Merge pull request #10296 from akallabeth/tzid-fix

[winpr,timezone] fix windows timezone mappings
This commit is contained in:
Martin Fleisz 2024-06-24 11:45:12 +02:00 committed by GitHub
commit 607606c6ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 2 deletions

View File

@ -115,7 +115,28 @@ static const char* map_fallback(const char* iana, TimeZoneNameType type)
for (size_t x = 0; x < WindowsZonesNrElements; x++)
{
const WINDOWS_TZID_ENTRY* const entry = &WindowsZones[x];
if (strcmp(entry->tzid, iana) == 0)
if (strchr(entry->tzid, ' '))
{
const char* res = NULL;
char* tzid = _strdup(entry->tzid);
char* ctzid = tzid;
while (tzid)
{
char* space = strchr(tzid, ' ');
if (space)
*space++ = '\0';
if (strcmp(tzid, iana) == 0)
{
res = entry->windows;
break;
}
tzid = space;
}
free(ctzid);
if (res)
return res;
}
else if (strcmp(entry->tzid, iana) == 0)
return entry->windows;
}

View File

@ -8,8 +8,8 @@
typedef struct
{
const char* windows;
const char* tzid;
const char* windows;
} WINDOWS_TZID_ENTRY;
extern const WINDOWS_TZID_ENTRY WindowsZones[];