You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dean Gaudet <dg...@arctic.org> on 1997/07/21 06:16:05 UTC

[PATCH] PR#344: 64-bit warnings

Ok, here we go again.  This time I think you all just *have* to be happy,
ok?  I don't introduce any new types, I don't change any existing
structures.  I just cast to (long) everywhere.  Nyah nyah. 

So this gets rid of warnings where sizeof(void *) > sizeof(int), but
starts generating warnings where sizeof(long) > sizeof(void *).  The
latter shouldn't be really common at all... 'cept for 16-bit 286 in
small-data models.  Which, well, I'd be surprised if Apache can even run
well with only 64k of data per process.  And if it can, then they can just
suffer the warnings.

Dean

Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache/src/CHANGES,v
retrieving revision 1.357
diff -u -r1.357 CHANGES
--- CHANGES	1997/07/21 03:37:47	1.357
+++ CHANGES	1997/07/21 04:11:38
@@ -1,4 +1,8 @@
 Changes with Apache 1.3
+  
+  *) PORT: Various tweaks to eliminate pointer-int casting warnings on 64-bit
+     cpus like the alpha.  Apache still stores ints in pointers, but that's
+     the relatively safe direction.  [Dean Gaudet] PR#344
 
   *) PORT: Some architectures use size_t for various lengths in network
      functions such as accept(), and getsockname().  The definition
Index: alloc.c
===================================================================
RCS file: /export/home/cvs/apache/src/alloc.c,v
retrieving revision 1.40
diff -u -r1.40 alloc.c
--- alloc.c	1997/07/15 21:39:50	1.40
+++ alloc.c	1997/07/21 04:11:38
@@ -815,15 +815,15 @@
  * generic cleanup interface.
  */
 
-static void fd_cleanup (void *fdv) { close ((int)fdv); }
+static void fd_cleanup (void *fdv) { close ((int)(long)fdv); }
 
 API_EXPORT(void) note_cleanups_for_fd (pool *p, int fd) {
-  register_cleanup (p, (void *)fd, fd_cleanup, fd_cleanup);
+  register_cleanup (p, (void *)(long)fd, fd_cleanup, fd_cleanup);
 }
 
 API_EXPORT(void) kill_cleanups_for_fd(pool *p,int fd)
     {
-    kill_cleanup(p,(void *)fd,fd_cleanup);
+    kill_cleanup(p,(void *)(long)fd,fd_cleanup);
     }
 
 API_EXPORT(int) popenf(pool *a, const char *name, int flg, int mode)
@@ -851,7 +851,7 @@
   block_alarms();
   res = close(fd);
   save_errno = errno;
-  kill_cleanup(a, (void *)fd, fd_cleanup);
+  kill_cleanup(a, (void *)(long)fd, fd_cleanup);
   unblock_alarms();
   errno = save_errno;
   return res;
@@ -970,16 +970,16 @@
 {
     int rv;
     
-    rv = closesocket((int)fdv);
+    rv = closesocket((int)(long)fdv);
 }
 
 API_EXPORT(void) note_cleanups_for_socket (pool *p, int fd) {
-  register_cleanup (p, (void *)fd, socket_cleanup, socket_cleanup);
+  register_cleanup (p, (void *)(long)fd, socket_cleanup, socket_cleanup);
 }
 
 API_EXPORT(void) kill_cleanups_for_socket(pool *p,int sock)
 {
-    kill_cleanup(p,(void *)sock,socket_cleanup);
+    kill_cleanup(p,(void *)(long)sock,socket_cleanup);
 }
 
 API_EXPORT(int) pclosesocket(pool *a, int sock)
@@ -993,7 +993,7 @@
   errno = WSAGetLastError() - WSABASEERR;
 #endif /* WIN32 */
   save_errno = errno;
-  kill_cleanup(a, (void *)sock, socket_cleanup);
+  kill_cleanup(a, (void *)(long)sock, socket_cleanup);
   unblock_alarms();
   errno = save_errno;
   return res;
Index: http_config.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_config.c,v
retrieving revision 1.61
diff -u -r1.61 http_config.c
--- http_config.c	1997/07/17 22:27:28	1.61
+++ http_config.c	1997/07/21 04:11:38
@@ -781,7 +781,7 @@
 {
     /* This one's pretty generic... */
   
-    int offset = (int)cmd->info; 
+    int offset = (int)(long)cmd->info; 
     *(char **)(struct_ptr + offset) = pstrdup (cmd->pool, arg);
     return NULL;
 }
