Re: [PATCH] WIN64: httpd API changes

2004-10-08 Thread Joe Orton
On Thu, Oct 07, 2004 at 04:52:28PM -0400, Allan Edwards wrote:
 This set of changes gets rid of most of the libhttpd
 64bit warnings on Windows at the cost of several httpd
 API changes. I defined AP_INT_TRUNC_CAST for use where
 there are size mismatches with APR API's (those APR
 API's will need to be updated in APR 2.0)

Again I think the use of the macro is really ugly.

 -AP_DECLARE(int) ap_rputs(const char *str, request_rec *r);
 +AP_DECLARE(apr_size_t) ap_rputs(const char *str, request_rec *r);

The ap_r* changes are not safe: these functions return negative values
on error.  Each and every int-size_t conversion needs to be carefully
checked for this kind of issue.

joe


Re: [PATCH] WIN64: httpd API changes

2004-10-08 Thread Allan Edwards
Joe Orton wrote:
The ap_r* changes are not safe: these functions return negative values
on error.  Each and every int-size_t conversion needs to be carefully
checked for this kind of issue.
Good point. I will review closely this weekend.
Thanks, Allan


[PATCH] WIN64: httpd API changes

2004-10-07 Thread Allan Edwards
This set of changes gets rid of most of the libhttpd
64bit warnings on Windows at the cost of several httpd
API changes. I defined AP_INT_TRUNC_CAST for use where
there are size mismatches with APR API's (those APR
API's will need to be updated in APR 2.0)
Comments before I commit?
Allan
-
Index: include/ap_mmn.h
===
RCS file: /home/cvs/httpd-2.0/include/ap_mmn.h,v
retrieving revision 1.69
diff -U3 -r1.69 ap_mmn.h
--- include/ap_mmn.h4 Jun 2004 22:40:46 -   1.69
+++ include/ap_mmn.h7 Oct 2004 20:48:55 -
@@ -84,14 +84,15 @@
  *  changed ap_add_module, ap_add_loaded_module,
  *  ap_setup_prelinked_modules, ap_process_resource_config
  * 20040425.1 (2.1.0-dev) Added ap_module_symbol_t and ap_prelinked_module_symbols
+ * 20041007 (2.1.0-dev) API changes to clean up 64bit compiles
  */
 #define MODULE_MAGIC_COOKIE 0x41503230UL /* AP20 */
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
-#define MODULE_MAGIC_NUMBER_MAJOR 20040425
+#define MODULE_MAGIC_NUMBER_MAJOR 20041007
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
Index: include/http_protocol.h
===
RCS file: /home/cvs/httpd-2.0/include/http_protocol.h,v
retrieving revision 1.92
diff -U3 -r1.92 http_protocol.h
--- include/http_protocol.h 18 Jul 2004 20:06:38 -  1.92
+++ include/http_protocol.h 7 Oct 2004 20:48:55 -
@@ -340,7 +340,7 @@
  * @return The number of bytes sent
  * @deffunc int ap_rputs(const char *str, request_rec *r)
  */
-AP_DECLARE(int) ap_rputs(const char *str, request_rec *r);
+AP_DECLARE(apr_size_t) ap_rputs(const char *str, request_rec *r);
 /**
  * Write a buffer for the current request
@@ -359,7 +359,7 @@
  * @return The number of bytes sent
  * @deffunc int ap_rvputs(request_rec *r, ...)
  */
-AP_DECLARE_NONSTD(int) ap_rvputs(request_rec *r,...);
+AP_DECLARE_NONSTD(apr_size_t) ap_rvputs(request_rec *r,...);
 /**
  * Output data to the client in a printf format
@@ -369,7 +369,7 @@
  * @return The number of bytes sent
  * @deffunc int ap_vrprintf(request_rec *r, const char *fmt, va_list vlist)
  */
-AP_DECLARE(int) ap_vrprintf(request_rec *r, const char *fmt, va_list vlist);
+AP_DECLARE(apr_size_t) ap_vrprintf(request_rec *r, const char *fmt, va_list vlist);
 /**
  * Output data to the client in a printf format
@@ -379,7 +379,7 @@
  * @return The number of bytes sent
  * @deffunc int ap_rprintf(request_rec *r, const char *fmt, ...)
  */
-AP_DECLARE_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt,...)
+AP_DECLARE_NONSTD(apr_size_t) ap_rprintf(request_rec *r, const char *fmt,...)
__attribute__((format(printf,2,3)));
 /**
  * Flush all of the data for the current request to the client
@@ -445,7 +445,7 @@
  * if EOF, or -1 if there was an error
  * @deffunc long ap_get_client_block(request_rec *r, char *buffer, apr_size_t bufsiz)
  */
-AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, apr_size_t bufsiz);
+AP_DECLARE(apr_size_t) ap_get_client_block(request_rec *r, char *buffer, apr_size_t 
bufsiz);
 /**
  * In HTTP/1.1, any method can have a body.  However, most GET handlers
Index: include/httpd.h
===
RCS file: /home/cvs/httpd-2.0/include/httpd.h,v
retrieving revision 1.212
diff -U3 -r1.212 httpd.h
--- include/httpd.h 12 Aug 2004 05:22:59 -  1.212
+++ include/httpd.h 7 Oct 2004 20:48:55 -
@@ -1091,7 +1091,7 @@
 /** Pathname for ServerPath */
 const char *path;
 /** Length of path */
-int pathlen;
+apr_size_t pathlen;
 /** Normal names for ServerAlias servers */
 apr_array_header_t *names;
@@ -1244,7 +1244,7 @@
  * address of field is shifted to the next non-comma, non-whitespace
  * character.  len is the length of the item excluding any beginning whitespace.
  */
-AP_DECLARE(const char *) ap_size_list_item(const char **field, int *len);
+AP_DECLARE(const char *) ap_size_list_item(const char **field, apr_size_t *len);
 /**
  * Retrieve an HTTP header field list item, as separated by a comma,
@@ -1587,7 +1587,7 @@
  * @param c The character to search for
  * @return The index of the first occurrence of c in str
  */
-AP_DECLARE(int) ap_ind(const char *str, char c);   /* Sigh... */
+AP_DECLARE(apr_size_t) ap_ind(const char *str, char c);/* Sigh... */
 /**
  * Search a string from right to left for the first occurrence of a
@@ -1596,7 +1596,7 @@
  * @param c The character to search for
  * @return The index of the first occurrence of c in str
  */
-AP_DECLARE(int) ap_rind(const char *str, char c);
+AP_DECLARE(apr_size_t) ap_rind(const char *str, char c);
 /**
  * Given a string, replace any bare