From 253ac31a649f1fd4dfc2249d5a99e869550d0ee3 Mon Sep 17 00:00:00 2001 From: Et7f3 Date: Mon, 25 Oct 2021 22:39:05 +0200 Subject: [PATCH] Fix build from docker build with alpine from macOS (#286) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(build): Remove unused variable and fix const warning. * fix(build): Fix others -Werror=discarded-qualifiers Co-authored-by: Élie BRAMI --- dsp/core/byte2double.c | 2 +- dsp/core/dct.c | 2 +- dsp/core/float2short.c | 1 - dsp/core/unalaw.c | 2 +- libc/alg/bisect.internal.h | 2 +- libc/alg/critbit0_emplace.c | 2 +- libc/alg/critbit0_get.c | 2 +- 7 files changed, 6 insertions(+), 7 deletions(-) diff --git a/dsp/core/byte2double.c b/dsp/core/byte2double.c index 72d8554fa..205bc8847 100644 --- a/dsp/core/byte2double.c +++ b/dsp/core/byte2double.c @@ -22,7 +22,7 @@ void *byte2double(long n, const void *p, double weight, double bias) { long i; double f, *dst; - unsigned char *src; + const unsigned char *src; if ((dst = valloc(n * sizeof(double)))) { for (src = p, i = 0; i < n; ++i) { f = src[i]; diff --git a/dsp/core/dct.c b/dsp/core/dct.c index 07a0396c4..d69660a19 100644 --- a/dsp/core/dct.c +++ b/dsp/core/dct.c @@ -21,7 +21,7 @@ #define DCT(A, B, C, D, E, F, G, H, T, C0, C1, C2, C3, C4) \ do { \ T z1, z2, z3, z4, z5, z11, z13; \ - T t0, t1, t2, t3, t4, t5, t6, t7, t8, t10, t11, t12, t13; \ + T t0, t1, t2, t3, t4, t5, t6, t7, t10, t11, t12, t13; \ t0 = A + H; \ t7 = A - H; \ t1 = B + G; \ diff --git a/dsp/core/float2short.c b/dsp/core/float2short.c index 7d879d3be..b4cbe43f9 100644 --- a/dsp/core/float2short.c +++ b/dsp/core/float2short.c @@ -30,7 +30,6 @@ */ void float2short(size_t n, short pcm16[n][8], const float binary32[n][8]) { size_t i, j; - float f[8], w[8]; for (i = 0; i < n; ++i) { for (j = 0; j < 8; ++j) { pcm16[i][j] = diff --git a/dsp/core/unalaw.c b/dsp/core/unalaw.c index 7571a98f1..d025f4a26 100644 --- a/dsp/core/unalaw.c +++ b/dsp/core/unalaw.c @@ -27,7 +27,7 @@ * @see ITU G.711 */ int unalaw(int x) { - int e, i, m, r; + int e, i, m; i = (x ^ 85) & 127; e = i >> 4; m = i & 15; diff --git a/libc/alg/bisect.internal.h b/libc/alg/bisect.internal.h index 242d50668..0616a859d 100644 --- a/libc/alg/bisect.internal.h +++ b/libc/alg/bisect.internal.h @@ -21,7 +21,7 @@ forceinline void *bisect(const void *k, const void *data, size_t n, size_t size, } else if (c < 0) { r = m - 1; } else { - return p + m * size; + return (char *)p + m * size; } } } diff --git a/libc/alg/critbit0_emplace.c b/libc/alg/critbit0_emplace.c index aacee5120..9be59c55d 100644 --- a/libc/alg/critbit0_emplace.c +++ b/libc/alg/critbit0_emplace.c @@ -67,7 +67,7 @@ different_byte_found: struct CritbitNode *newnode = malloc(sizeof(struct CritbitNode)); newnode->byte = newbyte; newnode->otherbits = newotherbits; - newnode->child[1 - newdirection] = ubytes; + newnode->child[1 - newdirection] = (void*)ubytes; void **wherep = &t->root; for (;;) { unsigned char *wp = *wherep; diff --git a/libc/alg/critbit0_get.c b/libc/alg/critbit0_get.c index 523916f81..a395b2e4e 100644 --- a/libc/alg/critbit0_get.c +++ b/libc/alg/critbit0_get.c @@ -39,5 +39,5 @@ char *critbit0_get(struct critbit0 *t, const char *u) { const int direction = (1 + (q->otherbits | c)) >> 8; p = q->child[direction]; } - return strncmp(u, (const char *)p, ulen) == 0 ? (const char *)p : NULL; + return strncmp(u, (char *)p, ulen) == 0 ? (char *)p : NULL; }