After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 700690 - Use GFile instead of stdio in misc.c in EasyTAG
Use GFile instead of stdio in misc.c in EasyTAG
Status: RESOLVED FIXED
Product: easytag
Classification: Other
Component: general
master
Other Linux
: Normal normal
: 2.1
Assigned To: EasyTAG maintainer(s)
EasyTAG maintainer(s)
Depends on:
Blocks: 700050
 
 
Reported: 2013-05-20 05:51 UTC by Abhinav
Modified: 2013-05-20 07:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Did the required changes (18.44 KB, patch)
2013-05-20 06:05 UTC, Abhinav
needs-work Details | Review
Oh!! yes yes!! Change done (18.44 KB, patch)
2013-05-20 06:49 UTC, Abhinav
committed Details | Review

Description Abhinav 2013-05-20 05:51:53 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.
Comment 1 Abhinav 2013-05-20 06:05:36 UTC
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.
Comment 2 David King 2013-05-20 06:44:26 UTC
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.
Comment 3 Abhinav 2013-05-20 06:49:30 UTC
Created attachment 244752 [details] [review]
Oh!! yes yes!! Change done
Comment 4 David King 2013-05-20 07:07:08 UTC
Comment on attachment 244752 [details] [review]
Oh!! yes yes!! Change done

I pushed a modified patch to master as commit c1395b0963facb01b25b84a5de8b40b983882fb0. Thanks!