performance fix for mailnews for. (especially us-ascii users)

skip a lot of expensive code if we don't need to do the conversion.
this will help sorting, scrolling and message display.
there is more work to do on this code for non us-ascii users.
sr=bienvenu
This commit is contained in:
sspitzer%netscape.com 2001-01-24 15:10:08 +00:00
Родитель ee79b12867
Коммит 36ccf5c4b9
1 изменённых файлов: 17 добавлений и 0 удалений

Просмотреть файл

@ -1437,6 +1437,23 @@ PRInt32 MIME_ConvertCharset(const PRBool autoDetection, const char* from_charset
const char* inBuffer, const PRInt32 inLength, char** outBuffer, PRInt32* outLength,
PRInt32* numUnConverted)
{
if (!autoDetection && from_charset && to_charset &&
(!strcasecmp(from_charset,to_charset) ||
(!strcasecmp(from_charset,"us-ascii") && !strcasecmp(to_charset,"UTF-8")) ||
(!strcasecmp(from_charset,"UTF-8") && !strcasecmp(to_charset,"us-ascii")))) {
if (NULL != numUnConverted)
*numUnConverted = 0;
*outBuffer = (char *) PR_Malloc(inLength+1);
if (NULL != *outBuffer) {
nsCRT::memcpy(*outBuffer, inBuffer, inLength);
*outLength = inLength;
(*outBuffer)[inLength] = '\0';
return 0;
}
return -1;
}
MimeCharsetConverterClass aMimeCharsetConverterClass;
PRInt32 res;