aboutsummaryrefslogtreecommitdiff
path: root/src
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 /src
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
Diffstat (limited to 'src')
-rw-r--r--src/debug.c6
-rw-r--r--src/short_term.c16
-rw-r--r--src/toast.c15
3 files changed, 17 insertions, 20 deletions
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);