diff options
Diffstat (limited to 'src/classlibnative/nls/nlsinfo.cpp')
-rw-r--r-- | src/classlibnative/nls/nlsinfo.cpp | 131 |
1 files changed, 6 insertions, 125 deletions
diff --git a/src/classlibnative/nls/nlsinfo.cpp b/src/classlibnative/nls/nlsinfo.cpp index 864f998d1f..0e034c4a0c 100644 --- a/src/classlibnative/nls/nlsinfo.cpp +++ b/src/classlibnative/nls/nlsinfo.cpp @@ -1057,7 +1057,7 @@ FCIMPLEND #define CULTURETYPES_FRAMEWORKCULTURES 0x0040 -const LPWSTR WHIDBEY_FRAMEWORK_CULTURE_LIST [] = +const LPCWSTR WHIDBEY_FRAMEWORK_CULTURE_LIST [] = { W(""), W("af"), @@ -1877,127 +1877,6 @@ INT32 QCALLTYPE COMNlsInfo::InternalGetGlobalizedHashCode(INT_PTR handle, INT_PT return(iReturnHash); } -#ifndef FEATURE_CORECLR // FCalls used by System.TimeZone - -FCIMPL0(LONG, COMNlsInfo::nativeGetTimeZoneMinuteOffset) -{ - FCALL_CONTRACT; - - TIME_ZONE_INFORMATION timeZoneInfo; - - GetTimeZoneInformation(&timeZoneInfo); - - // - // In Win32, UTC = local + offset. So for Pacific Standard Time, offset = 8. - // In NLS+, Local time = UTC + offset. So for PST, offset = -8. - // So we have to reverse the sign here. - // - return (timeZoneInfo.Bias * -1); -} -FCIMPLEND - -FCIMPL0(Object*, COMNlsInfo::nativeGetStandardName) -{ - FCALL_CONTRACT; - - STRINGREF refRetVal = NULL; - HELPER_METHOD_FRAME_BEGIN_RET_1(refRetVal); - - TIME_ZONE_INFORMATION timeZoneInfo; - GetTimeZoneInformation(&timeZoneInfo); - - refRetVal = StringObject::NewString(timeZoneInfo.StandardName); - - HELPER_METHOD_FRAME_END(); - return OBJECTREFToObject(refRetVal); -} -FCIMPLEND - -FCIMPL0(Object*, COMNlsInfo::nativeGetDaylightName) -{ - FCALL_CONTRACT; - - STRINGREF refRetVal = NULL; - HELPER_METHOD_FRAME_BEGIN_RET_1(refRetVal); - - TIME_ZONE_INFORMATION timeZoneInfo; - GetTimeZoneInformation(&timeZoneInfo); - // Instead of returning null when daylight saving is not used, now we return the same result as the OS. - //In this case, if daylight saving time is used, the standard name is returned. - -#if 0 - if (result == TIME_ZONE_ID_UNKNOWN || timeZoneInfo.DaylightDate.wMonth == 0) { - // If daylight saving time is not used in this timezone, return null. - // - // Windows NT/2000: TIME_ZONE_ID_UNKNOWN is returned if daylight saving time is not used in - // the current time zone, because there are no transition dates. - // - // For Windows 9x, a zero in the wMonth in DaylightDate means daylight saving time - // is not specified. - // - // If the current timezone uses daylight saving rule, but user unchekced the - // "Automatically adjust clock for daylight saving changes", the value - // for DaylightBias will be 0. - return (I2ARRAYREF)NULL; - } -#endif // 0 - - refRetVal = StringObject::NewString(timeZoneInfo.DaylightName); - - HELPER_METHOD_FRAME_END(); - return OBJECTREFToObject(refRetVal); -} -FCIMPLEND - -FCIMPL1(Object*, COMNlsInfo::nativeGetDaylightChanges, int year) -{ - FCALL_CONTRACT; - - I2ARRAYREF pResultArray = NULL; - HELPER_METHOD_FRAME_BEGIN_RET_1(pResultArray); - - TIME_ZONE_INFORMATION timeZoneInfo; - DWORD result = GetTimeZoneInformation(&timeZoneInfo); - - if (result == TIME_ZONE_ID_UNKNOWN || timeZoneInfo.DaylightBias == 0 - || timeZoneInfo.DaylightDate.wMonth == 0 - ) { - // If daylight saving time is not used in this timezone, return null. - // - // If the current timezone uses daylight saving rule, but user unchekced the - // "Automatically adjust clock for daylight saving changes", the value - // for DaylightBias will be 0. - goto lExit; - } - - pResultArray = (I2ARRAYREF)AllocatePrimitiveArray(ELEMENT_TYPE_I2, 17); - - // - // The content of timeZoneInfo.StandardDate is 8 words, which - // contains year, month, day, dayOfWeek, hour, minute, second, millisecond. - // - memcpyNoGCRefs(pResultArray->m_Array, - (LPVOID)&timeZoneInfo.DaylightDate, - 8 * sizeof(INT16)); - - // - // The content of timeZoneInfo.DaylightDate is 8 words, which - // contains year, month, day, dayOfWeek, hour, minute, second, millisecond. - // - memcpyNoGCRefs(((INT16*)pResultArray->m_Array) + 8, - (LPVOID)&timeZoneInfo.StandardDate, - 8 * sizeof(INT16)); - - ((INT16*)pResultArray->m_Array)[16] = (INT16)timeZoneInfo.DaylightBias * -1; - -lExit: ; - HELPER_METHOD_FRAME_END(); - return OBJECTREFToObject(pResultArray); -} -FCIMPLEND - -#endif // FEATURE_CORECLR - inline BOOL IsInvariantLocale(STRINGREF localeName) { return localeName->GetStringLength() == 0; @@ -3411,7 +3290,6 @@ INT_PTR COMNlsInfo::InternalInitOsSortHandle(LPCWSTR localeName, __out INT_PTR* return pSort; } -#ifndef FEATURE_CORECLR BOOL QCALLTYPE COMNlsInfo::InternalGetNlsVersionEx(INT_PTR handle, INT_PTR handleOrigin, LPCWSTR lpLocaleName, NLSVERSIONINFOEX * lpVersionInformation) { CONTRACTL { @@ -3421,7 +3299,7 @@ BOOL QCALLTYPE COMNlsInfo::InternalGetNlsVersionEx(INT_PTR handle, INT_PTR handl BOOL ret = FALSE; BEGIN_QCALL; - +#ifndef FEATURE_CORECLR AppDomain* curDomain = GetAppDomain(); if(curDomain->m_bUseOsSorting) @@ -3449,12 +3327,15 @@ BOOL QCALLTYPE COMNlsInfo::InternalGetNlsVersionEx(INT_PTR handle, INT_PTR handl lpVersionInformation->dwEffectiveId = 0; ZeroMemory(&(lpVersionInformation->guidCustomVersion), sizeof(GUID)); } - +#else + ret = GetNLSVersionEx(COMPARE_STRING, lpLocaleName, lpVersionInformation); +#endif // FEATURE_CORECLR END_QCALL; return ret; } +#ifndef FEATURE_CORECLR DWORD QCALLTYPE COMNlsInfo::InternalGetSortVersion() { CONTRACTL { |