GNOME Bugzilla – Bug 700454
Use GFile instead of stdio in id3_tag.c in EasyTAG
Last modified: 2013-05-16 20:53:37 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.
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 on attachment 244398 [details] [review] Fixes this Bug With this patch applied, EasyTAG does not compile. Please check more carefully before submitting a patch.
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 on attachment 244414 [details] [review] Corrected Still does not compile.
Created attachment 244435 [details] [review] Corrected one!!
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.
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 on attachment 244446 [details] [review] Did the changes Thans. I pushed a modified patch to master as commit c9b9c5413a7db5c92f64408403531af37d63d63c.