GNOME Bugzilla – Bug 700636
Use GFile instead of stdio in crc32.c in EasyTAG
Last modified: 2013-05-19 15:45:05 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.
Created attachment 244708 [details] [review] Fixed!!
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.
Created attachment 244714 [details] [review] Did the changes
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.