13 May
2008
13 May
'08
5:57 p.m.
Michael Karcher wrote:
UDATE *lpUdate) static void VARIANT_GetLocalisedNumberChars(VARIANT_NUMBER_CHARS *lpChars, LCID lcid, DWORD dwFlags) { static const VARIANT_NUMBER_CHARS defaultChars = { '-','+','.',',','$',0,'.',',' }; + static VARIANT_NUMBER_CHARS lastChars; + static LCID lastLcid = -1; + static DWORD lastFlags = 0; LCTYPE lctype = dwFlags & LOCALE_NOUSEROVERRIDE; WCHAR buff[4];
+ /* Asking for default locale entries is very expensive: It is a registry + server call. So cache one localy, as Microsoft does it too */ + if(lcid == lastLcid && dwFlags == lastFlags) + { + memcpy(lpChars, &lastChars, sizeof(defaultChars)); + return; + } +
This introduces a race condition. -- Rob Shearman