Alexandre Julliard : kernelbase: Reimplement LOCALE_*DAYNAME in GetLocaleInfoW/Ex using the locale.nls data.

Alexandre Julliard julliard at winehq.org
Mon Mar 28 15:53:40 CDT 2022


Module: wine
Branch: master
Commit: 5bf289ea37cc22309b9bb47b016195d5e12c2de2
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=5bf289ea37cc22309b9bb47b016195d5e12c2de2

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Mar 28 13:26:01 2022 +0200

kernelbase: Reimplement LOCALE_*DAYNAME in GetLocaleInfoW/Ex using the locale.nls data.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernelbase/locale.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c
index 7f8c51a8414..6e7a277ba07 100644
--- a/dlls/kernelbase/locale.c
+++ b/dlls/kernelbase/locale.c
@@ -887,6 +887,15 @@ static int locale_return_number( UINT val, LCTYPE type, WCHAR *buffer, int len )
 }
 
 
+static int locale_return_strarray( DWORD pos, WORD idx, LCTYPE type, WCHAR *buffer, int len )
+{
+    const DWORD *array = (const DWORD *)(locale_strings + pos + 1);
+    WORD count = locale_strings[pos];
+
+    return locale_return_string( idx < count ? array[idx] : 0, type, buffer, len );
+}
+
+
 /* get locale information from the locale.nls file */
 static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE type,
                             WCHAR *buffer, int len )
@@ -1030,7 +1039,8 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ
     case LOCALE_SDAYNAME5:
     case LOCALE_SDAYNAME6:
     case LOCALE_SDAYNAME7:
-        return -1;
+        return locale_return_strarray( locale->sdayname,
+                                       LOWORD(type - LOCALE_SDAYNAME1 + 1) % 7, type, buffer, len );
 
     case LOCALE_SABBREVDAYNAME1:
     case LOCALE_SABBREVDAYNAME2:
@@ -1039,7 +1049,8 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ
     case LOCALE_SABBREVDAYNAME5:
     case LOCALE_SABBREVDAYNAME6:
     case LOCALE_SABBREVDAYNAME7:
-        return -1;
+        return locale_return_strarray( locale->sabbrevdayname,
+                                       LOWORD(type - LOCALE_SABBREVDAYNAME1 + 1) % 7, type, buffer, len );
 
     case LOCALE_SMONTHNAME1:
     case LOCALE_SMONTHNAME2:
@@ -1126,7 +1137,8 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ
     case LOCALE_SSHORTESTDAYNAME5:
     case LOCALE_SSHORTESTDAYNAME6:
     case LOCALE_SSHORTESTDAYNAME7:
-        return -1;
+        return locale_return_strarray( locale->sshortestdayname,
+                                       LOWORD(type - LOCALE_SSHORTESTDAYNAME1 + 1) % 7, type, buffer, len );
 
     case LOCALE_SISO639LANGNAME2:
         return locale_return_string( locale->siso639langname2, type, buffer, len );




More information about the wine-cvs mailing list