diff options
author | Paolo Carlini <pcarlini@suse.de> | 2004-08-07 13:48:31 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2004-08-07 13:48:31 +0000 |
commit | 49864a8255efafcce754540709efe5b4e28eea7b (patch) | |
tree | 00ab173ce0375195be624ab5f464dffb7463aab0 /libstdc++-v3/config | |
parent | cbf8a6ab5dad4e5fc74cfe1688a17403b0abe2db (diff) | |
download | gcc-49864a8255efafcce754540709efe5b4e28eea7b.zip gcc-49864a8255efafcce754540709efe5b4e28eea7b.tar.gz gcc-49864a8255efafcce754540709efe5b4e28eea7b.tar.bz2 |
c_locale.h (__convert_from_v): Don't use a default for __prec, assume __prec >= 0 and simplify.
2004-08-07 Paolo Carlini <pcarlini@suse.de>
* config/locale/generic/c_locale.h (__convert_from_v): Don't
use a default for __prec, assume __prec >= 0 and simplify.
* config/locale/gnu/c_locale.h (__convert_from_v): Likewise.
* include/bits/locale_facets.tcc (money_put<>::do_put(long double)):
Pass format "%.*Lf" + precision == 0, equivalent to "%.0Lf".
From-SVN: r85669
Diffstat (limited to 'libstdc++-v3/config')
-rw-r--r-- | libstdc++-v3/config/locale/generic/c_locale.h | 13 | ||||
-rw-r--r-- | libstdc++-v3/config/locale/gnu/c_locale.h | 15 |
2 files changed, 7 insertions, 21 deletions
diff --git a/libstdc++-v3/config/locale/generic/c_locale.h b/libstdc++-v3/config/locale/generic/c_locale.h index 9fadcc4..a1a5686 100644 --- a/libstdc++-v3/config/locale/generic/c_locale.h +++ b/libstdc++-v3/config/locale/generic/c_locale.h @@ -57,24 +57,17 @@ namespace std __convert_from_v(char* __out, const int __size __attribute__((__unused__)), const char* __fmt, - _Tv __v, const __c_locale&, int __prec = -1) + _Tv __v, const __c_locale&, int __prec) { char* __old = std::setlocale(LC_ALL, NULL); char* __sav = new char[std::strlen(__old) + 1]; std::strcpy(__sav, __old); std::setlocale(LC_ALL, "C"); - int __ret; #ifdef _GLIBCXX_USE_C99 - if (__prec >= 0) - __ret = std::snprintf(__out, __size, __fmt, __prec, __v); - else - __ret = std::snprintf(__out, __size, __fmt, __v); + const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v); #else - if (__prec >= 0) - __ret = std::sprintf(__out, __fmt, __prec, __v); - else - __ret = std::sprintf(__out, __fmt, __v); + const int __ret = std::sprintf(__out, __fmt, __prec, __v); #endif std::setlocale(LC_ALL, __sav); delete [] __sav; diff --git a/libstdc++-v3/config/locale/gnu/c_locale.h b/libstdc++-v3/config/locale/gnu/c_locale.h index fe899cf..b6082a2 100644 --- a/libstdc++-v3/config/locale/gnu/c_locale.h +++ b/libstdc++-v3/config/locale/gnu/c_locale.h @@ -68,11 +68,11 @@ namespace std int __convert_from_v(char* __out, const int __size, const char* __fmt, #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) - _Tv __v, const __c_locale& __cloc, int __prec = -1) + _Tv __v, const __c_locale& __cloc, int __prec) { __c_locale __old = __gnu_cxx::__uselocale(__cloc); #else - _Tv __v, const __c_locale&, int __prec = -1) + _Tv __v, const __c_locale&, int __prec) { char* __old = std::setlocale(LC_ALL, NULL); char* __sav = new char[std::strlen(__old) + 1]; @@ -80,17 +80,10 @@ namespace std std::setlocale(LC_ALL, "C"); #endif - int __ret; #ifdef _GLIBCXX_USE_C99 - if (__prec >= 0) - __ret = std::snprintf(__out, __size, __fmt, __prec, __v); - else - __ret = std::snprintf(__out, __size, __fmt, __v); + const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v); #else - if (__prec >= 0) - __ret = std::sprintf(__out, __fmt, __prec, __v); - else - __ret = std::sprintf(__out, __fmt, __v); + const int __ret = std::sprintf(__out, __fmt, __prec, __v); #endif #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) |