This is a patch for audio/shorten.
The utils/mkbshift.c emits bitshift.c
which is later used in ulaw ancoding/decoding
- it contains the arrays of ulaw constants.
However, mkbshift.c prints them as %lu, resulting in e.g.
schar ulaw_inward[13][256] = {
{4294967169,4294967170,4294967171,...
and thousands of lines of warnings from the compiler such as
./bitshift.h:16:1399: warning: implicit conversion from 'long' to 'int8_t' (aka
'signed char') changes value from 4294967294 to -2 [-Wconstant-conversion]
Indeed, these are not signed chars. (Luckily, the implicit
conversion 'fixes' it, so the actual audio ends up OK.)
Changing the generator to printf %u (as the compiler also suggests)
makes these go away and results in e.g.
schar ulaw_inward[13][256] = {
{-127,-126,-125,...
Jan
Don't print the u-law constants as longs:
implicit conversion from 'long' to 'int8_t' (aka 'signed char')
changes value from 4294967294 to -2 [-Wconstant-conversion]
Index: utils/mkbshift.c
--- utils/mkbshift.c.orig
+++ utils/mkbshift.c
@@ -83,11 +83,11 @@ int main() {
for(shift = 0; shift < SHIFTSIZE; shift++) {
fprintf(fout, "{");
for(i = 0; i < USIZE - 1; i++)
- fprintf(fout, "%ld,", forwardmap[shift][i]);
+ fprintf(fout, "%d,", forwardmap[shift][i]);
if(shift != SHIFTSIZE - 1)
- fprintf(fout, "%ld},\n", forwardmap[shift][USIZE - 1]);
+ fprintf(fout, "%d},\n", forwardmap[shift][USIZE - 1]);
else
- fprintf(fout, "%ld}\n};\n", forwardmap[shift][USIZE - 1]);
+ fprintf(fout, "%d}\n};\n", forwardmap[shift][USIZE - 1]);
}
fprintf(fout, "\n");
@@ -96,11 +96,11 @@ int main() {
for(shift = 0; shift < SHIFTSIZE; shift++) {
fprintf(fout, "{");
for(i = 0; i < USIZE - 1; i++)
- fprintf(fout, "%ld,", reversemap[shift][i]);
+ fprintf(fout, "%d,", reversemap[shift][i]);
if(shift != SHIFTSIZE - 1)
- fprintf(fout, "%ld},\n", reversemap[shift][USIZE - 1]);
+ fprintf(fout, "%d},\n", reversemap[shift][USIZE - 1]);
else
- fprintf(fout, "%ld}\n};\n", reversemap[shift][USIZE - 1]);
+ fprintf(fout, "%d}\n};\n", reversemap[shift][USIZE - 1]);
}
fclose(fout);