Take integer promotion into account.

This commit is contained in:
Victor Zverovich 2014-08-11 06:54:58 -07:00
parent 910dec5ed3
commit 137153b9f0

View File

@ -300,7 +300,7 @@ template <typename T, typename U>
std::string sprintf_int(std::string format, U value) {
char buffer[BUFFER_SIZE];
char type = format[format.size() - 1];
if (sizeof(T) < sizeof(U)) {
if (sizeof(T) < sizeof(int)) {
if (type == 'd' || type == 'i') {
typedef typename MakeSigned<T>::Type Signed;
safe_sprintf(buffer, format.c_str(), static_cast<Signed>(value));