]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge branch 'maint'
authorAndre Noll <maan@tuebingen.mpg.de>
Thu, 11 May 2023 17:50:22 +0000 (19:50 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 11 May 2023 17:50:22 +0000 (19:50 +0200)
Two fixes for gcc-12 warnings, and another fix for a benign but
embarrassing braino in gcrypt.c.

* maint:
  gcrypt: Fix return value of apc_get_pubkey().
  error.h: Be more careful with error code masking.
  mp3_afh: Drop unused fields from struct mp3header.

crypt.h
error.h
gcrypt.c
mp3_afh.c

diff --git a/crypt.h b/crypt.h
index 5ca6a54112b60f6d61b16485248fb28ff708df6b..5578cd563fae4dc24d673e653dcf21329eba90bc 100644 (file)
--- a/crypt.h
+++ b/crypt.h
@@ -48,7 +48,7 @@ int apc_priv_decrypt(const char *key_file, unsigned char *outbuf,
  * \param key_file The file containing the key.
  * \param result The key structure is returned here.
  *
- * \return The size of the key on success, negative on errors.
+ * \return The size of the key in bytes on success, negative on errors.
  */
 int apc_get_pubkey(const char *key_file, struct asymmetric_key **result);
 
diff --git a/error.h b/error.h
index 94f315ce9948c2a042c3014c5b5c334af1129da8..8805c9c7a4c0de6fe958e1523df883ad47effaad 100644 (file)
--- a/error.h
+++ b/error.h
@@ -290,18 +290,20 @@ static const char *weak_lls_strerror(int) __attribute__ ((weakref("lls_strerror"
  */
 _static_inline_ const char *para_strerror(int num)
 {
+       unsigned idx = num & ~((1U << OSL_ERROR_BIT) | (1U << LLS_ERROR_BIT)
+               | (1U << SYSTEM_ERROR_BIT));
        assert(num > 0);
        if (IS_OSL_ERROR(num)) {
                assert(weak_osl_strerror);
-               return weak_osl_strerror(num & ~(1U << OSL_ERROR_BIT));
+               return weak_osl_strerror(idx);
        }
        if (IS_LLS_ERROR(num)) {
                assert(weak_lls_strerror);
-               return weak_lls_strerror(num & ~(1U << LLS_ERROR_BIT));
+               return weak_lls_strerror(idx);
        }
        if (IS_SYSTEM_ERROR(num))
-               return strerror(num & ~(1U << SYSTEM_ERROR_BIT));
-       return para_errlist[num];
+               return strerror(idx);
+       return para_errlist[idx];
 }
 
 /**
index 763fa6de3252d2f5f188fc3f447f2029d0f5775a..f9a849067f3ef1084b36e36ccef72cf1826a12a9 100644 (file)
--- a/gcrypt.c
+++ b/gcrypt.c
@@ -460,7 +460,7 @@ int apc_get_pubkey(const char *key_file, struct asymmetric_key **result)
        key->num_bytes = ret;
        key->sexp = sexp;
        *result = key;
-       ret = bits;
+       ret = bits / 8;
 release_n:
        gcry_mpi_release(n);
 release_e:
index d7493ac01e28bba581b7112a41a37e84426be11a..56f28a09d8eb9fd18a9ba2262f14a58c6cec7997 100644 (file)
--- a/mp3_afh.c
+++ b/mp3_afh.c
@@ -37,9 +37,6 @@ struct mp3header {
        unsigned int freq;
        unsigned int padding;
        unsigned int mode;
-       unsigned int copyright;
-       unsigned int original;
-       unsigned int emphasis;
 };
 
 static const int frequencies[3][4] = {
@@ -473,7 +470,7 @@ static int frame_length(struct mp3header *header)
                + header->padding;
 }
 
-static int compare_headers(struct mp3header *h1,struct mp3header *h2)
+static int compare_headers(struct mp3header *h1, struct mp3header *h2)
 {
        if ((*(unsigned int*)h1) == (*(unsigned int*)h2))
                return 1;
@@ -481,10 +478,7 @@ static int compare_headers(struct mp3header *h1,struct mp3header *h2)
                        (h1->layer == h2->layer) &&
                        (h1->crc == h2->crc) &&
                        (h1->freq == h2->freq) &&
-                       (h1->mode == h2->mode) &&
-                       (h1->copyright == h2->copyright) &&
-                       (h1->original == h2->original) &&
-                       (h1->emphasis == h2->emphasis))
+                       (h1->mode == h2->mode))
                return 1;
        return 0;
 }