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:
Michael Jerris 2008-08-20 01:55:43 +00:00
parent bf91ac1605
commit 4257622c56
4 changed files with 223 additions and 50 deletions

View File

@ -966,6 +966,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_say_zh", "src\mod\say\m
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_timezone", "src\mod\applications\mod_timezone\mod_timezone.2008.vcproj", "{5CA0F863-CB0F-4250-A863-A5355BDAE224}"
ProjectSection(ProjectDependencies) = postProject
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -1688,6 +1693,12 @@ Global
{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|Win32.ActiveCfg = Release|Win32
{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|Win32.Build.0 = Release|Win32
{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|x64.ActiveCfg = Release|Win32
{5CA0F863-CB0F-4250-A863-A5355BDAE224}.Debug|Win32.ActiveCfg = Debug|Win32
{5CA0F863-CB0F-4250-A863-A5355BDAE224}.Debug|Win32.Build.0 = Debug|Win32
{5CA0F863-CB0F-4250-A863-A5355BDAE224}.Debug|x64.ActiveCfg = Debug|Win32
{5CA0F863-CB0F-4250-A863-A5355BDAE224}.Release|Win32.ActiveCfg = Release|Win32
{5CA0F863-CB0F-4250-A863-A5355BDAE224}.Release|Win32.Build.0 = Release|Win32
{5CA0F863-CB0F-4250-A863-A5355BDAE224}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -1717,6 +1728,7 @@ Global
{65A6273D-FCAB-4C55-B09E-65100141A5D4} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{E3246D17-E29B-4AB5-962A-C69B0C5837BB} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{5CA0F863-CB0F-4250-A863-A5355BDAE224} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{07113B25-D3AF-4E04-BA77-4CD1171F022C} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4}
{A27CCA23-1541-4337-81A4-F0A6413078A0} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4}
{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4}

View File

@ -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);

View File

@ -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>

View File

@ -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";
}