]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3256] fix Wtype-limits warnings
authorAndrei Pavel <andrei@isc.org>
Thu, 16 May 2024 12:45:54 +0000 (15:45 +0300)
committerAndrei Pavel <andrei@isc.org>
Mon, 20 May 2024 20:28:17 +0000 (23:28 +0300)
```
data.cc:905:21: warning: comparison is always true due to limited range of data type [-Wtype-limits]
data.cc:905:48: warning: comparison is always false due to limited range of data type [-Wtype-limits]
http_message_parser_base.cc:266:15: warning: comparison is always true due to limited range of data type [-Wtype-limits]
http_message_parser_base.cc:271:17: warning: comparison is always true due to limited range of data type [-Wtype-limits]
```

src/lib/cc/data.cc
src/lib/http/http_message_parser_base.cc
src/lib/http/http_message_parser_base.h

index 3fb117ac0fe050b62219c0b9a829ff7d391b852d..b7bc6c399abeb50776d4583f778afcc41a14e001 100644 (file)
@@ -875,7 +875,7 @@ StringElement::toJSON(std::ostream& ss) const {
     ss << "\"";
     const std::string& str = stringValue();
     for (size_t i = 0; i < str.size(); ++i) {
-        const char c = str[i];
+        const signed char c = str[i];
         // Escape characters as defined in JSON spec
         // Note that we do not escape forward slash; this
         // is allowed, but not mandatory.
index 000e3439dede64ffd66391c3e0d720e602a37f76..cbda31a01301cb77ecc23eafc501209bf832b939 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2024 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -261,18 +261,18 @@ HttpMessageParserBase::popNextFromBuffer(std::string& next, const size_t limit)
 }
 
 bool
-HttpMessageParserBase::isChar(const char c) const {
+HttpMessageParserBase::isChar(const signed char c) const {
     // was (c >= 0) && (c <= 127)
     return (c >= 0);
 }
 
 bool
-HttpMessageParserBase::isCtl(const char c) const {
+HttpMessageParserBase::isCtl(const signed char c) const {
     return (((c >= 0) && (c <= 31)) || (c == 127));
 }
 
 bool
-HttpMessageParserBase::isSpecial(const char c) const {
+HttpMessageParserBase::isSpecial(const signed char c) const {
     switch (c) {
     case '(':
     case ')':
index 01f9831e2db1b6c061091dc2527aa076b092b1ca..b11e558591af68060f7f51101ec897c5c51d5ed2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2024 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -285,17 +285,17 @@ protected:
     /// @brief Checks if specified value is a character.
     ///
     /// @return true, if specified value is a character.
-    bool isChar(const char c) const;
+    bool isChar(const signed char c) const;
 
     /// @brief Checks if specified value is a control value.
     ///
     /// @return true, if specified value is a control value.
-    bool isCtl(const char c) const;
+    bool isCtl(const signed char c) const;
 
     /// @brief Checks if specified value is a special character.
     ///
     /// @return true, if specified value is a special character.
-    bool isSpecial(const char c) const;
+    bool isSpecial(const signed char c) const;
 
     /// @brief Reference to the parsed HTTP message.
     HttpMessage& message_;