git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11333 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-01-21 19:18:51 +00:00
parent b5b983e5cd
commit c67c96914b
5 changed files with 15 additions and 14 deletions

View File

@ -11,7 +11,7 @@
#ifndef _bits_h_
#define _bits_h_
#include <inttypes.h>
#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

View File

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

View File

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

View File

@ -11,6 +11,7 @@
#ifndef _linkhash_h_
#define _linkhash_h_
#include <inttypes.h>
/**
* 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);

View File

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