mirror of
https://github.com/cesanta/mongoose.git
synced 2024-11-27 12:49:01 +08:00
Squash warnings on gcc 9.4
This commit is contained in:
parent
68f7be7a1a
commit
ac0e6f3377
14
mongoose.c
14
mongoose.c
@ -2230,7 +2230,7 @@ struct mg_fs mg_fs_posix = {p_stat, p_list, p_open, p_close, p_read,
|
||||
static int mg_ncasecmp(const char *s1, const char *s2, size_t len) {
|
||||
int diff = 0;
|
||||
if (len > 0) do {
|
||||
char c = *s1++, d = *s2++;
|
||||
int c = *s1++, d = *s2++;
|
||||
if (c >= 'A' && c <= 'Z') c += 'a' - 'A';
|
||||
if (d >= 'A' && d <= 'Z') d += 'a' - 'A';
|
||||
diff = c - d;
|
||||
@ -8033,14 +8033,14 @@ struct mg_str mg_str_n(const char *s, size_t n) {
|
||||
return str;
|
||||
}
|
||||
|
||||
static char tolc(char c) {
|
||||
static int mg_tolc(char c) {
|
||||
return (c >= 'A' && c <= 'Z') ? c + 'a' - 'A' : c;
|
||||
}
|
||||
|
||||
int mg_casecmp(const char *s1, const char *s2) {
|
||||
int diff = 0;
|
||||
do {
|
||||
char c = tolc(*s1++), d = tolc(*s2++);
|
||||
int c = mg_tolc(*s1++), d = mg_tolc(*s2++);
|
||||
diff = c - d;
|
||||
} while (diff == 0 && s1[-1] != '\0');
|
||||
return diff;
|
||||
@ -8049,8 +8049,8 @@ int mg_casecmp(const char *s1, const char *s2) {
|
||||
int mg_strcmp(const struct mg_str str1, const struct mg_str str2) {
|
||||
size_t i = 0;
|
||||
while (i < str1.len && i < str2.len) {
|
||||
char c1 = str1.buf[i];
|
||||
char c2 = str2.buf[i];
|
||||
int c1 = str1.buf[i];
|
||||
int c2 = str2.buf[i];
|
||||
if (c1 < c2) return -1;
|
||||
if (c1 > c2) return 1;
|
||||
i++;
|
||||
@ -8063,8 +8063,8 @@ int mg_strcmp(const struct mg_str str1, const struct mg_str str2) {
|
||||
int mg_strcasecmp(const struct mg_str str1, const struct mg_str str2) {
|
||||
size_t i = 0;
|
||||
while (i < str1.len && i < str2.len) {
|
||||
char c1 = tolc(str1.buf[i]);
|
||||
char c2 = tolc(str2.buf[i]);
|
||||
int c1 = mg_tolc(str1.buf[i]);
|
||||
int c2 = mg_tolc(str2.buf[i]);
|
||||
if (c1 < c2) return -1;
|
||||
if (c1 > c2) return 1;
|
||||
i++;
|
||||
|
@ -14,7 +14,7 @@
|
||||
static int mg_ncasecmp(const char *s1, const char *s2, size_t len) {
|
||||
int diff = 0;
|
||||
if (len > 0) do {
|
||||
char c = *s1++, d = *s2++;
|
||||
int c = *s1++, d = *s2++;
|
||||
if (c >= 'A' && c <= 'Z') c += 'a' - 'A';
|
||||
if (d >= 'A' && d <= 'Z') d += 'a' - 'A';
|
||||
diff = c - d;
|
||||
|
12
src/str.c
12
src/str.c
@ -10,14 +10,14 @@ struct mg_str mg_str_n(const char *s, size_t n) {
|
||||
return str;
|
||||
}
|
||||
|
||||
static char tolc(char c) {
|
||||
static int mg_tolc(char c) {
|
||||
return (c >= 'A' && c <= 'Z') ? c + 'a' - 'A' : c;
|
||||
}
|
||||
|
||||
int mg_casecmp(const char *s1, const char *s2) {
|
||||
int diff = 0;
|
||||
do {
|
||||
char c = tolc(*s1++), d = tolc(*s2++);
|
||||
int c = mg_tolc(*s1++), d = mg_tolc(*s2++);
|
||||
diff = c - d;
|
||||
} while (diff == 0 && s1[-1] != '\0');
|
||||
return diff;
|
||||
@ -26,8 +26,8 @@ int mg_casecmp(const char *s1, const char *s2) {
|
||||
int mg_strcmp(const struct mg_str str1, const struct mg_str str2) {
|
||||
size_t i = 0;
|
||||
while (i < str1.len && i < str2.len) {
|
||||
char c1 = str1.buf[i];
|
||||
char c2 = str2.buf[i];
|
||||
int c1 = str1.buf[i];
|
||||
int c2 = str2.buf[i];
|
||||
if (c1 < c2) return -1;
|
||||
if (c1 > c2) return 1;
|
||||
i++;
|
||||
@ -40,8 +40,8 @@ int mg_strcmp(const struct mg_str str1, const struct mg_str str2) {
|
||||
int mg_strcasecmp(const struct mg_str str1, const struct mg_str str2) {
|
||||
size_t i = 0;
|
||||
while (i < str1.len && i < str2.len) {
|
||||
char c1 = tolc(str1.buf[i]);
|
||||
char c2 = tolc(str2.buf[i]);
|
||||
int c1 = mg_tolc(str1.buf[i]);
|
||||
int c2 = mg_tolc(str2.buf[i]);
|
||||
if (c1 < c2) return -1;
|
||||
if (c1 > c2) return 1;
|
||||
i++;
|
||||
|
Loading…
Reference in New Issue
Block a user