nsresult nsUnicodeDecodeHelper::CreateFastTable( uMappingTable * aMappingTable, PRUnichar * aFastTable, int32_t aTableSize) { int32_t tableSize = aTableSize; int32_t buffSize = aTableSize; nsAutoArrayPtr<char> buff(new char [buffSize]); char * p = buff; for (int32_t i=0; i<aTableSize; i++) *(p++) = i; return ConvertByTable(buff, &buffSize, aFastTable, &tableSize, u1ByteCharset, nullptr, aMappingTable); }
nsresult nsUnicodeDecodeHelper::CreateFastTable( uMappingTable * aMappingTable, PRUnichar * aFastTable, PRInt32 aTableSize) { PRInt32 tableSize = aTableSize; PRInt32 buffSize = aTableSize; char * buff = new char [buffSize]; if (buff == NULL) return NS_ERROR_OUT_OF_MEMORY; char * p = buff; for (PRInt32 i=0; i<aTableSize; i++) *(p++) = i; nsresult res = ConvertByTable(buff, &buffSize, aFastTable, &tableSize, u1ByteCharset, nsnull, aMappingTable); delete [] buff; return res; }