diff --git a/src/mod/applications/mod_http/bits.h b/src/mod/applications/mod_http/bits.h index 2c107cce11..c7b51b3cf5 100644 --- a/src/mod/applications/mod_http/bits.h +++ b/src/mod/applications/mod_http/bits.h @@ -11,7 +11,7 @@ #ifndef _bits_h_ #define _bits_h_ - +#include #ifndef min #define min(a,b) ((a) < (b) ? (a) : (b)) #endif @@ -21,7 +21,7 @@ #endif #define hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x) & 7) + 9) -#define error_ptr(error) ((void*)error) -#define is_error(ptr) ((unsigned long)ptr > (unsigned long)-4000L) +#define error_ptr(error) ((void*)(intptr_t)error) +#define is_error(ptr) ((uint32_t)(intptr_t)ptr > (uint32_t)-4000L) #endif diff --git a/src/mod/applications/mod_http/http_req.c b/src/mod/applications/mod_http/http_req.c index 89f5486406..70647dad39 100644 --- a/src/mod/applications/mod_http/http_req.c +++ b/src/mod/applications/mod_http/http_req.c @@ -244,7 +244,7 @@ int http_req(http_request_t *req, http_response_t *res) dprintf(s, "Host: %s:%d\r\n", hostname, port); else dprintf(s, "Host: %s\r\n", hostname); dprintf(s, "Connection: close\r\n"); - dprintf(s, "Content-Length: %d\r\n", req->body_len); + dprintf(s, "Content-Length: %ld\r\n", req->body_len); for(i = 0; i < req->header_len; i++){ dprintf( diff --git a/src/mod/applications/mod_http/linkhash.c b/src/mod/applications/mod_http/linkhash.c index 6cfc9a0ea6..818d3dd7b5 100644 --- a/src/mod/applications/mod_http/linkhash.c +++ b/src/mod/applications/mod_http/linkhash.c @@ -28,10 +28,10 @@ void lh_abort(const char *msg, ...) exit(1); } -unsigned long lh_ptr_hash(void *k) +uint32_t lh_ptr_hash(void *k) { /* CAW: refactored to be 64bit nice */ - return (unsigned long)((((ptrdiff_t)k * LH_PRIME) >> 4) & ULONG_MAX); + return (uint32_t)((((ptrdiff_t)k * LH_PRIME) >> 4) & ULONG_MAX); } int lh_ptr_equal(void *k1, void *k2) @@ -39,7 +39,7 @@ int lh_ptr_equal(void *k1, void *k2) return (k1 == k2); } -unsigned long lh_char_hash(void *k) +uint32_t lh_char_hash(void *k) { unsigned int h = 0; const char* data = k; @@ -123,7 +123,7 @@ void lh_table_free(struct lh_table *t) int lh_table_insert(struct lh_table *t, void *k, void *v) { - unsigned long h, n; + uint32_t h, n; t->inserts++; if(t->count > t->size * 0.66) lh_table_resize(t, t->size * 2); @@ -157,8 +157,8 @@ int lh_table_insert(struct lh_table *t, void *k, void *v) struct lh_entry* lh_table_lookup_entry(struct lh_table *t, void *k) { - unsigned long h = t->hash_fn(k); - unsigned long n = h % t->size; + uint32_t h = t->hash_fn(k); + uint32_t n = h % t->size; t->lookups++; while( 1 ) { diff --git a/src/mod/applications/mod_http/linkhash.h b/src/mod/applications/mod_http/linkhash.h index 5c9fa852d8..21b62e3049 100644 --- a/src/mod/applications/mod_http/linkhash.h +++ b/src/mod/applications/mod_http/linkhash.h @@ -11,6 +11,7 @@ #ifndef _linkhash_h_ #define _linkhash_h_ +#include /** * golden prime used in hash functions @@ -36,7 +37,7 @@ typedef void (lh_entry_free_fn) (struct lh_entry *e); /** * callback function prototypes */ -typedef unsigned long (lh_hash_fn) (void *k); +typedef uint32_t (lh_hash_fn) (void *k); /** * callback function prototypes */ @@ -132,10 +133,10 @@ struct lh_table { /** * Pre-defined hash and equality functions */ -extern unsigned long lh_ptr_hash(void *k); +extern uint32_t lh_ptr_hash(void *k); extern int lh_ptr_equal(void *k1, void *k2); -extern unsigned long lh_char_hash(void *k); +extern uint32_t lh_char_hash(void *k); extern int lh_char_equal(void *k1, void *k2); diff --git a/src/mod/applications/mod_http/mod_http.c b/src/mod/applications/mod_http/mod_http.c index 46ee4da088..2984d3802d 100644 --- a/src/mod/applications/mod_http/mod_http.c +++ b/src/mod/applications/mod_http/mod_http.c @@ -359,7 +359,7 @@ SWITCH_STANDARD_API(http_api_main) switch_log_printf( SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, - "RESERVED %d BYTES, USED %d BYTES, HTTP Response as JSON: %s\n", + "RESERVED %ld BYTES, USED %ld BYTES, HTTP Response as JSON: %s\n", l, m, json_response