[easytag] Fix CRC calculation function return value
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag] Fix CRC calculation function return value
- Date: Sun, 19 May 2013 10:20:03 +0000 (UTC)
commit 311128b0cdee64f5a72aec396e8d16322fd17b65
Author: David King <amigadave amigadave com>
Date: Sun May 19 11:15:50 2013 +0100
Fix CRC calculation function return value
Return TRUE on success and FALSE on error, as mentioned in the
crc32_file_with_ID3_tag documentation comment. Do not try to close a
NULL file stream pointer.
src/crc32.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/crc32.c b/src/crc32.c
index 3ea807c..a3426b2 100644
--- a/src/crc32.c
+++ b/src/crc32.c
@@ -125,7 +125,7 @@ crc32_file_with_ID3_tag (gchar *filename, guint32 *crc32)
if ((fd = fopen (filename, "r")) == NULL)
{
- goto error;
+ return FALSE;
}
/* Check if there is an ID3v1 tag. */
@@ -187,11 +187,16 @@ crc32_file_with_ID3_tag (gchar *filename, guint32 *crc32)
}
}
+ if (!feof (fd))
+ {
+ goto error;
+ }
+
out:
fclose (fd);
*crc32 = ~crc;
- return nr < 0;
+ return nr == 0;
error:
nr = -1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]