]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
build
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 21 Jan 2009 19:18:51 +0000 (19:18 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 21 Jan 2009 19:18:51 +0000 (19:18 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11333 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_http/bits.h
src/mod/applications/mod_http/http_req.c
src/mod/applications/mod_http/linkhash.c
src/mod/applications/mod_http/linkhash.h
src/mod/applications/mod_http/mod_http.c

index 2c107cce11a42fd1dd7821613e55dcb4666d1484..c7b51b3cf519fdb3267c2f38765364febc57c4b3 100644 (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
index 89f548640669c632366cc2d87018e45067c11964..70647dad39926341e7648416f1d8b17df29cf2ae 100644 (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(
index 6cfc9a0ea6e4f633335184966439b57fa1a148c4..818d3dd7b55804211154708b25560a2abb87439d 100644 (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 ) {
index 5c9fa852d8efba088164e22f4203cd935d0cc5bb..21b62e3049deb2cdeb4a6d0dc8933228ea096be0 100644 (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);
 
 
index 46ee4da088b75cb4b55ed5147125e688e4e1c979..2984d3802d2faee60105a7d91a8b148d9558575a 100644 (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