mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-30 07:04:17 +00:00
add mod_timezone to msvc build
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9327 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
bf91ac1605
commit
4257622c56
4 files changed
+223
-50
No files matched your search
@@ -139,6 +139,9 @@
|
||||
#endif /* defined __GNUC__ */
|
||||
#endif /* !defined lint */
|
||||
#endif /* !defined GNUC_or_lint */
|
||||
#ifdef WIN32
|
||||
#define GNUC_or_lint
|
||||
#endif
|
||||
|
||||
#ifndef INITIALIZE
|
||||
#ifdef GNUC_or_lint
|
||||
@@ -241,10 +244,9 @@ static const int year_lengths[2] = {
|
||||
character.
|
||||
*/
|
||||
|
||||
static const char *getzname(strp)
|
||||
register const char * strp;
|
||||
static const char *getzname(register const char *strp)
|
||||
{
|
||||
register char c;
|
||||
register char c;
|
||||
|
||||
while ((c = *strp) != '\0' && !is_digit(c) && c != ',' && c != '-' &&
|
||||
c != '+')
|
||||
@@ -260,11 +262,7 @@ register const char * strp;
|
||||
Otherwise, return a pointer to the first character not part of the number.
|
||||
*/
|
||||
|
||||
static const char *getnum(strp, nump, min, max)
|
||||
register const char * strp;
|
||||
int * const nump;
|
||||
const int min;
|
||||
const int max;
|
||||
static const char *getnum(register const char *strp, int * const nump, const int min, const int max)
|
||||
{
|
||||
register char c;
|
||||
register int num;
|
||||
@@ -292,9 +290,7 @@ static const char *getnum(strp, nump, min, max)
|
||||
of seconds.
|
||||
*/
|
||||
|
||||
static const char *getsecs(strp, secsp)
|
||||
register const char * strp;
|
||||
long * const secsp;
|
||||
static const char *getsecs(register const char *strp, long * const secsp)
|
||||
{
|
||||
int num;
|
||||
|
||||
@@ -333,9 +329,7 @@ static const char *getsecs(strp, secsp)
|
||||
Otherwise, return a pointer to the first character not part of the time.
|
||||
*/
|
||||
|
||||
static const char *getoffset(strp, offsetp)
|
||||
register const char * strp;
|
||||
long * const offsetp;
|
||||
static const char *getoffset(register const char *strp, long * const offsetp)
|
||||
{
|
||||
register int neg = 0;
|
||||
|
||||
@@ -359,9 +353,7 @@ static const char *getoffset(strp, offsetp)
|
||||
Otherwise, return a pointer to the first character not part of the rule.
|
||||
*/
|
||||
|
||||
static const char *getrule(strp, rulep)
|
||||
const char * strp;
|
||||
register struct rule * const rulep;
|
||||
static const char *getrule(const char *strp, register struct rule * const rulep)
|
||||
{
|
||||
if (*strp == 'J') {
|
||||
/*
|
||||
@@ -413,11 +405,7 @@ static const char *getrule(strp, rulep)
|
||||
calculate the Epoch-relative time that rule takes effect.
|
||||
*/
|
||||
|
||||
static time_t transtime(janfirst, year, rulep, offset)
|
||||
const time_t janfirst;
|
||||
const int year;
|
||||
register const struct rule * const rulep;
|
||||
const long offset;
|
||||
static time_t transtime(const time_t janfirst, const int year, register const struct rule * const rulep, const long offset)
|
||||
{
|
||||
register int leapyear;
|
||||
register time_t value;
|
||||
@@ -509,10 +497,7 @@ static time_t transtime(janfirst, year, rulep, offset)
|
||||
appropriate.
|
||||
*/
|
||||
|
||||
static int tzparse(name, sp, lastditch)
|
||||
const char * name;
|
||||
register struct state * const sp;
|
||||
const int lastditch;
|
||||
static int tzparse(const char *name, register struct state * const sp, const int lastditch)
|
||||
{
|
||||
const char * stdname;
|
||||
const char * dstname;
|
||||
@@ -666,7 +651,7 @@ static int tzparse(name, sp, lastditch)
|
||||
*/
|
||||
for (i = 0; i < sp->timecnt; ++i) {
|
||||
j = sp->types[i];
|
||||
sp->types[i] = sp->ttis[j].tt_isdst;
|
||||
sp->types[i] = (unsigned char)sp->ttis[j].tt_isdst;
|
||||
if (sp->ttis[j].tt_ttisgmt) {
|
||||
/* No adjustment to transition time */
|
||||
} else {
|
||||
@@ -737,12 +722,13 @@ static int tzparse(name, sp, lastditch)
|
||||
/* **************************************************************************
|
||||
|
||||
************************************************************************** */
|
||||
#if (_MSC_VER >= 1400) // VC8+
|
||||
#define switch_assert(expr) assert(expr);__analysis_assume( expr )
|
||||
#else
|
||||
#define switch_assert(expr) assert(expr)
|
||||
#endif
|
||||
|
||||
static void timesub(timep, offset, sp, tmp)
|
||||
const time_t * const timep;
|
||||
const long offset;
|
||||
register const struct state * const sp;
|
||||
register struct tm * const tmp;
|
||||
static void timesub(const time_t * const timep, const long offset, register const struct state * const sp, register struct tm * const tmp)
|
||||
{
|
||||
register const struct lsinfo * lp;
|
||||
register long days;
|
||||
@@ -754,9 +740,9 @@ static void timesub(timep, offset, sp, tmp)
|
||||
register int hit;
|
||||
register int i;
|
||||
|
||||
assert(timep != NULL);
|
||||
assert(sp != NULL);
|
||||
assert(tmp != NULL);
|
||||
switch_assert(timep != NULL);
|
||||
switch_assert(sp != NULL);
|
||||
switch_assert(tmp != NULL);
|
||||
|
||||
corr = 0;
|
||||
hit = 0;
|
||||
@@ -782,7 +768,7 @@ static void timesub(timep, offset, sp, tmp)
|
||||
break;
|
||||
}
|
||||
}
|
||||
days = *timep / SECSPERDAY;
|
||||
days = (long)(*timep / SECSPERDAY);
|
||||
rem = *timep % SECSPERDAY;
|
||||
|
||||
|
||||
@@ -846,17 +832,16 @@ static void timesub(timep, offset, sp, tmp)
|
||||
|
||||
tmp->tm_mday = (int) (days + 1);
|
||||
tmp->tm_isdst = 0;
|
||||
#ifndef WIN32
|
||||
tmp->tm_gmtoff = offset;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* **************************************************************************
|
||||
|
||||
************************************************************************** */
|
||||
|
||||
void tztime( timep, tzstring, tmp )
|
||||
const time_t * const timep;
|
||||
const char *tzstring;
|
||||
struct tm * const tmp;
|
||||
void tztime(const time_t * const timep, const char *tzstring, struct tm * const tmp )
|
||||
{
|
||||
struct state *tzptr,
|
||||
*sp;
|
||||
@@ -903,7 +888,9 @@ void tztime( timep, tzstring, tmp )
|
||||
{
|
||||
timesub( &t, ttisp->tt_gmtoff, sp, tmp);
|
||||
tmp->tm_isdst = ttisp->tt_isdst;
|
||||
#ifndef WIN32
|
||||
tmp->tm_zone = &sp->chars[ttisp->tt_abbrind];
|
||||
#endif
|
||||
}
|
||||
|
||||
free(tzptr);
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="mod_timezone"
|
||||
ProjectGUID="{5CA0F863-CB0F-4250-A863-A5355BDAE224}"
|
||||
RootNamespace="mod_timezone"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\localtime_find.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
DisableSpecificWarnings="6385"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
DisableSpecificWarnings="6385"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\mod_timezone.c"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -34,9 +34,7 @@
|
||||
and use switch_* functions for the output.
|
||||
*/
|
||||
|
||||
static void tm2switchtime( tm, xt )
|
||||
struct tm *tm;
|
||||
switch_time_exp_t *xt;
|
||||
static void tm2switchtime(struct tm * tm, switch_time_exp_t *xt )
|
||||
{
|
||||
|
||||
if (!xt || !tm) {
|
||||
@@ -53,7 +51,9 @@ switch_time_exp_t *xt;
|
||||
xt->tm_wday = tm->tm_wday;
|
||||
xt->tm_yday = tm->tm_yday;
|
||||
xt->tm_isdst = tm->tm_isdst;
|
||||
#ifndef WIN32
|
||||
xt->tm_gmtoff = tm->tm_gmtoff;
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -70,12 +70,12 @@ typedef struct {
|
||||
static switch_timezones_list_t TIMEZONES_LIST = { 0 };
|
||||
static switch_event_node_t *NODE = NULL;
|
||||
|
||||
const char *switch_lookup_timezone( const char *tzname )
|
||||
const char *switch_lookup_timezone( const char *tz_name )
|
||||
{
|
||||
char *value = NULL;
|
||||
|
||||
if ( tzname && (value = switch_core_hash_find(TIMEZONES_LIST.hash, tzname))==NULL ) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timezone '%s' not found!\n", tzname);
|
||||
if ( tz_name && (value = switch_core_hash_find(TIMEZONES_LIST.hash, tz_name))==NULL ) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timezone '%s' not found!\n", tz_name);
|
||||
}
|
||||
|
||||
return value;
|
||||
@@ -135,7 +135,7 @@ SWITCH_STANDARD_API(strftime_tz_api_function)
|
||||
time_t timep;
|
||||
|
||||
char *format = NULL;
|
||||
const char *tzname;
|
||||
const char *tz_name;
|
||||
const char *tzdef;
|
||||
|
||||
switch_size_t retsize;
|
||||
@@ -150,15 +150,15 @@ SWITCH_STANDARD_API(strftime_tz_api_function)
|
||||
|
||||
if (!switch_strlen_zero(cmd)) {
|
||||
format = strchr(cmd, ' ');
|
||||
tzname = cmd;
|
||||
tz_name = cmd;
|
||||
if (format) {
|
||||
*format++ = '\0';
|
||||
}
|
||||
|
||||
tzdef = switch_lookup_timezone( tzname );
|
||||
tzdef = switch_lookup_timezone( tz_name );
|
||||
} else {
|
||||
/* We set the default timezone to GMT. */
|
||||
tzname="GMT";
|
||||
tz_name="GMT";
|
||||
tzdef="GMT";
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user