GNOME Bugzilla – Bug 700690
Use GFile instead of stdio in misc.c in EasyTAG
Last modified: 2013-05-20 07:07:18 UTC
Currently EasyTAG uses stdio functions fread, fopen, fclose, feof in src/misc.c. These stdio functions could be replaced with much better and high level GFile from GIO. This will simplify file handling, name of file handling encoding, could also help in making Asynchronous I/O and with this EasyTAG could be used over NFS and CIFS/Samba shares.
Created attachment 244751 [details] [review] Did the required changes In Write_Playlist at line 1677 (after applying the patch), I could have used g_file_new_for_path (filename) and then getting the parents file name by g_file_get_parent and g_file_get_path. This will require 3 function calls and also 3 more to free them, hence I decided to leave the way it is using g_path_get_basename as the work is done in 2 calls. Also, I have used GString instead of fprintf. At two places, as there is a conversion from int to char *, I used g_string_append_printf. I have inserted g_assert (error == NULL || *error == NULL), at the end of the function because, all above are if-elseif-else statements hence, if there is no error then control has to reach at the end. Also, I have found a function GetFileSize, it is used in other files (these files code is yet to be converted to GFile). So, I think I should remove that function and will do the required changes in the respective bugs of these files.
Review of attachment 244751 [details] [review]: ::: src/misc.c @@ +3088,3 @@ + GFileInputStream *istream; + GError *error = NULL; + int size_read; g_input_stream_read() returns a gssize, so this should be a gssize.
Created attachment 244752 [details] [review] Oh!! yes yes!! Change done
Comment on attachment 244752 [details] [review] Oh!! yes yes!! Change done I pushed a modified patch to master as commit c1395b0963facb01b25b84a5de8b40b983882fb0. Thanks!