Fix building on OS X 10.10

This commit is contained in:
Robert Xu 2015-02-10 23:17:39 -05:00
parent 73d63c508a
commit 00e637645c
6 changed files with 145 additions and 10 deletions

View file

@ -263,6 +263,30 @@ namespace fmt
}
};
template<>
struct get_fmt<unsigned long>
{
static std::string text(const char* fmt, size_t len, unsigned long arg)
{
if (fmt[len - 1] == 'x')
{
return to_hex(arg, get_fmt_precision(fmt, len));
}
else if (fmt[len - 1] == 'X')
{
return fmt::toupper(to_hex(arg, get_fmt_precision(fmt, len)));
}
else if (fmt[len - 1] == 'd' || fmt[len - 1] == 'u')
{
return to_udec(arg);
}
else
{
throw "Invalid formatting (unsigned long): " + std::string(fmt, len);
}
}
};
template<>
struct get_fmt<u64>
{
@ -359,6 +383,30 @@ namespace fmt
}
};
template<>
struct get_fmt<long>
{
static std::string text(const char* fmt, size_t len, long arg)
{
if (fmt[len - 1] == 'x')
{
return to_hex((u64)arg, get_fmt_precision(fmt, len));
}
else if (fmt[len - 1] == 'X')
{
return fmt::toupper(to_hex((u64)arg, get_fmt_precision(fmt, len)));
}
else if (fmt[len - 1] == 'd')
{
return to_sdec(arg);
}
else
{
throw "Invalid formatting (long): " + std::string(fmt, len);
}
}
};
template<>
struct get_fmt<s64>
{