build: get base of windows build for openzap going again (OPENZAP-55)

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@682 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Michael Jerris committed 2009-03-06 18:17:15 +00:00
1 parent 39f3539d63
commit 7d8ea02776
21 files changed
+1317 -599

No files matched your search

+3 -3
View File
@@ -268,7 +268,7 @@ struct hashtable_iterator *hashtable_next(struct hashtable_iterator *i)
{
if (i->e) {
if ((i->e = i->e->next)) {
if ((i->e = i->e->next) != 0) {
return i;
} else {
i->pos++;
@@ -283,7 +283,7 @@ struct hashtable_iterator *hashtable_next(struct hashtable_iterator *i)
return NULL;
}
if ((i->e = i->h->table[i->pos])) {
if ((i->e = i->h->table[i->pos]) != 0) {
return i;
}
@@ -307,7 +307,7 @@ void hashtable_this(struct hashtable_iterator *i, const void **key, int *klen, v
*key = i->e->k;
}
if (klen) {
*klen = strlen(i->e->k);
*klen = (int)strlen(i->e->k);
}
if (val) {
*val = i->e->v;
+1 -1
View File
@@ -17,7 +17,7 @@ struct entry
};
struct hashtable_iterator {
int pos;
unsigned int pos;
struct entry *e;
struct hashtable *h;
};
+4
View File
@@ -239,6 +239,10 @@
else zap_log(ZAP_LOG_WARNING, "VETO Changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, zap_channel_state2str(st), zap_channel_state2str(s)); \
}
#ifdef _MSC_VER
/* The while(0) below throws a conditional expression is constant warning */
#pragma warning(disable:4127)
#endif
#define zap_set_state_locked_wait(obj, s) \
do { \
int __safety = 100; \
+11 -4
View File
@@ -83,6 +83,9 @@
#include "Q921priv.h"
#include "mfifo.h"
#ifdef WIN32
#pragma warning(disable:4100 4244)
#endif
/******************************************************************************************************
* Actual code below this line
@@ -650,7 +653,7 @@ static int Q921LogMesg(L2TRUNK trunk, Q921LogLevel_t level, L2UCHAR received, L2
if(tei != link->tei) {
APPEND_MSG(pbuf, poffset, pleft, " CONTENT:\n");
len = print_hex(pbuf + poffset, pleft, &pmes[4], size - (trunk->Q921HeaderSpace + 4));
len = print_hex(pbuf + poffset, (int)pleft, &pmes[4], size - (trunk->Q921HeaderSpace + 4));
poffset += len;
pleft -= len;
}
@@ -775,7 +778,7 @@ static int Q921LogMesg(L2TRUNK trunk, Q921LogLevel_t level, L2UCHAR received, L2
else {
APPEND_MSG(pbuf, poffset, pleft, " ENT ID: %d (%s), MESSAGE CONTENT:\n", pmes[3], type);
len = print_hex(pbuf + poffset, pleft, &pmes[3], size - (trunk->Q921HeaderSpace + 3));
len = print_hex(pbuf + poffset, (int)pleft, &pmes[3], size - (trunk->Q921HeaderSpace + 3));
poffset += len;
pleft -= len;
}
@@ -822,7 +825,7 @@ static int Q921LogMesg(L2TRUNK trunk, Q921LogLevel_t level, L2UCHAR received, L2
out:
buf[sizeof(buf) - 1] = '\0';
return trunk->Q921LogProc(trunk->PrivateDataLog, level, buf, strlen(buf));
return trunk->Q921LogProc(trunk->PrivateDataLog, level, buf, (int)strlen(buf));
}
/*****************************************************************************
@@ -3108,7 +3111,11 @@ static int Q921TeiSendAssignRequest(L2TRUNK trunk)
if (!Q921_IS_PTMP_TE(trunk)) /* only ptmp te mode*/
return 0;
link->ri = (L2USHORT)(random() % 0xffff);
#ifndef WIN32
link->ri = (L2USHORT)(random() % 0xffff);
#else
link->ri = (L2USHORT)(rand() % 0xffff); //todo
#endif
/* send TEI assign request */
res = Q921TeiSend(trunk, Q921_TEI_ID_REQUEST, link->ri, Q921_TEI_BCAST);
+1 -1
View File
@@ -164,7 +164,7 @@ zap_size_t zap_buffer_read_loop(zap_buffer_t *buffer, void *data, zap_size_t dat
}
buffer->head = buffer->data;
buffer->used = buffer->actually_used;
len = zap_buffer_read(buffer, data + len, datalen - len);
len = zap_buffer_read(buffer, (char*)data + len, datalen - len);
buffer->loops--;
}
return len;
+1 -1
View File
@@ -83,7 +83,7 @@ zap_status_t zap_fsk_data_add_checksum(zap_fsk_data_state_t *state)
check = check + state->buf[i];
}
state->checksum = state->buf[state->bpos] = 256 - check;
state->checksum = state->buf[state->bpos] = (uint8_t)(256 - check);
state->bpos++;
state->dlen = state->bpos;
+1 -1
View File
@@ -213,6 +213,7 @@ int zap_config_get_cas_bits(char *strvalue, unsigned char *outbits)
{
char cas_bits[5];
unsigned char bit = 0x8;
int x = 0;
char *double_colon = strchr(strvalue, ':');
if (!double_colon) {
zap_log(ZAP_LOG_ERROR, "No CAS bits specified: %s, :xxxx definition expected, where x is 1 or 0\n", double_colon);
@@ -226,7 +227,6 @@ int zap_config_get_cas_bits(char *strvalue, unsigned char *outbits)
return -1;
}
zap_log(ZAP_LOG_DEBUG, "CAS bits specification found: %s\n", cas_bits);
int x = 0;
for (; cas_bits[x]; x++) {
if ('1' == cas_bits[x]) {
*outbits |= bit;
+45
View File
@@ -21,6 +21,50 @@
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
#include <windows.h>
#include <stdio.h>
void zap_dso_destroy(zap_dso_lib_t *lib) {
if (lib && *lib) {
FreeLibrary(*lib);
*lib = NULL;
}
}
zap_dso_lib_t zap_dso_open(const char *path, char **err) {
HINSTANCE lib;
lib = LoadLibraryEx(path, NULL, 0);
if (!lib) {
LoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
}
if (!lib) {
DWORD error = GetLastError();
char tmp[80];
sprintf(tmp, "dll open error [%ul]\n", error);
*err = _strdup(tmp);
}
return lib;
}
void* zap_dso_func_sym(zap_dso_lib_t lib, const char *sym, char **err) {
FARPROC func = GetProcAddress(lib, sym);
if (!func) {
DWORD error = GetLastError();
char tmp[80];
sprintf(tmp, "dll sym error [%ul]\n", error);
*err = _strdup(tmp);
}
return (void *)(intptr_t)func; // this should really be addr - zap_dso_func_data
}
#else
/*
** {========================================================================
** This is an implementation of loadlib based on the dlfcn interface.
@@ -55,6 +99,7 @@ void *zap_dso_func_sym(zap_dso_lib_t lib, const char *sym, char **err) {
}
return func;
}
#endif
/* }====================================================== */
+46 -9
View File
@@ -1707,7 +1707,7 @@ zap_status_t zap_channel_queue_dtmf(zap_channel_t *zchan, const char *dtmf)
static zap_status_t handle_dtmf(zap_channel_t *zchan, zap_size_t datalen)
{
zap_buffer_t *buffer = NULL;
zap_size_t dblen;
zap_size_t dblen = 0;
if (zchan->gen_dtmf_buffer && (dblen = zap_buffer_inuse(zchan->gen_dtmf_buffer))) {
char digits[128] = "";
@@ -2362,6 +2362,7 @@ int zap_load_module(const char *name)
#ifdef WIN32
const char *ext = ".dll";
//const char *EXT = ".DLL";
#define ZAP_MOD_DIR "." //todo
#elif defined (MACOSX) || defined (DARWIN)
const char *ext = ".dylib";
//const char *EXT = ".DYLIB";
@@ -2389,18 +2390,18 @@ int zap_load_module(const char *name)
}
if (mod->io_load) {
zap_io_interface_t *interface = NULL;
zap_io_interface_t *interface1 = NULL; /* name conflict w/windows here */
if (mod->io_load(&interface) != ZAP_SUCCESS || !interface || !interface->name) {
if (mod->io_load(&interface1) != ZAP_SUCCESS || !interface1 || !interface1->name) {
zap_log(ZAP_LOG_ERROR, "Error loading %s\n", path);
} else {
zap_log(ZAP_LOG_INFO, "Loading IO from %s [%s]\n", path, interface->name);
zap_log(ZAP_LOG_INFO, "Loading IO from %s [%s]\n", path, interface1->name);
zap_mutex_lock(globals.mutex);
if (hashtable_search(globals.interface_hash, (void *)interface->name)) {
zap_log(ZAP_LOG_ERROR, "Interface %s already loaded!\n", interface->name);
if (hashtable_search(globals.interface_hash, (void *)interface1->name)) {
zap_log(ZAP_LOG_ERROR, "Interface %s already loaded!\n", interface1->name);
} else {
hashtable_insert(globals.interface_hash, (void *)interface->name, interface, HASHTABLE_FLAG_NONE);
process_module_config(interface);
hashtable_insert(globals.interface_hash, (void *)interface1->name, interface1, HASHTABLE_FLAG_NONE);
process_module_config(interface1);
x++;
}
zap_mutex_unlock(globals.mutex);
@@ -2844,6 +2845,42 @@ zap_status_t zap_console_stream_raw_write(zap_stream_handle_t *handle, uint8_t *
return ZAP_SUCCESS;
}
int zap_vasprintf(char **ret, const char *fmt, va_list ap) /* code from switch_apr.c */
{
#ifdef HAVE_VASPRINTF
return vasprintf(ret, fmt, ap);
#else
char *buf;
int len;
size_t buflen;
va_list ap2;
char *tmp = NULL;
#ifdef _MSC_VER
#if _MSC_VER >= 1500
/* hack for incorrect assumption in msvc header files for code analysis */
__analysis_assume(tmp);
#endif
ap2 = ap;
#else
va_copy(ap2, ap);
#endif
len = vsnprintf(tmp, 0, fmt, ap2);
if (len > 0 && (buf = malloc((buflen = (size_t) (len + 1)))) != NULL) {
len = vsnprintf(buf, buflen, fmt, ap);
*ret = buf;
} else {
*ret = NULL;
len = -1;
}
va_end(ap2);
return len;
#endif
}
zap_status_t zap_console_stream_write(zap_stream_handle_t *handle, const char *fmt, ...)
{
va_list ap;
@@ -2857,7 +2894,7 @@ zap_status_t zap_console_stream_write(zap_stream_handle_t *handle, const char *f
}
va_start(ap, fmt);
ret = vasprintf(&data, fmt, ap);
ret = zap_vasprintf(&data, fmt, ap);
va_end(ap);
if (data) {