Piotr Caban : msvcrt: Added field names to MSVCRT___lc_time_data structure.
Alexandre Julliard
julliard at winehq.org
Wed Apr 11 12:56:47 CDT 2012
Module: wine
Branch: master
Commit: b58cfb40b9ca4dccac459d2a184ff5cd2e1d3895
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b58cfb40b9ca4dccac459d2a184ff5cd2e1d3895
Author: Piotr Caban <piotr at codeweavers.com>
Date: Wed Apr 11 15:22:12 2012 +0200
msvcrt: Added field names to MSVCRT___lc_time_data structure.
---
dlls/msvcrt/locale.c | 32 +++++++++++++++-----------------
dlls/msvcrt/msvcrt.h | 26 ++++++++++++++------------
2 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c
index 678550a..a24a5b9 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -427,7 +427,7 @@ char* CDECL _Getdays(void)
TRACE("\n");
- size = cur->str[2*7]-cur->str[0];
+ size = cur->str.names.short_mon[0]-cur->str.names.short_wday[0];
out = MSVCRT_malloc(size+1);
if(!out)
return NULL;
@@ -435,13 +435,13 @@ char* CDECL _Getdays(void)
size = 0;
for(i=0; i<7; i++) {
out[size++] = ':';
- len = strlen(cur->str[i]);
- memcpy(&out[size], cur->str[i], len);
+ len = strlen(cur->str.names.short_wday[i]);
+ memcpy(&out[size], cur->str.names.short_wday[i], len);
size += len;
out[size++] = ':';
- len = strlen(cur->str[7+i]);
- memcpy(&out[size], cur->str[7+i], len);
+ len = strlen(cur->str.names.wday[i]);
+ memcpy(&out[size], cur->str.names.wday[i], len);
size += len;
}
out[size] = '\0';
@@ -454,15 +454,13 @@ char* CDECL _Getdays(void)
*/
char* CDECL _Getmonths(void)
{
- static const int months_offset = 14;
-
MSVCRT___lc_time_data *cur = get_locinfo()->lc_time_curr;
int i, len, size;
char *out;
TRACE("\n");
- size = cur->str[months_offset+2*12]-cur->str[months_offset];
+ size = cur->str.names.am-cur->str.names.short_mon[0];
out = MSVCRT_malloc(size+1);
if(!out)
return NULL;
@@ -470,13 +468,13 @@ char* CDECL _Getmonths(void)
size = 0;
for(i=0; i<12; i++) {
out[size++] = ':';
- len = strlen(cur->str[months_offset+i]);
- memcpy(&out[size], cur->str[months_offset+i], len);
+ len = strlen(cur->str.names.short_mon[i]);
+ memcpy(&out[size], cur->str.names.short_mon[i], len);
size += len;
out[size++] = ':';
- len = strlen(cur->str[months_offset+12+i]);
- memcpy(&out[size], cur->str[months_offset+12+i], len);
+ len = strlen(cur->str.names.mon[i]);
+ memcpy(&out[size], cur->str.names.mon[i], len);
size += len;
}
out[size] = '\0';
@@ -494,8 +492,8 @@ void* CDECL _Gettnames(void)
TRACE("\n");
- for(i=0; i<sizeof(cur->str)/sizeof(cur->str[0]); i++)
- size += strlen(cur->str[i])+1;
+ for(i=0; i<sizeof(cur->str.str)/sizeof(cur->str.str[0]); i++)
+ size += strlen(cur->str.str[i])+1;
ret = MSVCRT_malloc(size);
if(!ret)
@@ -503,8 +501,8 @@ void* CDECL _Gettnames(void)
memcpy(ret, cur, size);
size = 0;
- for(i=0; i<sizeof(cur->str)/sizeof(cur->str[0]); i++) {
- ret->str[i] = &ret->data[size];
+ for(i=0; i<sizeof(cur->str.str)/sizeof(cur->str.str[0]); i++) {
+ ret->str.str[i] = &ret->data[size];
size += strlen(&ret->data[size])+1;
}
@@ -1244,7 +1242,7 @@ MSVCRT__locale_t CDECL MSVCRT__create_locale(int category, const char *locale)
ret = 0;
for(i=0; i<sizeof(time_data)/sizeof(time_data[0]); i++) {
- loc->locinfo->lc_time_curr->str[i] = &loc->locinfo->lc_time_curr->data[ret];
+ loc->locinfo->lc_time_curr->str.str[i] = &loc->locinfo->lc_time_curr->data[ret];
if(time_data[i]==LOCALE_SSHORTDATE && !lcid[MSVCRT_LC_TIME]) {
memcpy(&loc->locinfo->lc_time_curr->data[ret], cloc_short_date, sizeof(cloc_short_date));
ret += sizeof(cloc_short_date);
diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h
index 26a1177..0fd3410 100644
--- a/dlls/msvcrt/msvcrt.h
+++ b/dlls/msvcrt/msvcrt.h
@@ -109,18 +109,20 @@ typedef struct MSVCRT_tagLC_ID {
} MSVCRT_LC_ID, *MSVCRT_LPLC_ID;
typedef struct {
- /* str table contains following strings:
- * short weekday names [7];
- * weekday names [7];
- * short month names [12];
- * month names [12];
- * s1159 (AM);
- * s2359 (PM);
- * short date format;
- * date format;
- * time format;
- */
- char *str[43];
+ union {
+ char *str[43];
+ struct {
+ char *short_wday[7];
+ char *wday[7];
+ char *short_mon[12];
+ char *mon[12];
+ char *am;
+ char *pm;
+ char *short_date;
+ char *date;
+ char *time;
+ } names;
+ } str;
LCID lcid;
int unk[2];
MSVCRT_wchar_t *wstr[43];
More information about the wine-cvs
mailing list