提交 ead82d86 authored 作者: Michael Jerris's avatar Michael Jerris

msvc types tweaks.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1416 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 87152f99
...@@ -184,7 +184,7 @@ SWITCH_DECLARE(char *) switch_string_replace(const char *string, const char *sea ...@@ -184,7 +184,7 @@ SWITCH_DECLARE(char *) switch_string_replace(const char *string, const char *sea
SWITCH_DECLARE(switch_status_t) switch_string_match(const char *string, size_t string_len, const char *search, size_t search_len); SWITCH_DECLARE(switch_status_t) switch_string_match(const char *string, size_t string_len, const char *search, size_t search_len);
#define SWITCH_READ_ACCEPTABLE(status) status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK #define SWITCH_READ_ACCEPTABLE(status) status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK
SWITCH_DECLARE(int) switch_url_encode(char *url, char *buf, size_t len); SWITCH_DECLARE(size_t) switch_url_encode(char *url, char *buf, size_t len);
SWITCH_DECLARE(char *) switch_url_decode(char *s); SWITCH_DECLARE(char *) switch_url_decode(char *s);
END_EXTERN_C END_EXTERN_C
......
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
*/ */
#include <switch.h> #include <switch.h>
#include <xmlrpc-c/base.h> #include <xmlrpc-c/base.h>
#ifdef ABYSS_WIN32
#undef strcasecmp
#endif
#include <xmlrpc-c/abyss.h> #include <xmlrpc-c/abyss.h>
#include <xmlrpc-c/server.h> #include <xmlrpc-c/server.h>
#include <xmlrpc-c/server_abyss.h> #include <xmlrpc-c/server_abyss.h>
...@@ -43,7 +46,7 @@ static const char modname[] = "mod_xml_rpc"; ...@@ -43,7 +46,7 @@ static const char modname[] = "mod_xml_rpc";
static struct { static struct {
int port; uint16_t port;
uint8_t running; uint8_t running;
char *url; char *url;
} globals; } globals;
...@@ -78,7 +81,7 @@ static switch_xml_t xml_url_fetch(char *section, ...@@ -78,7 +81,7 @@ static switch_xml_t xml_url_fetch(char *section,
snprintf(url, sizeof(url), "%s?section=%s&tag_name=%s&key_name=%s&key_value=%s%s%s\n", snprintf(url, sizeof(url), "%s?section=%s&tag_name=%s&key_name=%s&key_value=%s%s%s\n",
globals.url, section, tag_name, key_name, key_value, params ? "&" : "", params ? params : ""); globals.url, section, tag_name, key_name, key_value, params ? "&" : "", params ? params : "");
srand(time(NULL) + strlen(url)); srand((unsigned int)(time(NULL) + strlen(url)));
snprintf(filename, sizeof(filename), "%s%04x.tmp", SWITCH_GLOBAL_dirs.temp_dir, (rand() & 0xffff)); snprintf(filename, sizeof(filename), "%s%04x.tmp", SWITCH_GLOBAL_dirs.temp_dir, (rand() & 0xffff));
curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL);
curl_handle = curl_easy_init(); curl_handle = curl_easy_init();
...@@ -142,7 +145,7 @@ static switch_status_t do_config(void) ...@@ -142,7 +145,7 @@ static switch_status_t do_config(void)
if (!strcasecmp(var, "gateway_url")) { if (!strcasecmp(var, "gateway_url")) {
set_global_url(val); set_global_url(val);
} else if (!strcasecmp(var, "http_port")) { } else if (!strcasecmp(var, "http_port")) {
globals.port = atoi(val); globals.port = (uint16_t)atoi(val);
} }
} }
} }
...@@ -193,7 +196,7 @@ static switch_status_t http_stream_write(switch_stream_handle_t *handle, char *f ...@@ -193,7 +196,7 @@ static switch_status_t http_stream_write(switch_stream_handle_t *handle, char *f
if (data) { if (data) {
ret = 0; ret = 0;
HTTPWrite(r, data, strlen(data)); HTTPWrite(r, data, (uint32_t)strlen(data));
free(data); free(data);
} }
......
...@@ -57,7 +57,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_stream_write(switch_stream_handle ...@@ -57,7 +57,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_stream_write(switch_stream_handle
va_end(ap); va_end(ap);
if (data) { if (data) {
uint32_t len = handle->data_size - handle->data_len; switch_size_t len = handle->data_size - handle->data_len;
if (len <= strlen(data)) { if (len <= strlen(data)) {
ret = -1; ret = -1;
...@@ -65,7 +65,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_stream_write(switch_stream_handle ...@@ -65,7 +65,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_stream_write(switch_stream_handle
ret = 0; ret = 0;
snprintf(end, len, data); snprintf(end, len, data);
handle->data_len = strlen(buf); handle->data_len = strlen(buf);
handle->end = handle->data + handle->data_len; handle->end = (uint8_t *)(handle->data) + handle->data_len;
} }
free(data); free(data);
} }
......
...@@ -213,10 +213,10 @@ SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t *poll, int ms) ...@@ -213,10 +213,10 @@ SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t *poll, int ms)
} }
SWITCH_DECLARE(int) switch_url_encode(char *url, char *buf, size_t len) SWITCH_DECLARE(size_t) switch_url_encode(char *url, char *buf, size_t len)
{ {
char *p; char *p;
int x = 0; size_t x = 0;
const char urlunsafe[] = " \"#%&+:;<=>?@[\\]^`{|}"; const char urlunsafe[] = " \"#%&+:;<=>?@[\\]^`{|}";
const char hex[] = "0123456789ABCDEF"; const char hex[] = "0123456789ABCDEF";
...@@ -246,7 +246,7 @@ SWITCH_DECLARE(char *) switch_url_decode(char *s) ...@@ -246,7 +246,7 @@ SWITCH_DECLARE(char *) switch_url_decode(char *s)
for (o = s; *s; s++, o++) { for (o = s; *s; s++, o++) {
if (*s == '%' && strlen(s) > 2 && sscanf(s + 1, "%2x", &tmp) == 1) { if (*s == '%' && strlen(s) > 2 && sscanf(s + 1, "%2x", &tmp) == 1) {
*o = tmp; *o = (char)tmp;
s += 2; s += 2;
} else { } else {
*o = *s; *o = *s;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论