[Github-comments] [geany] Fix the "source file has been modified" issue (#621)

elextr notifications at xxxxx
Tue Sep 29 00:15:50 UTC 2015


>  	{
>  		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:
https://github.com/geany/geany/pull/621/files#r40621975
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20150928/0a6b84ee/attachment.html>


More information about the Github-comments mailing list