]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
tests: fix compile error with -Wshadow on older gcc releases 1087/head
authorRolf Eike Beer <eike@sf-mail.de>
Wed, 21 Nov 2018 19:22:31 +0000 (20:22 +0100)
committerRolf Eike Beer <eike@sf-mail.de>
Wed, 21 Nov 2018 19:22:31 +0000 (20:22 +0100)
Older gcc releases also warn when a local variable has the name of a global
function, like this output from gcc 4.6:

test_read_format_rar5.c:93:23: error: declaration of 'read' shadows a global declaration [-Werror=shadow]

libarchive/test/test_read_format_rar5.c

index 6c570f1c66436a3da78645a60dccc5c8b0201247..0ccedc76f3764862aa720c3080485bfd097d5c97 100644 (file)
@@ -90,7 +90,7 @@ int verify_data(const uint8_t* data_ptr, int magic, int size) {
 
 static
 int extract_one(struct archive* a, struct archive_entry* ae, uint32_t crc) {
-    la_ssize_t fsize, read;
+    la_ssize_t fsize, bytes_read;
     uint8_t* buf;
     int ret = 1;
     uint32_t computed_crc;
@@ -100,9 +100,9 @@ int extract_one(struct archive* a, struct archive_entry* ae, uint32_t crc) {
     if(buf == NULL)
         return 1;
 
-    read = archive_read_data(a, buf, fsize);
-    if(read != fsize) {
-        assertEqualInt(read, fsize);
+    bytes_read = archive_read_data(a, buf, fsize);
+    if(bytes_read != fsize) {
+        assertEqualInt(bytes_read, fsize);
         goto fn_exit;
     }