]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Removed usage of __attribute__ macros and unsafe cast in debug code 1061/head
authorGrzegorz Antoniak <ga@anadoxin.org>
Thu, 4 Oct 2018 20:01:35 +0000 (22:01 +0200)
committerGrzegorz Antoniak <ga@anadoxin.org>
Thu, 4 Oct 2018 20:01:35 +0000 (22:01 +0200)
libarchive/archive_read_support_format_rar5.c

index 4b770d77ec83320176dd2b6092d79a4b69ea4649..d891ff94c9a99819dbaa497749c81ac63eee0424 100644 (file)
 /*#define DONT_FAIL_ON_CRC_ERROR*/
 /*#define DEBUG*/
 
-#if __GNUC__ > 4 && !defined __OpenBSD__
-#define fallthrough __attribute__((fallthrough))
-#define unused      __attribute__((unused))
-#else
-#define fallthrough
-#define unused
-#endif
-
 #define rar5_min(a, b) (((a) > (b)) ? (b) : (a))
 #define rar5_max(a, b) (((a) > (b)) ? (a) : (b))
 #define rar5_countof(X) ((const ssize_t) (sizeof(X) / sizeof(*X)))
@@ -597,7 +589,7 @@ static int run_filter(struct archive_read* a, struct filter_info* flt) {
             break;
 
         case FILTER_E8:
-            fallthrough;
+            /* fallthrough */
         case FILTER_E8E9:
             ret = run_e8e9_filter(rar, flt, flt->type == FILTER_E8E9);
             break;
@@ -1255,15 +1247,15 @@ static int process_head_file_extra(struct archive_read* a,
                 ret = parse_file_extra_htime(a, e, rar, &extra_data_size);
                 break;
             case CRYPT:
-                fallthrough;
+                /* fallthrough */
             case VERSION_:
-                fallthrough;
+                /* fallthrough */
             case REDIR:
-                fallthrough;
+                /* fallthrough */
             case UOWNER:
-                fallthrough;
+                /* fallthrough */
             case SUBDATA:
-                fallthrough;
+                /* fallthrough */
             default:
                 archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
                         "Unknown extra field in file/service block: 0x%02x",
@@ -3150,13 +3142,13 @@ static int do_unpack(struct archive_read* a, struct rar5* rar,
             case STORE:
                 return do_unstore_file(a, rar, buf, size, offset);
             case FASTEST:
-                fallthrough;
+                /* fallthrough */
             case FAST:
-                fallthrough;
+                /* fallthrough */
             case NORMAL:
-                fallthrough;
+                /* fallthrough */
             case GOOD:
-                fallthrough;
+                /* fallthrough */
             case BEST:
                 return uncompress_file(a);
             default:
@@ -3251,24 +3243,12 @@ static int verify_checksums(struct archive_read* a) {
             (void) blake2sp_final(&rar->file.b2state, b2_buf, 32);
 
             if(memcmp(&rar->file.blake2sp, b2_buf, 32) != 0) {
-                DEBUG_CODE {
-                    printf("Checksum error: BLAKE2sp (%08x/%08x)\n",
-                            *(uint32_t*)rar->file.blake2sp,
-                            *(uint32_t*)b2_buf);
-                }
-
 #ifndef DONT_FAIL_ON_CRC_ERROR
                 archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
                                   "Checksum error: BLAKE2");
 
                 return ARCHIVE_FATAL;
 #endif
-            } else {
-                DEBUG_CODE {
-                    printf("Checksum OK: BLAKE2sp (%08x/%08x)\n",
-                            *(uint32_t*)rar->file.blake2sp,
-                            *(uint32_t*)b2_buf);
-                }
             }
         }
     }