From f700a717d74218ac5a6bedaf5b71eaf96399dc13 Mon Sep 17 00:00:00 2001 From: kichikuou Date: Thu, 15 Aug 2024 16:50:52 +0900 Subject: [PATCH] Do not pass negative values to isspace() MSVCRT debug versions assert that. --- src/config.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config.cpp b/src/config.cpp index 8c418c5..ff7b16d 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -38,7 +38,7 @@ std::string normalize_path(std::string s) bool is_empty_line(const char *s) { for (; *s; s++) { - if (!isspace(*s)) + if (!isspace((unsigned char)*s)) return false; } return true; @@ -46,10 +46,10 @@ bool is_empty_line(const char *s) char *trim(char *s) { - while (isspace(*s)) + while (isspace((unsigned char)*s)) s++; char *p = s + strlen(s) - 1; - while (p > s && isspace(*p)) + while (p > s && isspace((unsigned char)*p)) *p-- = '\0'; return s; }