From 1dbab3b37f5cda14a870156b1fa927ab1853266c Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Wed, 19 Feb 2014 22:38:50 +0100 Subject: [PATCH] Warnings: be explicit about values we are using. --- gnushogi/commondsp.c | 10 ++++------ gnushogi/rawdsp.c | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/gnushogi/commondsp.c b/gnushogi/commondsp.c index 5e87fb4..1950b42 100644 --- a/gnushogi/commondsp.c +++ b/gnushogi/commondsp.c @@ -1420,16 +1420,15 @@ TestPSpeed(short(*f) (short side), unsigned j) static void SetOppTime(char *time) { - int m, t, sec; + int m, t; - sec = 0; t = (int)strtol(time, &time, 10); if (*time == ':') { time++; /* FIXME: sec is parsed but ignored */ - sec = (int)strtol(time, &time, 10); + (void)strtol(time, &time, 10); } m = (int)strtol(time, &time, 10); @@ -1453,16 +1452,15 @@ SetOppTime(char *time) static void SetMachineTime(char *time) { - int m, t, sec; + int m, t; - sec = 0; t = (int)strtol(time, &time, 10); if (*time == ':') { time++; /* FIXME: sec is parsed but ignored */ - sec = (int)strtol(time, &time, 10); + (void)strtol(time, &time, 10); } m = (int)strtol(time, &time, 10); diff --git a/gnushogi/rawdsp.c b/gnushogi/rawdsp.c index d9ebe36..033d93b 100644 --- a/gnushogi/rawdsp.c +++ b/gnushogi/rawdsp.c @@ -758,8 +758,8 @@ Raw_SelectLevel(char *sx) } else { int min, sec=0, inc, mps; /* parse regular "level MPS TC INC" command of WB protocol */ - sscanf(sx, "%d %d %d", &mps, &min, &inc) == 3 || - sscanf(sx, "%d %d:%d %d", &mps, &min, &sec, &inc); + if (sscanf(sx, "%d %d %d", &mps, &min, &inc) != 3) + sscanf(sx, "%d %d:%d %d", &mps, &min, &sec, &inc); TCminutes = min; TCseconds = sec; TCadd = inc*100; TCmoves = mps ? mps : 50; MaxResponseTime = 0; TCflag = true; -- 1.7.0.4