Never pass a signed char to ctype macros like isdigit()
Bug: None Change-Id: I451bb2c1f175a77aefbc8363009bf35a769fe941 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264442 Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37037}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
c85e473740
commit
e66b83f8ad
@ -286,7 +286,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
/* Packet loss test */
|
||||
if (!strcmp("-PL", argv[i])) {
|
||||
if (isdigit(*argv[i + 1])) {
|
||||
if (isdigit(static_cast<unsigned char>(*argv[i + 1]))) {
|
||||
packetLossPercent = atoi(argv[i + 1]);
|
||||
if ((packetLossPercent < 0) | (packetLossPercent > 100)) {
|
||||
printf("\nInvalid packet loss perentage \n");
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
|
||||
/* include API */
|
||||
|
||||
@ -62,7 +62,9 @@ int16_t PCMFile::ChooseFile(std::string* file_name,
|
||||
int16_t n = 0;
|
||||
|
||||
// Removing trailing spaces.
|
||||
while ((isspace(tmp_name[n]) || iscntrl(tmp_name[n])) && (tmp_name[n] != 0) &&
|
||||
while ((isspace(static_cast<unsigned char>(tmp_name[n])) ||
|
||||
iscntrl(static_cast<unsigned char>(tmp_name[n]))) &&
|
||||
(static_cast<unsigned char>(tmp_name[n]) != 0) &&
|
||||
(n < MAX_FILE_NAME_LENGTH_BYTE)) {
|
||||
n++;
|
||||
}
|
||||
@ -73,7 +75,9 @@ int16_t PCMFile::ChooseFile(std::string* file_name,
|
||||
// Removing trailing spaces.
|
||||
n = (int16_t)(strlen(tmp_name) - 1);
|
||||
if (n >= 0) {
|
||||
while ((isspace(tmp_name[n]) || iscntrl(tmp_name[n])) && (n >= 0)) {
|
||||
while ((isspace(static_cast<unsigned char>(tmp_name[n])) ||
|
||||
iscntrl(static_cast<unsigned char>(tmp_name[n]))) &&
|
||||
(n >= 0)) {
|
||||
n--;
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
|
||||
#include "TwoWayCommunication.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
|
||||
#include "modules/audio_coding/test/iSACTest.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user