#ifndef _bits_h_
#define _bits_h_
-
+#include <inttypes.h>
#ifndef min
#define min(a,b) ((a) < (b) ? (a) : (b))
#endif
#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
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(
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)
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;
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);
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 ) {
#ifndef _linkhash_h_
#define _linkhash_h_
+#include <inttypes.h>
/**
* golden prime used in hash functions
/**
* callback function prototypes
*/
-typedef unsigned long (lh_hash_fn) (void *k);
+typedef uint32_t (lh_hash_fn) (void *k);
/**
* callback function prototypes
*/
/**
* 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);
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