From: Michael Tremer Date: Wed, 4 Oct 2023 17:11:47 +0000 (+0000) Subject: Fix any issues with falling through a switch statement X-Git-Tag: 0.9.30~1546 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=727be1f33aa8c6067484d49ee5975a6637ed8b0e;p=pakfire.git Fix any issues with falling through a switch statement Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/archive.c b/src/libpakfire/archive.c index 80a6a36f3..1dfbdefde 100644 --- a/src/libpakfire/archive.c +++ b/src/libpakfire/archive.c @@ -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; } /* diff --git a/src/libpakfire/digest.c b/src/libpakfire/digest.c index 7149c27ba..8029f916e 100644 --- a/src/libpakfire/digest.c +++ b/src/libpakfire/digest.c @@ -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; diff --git a/src/libpakfire/util.c b/src/libpakfire/util.c index 5a7bddafe..bcb148870 100644 --- a/src/libpakfire/util.c +++ b/src/libpakfire/util.c @@ -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