Skip to content

Commit 676b6d1

Browse files
egrimleyLocutusOfBorg
authored andcommitted
Fix build failure on non i386 and amd64 platforms (e.g. arm)
where the limited range makes comparison always false e.g. Release/src/utilities/base64.cpp:106:21: error: comparison is always false due to limited range of data type [-Werror=type-limits] if ( ch < 0 ) Release/src/utilities/base64.cpp:126:30: error: comparison is always false due to limited range of data type [-Werror=type-limits] if ( ch2 < 0 )
1 parent c7d85ee commit 676b6d1

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

Release/src/utilities/base64.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,7 @@ std::vector<unsigned char> _from_base64(const utility::string_t& input)
102102

103103
for (auto iter = input.begin(); iter != input.end(); ++iter,--size)
104104
{
105-
const auto ch = *iter;
106-
if ( ch < 0 )
107-
{
108-
throw std::runtime_error("invalid character found in base64 string");
109-
}
110-
const size_t ch_sz = static_cast<size_t>(ch);
105+
const size_t ch_sz = static_cast<size_t>(*iter);
111106
if ( ch_sz >= _base64_dectbl.size() || _base64_dectbl[ch_sz] == 255 )
112107
{
113108
throw std::runtime_error("invalid character found in base64 string");
@@ -122,12 +117,7 @@ std::vector<unsigned char> _from_base64(const utility::string_t& input)
122117
}
123118
if ( size == 2 )
124119
{
125-
const auto ch2 = *(iter+1);
126-
if ( ch2 < 0 )
127-
{
128-
throw std::runtime_error("invalid padding character found in base64 string");
129-
}
130-
const size_t ch2_sz = static_cast<size_t>(ch2);
120+
const size_t ch2_sz = static_cast<size_t>(*(iter+1));
131121
if ( ch2_sz >= _base64_dectbl.size() || _base64_dectbl[ch2_sz] != 254 )
132122
{
133123
throw std::runtime_error("invalid padding character found in base64 string");

0 commit comments

Comments
 (0)