tidy-up: replace (1 == expressions sscanf

This commit is contained in:
Viktor Szakats 2025-07-09 19:43:03 +02:00
parent 29e22ef65b
commit aaa4816bcb
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
3 changed files with 7 additions and 7 deletions

View file

@ -269,7 +269,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
logmsg("instructed to stream");
req->rcmd = RCMD_STREAM;
}
else if(1 == sscanf(ptr, "pipe: %d", &num)) {
else if(sscanf(ptr, "pipe: %d", &num) == 1) {
logmsg("instructed to allow a pipe size of %d", num);
if(num < 0)
logmsg("negative pipe size ignored");
@ -277,7 +277,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
req->pipe = num-1; /* decrease by one since we don't count the
first request in this number */
}
else if(1 == sscanf(ptr, "skip: %d", &num)) {
else if(sscanf(ptr, "skip: %d", &num) == 1) {
logmsg("instructed to skip this number of bytes %d", num);
req->skip = num;
}

View file

@ -183,7 +183,7 @@ static int parse_cmdfile(struct sws_httprequest *req)
int testnum = DOCNUMBER_NOTHING;
char buf[256];
while(fgets(buf, sizeof(buf), f)) {
if(1 == sscanf(buf, "Testnum %d", &testnum)) {
if(sscanf(buf, "Testnum %d", &testnum) == 1) {
logmsg("[%s] cmdfile says testnum %d", cmdfile, testnum);
req->testno = testnum;
}
@ -255,7 +255,7 @@ static int sws_parse_servercmd(struct sws_httprequest *req)
logmsg("swsclose: close this connection after response");
req->close = TRUE;
}
else if(1 == sscanf(cmd, "skip: %d", &num)) {
else if(sscanf(cmd, "skip: %d", &num) == 1) {
logmsg("instructed to skip this number of bytes %d", num);
req->skip = num;
}
@ -263,11 +263,11 @@ static int sws_parse_servercmd(struct sws_httprequest *req)
logmsg("instructed to reject Expect: 100-continue");
req->noexpect = TRUE;
}
else if(1 == sscanf(cmd, "delay: %d", &num)) {
else if(sscanf(cmd, "delay: %d", &num) == 1) {
logmsg("instructed to delay %d msecs after connect", num);
req->delay = num;
}
else if(1 == sscanf(cmd, "writedelay: %d", &num)) {
else if(sscanf(cmd, "writedelay: %d", &num) == 1) {
logmsg("instructed to delay %d msecs between packets", num);
req->writedelay = num;
}

View file

@ -1029,7 +1029,7 @@ static int tftpd_parse_servercmd(struct testcase *req)
cmd = orgcmd;
while(cmd && cmdsize) {
char *check;
if(1 == sscanf(cmd, "writedelay: %d", &num)) {
if(sscanf(cmd, "writedelay: %d", &num) == 1) {
logmsg("instructed to delay %d secs between packets", num);
req->writedelay = num;
}