Commit 2def5b76 by Paolo Carlini Committed by Paolo Carlini

c_locale.h (__convert_from_v): Include <cstdio>.

2003-07-14  Paolo Carlini  <pcarlini@unitus.it>

	* config/locale/gnu/c_locale.h (__convert_from_v): Include
	<cstdio>. Qualify names.
	* config/locale/generic/c_locale.h (__convert_from_v): Ditto.

From-SVN: r69343
parent 5e08432e
2003-07-14 Paolo Carlini <pcarlini@unitus.it> 2003-07-14 Paolo Carlini <pcarlini@unitus.it>
* config/locale/gnu/c_locale.h (__convert_from_v): Include
<cstdio>. Qualify names.
* config/locale/generic/c_locale.h (__convert_from_v): Ditto.
2003-07-14 Paolo Carlini <pcarlini@unitus.it>
Nathan C. Myers <ncm-nospam@cantrip.org> Nathan C. Myers <ncm-nospam@cantrip.org>
PR libstdc++/11378 PR libstdc++/11378
......
...@@ -39,8 +39,9 @@ ...@@ -39,8 +39,9 @@
#pragma GCC system_header #pragma GCC system_header
#include <clocale> #include <clocale>
#include <cstdlib> #include <cstdlib> // get std::malloc
#include <cstring> #include <cstring> // get std::strlen
#include <cstdio> // get std::snprintf or std::sprintf
#define _GLIBCXX_NUM_CATEGORIES 0 #define _GLIBCXX_NUM_CATEGORIES 0
...@@ -59,26 +60,26 @@ namespace std ...@@ -59,26 +60,26 @@ namespace std
const char* __fmt, const char* __fmt,
_Tv __v, const __c_locale&, int __prec = -1) _Tv __v, const __c_locale&, int __prec = -1)
{ {
char* __old = setlocale(LC_ALL, NULL); char* __old = std::setlocale(LC_ALL, NULL);
char* __sav = static_cast<char*>(malloc(strlen(__old) + 1)); char* __sav = static_cast<char*>(std::malloc(std::strlen(__old) + 1));
if (__sav) if (__sav)
strcpy(__sav, __old); std::strcpy(__sav, __old);
setlocale(LC_ALL, "C"); std::setlocale(LC_ALL, "C");
int __ret; int __ret;
#ifdef _GLIBCXX_USE_C99 #ifdef _GLIBCXX_USE_C99
if (__prec >= 0) if (__prec >= 0)
__ret = snprintf(__out, __size, __fmt, __prec, __v); __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
else else
__ret = snprintf(__out, __size, __fmt, __v); __ret = std::snprintf(__out, __size, __fmt, __v);
#else #else
if (__prec >= 0) if (__prec >= 0)
__ret = sprintf(__out, __fmt, __prec, __v); __ret = std::sprintf(__out, __fmt, __prec, __v);
else else
__ret = sprintf(__out, __fmt, __v); __ret = std::sprintf(__out, __fmt, __v);
#endif #endif
setlocale(LC_ALL, __sav); std::setlocale(LC_ALL, __sav);
free(__sav); std::free(__sav);
return __ret; return __ret;
} }
} }
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <cstring> // get std::strlen #include <cstring> // get std::strlen
#include <cstdlib> // get std::malloc #include <cstdlib> // get std::malloc
#include <cstdio> // get std::snprintf or std::sprintf
#include <clocale> #include <clocale>
#include <langinfo.h> // For codecvt #include <langinfo.h> // For codecvt
#include <iconv.h> // For codecvt using iconv, iconv_t #include <iconv.h> // For codecvt using iconv, iconv_t
...@@ -84,9 +85,9 @@ namespace std ...@@ -84,9 +85,9 @@ namespace std
int __ret; int __ret;
#ifdef _GLIBCXX_USE_C99 #ifdef _GLIBCXX_USE_C99
if (__prec >= 0) if (__prec >= 0)
__ret = snprintf(__out, __size, __fmt, __prec, __v); __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
else else
__ret = snprintf(__out, __size, __fmt, __v); __ret = std::snprintf(__out, __size, __fmt, __v);
#else #else
if (__prec >= 0) if (__prec >= 0)
__ret = std::sprintf(__out, __fmt, __prec, __v); __ret = std::sprintf(__out, __fmt, __prec, __v);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment