mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
- Fix EnumDateFormatsA implementation. + 7 passed tests
svn path=/trunk/; revision=37551
This commit is contained in:
parent
21a89ddc01
commit
af6290f733
1 changed files with 42 additions and 267 deletions
|
@ -1730,302 +1730,77 @@ INT WINAPI GetCurrencyFormatW(LCID lcid, DWORD dwFlags,
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* EnumDateFormatsA (KERNEL32.@)
|
* EnumDateFormatsA (KERNEL32.@)
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI EnumDateFormatsA( DATEFMT_ENUMPROCA lpDateFmtEnumProc, LCID Locale, DWORD dwFlags)
|
BOOL WINAPI EnumDateFormatsA(DATEFMT_ENUMPROCA lpDateFmtEnumProc, LCID Locale, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
LCID Loc = GetUserDefaultLCID();
|
char buf[256];
|
||||||
if(!lpDateFmtEnumProc)
|
|
||||||
|
if (!lpDateFmtEnumProc)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( Loc )
|
switch (dwFlags & ~LOCALE_USE_CP_ACP)
|
||||||
{
|
|
||||||
|
|
||||||
case 0x00000407: /* (Loc,"de_DE") */
|
|
||||||
{
|
|
||||||
switch(dwFlags)
|
|
||||||
{
|
{
|
||||||
case DATE_SHORTDATE:
|
case 0:
|
||||||
if(!(*lpDateFmtEnumProc)("dd.MM.yy")) return TRUE;
|
case DATE_SHORTDATE:
|
||||||
if(!(*lpDateFmtEnumProc)("d.M.yyyy")) return TRUE;
|
if (GetLocaleInfoA(Locale, LOCALE_SSHORTDATE | (dwFlags & LOCALE_USE_CP_ACP), buf, 256))
|
||||||
if(!(*lpDateFmtEnumProc)("d.MM.yy")) return TRUE;
|
lpDateFmtEnumProc(buf);
|
||||||
if(!(*lpDateFmtEnumProc)("d.M.yy")) return TRUE;
|
break;
|
||||||
return TRUE;
|
|
||||||
case DATE_LONGDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("dddd,d. MMMM yyyy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("d. MMMM yyyy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("d. MMM yyyy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
default:
|
|
||||||
FIXME("Unknown date format (%ld)\n", dwFlags);
|
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case 0x0000040c: /* (Loc,"fr_FR") */
|
case DATE_LONGDATE:
|
||||||
{
|
if (GetLocaleInfoA(Locale, LOCALE_SLONGDATE | (dwFlags & LOCALE_USE_CP_ACP), buf, 256))
|
||||||
switch(dwFlags)
|
lpDateFmtEnumProc(buf);
|
||||||
{
|
break;
|
||||||
case DATE_SHORTDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("dd.MM.yy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("dd-MM-yy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("dd/MM/yyyy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
case DATE_LONGDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("dddd d MMMM yyyy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("d MMM yy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("d MMMM yyyy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
default:
|
|
||||||
FIXME("Unknown date format (%ld)\n", dwFlags);
|
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case 0x00000c0c: /* (Loc,"fr_CA") */
|
case DATE_YEARMONTH:
|
||||||
{
|
if (GetLocaleInfoA(Locale, LOCALE_SYEARMONTH | (dwFlags & LOCALE_USE_CP_ACP), buf, 256))
|
||||||
switch(dwFlags)
|
lpDateFmtEnumProc(buf);
|
||||||
{
|
break;
|
||||||
case DATE_SHORTDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("yy-MM-dd")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("dd-MM-yy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("yy MM dd")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
case DATE_LONGDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("d MMMM, yyyy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("d MMM yyyy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
default:
|
|
||||||
FIXME("Unknown date format (%ld)\n", dwFlags);
|
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case 0x00000809: /* (Loc,"en_UK") */
|
default:
|
||||||
{
|
FIXME("Unknown date format (%d)\n", dwFlags);
|
||||||
switch(dwFlags)
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
{
|
return FALSE;
|
||||||
case DATE_SHORTDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("dd/MM/yyyy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("d/M/yy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("d.M.yy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
case DATE_LONGDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("dd MMMM yyyy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("d MMMM yyyy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
default:
|
|
||||||
FIXME("Unknown date format (%ld)\n", dwFlags);
|
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
}
|
return TRUE;
|
||||||
|
|
||||||
case 0x00000c09: /* (Loc,"en_AU") */
|
|
||||||
{
|
|
||||||
switch(dwFlags)
|
|
||||||
{
|
|
||||||
case DATE_SHORTDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("d/MM/yy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("d/M/yy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
case DATE_LONGDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("dddd,d MMMM yyyy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("d MMMM yyyy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
default:
|
|
||||||
FIXME("Unknown date format (%ld)\n", dwFlags);
|
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case 0x00001009: /* (Loc,"en_CA") */
|
|
||||||
{
|
|
||||||
switch(dwFlags)
|
|
||||||
{
|
|
||||||
case DATE_SHORTDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("d/M/yy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("yy-MM-dd")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("M/dd/yy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
case DATE_LONGDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("d-MMM-yy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("MMMM d, yyyy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
default:
|
|
||||||
FIXME("Unknown date format (%ld)\n", dwFlags);
|
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case 0x00001409: /* (Loc,"en_NZ") */
|
|
||||||
{
|
|
||||||
switch(dwFlags)
|
|
||||||
{
|
|
||||||
case DATE_SHORTDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("d/MM/yy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("d.MM.yy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
case DATE_LONGDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("d MMMM yyyy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("dddd, d MMMM yyyy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
default:
|
|
||||||
FIXME("Unknown date format (%ld)\n", dwFlags);
|
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case 0x00001809: /* (Loc,"en_IE") */
|
|
||||||
{
|
|
||||||
switch(dwFlags)
|
|
||||||
{
|
|
||||||
case DATE_SHORTDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("dd/MM/yy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("d/M/yy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("d.M.yy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
case DATE_LONGDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("dd MMMM yyyy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("d MMMM yyyy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
default:
|
|
||||||
FIXME("Unknown date format (%ld)\n", dwFlags);
|
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case 0x00001c09: /* (Loc,"en_ZA") */
|
|
||||||
{
|
|
||||||
switch(dwFlags)
|
|
||||||
{
|
|
||||||
case DATE_SHORTDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("yy/MM/dd")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
case DATE_LONGDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("dd MMMM yyyy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
default:
|
|
||||||
FIXME("Unknown date format (%ld)\n", dwFlags);
|
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case 0x00002009: /* (Loc,"en_JM") */
|
|
||||||
{
|
|
||||||
switch(dwFlags)
|
|
||||||
{
|
|
||||||
case DATE_SHORTDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("dd/MM/yyyy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
case DATE_LONGDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("dddd,MMMM dd,yyyy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("MMMM dd,yyyy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("dddd,dd MMMM,yyyy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("dd MMMM,yyyy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
default:
|
|
||||||
FIXME("Unknown date format (%ld)\n", dwFlags);
|
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case 0x00002809: /* (Loc,"en_BZ") */
|
|
||||||
case 0x00002c09: /* (Loc,"en_TT") */
|
|
||||||
{
|
|
||||||
switch(dwFlags)
|
|
||||||
{
|
|
||||||
case DATE_SHORTDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("dd/MM/yyyy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
case DATE_LONGDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("dddd,dd MMMM yyyy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
default:
|
|
||||||
FIXME("Unknown date format (%ld)\n", dwFlags);
|
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
default: /* default to US English "en_US" */
|
|
||||||
{
|
|
||||||
switch(dwFlags)
|
|
||||||
{
|
|
||||||
case DATE_SHORTDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("M/d/yy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("M/d/yyyy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("MM/dd/yy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("MM/dd/yyyy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("yy/MM/dd")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("dd-MMM-yy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
case DATE_LONGDATE:
|
|
||||||
if(!(*lpDateFmtEnumProc)("dddd, MMMM dd, yyyy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("MMMM dd, yyyy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("dddd, dd MMMM, yyyy")) return TRUE;
|
|
||||||
if(!(*lpDateFmtEnumProc)("dd MMMM, yyyy")) return TRUE;
|
|
||||||
return TRUE;
|
|
||||||
default:
|
|
||||||
FIXME("Unknown date format (%ld)\n", dwFlags);
|
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* EnumDateFormatsW (KERNEL32.@)
|
* EnumDateFormatsW (KERNEL32.@)
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI EnumDateFormatsW( DATEFMT_ENUMPROCW proc, LCID lcid, DWORD flags )
|
BOOL WINAPI EnumDateFormatsW(DATEFMT_ENUMPROCW lpDateFmtEnumProc, LCID Locale, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
WCHAR buf[256];
|
WCHAR buf[256];
|
||||||
|
|
||||||
if (!proc)
|
if (!lpDateFmtEnumProc)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (flags & ~LOCALE_USE_CP_ACP)
|
switch (dwFlags & ~LOCALE_USE_CP_ACP)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
case DATE_SHORTDATE:
|
case DATE_SHORTDATE:
|
||||||
if (GetLocaleInfoW(lcid, LOCALE_SSHORTDATE | (flags & LOCALE_USE_CP_ACP), buf, 256))
|
if (GetLocaleInfoW(Locale, LOCALE_SSHORTDATE | (dwFlags & LOCALE_USE_CP_ACP), buf, 256))
|
||||||
proc(buf);
|
lpDateFmtEnumProc(buf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DATE_LONGDATE:
|
case DATE_LONGDATE:
|
||||||
if (GetLocaleInfoW(lcid, LOCALE_SLONGDATE | (flags & LOCALE_USE_CP_ACP), buf, 256))
|
if (GetLocaleInfoW(Locale, LOCALE_SLONGDATE | (dwFlags & LOCALE_USE_CP_ACP), buf, 256))
|
||||||
proc(buf);
|
lpDateFmtEnumProc(buf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DATE_YEARMONTH:
|
case DATE_YEARMONTH:
|
||||||
if (GetLocaleInfoW(lcid, LOCALE_SYEARMONTH | (flags & LOCALE_USE_CP_ACP), buf, 256))
|
if (GetLocaleInfoW(Locale, LOCALE_SYEARMONTH | (dwFlags & LOCALE_USE_CP_ACP), buf, 256))
|
||||||
proc(buf);
|
lpDateFmtEnumProc(buf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
FIXME("Unknown date format (%d)\n", flags);
|
FIXME("Unknown date format (%d)\n", dwFlags);
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue