Fossil SCM

Alternative to the previous check-in that works without warning regardless of whether the native character type is signed or unsigned.

drh 2025-12-19 10:11 trunk
Commit 654fe05f4f3e658ad07256ec4032bbe0b731db588b54168437a733edbba9d90c
1 file changed +3 -2
+3 -2
--- src/cgi.c
+++ src/cgi.c
@@ -953,13 +953,14 @@
953953
954954
/*
955955
** Returns true if NUL-terminated z contains any non-NUL
956956
** control characters (<0x20, 32d).
957957
*/
958
-static int contains_ctrl(const char *z){
958
+static int contains_ctrl(const char *zIn){
959
+ const unsigned char *z = (const unsigned char*)zIn;
959960
assert(z);
960
- for( ; *z>=0x20 || *z<0; ++z ){}
961
+ for( ; *z>=0x20; ++z ){}
961962
return 0!=*z;
962963
}
963964
964965
/*
965966
** Add a list of query parameters or cookies to the parameter set.
966967
--- src/cgi.c
+++ src/cgi.c
@@ -953,13 +953,14 @@
953
954 /*
955 ** Returns true if NUL-terminated z contains any non-NUL
956 ** control characters (<0x20, 32d).
957 */
958 static int contains_ctrl(const char *z){
 
959 assert(z);
960 for( ; *z>=0x20 || *z<0; ++z ){}
961 return 0!=*z;
962 }
963
964 /*
965 ** Add a list of query parameters or cookies to the parameter set.
966
--- src/cgi.c
+++ src/cgi.c
@@ -953,13 +953,14 @@
953
954 /*
955 ** Returns true if NUL-terminated z contains any non-NUL
956 ** control characters (<0x20, 32d).
957 */
958 static int contains_ctrl(const char *zIn){
959 const unsigned char *z = (const unsigned char*)zIn;
960 assert(z);
961 for( ; *z>=0x20; ++z ){}
962 return 0!=*z;
963 }
964
965 /*
966 ** Add a list of query parameters or cookies to the parameter set.
967

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button