aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/src/locale.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/src/locale.cc')
-rw-r--r--libstdc++-v3/src/locale.cc47
1 files changed, 24 insertions, 23 deletions
diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc
index c5c6dd8a049..74532759181 100644
--- a/libstdc++-v3/src/locale.cc
+++ b/libstdc++-v3/src/locale.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -28,7 +28,6 @@
#include <clocale>
#include <cstring>
-#include <cassert>
#include <cctype>
#include <cwctype> // For towupper, etc.
#include <locale>
@@ -195,19 +194,19 @@ namespace std
}
else
{
- char* __res;
+ string __res;
// LANG may set a default different from "C".
char* __env = getenv("LANG");
if (!__env || strcmp(__env, "") == 0 || strcmp(__env, "C") == 0
|| strcmp(__env, "POSIX") == 0)
- __res = strdup("C");
+ __res = "C";
else
- __res = strdup(__env);
+ __res = __env;
// Scan the categories looking for the first one
// different from LANG.
size_t __i = 0;
- if (strcmp(__res, "C") == 0)
+ if (__res == "C")
for (; __i < _S_categories_size
+ _S_extra_categories_size; ++__i)
{
@@ -223,7 +222,7 @@ namespace std
{
__env = getenv(_S_categories[__i]);
if (__env && strcmp(__env, "") != 0
- && strcmp(__env, __res) != 0)
+ && __res != __env)
break;
}
@@ -274,11 +273,10 @@ namespace std
}
// ... otherwise either an additional instance of
// the "C" locale or LANG.
- else if (strcmp(__res, "C") == 0)
+ else if (__res == "C")
(_M_impl = _S_classic)->_M_add_reference();
else
- _M_impl = new _Impl(__res, 1);
- free(__res);
+ _M_impl = new _Impl(__res.c_str(), 1);
}
}
}
@@ -449,6 +447,8 @@ namespace std
__c_locale
locale::facet::_S_c_locale;
+ char locale::facet::_S_c_name[2];
+
locale::facet::
~facet() { }
@@ -500,13 +500,16 @@ namespace std
const money_base::pattern
money_base::_S_default_pattern = { {symbol, sign, none, value} };
- const char __num_base::_S_atoms[] = "0123456789eEabcdfABCDF";
+ const char* __num_base::_S_atoms_in = "0123456789eEabcdfABCDF";
+ const char* __num_base::_S_atoms_out ="-+xX0123456789abcdef0123456789ABCDEF";
- bool
- __num_base::_S_format_float(const ios_base& __io, char* __fptr, char __mod,
- streamsize __prec)
+ // _GLIBCPP_RESOLVE_LIB_DEFECTS
+ // According to the resolution of DR 231, about 22.2.2.2.2, p11,
+ // "str.precision() is specified in the conversion specification".
+ void
+ __num_base::_S_format_float(const ios_base& __io, char* __fptr,
+ char __mod, streamsize/* unused post DR 231 */)
{
- bool __incl_prec = false;
ios_base::fmtflags __flags = __io.flags();
*__fptr++ = '%';
// [22.2.2.2.2] Table 60
@@ -514,13 +517,12 @@ namespace std
*__fptr++ = '+';
if (__flags & ios_base::showpoint)
*__fptr++ = '#';
- // As per [22.2.2.2.2.11]
- if (__flags & ios_base::fixed || __prec > 0)
- {
- *__fptr++ = '.';
- *__fptr++ = '*';
- __incl_prec = true;
- }
+
+ // As per DR 231: _always_, not only when
+ // __flags & ios_base::fixed || __prec > 0
+ *__fptr++ = '.';
+ *__fptr++ = '*';
+
if (__mod)
*__fptr++ = __mod;
ios_base::fmtflags __fltfield = __flags & ios_base::floatfield;
@@ -532,7 +534,6 @@ namespace std
else
*__fptr++ = (__flags & ios_base::uppercase) ? 'G' : 'g';
*__fptr = '\0';
- return __incl_prec;
}
void