Skip to content

Commit bceff40

Browse files
committed
[#3256] fix Wtype-limits warnings
``` 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] ```
1 parent 05362b1 commit bceff40

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/lib/cc/data.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ StringElement::toJSON(std::ostream& ss) const {
875875
ss << "\"";
876876
const std::string& str = stringValue();
877877
for (size_t i = 0; i < str.size(); ++i) {
878-
const char c = str[i];
878+
const signed char c = str[i];
879879
// Escape characters as defined in JSON spec
880880
// Note that we do not escape forward slash; this
881881
// is allowed, but not mandatory.

src/lib/http/http_message_parser_base.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
1+
// Copyright (C) 2017-2024 Internet Systems Consortium, Inc. ("ISC")
22
//
33
// This Source Code Form is subject to the terms of the Mozilla Public
44
// 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)
261261
}
262262

263263
bool
264-
HttpMessageParserBase::isChar(const char c) const {
264+
HttpMessageParserBase::isChar(const signed char c) const {
265265
// was (c >= 0) && (c <= 127)
266266
return (c >= 0);
267267
}
268268

269269
bool
270-
HttpMessageParserBase::isCtl(const char c) const {
270+
HttpMessageParserBase::isCtl(const signed char c) const {
271271
return (((c >= 0) && (c <= 31)) || (c == 127));
272272
}
273273

274274
bool
275-
HttpMessageParserBase::isSpecial(const char c) const {
275+
HttpMessageParserBase::isSpecial(const signed char c) const {
276276
switch (c) {
277277
case '(':
278278
case ')':

src/lib/http/http_message_parser_base.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
1+
// Copyright (C) 2017-2024 Internet Systems Consortium, Inc. ("ISC")
22
//
33
// This Source Code Form is subject to the terms of the Mozilla Public
44
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -285,17 +285,17 @@ class HttpMessageParserBase : public util::StateModel {
285285
/// @brief Checks if specified value is a character.
286286
///
287287
/// @return true, if specified value is a character.
288-
bool isChar(const char c) const;
288+
bool isChar(const signed char c) const;
289289

290290
/// @brief Checks if specified value is a control value.
291291
///
292292
/// @return true, if specified value is a control value.
293-
bool isCtl(const char c) const;
293+
bool isCtl(const signed char c) const;
294294

295295
/// @brief Checks if specified value is a special character.
296296
///
297297
/// @return true, if specified value is a special character.
298-
bool isSpecial(const char c) const;
298+
bool isSpecial(const signed char c) const;
299299

300300
/// @brief Reference to the parsed HTTP message.
301301
HttpMessage& message_;

0 commit comments

Comments
 (0)