Piotr Caban : msvcp: Fix setting decimal point and thousands separator in numpunct_wchar__Init.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jan 8 16:12:13 CST 2015


Module: wine
Branch: master
Commit: e899bd82491a3eb5b73f716b89c4a3c702cb060f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e899bd82491a3eb5b73f716b89c4a3c702cb060f

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Jan  8 18:19:41 2015 +0100

msvcp: Fix setting decimal point and thousands separator in numpunct_wchar__Init.

---

 dlls/msvcp60/locale.c | 20 ++++++++++----------
 dlls/msvcp90/locale.c | 20 ++++++++++----------
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/dlls/msvcp60/locale.c b/dlls/msvcp60/locale.c
index 53de64c..027c529 100644
--- a/dlls/msvcp60/locale.c
+++ b/dlls/msvcp60/locale.c
@@ -1997,6 +1997,14 @@ int __cdecl _Mbrtowc(wchar_t *out, const char *in, MSVCP_size_t len, int *state,
     return 1;
 }
 
+static inline wchar_t mb_to_wc(char ch, const _Cvtvec *cvt)
+{
+    int state = 0;
+    wchar_t ret;
+
+    return _Mbrtowc(&ret, &ch, 1, &state, cvt) == 1 ? ret : 0;
+}
+
 /* ?_Dowiden@?$ctype at _W@std@@IBE_WD at Z */
 /* ?_Dowiden@?$ctype at _W@std@@IEBA_WD at Z */
 /* ?_Dowiden@?$ctype at G@std@@IBEGD at Z */
@@ -3454,8 +3462,8 @@ static void numpunct_wchar__Init(numpunct_wchar *this,
         if(this->grouping)
             memcpy((char*)this->grouping, lc->grouping, len);
 
-        this->dp = lc->decimal_point[0];
-        this->sep = lc->thousands_sep[0];
+        this->dp = mb_to_wc(lc->decimal_point[0], &cvt);
+        this->sep = mb_to_wc(lc->thousands_sep[0], &cvt);
     }
 
     if(!this->false_name || !this->true_name || !this->grouping) {
@@ -4083,14 +4091,6 @@ num_get* num_get_short_use_facet(const locale *loc)
     return obj;
 }
 
-static inline wchar_t mb_to_wc(char ch, const _Cvtvec *cvt)
-{
-    int state = 0;
-    wchar_t ret;
-
-    return _Mbrtowc(&ret, &ch, 1, &state, cvt) == 1 ? ret : 0;
-}
-
 static int num_get__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
         istreambuf_iterator_wchar *last, const locale *loc, numpunct_wchar *numpunct)
 {
diff --git a/dlls/msvcp90/locale.c b/dlls/msvcp90/locale.c
index 097dad8..9dedcc6 100644
--- a/dlls/msvcp90/locale.c
+++ b/dlls/msvcp90/locale.c
@@ -2394,6 +2394,14 @@ int __cdecl _Mbrtowc(wchar_t *out, const char *in, MSVCP_size_t len, int *state,
     return 1;
 }
 
+static inline wchar_t mb_to_wc(char ch, const _Cvtvec *cvt)
+{
+    int state = 0;
+    wchar_t ret;
+
+    return _Mbrtowc(&ret, &ch, 1, &state, cvt) == 1 ? ret : 0;
+}
+
 /* ?_Dowiden@?$ctype at _W@std@@IBE_WD at Z */
 /* ?_Dowiden@?$ctype at _W@std@@IEBA_WD at Z */
 /* ?_Dowiden@?$ctype at G@std@@IBEGD at Z */
@@ -4167,8 +4175,8 @@ void __thiscall numpunct_wchar__Init(numpunct_wchar *this,
         if(this->grouping)
             memcpy((char*)this->grouping, lc->grouping, len);
 
-        this->dp = lc->decimal_point[0];
-        this->sep = lc->thousands_sep[0];
+        this->dp = mb_to_wc(lc->decimal_point[0], &cvt);
+        this->sep = mb_to_wc(lc->thousands_sep[0], &cvt);
     }
 
     if(!this->false_name || !this->true_name || !this->grouping) {
@@ -4896,14 +4904,6 @@ num_get* num_get_short_use_facet(const locale *loc)
     return obj;
 }
 
-static inline wchar_t mb_to_wc(char ch, const _Cvtvec *cvt)
-{
-    int state = 0;
-    wchar_t ret;
-
-    return _Mbrtowc(&ret, &ch, 1, &state, cvt) == 1 ? ret : 0;
-}
-
 static int num_get__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
         istreambuf_iterator_wchar *last, const locale *loc, numpunct_wchar *numpunct)
 {




More information about the wine-cvs mailing list