aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/obsproc.c
diff options
context:
space:
mode:
Diffstat (limited to 'FICS/obsproc.c')
-rw-r--r--FICS/obsproc.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/FICS/obsproc.c b/FICS/obsproc.c
index 966e30e..2353c60 100644
--- a/FICS/obsproc.c
+++ b/FICS/obsproc.c
@@ -32,6 +32,7 @@
Markus Uhlin 25/01/18 Fixed -Wshadow
Markus Uhlin 25/03/15 Fixed possible buffer overflow
in FindHistory2().
+ Markus Uhlin 25/04/06 Fixed Clang Tidy warnings.
*/
#include "stdinclude.h"
@@ -152,6 +153,9 @@ com_games(int p, param_list param)
wp = garray[i].white;
bp = garray[i].black;
+ UNUSED_VAR(wp);
+ UNUSED_VAR(bp);
+
if ((!selected) &&
s &&
strncasecmp(s, garray[i].white_name, slen) &&
@@ -380,9 +384,8 @@ com_allobservers(int p, param_list param)
start = 0;
end = g_num;
} else if ((obgame >= g_num) ||
- ((obgame < g_num) &&
- ((garray[obgame].status != GAME_ACTIVE) &&
- (garray[obgame].status != GAME_EXAMINE)))) {
+ (garray[obgame].status != GAME_ACTIVE &&
+ garray[obgame].status != GAME_EXAMINE)) {
pprintf(p, "There is no such game.\n");
return COM_OK;
} else {
@@ -980,11 +983,16 @@ FindHistory(int p, int p1, int p_game)
ret = fscanf(fpHist, "%d %*c %*d %*c %*d %*s %*s %*d %*d %*d "
"%*d %*s %*s %ld", &index, &when);
- if (ret != 2)
- warn("%s: %s: corrupt", __func__, &fileName[0]);
- } while (!feof(fpHist) && index != p_game);
+ if (ret != 2) {
+ warnx("%s: %s: corrupt", __func__, fileName);
+ fclose(fpHist);
+ return NULL;
+ }
+ } while (!feof(fpHist) &&
+ !ferror(fpHist) &&
+ index != p_game);
- if (feof(fpHist)) {
+ if (feof(fpHist) || ferror(fpHist)) {
pprintf(p, "There is no history game %d for %s.\n", p_game,
parray[p1].name);
fclose(fpHist);
@@ -1019,11 +1027,16 @@ FindHistory2(int p, int p1, int p_game, char *End, const size_t End_size)
"%%*d %%*d %%*d %%*s %%%zus %%ld\n", (End_size - 1));
do {
- if (fscanf(fpHist, fmt, &index, End, &when) != 3)
- warn("%s: %s: corrupt", __func__, &fileName[0]);
- } while (!feof(fpHist) && index != p_game);
+ if (fscanf(fpHist, fmt, &index, End, &when) != 3) {
+ warnx("%s: %s: corrupt", __func__, fileName);
+ fclose(fpHist);
+ return NULL;
+ }
+ } while (!feof(fpHist) &&
+ !ferror(fpHist) &&
+ index != p_game);
- if (feof(fpHist)) {
+ if (feof(fpHist) || ferror(fpHist)) {
pprintf(p, "There is no history game %d for %s.\n", p_game,
parray[p1].name);
fclose(fpHist);