aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2017-06-30 10:23:30 -0700
committerElliott Hughes <enh@google.com>2017-06-30 10:24:31 -0700
commit6e43663af81df940f02f1456b348184b0dbb5b40 (patch)
tree8ba9d3ca08627db2b8186eaa7bbb4a1139510928
parent28a3c4af57183ff4030869a8b81cfe87c77812c0 (diff)
downloadlibgsm-6e43663af81df940f02f1456b348184b0dbb5b40.tar.gz
Update libgsm to patchlevel 17.
Fixes undefined behavior warnings from clang. external/libgsm/src/short_term.c:68:2: warning: shifting a negative signed value is undefined [-Wshift-negative-value] STEP( -1144, -4, 29708 ); ^ ~~~~~ Bug: http://b/26694729 Test: builds Change-Id: I65063e1f4ba71c6231306baa7ae8c8fded7d4c89
-rw-r--r--Android.bp1
-rw-r--r--ChangeLog11
-rw-r--r--Makefile2
-rw-r--r--README4
-rw-r--r--README.version4
-rw-r--r--add-test/add_test.c24
-rw-r--r--src/debug.c6
-rw-r--r--src/short_term.c16
-rw-r--r--src/toast.c15
9 files changed, 45 insertions, 38 deletions
diff --git a/Android.bp b/Android.bp
index 4c56b44..26148b3 100644
--- a/Android.bp
+++ b/Android.bp
@@ -37,6 +37,7 @@ cc_library_static {
cflags: [
"-DSASR",
"-DWAV49",
+ "-Werror",
"-Wno-unused-parameter",
],
diff --git a/ChangeLog b/ChangeLog
index a95a739..f15352b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,16 @@
+Tue Jun 27 17:59:30 2017
+
+ * Release 1.0 Patchlevel 17
+ New email addresses in the README.
+ Avoid left-shifting signed integers.
+ Don't print longwords using %d or %ld, cast them to (long) first.
+ Don't compare longwords as longs in addtest, we only care for the
+ lower 32 bits. (The math works, but the test failed.)
+
Sat Sep 17 14:50:55 2016
* Release 1.0 Patchlevel 16
- New email addresses in the maual pages (patch 16)
+ New email addresses in the manual pages (patch 16)
Removed a stray .orig file (in patch 15)
Sun Apr 5 04:53:07 2009 Jutta Degener (jutta@pobox.com)
diff --git a/Makefile b/Makefile
index cfab74f..d5c0c90 100644
--- a/Makefile
+++ b/Makefile
@@ -44,7 +44,7 @@ WAV49 = -DWAV49
# CCFLAGS = -c -O
CC = gcc -ansi -pedantic
-CCFLAGS = -c -O2 -DNeedFunctionPrototypes=1
+CCFLAGS = -c -O2 -DNeedFunctionPrototypes=1 -Wall -Wno-comment
LD = $(CC)
diff --git a/README b/README
index cb6af85..82ec0bd 100644
--- a/README
+++ b/README
@@ -25,8 +25,8 @@ a library API. Compression and decompression run faster than realtime
on most SPARCstations. The implementation has been verified against the
ETSI standard test patterns.
-Jutta Degener (jutta@cs.tu-berlin.de)
-Carsten Bormann (cabo@cs.tu-berlin.de)
+Jutta Degener (then jutta@cs.tu-berlin.de, nowadays jutta@pobox.com)
+Carsten Bormann (then cabo@cs.tu-berlin.de, nowadays cabo@tzi.org)
Communications and Operating Systems Research Group, TU Berlin
Fax: +49.30.31425156, Phone: +49.30.31424315
diff --git a/README.version b/README.version
index 7f98a1b..5dc90fc 100644
--- a/README.version
+++ b/README.version
@@ -1,2 +1,2 @@
-URL: http://www.quut.com/gsm/gsm-1.0.16.tar.gz
-Version: 1.0.16
+URL: http://www.quut.com/gsm/gsm-1.0.17.tar.gz
+Version: 1.0.17
diff --git a/add-test/add_test.c b/add-test/add_test.c
index 8e832df..5d128f6 100644
--- a/add-test/add_test.c
+++ b/add-test/add_test.c
@@ -9,6 +9,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "gsm.h"
@@ -29,14 +30,13 @@ word M_gsm_abs P((word op1));
longword M_gsm_L_mult P((word op1, word op2));
longword M_gsm_L_add P((longword op1, longword op2));
-help()
+void help()
{
puts( " add a b sub a b mult a b div a b" );
puts( "L_add A B L_sub A B L_mult A B mult_r a b" );
puts( "" );
puts( "abs a norm a >> a b << a b" );
puts( " L_>> A B L_<< A B" );
-
}
char * strtek P2((str, sep), char * str, char * sep) {
@@ -96,18 +96,18 @@ long value P1((s), char * s)
char * parse P1((buf), char * buf)
{
char * s, * a;
- long l;
- if (a = strchr(buf, '=')) *a++ = 0;
+ if ((a = strchr(buf, '=')) != 0) *a++ = 0;
opname = s = strtek(buf, " \t(");
if (!s) return (char *)0;
op1 = op2 = L_op1 = L_op2 = 0;
- if (s = strtek( (char *)0, "( \t,")) {
+ if ((s = strtek( (char *)0, "( \t,")) != 0) {
op1 = L_op1 = value(s);
- if (s = strtek( (char *)0, ", \t)")) op2 = L_op2 = value(s);
+ if ((s = strtek( (char *)0, ", \t)")) != 0)
+ op2 = L_op2 = value(s);
}
if (a) {
@@ -136,8 +136,8 @@ void print_word P1((w), word w)
void fprint_longword P2((f, w), FILE * f, longword w)
{
if (!w) putc('0', f);
- else fprintf(f, "0x%8.8x (%ld%s)",
- w, w, w == MIN_WORD ? "/-"
+ else fprintf(f, "0x%8.8lx (%ld%s)",
+ (unsigned long)w, (long)w, w == MIN_WORD ? "/-"
: (w == MAX_WORD ? "/+"
: (w == MIN_LONGWORD ? "/--"
: (w == MAX_LONGWORD ? "/++" : ""))));
@@ -152,10 +152,10 @@ void do_longword P1((w), longword w)
{
if (interactive) print_longword(w);
if (do_expect) {
- if (w != L_expect) {
+ if ((w & 0xfffffffful) != (L_expect & 0xfffffffful)) {
if (!interactive) fprint_longword(stderr, w);
fprintf(stderr, " != %s (%ld, %ld) -- expected ",
- opname, L_op1, L_op2 );
+ opname, (long)L_op1, (long)L_op2 );
fprint_longword(stderr, L_expect);
putc( '\n', stderr );
}
@@ -169,7 +169,7 @@ void do_word P1((w), word w )
if (w != expect) {
if (!interactive) fprint_word(stderr, w);
fprintf(stderr, " != %s (%ld, %ld) -- expected ",
- opname, L_op1, L_op2 );
+ opname, (long)L_op1, (long)L_op2 );
fprint_word(stderr, expect);
putc('\n', stderr);
}
@@ -205,7 +205,7 @@ fail:
if (interactive) fprintf(stderr, "? ");
if (!fgets(buf, sizeof(buf), in)) exit(0);
- if (c = strchr(buf, '\n')) *c = 0;
+ if ((c = strchr(buf, '\n')) != 0) *c = 0;
if (*buf == ';' || *buf == '#') continue;
if (*buf == '\'') {
diff --git a/src/debug.c b/src/debug.c
index 04c3907..6e42842 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -49,7 +49,7 @@ void gsm_debug_longwords P4( (name, from, to, ptr),
fprintf( stderr, "%s [%d .. %d]: ", name, from, to );
while (from <= to) {
- fprintf(stderr, "%d ", ptr[ from ] );
+ fprintf(stderr, "%ld ", (long)ptr[ from ] );
from++;
if (nprinted++ >= 7) {
nprinted = 0;
@@ -63,14 +63,14 @@ void gsm_debug_longword P2( (name, value),
char * name,
longword value )
{
- fprintf(stderr, "%s: %d\n", name, (long)value );
+ fprintf(stderr, "%s: %ld\n", name, (long)value );
}
void gsm_debug_word P2( (name, value),
char * name,
word value )
{
- fprintf(stderr, "%s: %d\n", name, (long)value);
+ fprintf(stderr, "%s: %ld\n", name, (long)value);
}
#endif
diff --git a/src/short_term.c b/src/short_term.c
index f7829ba..b93ed00 100644
--- a/src/short_term.c
+++ b/src/short_term.c
@@ -51,21 +51,21 @@ static void Decoding_of_the_coded_Log_Area_Ratios P2((LARc,LARpp),
*/
#undef STEP
-#define STEP( B, MIC, INVA ) \
+#define STEP( B_TIMES_TWO, MIC, INVA ) \
temp1 = GSM_ADD( *LARc++, MIC ) << 10; \
- temp1 = GSM_SUB( temp1, B << 1 ); \
+ temp1 = GSM_SUB( temp1, B_TIMES_TWO ); \
temp1 = GSM_MULT_R( INVA, temp1 ); \
*LARpp++ = GSM_ADD( temp1, temp1 );
STEP( 0, -32, 13107 );
STEP( 0, -32, 13107 );
- STEP( 2048, -16, 13107 );
- STEP( -2560, -16, 13107 );
+ STEP( 4096, -16, 13107 );
+ STEP( -5120, -16, 13107 );
- STEP( 94, -8, 19223 );
- STEP( -1792, -8, 17476 );
- STEP( -341, -4, 31454 );
- STEP( -1144, -4, 29708 );
+ STEP( 188, -8, 19223 );
+ STEP( -3584, -8, 17476 );
+ STEP( -682, -4, 31454 );
+ STEP( -2288, -4, 29708 );
/* NOTE: the addition of *MIC is used to restore
* the sign of *LARc.
diff --git a/src/toast.c b/src/toast.c
index 9823642..c29baa7 100644
--- a/src/toast.c
+++ b/src/toast.c
@@ -252,7 +252,7 @@ static char * emalloc P1((len), size_t len)
char * s;
if (!(s = malloc(len))) {
fprintf(stderr, "%s: failed to malloc %d bytes -- abort\n",
- progname, len);
+ progname, (int)len);
onintr();
exit(1);
}
@@ -270,7 +270,7 @@ static char* normalname P3((name, want, cut), char *name, char *want,char *cut)
maxlen = strlen(name) + 1 + strlen(want) + strlen(cut);
p = strcpy(emalloc(maxlen), name);
- if (s = suffix(p, cut)) strcpy(s, want);
+ if ((s = suffix(p, cut)) != 0) strcpy(s, want);
else if (*want && !suffix(p, want)) strcat(p, want);
return p;
@@ -416,8 +416,9 @@ static int okay_as_input P3((name,f,st), char* name, FILE* f, struct stat * st)
}
if (st->st_nlink > 1 && !f_cat && !f_precious) {
fprintf(stderr,
- "%s: \"%s\" has %s other link%s -- unchanged.\n",
- progname,name,st->st_nlink - 1,"s" + (st->st_nlink<=2));
+ "%s: \"%s\" has %d other link%s -- unchanged.\n",
+ progname, name, (int)(st->st_nlink - 1),
+ "s" + (st->st_nlink <= 2));
return 0;
}
return 1;
@@ -586,7 +587,7 @@ static int process_decode P0()
if (cc != sizeof(s)) {
if (cc >= 0) fprintf(stderr,
"%s: incomplete frame (%d byte%s missing) from %s\n",
- progname, sizeof(s) - cc,
+ progname, (int)(sizeof(s) - cc),
"s" + (sizeof(s) - cc == 1),
inname ? inname : "stdin" );
gsm_destroy(r);
@@ -624,8 +625,6 @@ static int process_decode P0()
static int process P1((name), char * name)
{
- int step = 0;
-
out = (FILE *)0;
in = (FILE *)0;
@@ -754,7 +753,6 @@ int main P2((ac, av), int ac, char **av)
{
int opt;
extern int optind;
- extern char * optarg;
parse_argv0(*av);
@@ -779,7 +777,6 @@ int main P2((ac, av), int ac, char **av)
case 'h': help(); exit(0);
default:
- usage:
fprintf(stderr,
"Usage: %s [-fcpdhvuaslFC] [files...] (-h for help)\n",
progname);