From 2423a1487b0b9751f0dd97ce79bcba1d92551a7a Mon Sep 17 00:00:00 2001 From: AlexPeshkoff Date: Thu, 26 Dec 2024 17:24:37 +0300 Subject: [PATCH] Compare signed/unsigned warnings --- src/common/CvtFormat.cpp | 10 +++++----- src/common/dsc.cpp | 10 +++++----- src/common/dsc.h | 2 +- src/common/dsc_proto.h | 2 +- src/jrd/SysFunction.cpp | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/common/CvtFormat.cpp b/src/common/CvtFormat.cpp index 1e89c09c8c..c0485e2087 100644 --- a/src/common/CvtFormat.cpp +++ b/src/common/CvtFormat.cpp @@ -70,7 +70,7 @@ namespace } } - bool contains(const char* value, USHORT& outTimezoneId, int& outParsedTimezoneLength) + bool contains(const char* value, USHORT& outTimezoneId, unsigned int& outParsedTimezoneLength) { const TrieNode* currentNode = m_root; FB_SIZE_T valueLength = fb_strlen(value); @@ -97,7 +97,7 @@ namespace TrieNode* currentNode = m_root; FB_SIZE_T valueLength = fb_strlen(value); - for (int i = 0; i < valueLength; i++) + for (unsigned int i = 0; i < valueLength; i++) { int index = calculateIndex(value[i]); @@ -460,7 +460,7 @@ namespace patternStr = std::string_view(format + formatStart, offset - formatStart + 1); bool isFound = false; - for (int j = 0; j < PatternsSize; j++) + for (unsigned int j = 0; j < PatternsSize; j++) { if (!strncmp(patterns[j], patternStr.data(), patternStr.length())) { @@ -1542,7 +1542,7 @@ namespace } case Format::TZR: { - int parsedTimezoneNameLength = 0; + unsigned int parsedTimezoneNameLength = 0; const bool timezoneNameIsCorrect = timeZoneTrie().contains(str + strOffset, outTimezoneId, parsedTimezoneNameLength); if (!timezoneNameIsCorrect) status_exception::raise(Arg::Gds(isc_invalid_timezone_region) << string(str + strOffset, parsedTimezoneNameLength)); @@ -1669,7 +1669,7 @@ ISC_TIMESTAMP_TZ CVT_format_string_to_datetime(const dsc* desc, const Firebird:: stringUpper[i] = toupper(sourceString[i]); string formatUpper(format.length(), '\0'); - for (int i = 0; i < format.length(); i++) + for (unsigned int i = 0; i < format.length(); i++) formatUpper[i] = toupper(format[i]); StringToDateTimeData cvtData; diff --git a/src/common/dsc.cpp b/src/common/dsc.cpp index 44f3249506..ee867be24b 100644 --- a/src/common/dsc.cpp +++ b/src/common/dsc.cpp @@ -1356,7 +1356,7 @@ static bool validate_dsc_tables(); -int dsc::getStringLength() const +USHORT dsc::getStringLength() const { return DSC_string_length(this); } @@ -1533,7 +1533,7 @@ bool DSC_make_descriptor(DSC* desc, } -int DSC_string_length(const dsc* desc) +USHORT DSC_string_length(const dsc* desc) { /************************************** * @@ -1561,10 +1561,10 @@ int DSC_string_length(const dsc* desc) return desc->dsc_length - sizeof(USHORT); default: if (!DTYPE_IS_EXACT(desc->dsc_dtype) || desc->dsc_scale == 0) - return (int) _DSC_convert_to_text_length[desc->dsc_dtype]; + return _DSC_convert_to_text_length[desc->dsc_dtype]; if (desc->dsc_scale < 0) - return (int) _DSC_convert_to_text_length[desc->dsc_dtype] + 1; - return (int) _DSC_convert_to_text_length[desc->dsc_dtype] + desc->dsc_scale; + return _DSC_convert_to_text_length[desc->dsc_dtype] + 1; + return _DSC_convert_to_text_length[desc->dsc_dtype] + desc->dsc_scale; } } diff --git a/src/common/dsc.h b/src/common/dsc.h index d536102443..b39779b7a3 100644 --- a/src/common/dsc.h +++ b/src/common/dsc.h @@ -499,7 +499,7 @@ typedef struct dsc dsc_address = address; } - int getStringLength() const; + USHORT getStringLength() const; operator Ods::Descriptor() const { diff --git a/src/common/dsc_proto.h b/src/common/dsc_proto.h index 1664edabed..b8372d1abf 100644 --- a/src/common/dsc_proto.h +++ b/src/common/dsc_proto.h @@ -26,7 +26,7 @@ #include "../common/dsc.h" -int DSC_string_length(const struct dsc*); +USHORT DSC_string_length(const struct dsc*); const TEXT* DSC_dtype_tostring(UCHAR); void DSC_get_dtype_name(const dsc*, TEXT*, USHORT); bool DSC_make_descriptor(dsc*, USHORT, SSHORT, diff --git a/src/jrd/SysFunction.cpp b/src/jrd/SysFunction.cpp index 4bf7b03a27..027fa1a1ae 100644 --- a/src/jrd/SysFunction.cpp +++ b/src/jrd/SysFunction.cpp @@ -2626,7 +2626,7 @@ dsc* evlCharToUuid(thread_db* tdbb, const SysFunction* function, const NestValue Arg::Str(function->name)); } - for (int i = 0; i < Uuid::STR_LEN; ++i) + for (unsigned int i = 0; i < Uuid::STR_LEN; ++i) { if (i == 8 || i == 13 || i == 18 || i == 23) {