]> git.ipfire.org Git - pakfire.git/commitdiff
Fix any issues with falling through a switch statement
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 4 Oct 2023 17:11:47 +0000 (17:11 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 4 Oct 2023 17:11:47 +0000 (17:11 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/archive.c
src/libpakfire/digest.c
src/libpakfire/util.c

index 80a6a36f3a177a4e50856d67d0e79911cf3f1a9e..1dfbdefde5f7b0313c2d2bb162cbaadb79250d97 100644 (file)
@@ -550,16 +550,17 @@ static int __pakfire_archive_filter_payload(struct pakfire* pakfire,
                case 'p':
                        if (strcmp(path, "pakfire-format") == 0)
                                return PAKFIRE_WALK_SKIP;
-
-                       // Fallthrough
+                       break;
 
                case '.':
                        return PAKFIRE_WALK_SKIP;
 
-               // The first file that isn't metadata, so we are done calling the filter callback
                default:
-                       return PAKFIRE_WALK_DONE;
+                       break;
        }
+
+       // The first file that isn't metadata, so we are done calling the filter callback
+       return PAKFIRE_WALK_DONE;
 }
 
 /*
index 7149c27ba0ac1625b621ccb4c40653b2889886bf..8029f916e4235302a6b850d6bd3054a06fa7003f 100644 (file)
@@ -112,26 +112,32 @@ const unsigned char* pakfire_digest_get(struct pakfire_digests* digests,
                case PAKFIRE_DIGEST_SHA3_512:
                        if (pakfire_digest_set(digests->sha3_512))
                                return digests->sha3_512;
+                       break;
 
                case PAKFIRE_DIGEST_SHA3_256:
                        if (pakfire_digest_set(digests->sha3_256))
                                return digests->sha3_256;
+                       break;
 
                case PAKFIRE_DIGEST_BLAKE2B512:
                        if (pakfire_digest_set(digests->blake2b512))
                                return digests->blake2b512;
+                       break;
 
                case PAKFIRE_DIGEST_BLAKE2S256:
                        if (pakfire_digest_set(digests->blake2s256))
                                return digests->blake2s256;
+                       break;
 
                case PAKFIRE_DIGEST_SHA2_512:
                        if (pakfire_digest_set(digests->sha2_512))
                                return digests->sha2_512;
+                       break;
 
                case PAKFIRE_DIGEST_SHA2_256:
                        if (pakfire_digest_set(digests->sha2_256))
                                return digests->sha2_256;
+                       break;
 
                case PAKFIRE_DIGEST_UNDEFINED:
                        break;
index 5a7bddafeefe81d73a476f4af4f4f793a468a432..bcb148870c14f944961135b502866a1a40a01ae8 100644 (file)
@@ -157,20 +157,14 @@ static int __pakfire_path_match_star(const char* p, const char* s) {
 
        // Consume the string...
        for (; *s; s++) {
-               switch (*s) {
-                       // Found slash!
-                       case '/':
-                               if (stars == 1)
-                                       return pakfire_path_match(p, s);
+               // Found slash!
+               if (*s == '/' && stars == 1)
+                       return pakfire_path_match(p, s);
 
-                               // Otherwise fall through
-
-                       // Read as many characters as possible
-                       default:
-                               r = pakfire_path_match(p, s);
-                               if (r)
-                                       return r;
-               }
+               // Otherwise read as many characters as possible
+               r = pakfire_path_match(p, s);
+               if (r)
+                       return r;
        }
 
        // The pattern has not entirely been consumed