Revert "formatHex with lower case (#3657)" (#3670)

This reverts commit b1823b61c0.
This commit is contained in:
Aleksandar Fabijanic
2022-07-07 09:43:52 +02:00
committed by GitHub
parent bbe09e48d1
commit 674446d44d
4 changed files with 56 additions and 107 deletions

View File

@@ -374,8 +374,7 @@ bool intToStr(T value,
bool prefix = false,
int width = -1,
char fill = ' ',
char thSep = 0,
bool upper = true)
char thSep = 0)
/// Converts integer to string. Numeric bases from binary to hexadecimal are supported.
/// If width is non-zero, it pads the return value with fill character to the specified width.
/// When padding is zero character ('0'), it is prepended to the number itself; all other
@@ -397,10 +396,7 @@ bool intToStr(T value,
{
tmpVal = value;
value /= base;
if (upper)
*ptr++ = "FEDCBA9876543210123456789ABCDEF"[15 + (tmpVal - value * base)];
else
*ptr++ = "fedcba9876543210123456789abcdef"[15 + (tmpVal - value * base)];
*ptr++ = "FEDCBA9876543210123456789ABCDEF"[15 + (tmpVal - value * base)];
if (thSep && (base == 10) && (++thCount == 3))
{
*ptr++ = thSep;
@@ -456,8 +452,7 @@ bool uIntToStr(T value,
bool prefix = false,
int width = -1,
char fill = ' ',
char thSep = 0,
bool upper = true)
char thSep = 0)
/// Converts unsigned integer to string. Numeric bases from binary to hexadecimal are supported.
/// If width is non-zero, it pads the return value with fill character to the specified width.
/// When padding is zero character ('0'), it is prepended to the number itself; all other
@@ -479,10 +474,7 @@ bool uIntToStr(T value,
{
tmpVal = value;
value /= base;
if (upper)
*ptr++ = "FEDCBA9876543210123456789ABCDEF"[15 + (tmpVal - value * base)];
else
*ptr++ = "fedcba9876543210123456789abcdef"[15 + (tmpVal - value * base)];
*ptr++ = "FEDCBA9876543210123456789ABCDEF"[15 + (tmpVal - value * base)];
if (thSep && (base == 10) && (++thCount == 3))
{
*ptr++ = thSep;
@@ -528,26 +520,26 @@ bool uIntToStr(T value,
template <typename T>
bool intToStr (T number, unsigned short base, std::string& result, bool prefix = false, int width = -1, char fill = ' ', char thSep = 0, bool upper = true)
bool intToStr (T number, unsigned short base, std::string& result, bool prefix = false, int width = -1, char fill = ' ', char thSep = 0)
/// Converts integer to string; This is a wrapper function, for details see see the
/// bool intToStr(T, unsigned short, char*, int, int, char, char) implementation.
{
char res[POCO_MAX_INT_STRING_LEN] = {0};
std::size_t size = POCO_MAX_INT_STRING_LEN;
bool ret = intToStr(number, base, res, size, prefix, width, fill, thSep, upper);
bool ret = intToStr(number, base, res, size, prefix, width, fill, thSep);
result.assign(res, size);
return ret;
}
template <typename T>
bool uIntToStr (T number, unsigned short base, std::string& result, bool prefix = false, int width = -1, char fill = ' ', char thSep = 0, bool upper = true)
bool uIntToStr (T number, unsigned short base, std::string& result, bool prefix = false, int width = -1, char fill = ' ', char thSep = 0)
/// Converts unsigned integer to string; This is a wrapper function, for details see see the
/// bool uIntToStr(T, unsigned short, char*, int, int, char, char) implementation.
{
char res[POCO_MAX_INT_STRING_LEN] = {0};
std::size_t size = POCO_MAX_INT_STRING_LEN;
bool ret = uIntToStr(number, base, res, size, prefix, width, fill, thSep, upper);
bool ret = uIntToStr(number, base, res, size, prefix, width, fill, thSep);
result.assign(res, size);
return ret;
}