#124941 charset detector does not work with single line attachment in certain situation

We need to call MimeInlineText_open_dam after ibuffer has been all processed.
Because there are 2 return path, we need to call this function each in each
path.
r=ducarroz, sr=sspitzer, a=asa
This commit is contained in:
shanjian%netscape.com 2002-12-09 20:00:14 +00:00
Родитель 05e172e6f4
Коммит 9ab1981fda
1 изменённых файлов: 27 добавлений и 23 удалений

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

@ -214,32 +214,36 @@ MimeInlineText_parse_eof (MimeObject *obj, PRBool abort_p)
MimeInlineText *text = (MimeInlineText *) obj;
/* If there is still data in the ibuffer, that means that the last line of
this part didn't end in a newline; so push it out anyway (this means that
the parse_line method will be called with a string with no trailing
newline, which isn't the usual case.) We do this here, rather than in
MimeObject_parse_eof, because MimeObject likes to shove things through
parse_line, and we have to shove it through the magic rotating-and-converting
code. So, we do that and digest the buffer before MimeObject has a chance
to do the wrong thing. See bug #26276 for more painful details.
*/
if (!abort_p && obj->ibuffer_fp > 0)
{
status = MimeInlineText_rotate_convert_and_parse_line (obj->ibuffer,
obj->ibuffer_fp,
obj);
obj->ibuffer_fp = 0;
if (status < 0)
{
//we haven't find charset yet? Do it before return
if (text->inputAutodetect)
status = MimeInlineText_open_dam(nsnull, 0, obj);
obj->closed_p = PR_TRUE;
return status;
}
}
//we haven't find charset yet? now its the time
if (text->inputAutodetect)
status = MimeInlineText_open_dam(nsnull, 0, obj);
/* If there is still data in the ibuffer, that means that the last line of
this part didn't end in a newline; so push it out anyway (this means that
the parse_line method will be called with a string with no trailing
newline, which isn't the usual case.) We do this here, rather than in
MimeObject_parse_eof, because MimeObject likes to shove things through
parse_line, and we have to shove it through the magic rotating-and-converting
code. So, we do that and digest the buffer before MimeObject has a chance
to do the wrong thing. See bug #26276 for more painful details.
*/
if (!abort_p &&
obj->ibuffer_fp > 0)
{
status = MimeInlineText_rotate_convert_and_parse_line (obj->ibuffer,
obj->ibuffer_fp,
obj);
obj->ibuffer_fp = 0;
if (status < 0)
{
obj->closed_p = PR_TRUE;
return status;
}
}
return ((MimeObjectClass*)&MIME_SUPERCLASS)->parse_eof (obj, abort_p);
}