]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
initial check-in of msvc build.
authorMichael Jerris <mike@jerris.com>
Wed, 16 May 2007 22:56:27 +0000 (22:56 +0000)
committerMichael Jerris <mike@jerris.com>
Wed, 16 May 2007 22:56:27 +0000 (22:56 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@8 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/openzap/openzap.vcproj [new file with mode: 0644]
libs/openzap/src/hashtable.c
libs/openzap/src/include/hashtable.h
libs/openzap/src/include/hashtable_private.h
libs/openzap/src/include/openzap.h
libs/openzap/src/openzap.c
libs/openzap/src/zap_config.c

diff --git a/libs/openzap/openzap.vcproj b/libs/openzap/openzap.vcproj
new file mode 100644 (file)
index 0000000..001ce13
--- /dev/null
@@ -0,0 +1,227 @@
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+       ProjectType="Visual C++"\r
+       Version="8.00"\r
+       Name="openzap"\r
+       ProjectGUID="{93B8812C-3EC4-4F78-8970-FFBFC99E167D}"\r
+       RootNamespace="openzap"\r
+       Keyword="Win32Proj"\r
+       >\r
+       <Platforms>\r
+               <Platform\r
+                       Name="Win32"\r
+               />\r
+       </Platforms>\r
+       <ToolFiles>\r
+       </ToolFiles>\r
+       <Configurations>\r
+               <Configuration\r
+                       Name="Debug|Win32"\r
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+                       IntermediateDirectory="$(ConfigurationName)"\r
+                       ConfigurationType="4"\r
+                       CharacterSet="1"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="0"\r
+                               AdditionalIncludeDirectories="src/include"\r
+                               PreprocessorDefinitions="WIN32;_DEBUG;_LIB"\r
+                               MinimalRebuild="true"\r
+                               BasicRuntimeChecks="3"\r
+                               RuntimeLibrary="3"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="4"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="4"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLibrarianTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Release|Win32"\r
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+                       IntermediateDirectory="$(ConfigurationName)"\r
+                       ConfigurationType="4"\r
+                       CharacterSet="1"\r
+                       WholeProgramOptimization="1"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               AdditionalIncludeDirectories="src/include"\r
+                               PreprocessorDefinitions="WIN32;NDEBUG;_LIB"\r
+                               RuntimeLibrary="2"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="4"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="3"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLibrarianTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+       </Configurations>\r
+       <References>\r
+       </References>\r
+       <Files>\r
+               <Filter\r
+                       Name="Source Files"\r
+                       Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
+                       >\r
+                       <File\r
+                               RelativePath=".\src\hashtable.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\src\hashtable_itr.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\src\openzap.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\src\zap_config.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\src\zap_skel.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\src\zap_wanpipe.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\src\zap_zt.c"\r
+                               >\r
+                       </File>\r
+               </Filter>\r
+               <Filter\r
+                       Name="Header Files"\r
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
+                       >\r
+                       <File\r
+                               RelativePath=".\src\include\hashtable.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\src\include\hashtable_itr.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\src\include\hashtable_private.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\src\include\openzap.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\src\include\zap_config.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\src\include\zap_skel.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\src\include\zap_wanpipe.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\src\include\zap_zt.h"\r
+                               >\r
+                       </File>\r
+               </Filter>\r
+               <Filter\r
+                       Name="Resource Files"\r
+                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"\r
+                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"\r
+                       >\r
+               </Filter>\r
+       </Files>\r
+       <Globals>\r
+       </Globals>\r
+</VisualStudioProject>\r
index 763357edce54955114b5c0e1dc14de17ad3f7757..e03013ba1073fe0279353256fb4b9dc499761d3d 100644 (file)
@@ -22,13 +22,13 @@ static const unsigned int primes[] = {
 805306457, 1610612741
 };
 const unsigned int prime_table_length = sizeof(primes)/sizeof(primes[0]);
-const float max_load_factor = 0.65;
+const float max_load_factor = 0.65f;
 
 /*****************************************************************************/
 struct hashtable *
 create_hashtable(unsigned int minsize,
-                 unsigned int (*hashf) (void*),
-                 int (*eqf) (void*,void*))
+                 unsigned int (*hashf) (const void*),
+                 int (*eqf) (const void*,const void*))
 {
     struct hashtable *h;
     unsigned int pindex, size = primes[0];
@@ -54,7 +54,7 @@ create_hashtable(unsigned int minsize,
 
 /*****************************************************************************/
 unsigned int
-hash(struct hashtable *h, void *k)
+hash(struct hashtable *h, const void *k)
 {
     /* Aim to protect against poor hash functions by adding logic here
      * - logic taken from java 1.4 hashtable source */
@@ -160,7 +160,7 @@ hashtable_insert(struct hashtable *h, void *k, void *v)
 
 /*****************************************************************************/
 void * /* returns value associated with key */
-hashtable_search(struct hashtable *h, void *k)
+hashtable_search(struct hashtable *h, const void *k)
 {
     struct entry *e;
     unsigned int hashvalue, index;
index b90781abd4a75e6f910cf1450c8ad159bdeac33a..88d76572e84944a07d7f86639cbaa5f45ca1437f 100644 (file)
@@ -73,8 +73,8 @@ struct hashtable;
 
 struct hashtable *
 create_hashtable(unsigned int minsize,
-                 unsigned int (*hashfunction) (void*),
-                 int (*key_eq_fn) (void*,void*));
+                 unsigned int (*hashfunction) (const void*),
+                 int (*key_eq_fn) (const void*,const void*));
 
 /*****************************************************************************
  * hashtable_insert
@@ -114,7 +114,7 @@ int fnname (struct hashtable *h, keytype *k, valuetype *v) \
  */
 
 void *
-hashtable_search(struct hashtable *h, void *k);
+hashtable_search(struct hashtable *h, const void *k);
 
 #define DEFINE_HASHTABLE_SEARCH(fnname, keytype, valuetype) \
 valuetype * fnname (struct hashtable *h, keytype *k) \
index cb261e9af22e2352510d0899862ed5afcd101d6d..3087b8eaa10557d8a0554dd9baf0fb1b9dc011a3 100644 (file)
@@ -19,8 +19,8 @@ struct hashtable {
     unsigned int entrycount;
     unsigned int loadlimit;
     unsigned int primeindex;
-    unsigned int (*hashfn) (void *k);
-    int (*eqfn) (void *k1, void *k2);
+    unsigned int (*hashfn) (const void *k);
+    int (*eqfn) (const void *k1, const void *k2);
 };
 
 /*****************************************************************************/
index a3214c356ca18d981ea7c4c221e1cfb7c6dd7347..ca80a3874c852f53c2ba26ae1a1aa1d3ff4f6742 100644 (file)
 #define OPENZAP_H
 
 #define _XOPEN_SOURCE 500
+
+#ifdef _MSC_VER
+#if (_MSC_VER >= 1400)                 // VC8+
+#ifndef _CRT_SECURE_NO_DEPRECATE
+#define _CRT_SECURE_NO_DEPRECATE
+#endif
+#ifndef _CRT_NONSTDC_NO_DEPRECATE
+#define _CRT_NONSTDC_NO_DEPRECATE
+#endif
+#endif
+#ifndef strcasecmp
+#define strcasecmp(s1, s2) _stricmp(s1, s2)
+#endif
+#ifndef snprintf
+#define snprintf _snprintf
+#endif
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 4905f230bb4f529217fe6b97231a6c8c77560cbe..170bc727eb35d7b1629f912c58cd20c1c281f98d 100644 (file)
@@ -45,12 +45,12 @@ static struct {
 } globals;
 
 
-static int equalkeys(void *k1, void *k2)
+static int equalkeys(const void *k1, const void *k2)
 {
     return strcmp((char *) k1, (char *) k2) ? 0 : 1;
 }
 
-static unsigned hashfromstring(void *ky)
+static unsigned hashfromstring(const void *ky)
 {
        unsigned char *str = (unsigned char *) ky;
        unsigned hash = 0;
@@ -102,10 +102,9 @@ zap_status_t zap_span_destroy(zap_span_t **span);
 
 zap_status_t zap_channel_open(const char *name, unsigned span_id, unsigned chan_id, zap_channel_t **zchan)
 {
-       zap_software_interface_t *zint;
+       zap_software_interface_t *zint = (zap_software_interface_t *) hashtable_search(globals.interface_hash, name);
 
-       if (span_id < ZAP_MAX_SPANS_INTERFACE && chan_id < ZAP_MAX_CHANNELS_SPAN && 
-               (zint = (zap_software_interface_t *) hashtable_search(globals.interface_hash, (void *)name))) {
+       if (span_id < ZAP_MAX_SPANS_INTERFACE && chan_id < ZAP_MAX_CHANNELS_SPAN && zint) {
                zap_channel_t *check;
                check = &zint->spans[span_id].channels[chan_id];
                if (zap_test_flag(check, ZAP_CHANNEL_READY) && ! zap_test_flag(check, ZAP_CHANNEL_OPEN)) {
@@ -229,10 +228,10 @@ zap_status_t zap_global_init(void)
        zap_config_t cfg;
        char *var, *val;
        unsigned configured = 0;
-       zap_software_interface_t *zint;
-       
-       assert(zint = NULL);
+       zap_software_interface_t *zint = NULL;
        
+       zint, 0;
+
        globals.interface_hash = create_hashtable(16, hashfromstring, equalkeys);
 
 #ifdef ZAP_WANPIPE_SUPPORT
@@ -256,7 +255,8 @@ zap_status_t zap_global_init(void)
                        if (!strcmp(var, "load")) {
                                zap_software_interface_t *zint;
                                
-                               if ((zint = (zap_software_interface_t *) hashtable_search(globals.interface_hash, val))) {
+                               zint = (zap_software_interface_t *) hashtable_search(globals.interface_hash, val);
+                               if (zint) {
                                        if (zint->configure(zint) == ZAP_SUCCESS) {
                                                configured++;
                                        }
index 17fa4d059672a8599dbacbf29c40d768e4c41ba2..eb65fb380970d3b71dfe838745d6719175e512d3 100644 (file)
@@ -54,7 +54,9 @@ int zap_config_open_file(zap_config_t *cfg, char *file_path)
        memset(cfg, 0, sizeof(*cfg));
        cfg->lockto = -1;
 
-       if (!(f = fopen(path, "r"))) {
+       f = fopen(path, "r");
+
+       if (!f) {
                if (file_path[0] != '/') {
                        int last = -1;
                        char *var, *val;