Silencing warning in instances with char is unsigned. (#208)

* Silencing warning in instances with char is unsigned.

* Damn it.
This commit is contained in:
Daniel Lemire 2019-07-09 12:07:28 -04:00 committed by GitHub
parent 3bd3116cf8
commit 14ee003907
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -2,6 +2,7 @@
#include <cstring>
#include <dirent.h>
#include <inttypes.h>
#include <climits>
#include <iostream>
#include <math.h>
#include <stdbool.h>
@ -70,10 +71,17 @@ static bool parse_string(const char *p, char *output, char **end) {
p++;
for (;;) {
#if (CHAR_MIN < 0) || (!defined(CHAR_MIN)) // the '!defined' is just paranoia
// in this path, char is *signed*
if ((*p >= 0 && *p < 0x20)) {
return false; // unescaped
}
#else
// we have unsigned chars
if (*p < 0x20) {
return false; // unescaped
}
#endif
switch (*p) {
case '"':