msvcrt: Added field names to MSVCRT___lc_time_data structure.

This commit is contained in:
Piotr Caban 2012-04-11 15:22:12 +02:00 committed by Alexandre Julliard
parent 426e58be69
commit b58cfb40b9
2 changed files with 29 additions and 29 deletions

View File

@ -427,7 +427,7 @@ char* CDECL _Getdays(void)
TRACE("\n"); 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); out = MSVCRT_malloc(size+1);
if(!out) if(!out)
return NULL; return NULL;
@ -435,13 +435,13 @@ char* CDECL _Getdays(void)
size = 0; size = 0;
for(i=0; i<7; i++) { for(i=0; i<7; i++) {
out[size++] = ':'; out[size++] = ':';
len = strlen(cur->str[i]); len = strlen(cur->str.names.short_wday[i]);
memcpy(&out[size], cur->str[i], len); memcpy(&out[size], cur->str.names.short_wday[i], len);
size += len; size += len;
out[size++] = ':'; out[size++] = ':';
len = strlen(cur->str[7+i]); len = strlen(cur->str.names.wday[i]);
memcpy(&out[size], cur->str[7+i], len); memcpy(&out[size], cur->str.names.wday[i], len);
size += len; size += len;
} }
out[size] = '\0'; out[size] = '\0';
@ -454,15 +454,13 @@ char* CDECL _Getdays(void)
*/ */
char* CDECL _Getmonths(void) char* CDECL _Getmonths(void)
{ {
static const int months_offset = 14;
MSVCRT___lc_time_data *cur = get_locinfo()->lc_time_curr; MSVCRT___lc_time_data *cur = get_locinfo()->lc_time_curr;
int i, len, size; int i, len, size;
char *out; char *out;
TRACE("\n"); 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); out = MSVCRT_malloc(size+1);
if(!out) if(!out)
return NULL; return NULL;
@ -470,13 +468,13 @@ char* CDECL _Getmonths(void)
size = 0; size = 0;
for(i=0; i<12; i++) { for(i=0; i<12; i++) {
out[size++] = ':'; out[size++] = ':';
len = strlen(cur->str[months_offset+i]); len = strlen(cur->str.names.short_mon[i]);
memcpy(&out[size], cur->str[months_offset+i], len); memcpy(&out[size], cur->str.names.short_mon[i], len);
size += len; size += len;
out[size++] = ':'; out[size++] = ':';
len = strlen(cur->str[months_offset+12+i]); len = strlen(cur->str.names.mon[i]);
memcpy(&out[size], cur->str[months_offset+12+i], len); memcpy(&out[size], cur->str.names.mon[i], len);
size += len; size += len;
} }
out[size] = '\0'; out[size] = '\0';
@ -494,8 +492,8 @@ void* CDECL _Gettnames(void)
TRACE("\n"); TRACE("\n");
for(i=0; i<sizeof(cur->str)/sizeof(cur->str[0]); i++) for(i=0; i<sizeof(cur->str.str)/sizeof(cur->str.str[0]); i++)
size += strlen(cur->str[i])+1; size += strlen(cur->str.str[i])+1;
ret = MSVCRT_malloc(size); ret = MSVCRT_malloc(size);
if(!ret) if(!ret)
@ -503,8 +501,8 @@ void* CDECL _Gettnames(void)
memcpy(ret, cur, size); memcpy(ret, cur, size);
size = 0; size = 0;
for(i=0; i<sizeof(cur->str)/sizeof(cur->str[0]); i++) { for(i=0; i<sizeof(cur->str.str)/sizeof(cur->str.str[0]); i++) {
ret->str[i] = &ret->data[size]; ret->str.str[i] = &ret->data[size];
size += strlen(&ret->data[size])+1; size += strlen(&ret->data[size])+1;
} }
@ -1244,7 +1242,7 @@ MSVCRT__locale_t CDECL MSVCRT__create_locale(int category, const char *locale)
ret = 0; ret = 0;
for(i=0; i<sizeof(time_data)/sizeof(time_data[0]); i++) { 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]) { 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)); memcpy(&loc->locinfo->lc_time_curr->data[ret], cloc_short_date, sizeof(cloc_short_date));
ret += sizeof(cloc_short_date); ret += sizeof(cloc_short_date);

View File

@ -109,18 +109,20 @@ typedef struct MSVCRT_tagLC_ID {
} MSVCRT_LC_ID, *MSVCRT_LPLC_ID; } MSVCRT_LC_ID, *MSVCRT_LPLC_ID;
typedef struct { typedef struct {
/* str table contains following strings: union {
* short weekday names [7]; char *str[43];
* weekday names [7]; struct {
* short month names [12]; char *short_wday[7];
* month names [12]; char *wday[7];
* s1159 (AM); char *short_mon[12];
* s2359 (PM); char *mon[12];
* short date format; char *am;
* date format; char *pm;
* time format; char *short_date;
*/ char *date;
char *str[43]; char *time;
} names;
} str;
LCID lcid; LCID lcid;
int unk[2]; int unk[2];
MSVCRT_wchar_t *wstr[43]; MSVCRT_wchar_t *wstr[43];