Fix a problem with META that specify charsets - Bug #: 22036 - r: jefft

This commit is contained in:
rhp%netscape.com 2000-01-18 14:23:00 +00:00
Родитель dacf90aa91
Коммит dd3aab1997
2 изменённых файлов: 28 добавлений и 15 удалений

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

@ -644,10 +644,6 @@ mime_display_stream_complete (nsMIMESession *stream)
if ( (obj->options) && (obj->options->prefs) )
nsServiceManager::ReleaseService(kPrefCID, obj->options->prefs);
// Release the conversion object
if ( (obj->options) && (obj->options->conv) )
NS_RELEASE(obj->options->conv);
if ((obj->options) && (obj->options->headers == MimeHeadersOnly))
abortNow = PR_TRUE;
@ -671,6 +667,11 @@ mime_display_stream_complete (nsMIMESession *stream)
}
}
// Release the conversion object - this has to be done after
// we finish processing data.
if ( (obj->options) && (obj->options->conv) )
NS_RELEASE(obj->options->conv);
// Destroy the object now.
PR_ASSERT(msd->options == obj->options);
mime_free(obj);

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

@ -155,20 +155,32 @@ MimeInlineTextHTML_parse_line (char *line, PRInt32 length, MimeObject *obj)
PL_strncasestr(line, "CHARSET", length)
)
{
char *cp1 = PL_strncasestr(line, "CHARSET", length);
if (cp1)
char *workLine = (char *)PR_Malloc(length + 1);
if (workLine)
{
char *cp = PL_strncasestr(cp1, "=", (length - (int)(cp1-line)) ) + 1;
nsCRT::memset(workLine, 0, length + 1);
PL_strncpy(workLine, line, length);
char *cp1 = PL_strncasestr(workLine, "CHARSET", length);
if (cp1)
{
char *cp = PL_strncasestr(cp1, "=", (length - (int)(cp1-line)) ) + 1;
char seps[] = " \"\'";
char *token;
char* newStr;
token = nsCRT::strtok(cp, seps, &newStr);
if (token != NULL)
{
textHTML->charset = nsCRT::strdup(token);
}
char seps[] = " \"\'";
char *token;
char* newStr;
token = nsCRT::strtok(cp, seps, &newStr);
if (token != NULL)
{
textHTML->charset = nsCRT::strdup(token);
}
}
PR_FREEIF(workLine);
}
// Eat the META tag line that specifies CHARSET!
if (textHTML->charset)
return 0;
}
}