@@ -791,7 +791,7 @@
 {
     /* This one's pretty generic too... */
   
-    int offset = (int)cmd->info; 
+    int offset = (int)(long)cmd->info; 
     *(int *)(struct_ptr + offset) = arg ? 1 : 0;
     return NULL;
 }
Index: http_core.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_core.c,v
retrieving revision 1.98
diff -u -r1.98 http_core.c
--- http_core.c	1997/07/19 20:27:51	1.98
+++ http_core.c	1997/07/21 04:11:38
@@ -853,7 +853,7 @@
 {
     /* This one's pretty generic... */
   
-    int offset = (int)cmd->info;
+    int offset = (int)(long)cmd->info;
     char *struct_ptr = (char *)cmd->server;
     
     *(char **)(struct_ptr + offset) = pstrdup (cmd->pool, arg);
Index: mod_alias.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_alias.c,v
retrieving revision 1.19
diff -u -r1.19 mod_alias.c
--- mod_alias.c	1997/07/17 22:27:31	1.19
+++ mod_alias.c	1997/07/21 04:11:38
@@ -156,7 +156,7 @@
     server_rec *s = cmd->server;
     alias_server_conf *serverconf =
         (alias_server_conf *)get_module_config(s->module_config,&alias_module);
-    int status = (int)cmd->info;
+    int status = (int)(long)cmd->info;
     regex_t *r = NULL;
     char *f = arg2;
     char *url = arg3;
Index: mod_autoindex.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_autoindex.c,v
retrieving revision 1.39
diff -u -r1.39 mod_autoindex.c
--- mod_autoindex.c	1997/07/17 22:27:33	1.39
+++ mod_autoindex.c	1997/07/21 04:11:39
@@ -224,7 +224,7 @@
 
 static const char *add_opts_int(cmd_parms *cmd, void *d, int opts)
 {
-    push_item(((autoindex_config_rec *)d)->opts_list, (char*)opts, NULL,
+    push_item(((autoindex_config_rec *)d)->opts_list, (char*)(long)opts, NULL,
               cmd->path, NULL);
     return NULL;
 }
@@ -468,7 +468,7 @@
         struct item *p = &items[i];
         
         if (!strcmp_match(path, p->apply_path))
-            return (int)p->type;
+            return (int)(long)p->type;
     }
     return 0;
 }
Index: mod_browser.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_browser.c,v
retrieving revision 1.13
diff -u -r1.13 mod_browser.c
--- mod_browser.c	1997/07/21 00:34:05	1.13
+++ mod_browser.c	1997/07/21 04:11:39
@@ -98,7 +98,7 @@
       get_module_config (cmd->server->module_config, &browser_module);
     browser_entry *new, *entries = (browser_entry *)sconf->browsers->elts;
     char *var;
-    int i, cflags = (int)cmd->info;
+    int i, cflags = (int)(long)cmd->info;
 
     /* First, try to merge into an existing entry */
 
Index: mod_rewrite.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_rewrite.c,v
retrieving revision 1.34
diff -u -r1.34 mod_rewrite.c
--- mod_rewrite.c	1997/07/18 09:48:06	1.34
+++ mod_rewrite.c	1997/07/21 04:11:39
@@ -2400,7 +2400,11 @@
     else
         ap_snprintf(redir, sizeof(redir), "/redir#%d", i);
 
-    ap_snprintf(str3, sizeof(str3), "%s %s [%s/sid#%x][rid#%x/%s%s] (%d) %s\n", str1, current_logtime(r), r->server->server_hostname, (unsigned int)(r->server), (unsigned int)r, type, redir, level, str2);
+    ap_snprintf(str3, sizeof(str3),
+	"%s %s [%s/sid#%lx][rid#%lx/%s%s] (%d) %s\n", str1,
+	current_logtime(r), r->server->server_hostname,
+	(unsigned long)(r->server), (unsigned long)r,
+	type, redir, level, str2);
 
     fd_lock(conf->rewritelogfp);
     write(conf->rewritelogfp, str3, strlen(str3));