char buf[1024]; char *p; PRInt32 bufLen; ENCODER_BUFFER_ALLOC_IF_NEEDED(p, mFontMetricsContext->mUserDefinedConverter, aString, aLength, buf, sizeof(buf), bufLen);
PRUnichar buf[512]; PRUnichar *p = buf; PRUint32 bufLen = sizeof(buf)/sizeof(PRUnichar); if ((aLength*2) > bufLen) { PRUnichar *tmp; tmp = (PRUnichar*)nsMemory::Alloc(sizeof(PRUnichar) * (aLength*2)); if (tmp) { p = tmp; bufLen = (aLength*2); } }
nsFontXlibUserDefined::GetWidth(const PRUnichar* aString, PRUint32 aLength){  char buf[1024];  char *p;  PRInt32 bufLen;  ENCODER_BUFFER_ALLOC_IF_NEEDED(p, mFontMetricsContext->mUserDefinedConverter,                         aString, aLength, buf, sizeof(buf), bufLen);  PRUint32 len = Convert(aString, aLength, p, bufLen);  int outWidth;  if (mXFont->IsSingleByte())    outWidth = mXFont->TextWidth8(p, len);  else    outWidth = mXFont->TextWidth16((const XChar2b*)p, len/2);  ENCODER_BUFFER_FREE_IF_NEEDED(p, buf);  return outWidth;}