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 700636 - Use GFile instead of stdio in crc32.c in EasyTAG
Use GFile instead of stdio in crc32.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-19 13:11 UTC by Abhinav
Modified: 2013-05-19 15:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fixed!! (6.99 KB, patch)
2013-05-19 13:15 UTC, Abhinav
needs-work Details | Review
Did the changes (6.99 KB, patch)
2013-05-19 15:08 UTC, Abhinav
committed Details | Review

Description Abhinav 2013-05-19 13:11:33 UTC
Currently EasyTAG uses stdio functions fread, fopen, fclose, feof in src/crc32.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-19 13:15:46 UTC
Created attachment 244708 [details] [review]
Fixed!!
Comment 2 David King 2013-05-19 13:39:05 UTC
Review of attachment 244708 [details] [review]:

::: src/crc32.c
@@ +22,2 @@
 #include <unistd.h>
 #include <stdio.h>

Take out the three unused includes:

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

@@ +108,3 @@
  */
 gboolean
+crc32_file_with_ID3_tag (gchar *filename, guint32 *crc32, GError **err)

The filename is never modified, so you should make it const.

@@ +121,3 @@
     gboolean has_id3v1 = FALSE;
 
+    g_return_val_if_fail (filename != NULL && (err == NULL || *err == NULL),

Rather than combining the two invariant checks, add a new one.

@@ +127,3 @@
+    info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_SIZE,
+                              G_FILE_QUERY_INFO_NONE, NULL, err);
+    if (!info)

Add an empty line before the if statement.

@@ +136,3 @@
+    size = g_file_info_get_size (info);
+    istream = g_file_read (file, NULL, err);
+    if (!istream)

Add an empty line before the if statement.

@@ +149,3 @@
+        goto error;
+    }
+    if (g_input_stream_read (G_INPUT_STREAM (istream), tmp_id3, 3,

Add an empty line before the if statement.

@@ +181,3 @@
+            goto error;
+        }
+        if (g_input_stream_read (G_INPUT_STREAM (istream), tmp_id3, 4,

Add an empty line before the if statement.
Comment 3 Abhinav 2013-05-19 15:08:02 UTC
Created attachment 244714 [details] [review]
Did the changes
Comment 4 David King 2013-05-19 15:44:43 UTC
Review of attachment 244714 [details] [review]:

You do not seem to have made the requested changes, but I applied them myself and pushed the result to master as commit 511a1348c7b33d00a5ceb31bc93c6bc7d1473234.