httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1061874 - in /httpd/httpd/trunk/modules/slotmem: mod_slotmem_plain.c mod_slotmem_shm.c
Date Fri, 21 Jan 2011 16:13:22 GMT
Author: jim
Date: Fri Jan 21 16:13:21 2011
New Revision: 1061874

URL: http://svn.apache.org/viewvc?rev=1061874&view=rev
Log:
arith on void* is not good

Modified:
    httpd/httpd/trunk/modules/slotmem/mod_slotmem_plain.c
    httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c

Modified: httpd/httpd/trunk/modules/slotmem/mod_slotmem_plain.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/slotmem/mod_slotmem_plain.c?rev=1061874&r1=1061873&r2=1061874&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/slotmem/mod_slotmem_plain.c (original)
+++ httpd/httpd/trunk/modules/slotmem/mod_slotmem_plain.c Fri Jan 21 16:13:21 2011
@@ -41,7 +41,7 @@ static apr_pool_t *gpool = NULL;
 static apr_status_t slotmem_do(ap_slotmem_instance_t *mem, ap_slotmem_callback_fn_t *func,
void *data, apr_pool_t *pool)
 {
     unsigned int i;
-    void *ptr;
+    char *ptr;
     char *inuse;
     apr_status_t retval = APR_SUCCESS;
     
@@ -49,7 +49,7 @@ static apr_status_t slotmem_do(ap_slotme
     if (!mem)
         return APR_ENOSHMAVAIL;
 
-    ptr = mem->base;
+    ptr = (char *)mem->base;
     inuse = mem->inuse;
     for (i = 0; i < mem->num; i++, inuse++) {
         if (!AP_SLOTMEM_IS_PREGRAB(mem) ||
@@ -107,7 +107,7 @@ static apr_status_t slotmem_create(ap_sl
     res->num = item_num;
     res->next = NULL;
     res->type = type;
-    res->inuse = res->base + basesize;
+    res->inuse = (char *)res->base + basesize;
     if (globallistmem == NULL)
         globallistmem = res;
     else
@@ -149,14 +149,14 @@ static apr_status_t slotmem_attach(ap_sl
 static apr_status_t slotmem_dptr(ap_slotmem_instance_t *score, unsigned int id, void **mem)
 {
 
-    void *ptr;
+    char *ptr;
 
     if (!score)
         return APR_ENOSHMAVAIL;
     if (id >= score->num)
         return APR_ENOSHMAVAIL;
 
-    ptr = score->base + score->size * id;
+    ptr = (char *)score->base + score->size * id;
     if (!ptr)
         return APR_ENOSHMAVAIL;
     *mem = ptr;

Modified: httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c?rev=1061874&r1=1061873&r2=1061874&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c (original)
+++ httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c Fri Jan 21 16:13:21 2011
@@ -220,7 +220,7 @@ static apr_status_t slotmem_doall(ap_slo
                                   void *data, apr_pool_t *pool)
 {
     unsigned int i;
-    void *ptr;
+    char *ptr;
     char *inuse;
     apr_status_t retval = APR_SUCCESS;
 
@@ -228,7 +228,7 @@ static apr_status_t slotmem_doall(ap_slo
         return APR_ENOSHMAVAIL;
     }
 
-    ptr = mem->base;
+    ptr = (char *)mem->base;
     inuse = mem->inuse;
     for (i = 0; i < mem->desc.num; i++, inuse++) {
         if (!AP_SLOTMEM_IS_PREGRAB(mem) ||
@@ -248,7 +248,7 @@ static apr_status_t slotmem_create(ap_sl
                                    ap_slotmem_type_t type, apr_pool_t *pool)
 {
 /*    void *slotmem = NULL; */
-    void *ptr;
+    char *ptr;
     sharedslotdesc_t desc;
     ap_slotmem_instance_t *res;
     ap_slotmem_instance_t *next = globallistmem;
@@ -301,7 +301,7 @@ static apr_status_t slotmem_create(ap_sl
             apr_shm_detach(shm);
             return APR_EINVAL;
         }
-        ptr = apr_shm_baseaddr_get(shm);
+        ptr = (char *)apr_shm_baseaddr_get(shm);
         memcpy(&desc, ptr, sizeof(desc));
         if (desc.size != item_size || desc.num != item_num) {
             apr_shm_detach(shm);
@@ -330,7 +330,7 @@ static apr_status_t slotmem_create(ap_sl
              */
             unixd_set_shm_perms(fname);
         }
-        ptr = apr_shm_baseaddr_get(shm);
+        ptr = (char *)apr_shm_baseaddr_get(shm);
         desc.size = item_size;
         desc.num = item_num;
         desc.type = type;
@@ -350,7 +350,7 @@ static apr_status_t slotmem_create(ap_sl
                                                 sizeof(ap_slotmem_instance_t));
     res->name = apr_pstrdup(gpool, fname);
     res->shm = shm;
-    res->base = ptr;
+    res->base = (void *)ptr;
     res->desc = desc;
     res->gpool = gpool;
     res->next = NULL;
@@ -371,7 +371,7 @@ static apr_status_t slotmem_attach(ap_sl
                                    unsigned int *item_num, apr_pool_t *pool)
 {
 /*    void *slotmem = NULL; */
-    void *ptr;
+    char *ptr;
     ap_slotmem_instance_t *res;
     ap_slotmem_instance_t *next = globallistmem;
     sharedslotdesc_t desc;
@@ -418,7 +418,7 @@ static apr_status_t slotmem_attach(ap_sl
     }
 
     /* Read the description of the slotmem */
-    ptr = apr_shm_baseaddr_get(shm);
+    ptr = (char *)apr_shm_baseaddr_get(shm);
     memcpy(&desc, ptr, sizeof(desc));
     ptr = ptr + AP_SLOTMEM_OFFSET;
 
@@ -427,7 +427,7 @@ static apr_status_t slotmem_attach(ap_sl
                                                 sizeof(ap_slotmem_instance_t));
     res->name = apr_pstrdup(gpool, fname);
     res->shm = shm;
-    res->base = ptr;
+    res->base = (void *)ptr;
     res->desc = desc;
     res->gpool = gpool;
     res->inuse = ptr + (desc.size * desc.num);
@@ -448,7 +448,7 @@ static apr_status_t slotmem_attach(ap_sl
 static apr_status_t slotmem_dptr(ap_slotmem_instance_t *slot,
                                  unsigned int id, void **mem)
 {
-    void *ptr;
+    char *ptr;
 
     if (!slot) {
         return APR_ENOSHMAVAIL;
@@ -457,11 +457,11 @@ static apr_status_t slotmem_dptr(ap_slot
         return APR_ENOSHMAVAIL;
     }
 
-    ptr = slot->base + slot->desc.size * id;
+    ptr = (char *)slot->base + slot->desc.size * id;
     if (!ptr) {
         return APR_ENOSHMAVAIL;
     }
-    *mem = ptr;
+    *mem = (void *)ptr;
     return APR_SUCCESS;
 }
 



Mime
View raw message