Merge branch 'master' of github.com:cppformat/cppformat

This commit is contained in:
Victor Zverovich 2015-03-10 07:53:57 -07:00
commit 8c8826f749
2 changed files with 12 additions and 6 deletions

View File

@ -11,7 +11,7 @@ C++ Format
:target: http://cppformat.readthedocs.org/en/stable/ :target: http://cppformat.readthedocs.org/en/stable/
:alt: Documentation Status :alt: Documentation Status
.. image:: https://webapi.biicode.com/v1/badges/vitaut/vitaut/cppformat/master .. image:: https://webapi.biicode.com/v1/badges/vitaut/vitaut/cppformat/master?dummy
:target: https://www.biicode.com/vitaut/cppformat :target: https://www.biicode.com/vitaut/cppformat
C++ Format is an open-source formatting library for C++. C++ Format is an open-source formatting library for C++.
@ -288,7 +288,7 @@ tinyformat 2.0.1 tfm::printf 2.25
Boost Format 1.54 boost::format 9.94 Boost Format 1.54 boost::format 9.94
================= ============= =========== ================= ============= ===========
As you can see boost::format is much slower than the alternative methods; this As you can see ``boost::format`` is much slower than the alternative methods; this
is confirmed by `other tests <http://accu.org/index.php/journals/1539>`_. is confirmed by `other tests <http://accu.org/index.php/journals/1539>`_.
Tinyformat is quite good coming close to IOStreams. Unfortunately tinyformat Tinyformat is quite good coming close to IOStreams. Unfortunately tinyformat
cannot be faster than the IOStreams because it uses them internally. cannot be faster than the IOStreams because it uses them internally.

View File

@ -100,6 +100,12 @@ inline int fmt_snprintf(char *buffer, size_t size, const char *format, ...) {
# define FMT_SNPRINTF fmt_snprintf # define FMT_SNPRINTF fmt_snprintf
#endif // _MSC_VER #endif // _MSC_VER
#if defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT)
# define FMT_SWPRINTF snwprintf
#else
# define FMT_SWPRINTF swprintf
#endif // defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT)
// Checks if a value fits in int - used to avoid warnings about comparing // Checks if a value fits in int - used to avoid warnings about comparing
// signed and unsigned integers. // signed and unsigned integers.
template <bool IsSigned> template <bool IsSigned>
@ -388,12 +394,12 @@ int fmt::internal::CharTraits<wchar_t>::format_float(
unsigned width, int precision, T value) { unsigned width, int precision, T value) {
if (width == 0) { if (width == 0) {
return precision < 0 ? return precision < 0 ?
swprintf(buffer, size, format, value) : FMT_SWPRINTF(buffer, size, format, value) :
swprintf(buffer, size, format, precision, value); FMT_SWPRINTF(buffer, size, format, precision, value);
} }
return precision < 0 ? return precision < 0 ?
swprintf(buffer, size, format, width, value) : FMT_SWPRINTF(buffer, size, format, width, value) :
swprintf(buffer, size, format, width, precision, value); FMT_SWPRINTF(buffer, size, format, width, precision, value);
} }
template <typename T> template <typename T>