[winpr,timezone] Include TimeZoneNameMap as header
* Update tzextract to generate header * Update TimeZoneNameMapUtils to include header
This commit is contained in:
parent
384cd284d8
commit
66153045be
@ -37,7 +37,7 @@ set(SRCS
|
|||||||
)
|
)
|
||||||
if (WITH_TIMEZONE_COMPILED)
|
if (WITH_TIMEZONE_COMPILED)
|
||||||
list(APPEND SRCS
|
list(APPEND SRCS
|
||||||
TimeZoneNameMap.c
|
TimeZoneNameMap_static.h
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -39,6 +39,10 @@
|
|||||||
|
|
||||||
#include "TimeZoneNameMap.h"
|
#include "TimeZoneNameMap.h"
|
||||||
|
|
||||||
|
#if defined(WITH_TIMEZONE_COMPILED)
|
||||||
|
#include "TimeZoneNameMap_static.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
size_t count;
|
size_t count;
|
||||||
@ -272,10 +276,6 @@ static BOOL CALLBACK load_timezones(PINIT_ONCE once, PVOID param, PVOID* pvconte
|
|||||||
|
|
||||||
#if defined(WITH_TIMEZONE_COMPILED)
|
#if defined(WITH_TIMEZONE_COMPILED)
|
||||||
{
|
{
|
||||||
// Do not expose these, only used internally.
|
|
||||||
extern const TimeZoneNameMapEntry TimeZoneNameMap[];
|
|
||||||
extern const size_t TimeZoneNameMapSize;
|
|
||||||
|
|
||||||
const size_t offset = context->count;
|
const size_t offset = context->count;
|
||||||
if (!reallocate_context(context, TimeZoneNameMapSize))
|
if (!reallocate_context(context, TimeZoneNameMapSize))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "TimeZoneNameMap.h"
|
#include "TimeZoneNameMap.h"
|
||||||
|
|
||||||
const TimeZoneNameMapEntry TimeZoneNameMap[] = {
|
static const TimeZoneNameMapEntry TimeZoneNameMap[] = {
|
||||||
{ "Dateline Standard Time", "Dateline Standard Time",
|
{ "Dateline Standard Time", "Dateline Standard Time",
|
||||||
"(UTC-12:00) International Date Line West", "Dateline Daylight Time", "Etc/GMT+12" },
|
"(UTC-12:00) International Date Line West", "Dateline Daylight Time", "Etc/GMT+12" },
|
||||||
{ "UTC-11", "UTC-11", "(UTC-11:00) Coordinated Universal Time-11", "UTC-11", "Etc/GMT+11" },
|
{ "UTC-11", "UTC-11", "(UTC-11:00) Coordinated Universal Time-11", "UTC-11", "Etc/GMT+11" },
|
||||||
@ -289,4 +289,4 @@ const TimeZoneNameMapEntry TimeZoneNameMap[] = {
|
|||||||
"Line Islands Daylight Time", "Pacific/Kiritimati" }
|
"Line Islands Daylight Time", "Pacific/Kiritimati" }
|
||||||
};
|
};
|
||||||
|
|
||||||
const size_t TimeZoneNameMapSize = ARRAYSIZE(TimeZoneNameMap);
|
static const size_t TimeZoneNameMapSize = ARRAYSIZE(TimeZoneNameMap);
|
@ -22,7 +22,7 @@ internal class Program
|
|||||||
private static bool writeZoneMapC(string path)
|
private static bool writeZoneMapC(string path)
|
||||||
{
|
{
|
||||||
string fname = "TimeZoneNameMap";
|
string fname = "TimeZoneNameMap";
|
||||||
string fpath = Path.Combine(path, fname + ".c");
|
string fpath = Path.Combine(path, fname + "_static.h");
|
||||||
|
|
||||||
using (StreamWriter fs = new StreamWriter(fpath))
|
using (StreamWriter fs = new StreamWriter(fpath))
|
||||||
{
|
{
|
||||||
@ -30,7 +30,7 @@ internal class Program
|
|||||||
fs.WriteLine("");
|
fs.WriteLine("");
|
||||||
fs.WriteLine("#include \"" + fname + ".h\"");
|
fs.WriteLine("#include \"" + fname + ".h\"");
|
||||||
fs.WriteLine("");
|
fs.WriteLine("");
|
||||||
fs.WriteLine("const " + fname + "Entry " + fname + "[] ={");
|
fs.WriteLine("static const " + fname + "Entry " + fname + "[] ={");
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
foreach (System.TimeZoneInfo tz in System.TimeZoneInfo.GetSystemTimeZones())
|
foreach (System.TimeZoneInfo tz in System.TimeZoneInfo.GetSystemTimeZones())
|
||||||
@ -58,7 +58,7 @@ internal class Program
|
|||||||
|
|
||||||
fs.WriteLine("};");
|
fs.WriteLine("};");
|
||||||
fs.WriteLine("");
|
fs.WriteLine("");
|
||||||
fs.WriteLine("const size_t " + fname + "Size = ARRAYSIZE(" + fname + ");");
|
fs.WriteLine("static const size_t " + fname + "Size = ARRAYSIZE(" + fname + ");");
|
||||||
fs.WriteLine("");
|
fs.WriteLine("");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user