From 1c33835a53bc00d315f63721fa684d31b805fbb0 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Wed, 14 Nov 2012 15:37:54 +0100 Subject: [PATCH] msvcp60: Fixed basic_string::c_str implementation. --- dlls/msvcp60/locale.c | 12 ++++++------ dlls/msvcp60/string.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dlls/msvcp60/locale.c b/dlls/msvcp60/locale.c index bbeb5a50c04..f3500142f69 100644 --- a/dlls/msvcp60/locale.c +++ b/dlls/msvcp60/locale.c @@ -3970,7 +3970,7 @@ static int num_get__Getffld(const num_get *this, char *dest, istreambuf_iterator numpunct_wchar_grouping(numpunct, &grouping_bstr); grouping = basic_string_char_c_str(&grouping_bstr); - sep = grouping ? numpunct_wchar_thousands_sep(numpunct) : (wchar_t)0; + sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : (wchar_t)0; if(sep) basic_string_char_ctor(&groups_found); @@ -4124,7 +4124,7 @@ static int num_get__Getifld(const num_get *this, char *dest, istreambuf_iterator numpunct_wchar_grouping(numpunct, &grouping_bstr); grouping = basic_string_char_c_str(&grouping_bstr); - sep = grouping ? numpunct_wchar_thousands_sep(numpunct) : '\0'; + sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : '\0'; basefield = fmtflags & FMTFLAG_basefield; if(basefield == FMTFLAG_oct) @@ -5034,7 +5034,7 @@ static int num_get_char__Getffld(const num_get *this, char *dest, istreambuf_ite numpunct_char_grouping(numpunct, &grouping_bstr); grouping = basic_string_char_c_str(&grouping_bstr); - sep = grouping ? numpunct_char_thousands_sep(numpunct) : '\0'; + sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0'; if(sep) basic_string_char_ctor(&groups_found); @@ -5186,7 +5186,7 @@ static int num_get_char__Getifld(const num_get *this, char *dest, istreambuf_ite numpunct_char_grouping(numpunct, &grouping_bstr); grouping = basic_string_char_c_str(&grouping_bstr); - sep = grouping ? numpunct_char_thousands_sep(numpunct) : '\0'; + sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0'; basefield = fmtflags & FMTFLAG_basefield; if(basefield == FMTFLAG_oct) @@ -5949,7 +5949,7 @@ static ostreambuf_iterator_char* num_put_char_fput(const num_put *this, ostreamb /* Add separators to number */ numpunct_char_grouping(numpunct, &grouping_bstr); grouping = basic_string_char_c_str(&grouping_bstr); - sep = grouping ? numpunct_char_thousands_sep(numpunct) : '\0'; + sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0'; for(; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) { group_size++; @@ -6032,7 +6032,7 @@ static ostreambuf_iterator_char* num_put_char__Iput(const num_put *this, ostream /* Add separators to number */ numpunct_char_grouping(numpunct, &grouping_bstr); grouping = basic_string_char_c_str(&grouping_bstr); - sep = grouping ? numpunct_char_thousands_sep(numpunct) : '\0'; + sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0'; for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) { group_size++; diff --git a/dlls/msvcp60/string.c b/dlls/msvcp60/string.c index ed4391c7cc6..69917dca601 100644 --- a/dlls/msvcp60/string.c +++ b/dlls/msvcp60/string.c @@ -1666,7 +1666,7 @@ DEFINE_THISCALL_WRAPPER(basic_string_char_c_str, 4) const char* __thiscall basic_string_char_c_str(const basic_string_char *this) { TRACE("%p\n", this); - return this->ptr; + return this->ptr ? this->ptr : basic_string_char__Nullstr(); } /* ?size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ */ @@ -3376,7 +3376,7 @@ DEFINE_THISCALL_WRAPPER(basic_string_wchar_c_str, 4) const wchar_t* __thiscall basic_string_wchar_c_str(const basic_string_wchar *this) { TRACE("%p\n", this); - return this->ptr; + return this->ptr ? this->ptr : basic_string_wchar__Nullstr(); } /* ?size@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIXZ */