setlocale problem for some locale
setlocale problem for some locale
- Subject: setlocale problem for some locale
- From: Nicholas Ellis <email@hidden>
- Date: Tue, 16 Jun 2009 10:11:26 +0200
Hello
I am having an issue when using the combination setlocale / wcstod /
double extraction from STL stream.
When using the malloc utilities, I see that there is a double free in
setlocale using malloc_info
what should I do ?
#include <wchar.h>
#include <stdlib.h>
#include <locale.h>
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
int main()
{
wchar_t buffer[12];
char *val_s = "123";
setlocale(LC_ALL,"fr_FR/fr_FR/fr_FR/C/fr_FR/fr_FR");
mbstowcs(buffer,val_s,sizeof(buffer)/sizeof(buffer[0]));
double val;
val = wcstod(buffer,NULL);
printf("val is %lf\n",val);
string str("123");
unsigned int i;
for( i = 0 ; i < 1 ; i ++ )
{
istringstream string_stream(str);
string_stream >> val;
}
pause();
}
Call [2] [arg=1340]: thread_a0748720 |start | main | wcstod | wcstod_l
| __numeric_ctype | newlocale | _duplocale | malloc | malloc_zone_malloc
Call [4] [arg=0]: thread_a0748720 |start | main |
std::basic_istream<char, std::char_traits<char> >::operator>>(double&)
| std::num_get<char, std::istreambuf_iterator<char,
std::char_traits<char> > >::get(std::istreambuf_iterator<char,
std::char_traits<char> >, std::istreambuf_iterator<char,
std::char_traits<char> >, std::ios_base&, std::_Ios_Iostate&, double&)
const | std::num_get<char, std::istreambuf_iterator<char,
std::char_traits<char> > >::do_get(std::istreambuf_iterator<char,
std::char_traits<char> >, std::istreambuf_iterator<char,
std::char_traits<char> >, std::ios_base&, std::_Ios_Iostate&, double&)
const | void std::__convert_to_v<double>(char const*, double&,
std::_Ios_Iostate&, int* const&) | setlocale | free | malloc_zone_free
Call [4] [arg=0]: thread_a0748720 |start | main |
std::basic_istream<char, std::char_traits<char> >::operator>>(double&)
| std::num_get<char, std::istreambuf_iterator<char,
std::char_traits<char> > >::get(std::istreambuf_iterator<char,
std::char_traits<char> >, std::istreambuf_iterator<char,
std::char_traits<char> >, std::ios_base&, std::_Ios_Iostate&, double&)
const | std::num_get<char, std::istreambuf_iterator<char,
std::char_traits<char> > >::do_get(std::istreambuf_iterator<char,
std::char_traits<char> >, std::istreambuf_iterator<char,
std::char_traits<char> >, std::ios_base&, std::_Ios_Iostate&, double&)
const | void std::__convert_to_v<double>(char const*, double&,
std::_Ios_Iostate&, int* const&) | setlocale | free | malloc_zone_free
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden