// not all callers are ready to handle exceptions arising here.
char *end{nullptr};
unsigned long typeno = strtoul(digits, &end, 10);
- if (typeno <= std::numeric_limits<uint16_t>::max() && end != digits && (*end == '\0' || isspace(static_cast<int>(*end)) != 0)) {
+ if (typeno <= std::numeric_limits<uint16_t>::max() && end != digits && (*end == '\0' || isspace(static_cast<unsigned char>(*end)) != 0)) {
return typeno;
}
}
skipSpaces();
size_t len;
for(len=0;
- d_pos+len < d_string.length() && (isxdigit(d_string.at(d_pos+len)) || d_string.at(d_pos+len) == ':');
+ d_pos+len < d_string.length() && (isxdigit(static_cast<unsigned char>(d_string.at(d_pos+len))) || d_string.at(d_pos+len) == ':');
len++) ; // find length of ID
// Parse as v6, and then strip the final 64 zero bytes
{
skipSpaces();
- if(!isdigit(d_string.at(d_pos)))
+ if(!isdigit(static_cast<unsigned char>(d_string.at(d_pos))))
throw RecordTextException("expected digits at position "+std::to_string(d_pos)+" in '"+d_string+"'");
size_t pos;
{
skipSpaces();
- if(!isdigit(d_string.at(d_pos)))
+ if(!isdigit(static_cast<unsigned char>(d_string.at(d_pos))))
throw RecordTextException("expected digits at position "+std::to_string(d_pos)+" in '"+d_string+"'");
size_t pos;
{
skipSpaces();
- if(!isdigit(d_string.at(d_pos)))
+ if(!isdigit(static_cast<unsigned char>(d_string.at(d_pos))))
throw RecordTextException("while parsing IP address, expected digits at position "+std::to_string(d_pos)+" in '"+d_string+"'");
uint32_t octet=0;
if(count > 3)
throw RecordTextException(string("unable to parse IP address, too many dots"));
}
- else if(isdigit(d_string.at(d_pos))) {
+ else if(isdigit(static_cast<unsigned char>(d_string.at(d_pos)))) {
last_was_digit = true;
octet*=10;
octet+=d_string.at(d_pos) - '0';
size_t len;
// lookup end of value - think of ::ffff encoding too, has dots in it!
for(len=0;
- d_pos+len < d_string.length() && (isxdigit(d_string.at(d_pos+len)) || d_string.at(d_pos+len) == ':' || d_string.at(d_pos+len)=='.');
+ d_pos+len < d_string.length() && (isxdigit(static_cast<unsigned char>(d_string.at(d_pos+len))) || d_string.at(d_pos+len) == ':' || d_string.at(d_pos+len)=='.');
len++);
if(!len)
bool lowdigit{false};
uint8_t val{0};
for (auto chr : chunk) {
- if(isalnum(chr) == 0) {
+ if(isalnum(static_cast<unsigned char>(chr)) == 0) {
continue;
}
if (!lowdigit) {
static void
skipspace(const std::string& content, std::string::size_type& pos)
{
- while (pos < content.length() && std::isspace(content.at(pos)) != 0) {
+ while (pos < content.length() && std::isspace(static_cast<unsigned char>(content.at(pos))) != 0) {
++pos;
}
}
bool parsed{false};
number = 0;
- while (pos < content.length() && std::isdigit(content.at(pos)) != 0) {
+ while (pos < content.length() && std::isdigit(static_cast<unsigned char>(content.at(pos))) != 0) {
parsed = true;
number = number * 10 + (content.at(pos) - '0');
++pos;
++pos;
while (digits-- != 0) {
number *= 10;
- if (pos < content.length() && std::isdigit(content.at(pos)) != 0) {
+ if (pos < content.length() && std::isdigit(static_cast<unsigned char>(content.at(pos))) != 0) {
parsed = true; // intentionally rejects '.' alone
number += (content.at(pos) - '0');
++pos;
}
}
// skip any further digits
- while (pos < content.length() && std::isdigit(content.at(pos)) != 0) {
+ while (pos < content.length() && std::isdigit(static_cast<unsigned char>(content.at(pos))) != 0) {
++pos;
}
}