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 700454 - Use GFile instead of stdio in id3_tag.c in EasyTAG
Use GFile instead of stdio in id3_tag.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-16 12:20 UTC by Abhinav
Modified: 2013-05-16 20:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fixes this Bug (6.15 KB, patch)
2013-05-16 12:27 UTC, Abhinav
needs-work Details | Review
Corrected (6.15 KB, patch)
2013-05-16 14:27 UTC, Abhinav
needs-work Details | Review
Corrected one!! (6.30 KB, patch)
2013-05-16 17:08 UTC, Abhinav
needs-work Details | Review
Did the changes (6.43 KB, patch)
2013-05-16 18:15 UTC, Abhinav
committed Details | Review

Description Abhinav 2013-05-16 12:20:49 UTC
EasyTAG currently uses fopen, fclose, fread, feof in id3_tag.c. Instead of this use GIO from GFile. 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-16 12:27:56 UTC
Created attachment 244398 [details] [review]
Fixes this Bug

Here, I changed Id3tag_Check_If_File_Is_Corrupted to accept GFile, because its callee Id3tag_Write_File_v23Tag, has been modified to create a GFile and creating a GFile again would not be a good approach.
Comment 2 David King 2013-05-16 14:08:07 UTC
Comment on attachment 244398 [details] [review]
Fixes this Bug

With this patch applied, EasyTAG does not compile. Please check more carefully before submitting a patch.
Comment 3 Abhinav 2013-05-16 14:27:33 UTC
Created attachment 244414 [details] [review]
Corrected

I found the mistake it was a typo of "=".
But I compiled twice and in my case compiling went smoothly.
Comment 4 David King 2013-05-16 14:32:50 UTC
Comment on attachment 244414 [details] [review]
Corrected

Still does not compile.
Comment 5 Abhinav 2013-05-16 17:08:48 UTC
Created attachment 244435 [details] [review]
Corrected one!!
Comment 6 David King 2013-05-16 17:28:56 UTC
Review of attachment 244435 [details] [review]:

::: src/id3_tag.c
@@ +162,3 @@
+
+    if (!g_file_info_get_attribute_boolean (info,
+         G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE))

There is very little point in checking that a file can be written to before writing to it, so remove this whole check. Test that the code which does the tag writing works correctly after the change.

@@ +1233,1 @@
+    if (!file)

Use g_return_val_if_fail() instead of if.

@@ +1238,3 @@
+    if (!info)
+    {
+        Log_Print (LOG_ERROR, _("Error while getting fileinfo (%s)."),

Change the message to "Cannot query file information (%s)"

@@ +1248,2 @@
     {
+        Log_Print (LOG_ERROR, _("Error while opening file: '%s' (%s)."),

Instead of reporting the error here, make this function accept a GError and set that on error.
Comment 7 Abhinav 2013-05-16 18:15:27 UTC
Created attachment 244446 [details] [review]
Did the changes

I have returned TRUE, in the case if Id3tag_Check_If_File_Is_Corrupted got into error. because errors in this function are about not reading the file properly and this in most cases may imply that file could be corrupted.
Comment 8 David King 2013-05-16 20:53:23 UTC
Comment on attachment 244446 [details] [review]
Did the changes

Thans. I pushed a modified patch to master as commit c9b9c5413a7db5c92f64408403531af37d63d63c.