In src/document.c:

>  	{
>  		ui_set_statusbar(TRUE, "%s", err->message);
>  		g_error_free(err);
>  		return FALSE;
>  	}
>  
> -	filedata->len = (gsize) st.st_size;

@techee, the stat is done here (well just above) so we have the size, so unless something else does another stat it needs to be passed to handle_buffer() to compare to the strlen().

encodings_convert_to_utf8_auto() therefore expects the buffer length here and passes back the modified length after converting the encoding.

For that purpose it doesn't matter if you use the stat value or the *_contents() value, since if they are different there has been a read error.

So I would just use the buffer size returned by Glib/GIO since it is a more direct measure of the buffer size.


Reply to this email directly or view it on GitHub.