Hi, On Tue, Jul 16, 2002 at 06:01:08PM -0700, Greg Stein wrote: > On Tue, Jul 16, 2002 at 10:31:46AM -0500, William A. Rowe, Jr. wrote: > > At 07:23 PM 7/15/2002, Ryan Bloom wrote: > > > > >We could force the size, by using apr_int32_t. The problem that he is > > There is no need to force the size. The value is a simple integer. There is > no need to make it a long, and that integer will always be castable into a > void*, and then back (when we pull it out of the hash table). > > I see no purpose in the patch's casting to a long. What exactly is that > solving? We need a response from Peter.
Sorry for keeping you waiting on this. [...] > * mod_dav's namespace indexes are integers > * we stuff those into a hash table > * we extract them from a hash table > > Peter's patch changes the indexes to longs. Why? The code assumes that a pointer == int == 32 bit. While in fact int is 32 bit wide on all architectures, a pointer is sized long on 64 bit architectures... What the compiler sees is that a pointer is put into an incompatible type. It warns, and it can't know which actual values will occur at runtime. The patch was meant to take care of these possibly dangerous cases, while ignoring the more obvious harmless ones. But I'm certainly okay if you say that all these values are indices that actually never grow larger than int -- it's you who have the deep understanding of the code, not me. So, if you say that long wasts too many resources, we'll have to live with the compiler warnings; but at least we know that the could should work :^} Anyway, even if the code is safe in all places, one could argue that it is not written in a clean way, making assumptions about the pointer size. I would find it desirable if we could get rid of all benign warnings, so that actual harmful ones do not get lost in the noise. The stderr output of make (using gcc 3.1.1 20020708) is this: protocol.c: In function `ap_note_digest_auth_failure': protocol.c:1102: warning: long long unsigned int format, apr_time_t arg (arg 4) http_core.c: In function `chunk_filter': http_core.c:216: warning: long long unsigned int format, long unsigned int arg (arg 4) http_protocol.c: In function `ap_byterange_filter': http_protocol.c:2839: warning: long long unsigned int format, apr_time_t arg (arg 3) ab.c: In function `output_html_results': ab.c:1103: warning: long long int format, long int arg (arg 5) ab.c:1103: warning: long long int format, long int arg (arg 6) mod_disk_cache.c:431: warning: `remove_url' defined but not used mod_mem_cache.c: In function `set_max_cache_size': mod_mem_cache.c:1049: warning: int format, different type arg (arg 3) mod_mem_cache.c: In function `set_min_cache_object_size': mod_mem_cache.c:1060: warning: int format, different type arg (arg 3) mod_mem_cache.c: In function `set_max_cache_object_size': mod_mem_cache.c:1071: warning: int format, different type arg (arg 3) mod_mem_cache.c: In function `set_max_object_count': mod_mem_cache.c:1082: warning: int format, different type arg (arg 3) cache_pqueue.c: In function `cache_pq_dump': cache_pqueue.c:259: warning: int format, different type arg (arg 7) mod_log_config.c: In function `log_request_duration': mod_log_config.c:548: warning: long long int format, long int arg (arg 3) mod_log_config.c: In function `log_request_duration_microseconds': mod_log_config.c:553: warning: long long int format, apr_time_t arg (arg 3) mod_expires.c: In function `add_expires': mod_expires.c:502: warning: long long int format, long int arg (arg 3) mod_headers.c: In function `header_request_duration': mod_headers.c:185: warning: long long int format, apr_time_t arg (arg 3) mod_headers.c: In function `header_request_time': mod_headers.c:189: warning: long long int format, apr_time_t arg (arg 3) mod_usertrack.c: In function `make_cookie': mod_usertrack.c:149: warning: long long int format, apr_time_t arg (arg 5) ssl_scache_shmcb.c: In function `ssl_scache_shmcb_init': ssl_scache_shmcb.c:391: warning: unsigned int format, different type arg (arg 7) ssl_scache_shmht.c: In function `ssl_scache_shmht_init': ssl_scache_shmht.c:177: warning: int format, different type arg (arg 8) liveprop.c: In function `dav_register_liveprop_namespace': liveprop.c:83: warning: cast from pointer to integer of different size liveprop.c:91: warning: cast to pointer from integer of different size liveprop.c: In function `dav_get_liveprop_ns_index': liveprop.c:96: warning: cast from pointer to integer of different size liveprop.c: In function `dav_add_all_liveprop_xmlns': liveprop.c:115: warning: cast from pointer to integer of different size mod_cgid.c: In function `close_unix_socket': mod_cgid.c:938: warning: cast from pointer to integer of different size mod_cgid.c: In function `connect_to_daemon': mod_cgid.c:981: warning: cast to pointer from integer of different size mod_cgid.c: In function `cgid_handler': mod_cgid.c:1241: warning: cast to pointer from integer of different size mod_cgid.c:1253: warning: cast to pointer from integer of different size mod_cgid.c: In function `include_cmd': mod_cgid.c:1466: warning: cast to pointer from integer of different size dbm.c: In function `dav_build_key': dbm.c:349: warning: cast from pointer to integer of different size dbm.c: In function `dav_propdb_open': dbm.c:502: warning: cast to pointer from integer of different size dbm.c: In function `dav_propdb_map_namespaces': dbm.c:612: warning: cast from pointer to integer of different size dbm.c:622: warning: cast to pointer from integer of different size repos.c: In function `dav_fs_patch_validate': repos.c:2000: warning: cast to pointer from integer of different size repos.c: In function `dav_fs_patch_exec': repos.c:2042: warning: cast to pointer from integer of different size Thanks, Peter -- VFS: Busy inodes after unmount. Self-destruct in 5 seconds. Have a nice day...