🏁 adding parentheses around std::snprintf calls #1337

This commit is contained in:
Niels Lohmann 2018-11-09 21:18:02 +01:00
parent f80efd3954
commit da81e7be22
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
4 changed files with 22 additions and 22 deletions

View file

@ -264,7 +264,7 @@ class binary_reader
default: // anything else not supported (yet)
{
char cr[3];
snprintf(cr, sizeof(cr), "%.2hhX", static_cast<unsigned char>(element_type));
(std::snprintf)(cr, sizeof(cr), "%.2hhX", static_cast<unsigned char>(element_type));
return sax->parse_error(element_type_parse_position, std::string(cr), parse_error::create(114, element_type_parse_position, "Unsupported BSON record type 0x" + std::string(cr)));
}
}
@ -1921,7 +1921,7 @@ class binary_reader
std::string get_token_string() const
{
char cr[3];
snprintf(cr, 3, "%.2hhX", static_cast<unsigned char>(current));
(std::snprintf)(cr, 3, "%.2hhX", static_cast<unsigned char>(current));
return std::string{cr};
}

View file

@ -1360,7 +1360,7 @@ scan_number_done:
{
// escape control characters
char cs[9];
snprintf(cs, 9, "<U+%.4X>", static_cast<unsigned char>(c));
(std::snprintf)(cs, 9, "<U+%.4X>", static_cast<unsigned char>(c));
result += cs;
}
else