httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r1228323 - in /httpd/httpd/trunk: include/http_config.h include/http_core.h include/http_protocol.h include/httpd.h include/util_varbuf.h server/config.c server/core.c server/protocol.c server/request.c server/util.c server/util_cookies.c
Date Fri, 06 Jan 2012 18:15:08 GMT
Author: wrowe
Date: Fri Jan  6 18:15:08 2012
New Revision: 1228323

URL: http://svn.apache.org/viewvc?rev=1228323&view=rev
Log:
Clean up size_t abuse, part 2.  ap_malloc/calloc/realloc are explicitly
excluded from this cleanup as they must be signature identical to the
clib functions, and although the definition of size_t has been flakey,
the definition of those functions appears to be generally clean since
ANSI C.

Modified:
    httpd/httpd/trunk/include/http_config.h
    httpd/httpd/trunk/include/http_core.h
    httpd/httpd/trunk/include/http_protocol.h
    httpd/httpd/trunk/include/httpd.h
    httpd/httpd/trunk/include/util_varbuf.h
    httpd/httpd/trunk/server/config.c
    httpd/httpd/trunk/server/core.c
    httpd/httpd/trunk/server/protocol.c
    httpd/httpd/trunk/server/request.c
    httpd/httpd/trunk/server/util.c
    httpd/httpd/trunk/server/util_cookies.c

Modified: httpd/httpd/trunk/include/http_config.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_config.h?rev=1228323&r1=1228322&r2=1228323&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_config.h (original)
+++ httpd/httpd/trunk/include/http_config.h Fri Jan  6 18:15:08 2012
@@ -260,7 +260,7 @@ struct ap_configfile_t {
     /**< an apr_file_getc()-like function */
     apr_status_t (*getch) (char *ch, void *param);
     /**< an apr_file_gets()-like function */
-    apr_status_t (*getstr) (void *buf, size_t bufsiz, void *param);
+    apr_status_t (*getstr) (void *buf, apr_size_t bufsiz, void *param);
     /**< a close handler function */
     apr_status_t (*close) (void *param);
     /**< the argument passed to getch/getstr/close */
@@ -773,7 +773,7 @@ AP_DECLARE(ap_configfile_t *) ap_pcfg_op
     const char *descr,
     void *param,
     apr_status_t (*getc_func) (char *ch, void *param),
-    apr_status_t (*gets_func) (void *buf, size_t bufsiz, void *param),
+    apr_status_t (*gets_func) (void *buf, apr_size_t bufsiz, void *param),
     apr_status_t (*close_func) (void *param));
 
 /**
@@ -784,7 +784,7 @@ AP_DECLARE(ap_configfile_t *) ap_pcfg_op
  * @param cfp File to read from
  * @return error status, APR_ENOSPC if bufsize is too small for the line
  */
-AP_DECLARE(apr_status_t) ap_cfg_getline(char *buf, size_t bufsize, ap_configfile_t *cfp);
+AP_DECLARE(apr_status_t) ap_cfg_getline(char *buf, apr_size_t bufsize, ap_configfile_t *cfp);
 
 /**
  * Read one char from open configfile_t, increase line number upon LF

Modified: httpd/httpd/trunk/include/http_core.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_core.h?rev=1228323&r1=1228322&r2=1228323&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_core.h (original)
+++ httpd/httpd/trunk/include/http_core.h Fri Jan  6 18:15:08 2012
@@ -239,7 +239,7 @@ AP_DECLARE(apr_off_t) ap_get_limit_req_b
  * @param r The current request
  * @return the maximum number of bytes in XML request msg body
  */
-AP_DECLARE(size_t) ap_get_limit_xml_body(const request_rec *r);
+AP_DECLARE(apr_size_t) ap_get_limit_xml_body(const request_rec *r);
 
 /**
  * Install a custom response handler for a given status

Modified: httpd/httpd/trunk/include/http_protocol.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_protocol.h?rev=1228323&r1=1228322&r2=1228323&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_protocol.h (original)
+++ httpd/httpd/trunk/include/http_protocol.h Fri Jan  6 18:15:08 2012
@@ -209,8 +209,10 @@ AP_DECLARE(apr_status_t) ap_send_fd(apr_
  * @param length The amount of data to send
  * @return The number of bytes sent
  */
-AP_DECLARE(size_t) ap_send_mmap(apr_mmap_t *mm, request_rec *r, size_t offset,
-                             size_t length);
+AP_DECLARE(apr_size_t) ap_send_mmap(apr_mmap_t *mm,
+                                    request_rec *r,
+                                    apr_size_t offset,
+                                    apr_size_t length);
 #endif
 
 

Modified: httpd/httpd/trunk/include/httpd.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/httpd.h?rev=1228323&r1=1228322&r2=1228323&view=diff
==============================================================================
--- httpd/httpd/trunk/include/httpd.h (original)
+++ httpd/httpd/trunk/include/httpd.h Fri Jan  6 18:15:08 2012
@@ -1803,8 +1803,9 @@ AP_DECLARE(void) ap_pregfree(apr_pool_t 
  * @param pmatch the pmatch array returned from ap_pregex
  * @return The substituted string, or NULL on error
  */
-AP_DECLARE(char *) ap_pregsub(apr_pool_t *p, const char *input, const char *source,
-                              size_t nmatch, ap_regmatch_t pmatch[]);
+AP_DECLARE(char *) ap_pregsub(apr_pool_t *p, const char *input,
+                              const char *source, apr_size_t nmatch,
+                              ap_regmatch_t pmatch[]);
 
 /**
  * After performing a successful regex match, you may use this function to
@@ -1822,7 +1823,8 @@ AP_DECLARE(char *) ap_pregsub(apr_pool_t
  */
 AP_DECLARE(apr_status_t) ap_pregsub_ex(apr_pool_t *p, char **result,
                                        const char *input, const char *source,
-                                       size_t nmatch, ap_regmatch_t pmatch[],
+                                       apr_size_t nmatch,
+                                       ap_regmatch_t pmatch[],
                                        apr_size_t maxlen);
 
 /**

Modified: httpd/httpd/trunk/include/util_varbuf.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/util_varbuf.h?rev=1228323&r1=1228322&r2=1228323&view=diff
==============================================================================
--- httpd/httpd/trunk/include/util_varbuf.h (original)
+++ httpd/httpd/trunk/include/util_varbuf.h Fri Jan  6 18:15:08 2012
@@ -144,7 +144,8 @@ AP_DECLARE(char *) ap_varbuf_pdup(apr_po
  */
 AP_DECLARE(apr_status_t) ap_varbuf_regsub(struct ap_varbuf *vb,
                                           const char *input,
-                                          const char *source, size_t nmatch,
+                                          const char *source,
+                                          apr_size_t nmatch,
                                           ap_regmatch_t pmatch[],
                                           apr_size_t maxlen);
 

Modified: httpd/httpd/trunk/server/config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/config.c?rev=1228323&r1=1228322&r2=1228323&view=diff
==============================================================================
--- httpd/httpd/trunk/server/config.c (original)
+++ httpd/httpd/trunk/server/config.c Fri Jan  6 18:15:08 2012
@@ -1648,7 +1648,7 @@ typedef struct {
 
 
 /* arr_elts_getstr() returns the next line from the string array. */
-static apr_status_t arr_elts_getstr(void *buf, size_t bufsiz, void *param)
+static apr_status_t arr_elts_getstr(void *buf, apr_size_t bufsiz, void *param)
 {
     arr_elts_param_t *arr_param = (arr_elts_param_t *)param;
     char *elt;

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1228323&r1=1228322&r2=1228323&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Fri Jan  6 18:15:08 2012
@@ -64,7 +64,7 @@
 
 /* LimitXMLRequestBody handling */
 #define AP_LIMIT_UNSET                  ((long) -1)
-#define AP_DEFAULT_LIMIT_XML_BODY       ((size_t)1000000)
+#define AP_DEFAULT_LIMIT_XML_BODY       ((apr_size_t)1000000)
 
 #define AP_MIN_SENDFILE_BYTES           (256)
 
@@ -3347,7 +3347,7 @@ static const char *set_max_reversals(cmd
     return NULL;
 }
 
-AP_DECLARE(size_t) ap_get_limit_xml_body(const request_rec *r)
+AP_DECLARE(apr_size_t) ap_get_limit_xml_body(const request_rec *r)
 {
     core_dir_config *conf;
 
@@ -3355,7 +3355,7 @@ AP_DECLARE(size_t) ap_get_limit_xml_body
     if (conf->limit_xml_body == AP_LIMIT_UNSET)
         return AP_DEFAULT_LIMIT_XML_BODY;
 
-    return (size_t)conf->limit_xml_body;
+    return (apr_size_t)conf->limit_xml_body;
 }
 
 #if !defined (RLIMIT_CPU) || !(defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS))
|| !defined (RLIMIT_NPROC)

Modified: httpd/httpd/trunk/server/protocol.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/protocol.c?rev=1228323&r1=1228322&r2=1228323&view=diff
==============================================================================
--- httpd/httpd/trunk/server/protocol.c (original)
+++ httpd/httpd/trunk/server/protocol.c Fri Jan  6 18:15:08 2012
@@ -1462,8 +1462,10 @@ AP_DECLARE(apr_status_t) ap_send_fd(apr_
 
 #if APR_HAS_MMAP
 /* send data from an in-memory buffer */
-AP_DECLARE(size_t) ap_send_mmap(apr_mmap_t *mm, request_rec *r, size_t offset,
-                                size_t length)
+AP_DECLARE(apr_size_t) ap_send_mmap(apr_mmap_t *mm,
+                                    request_rec *r,
+                                    apr_size_t offset,
+                                    apr_size_t length)
 {
     conn_rec *c = r->connection;
     apr_bucket_brigade *bb = NULL;

Modified: httpd/httpd/trunk/server/request.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/request.c?rev=1228323&r1=1228322&r2=1228323&view=diff
==============================================================================
--- httpd/httpd/trunk/server/request.c (original)
+++ httpd/httpd/trunk/server/request.c Fri Jan  6 18:15:08 2012
@@ -1033,7 +1033,7 @@ AP_DECLARE(int) ap_directory_walk(reques
             seg_name = r->filename + filename_len;
             delim = strchr(r->path_info + (*r->path_info == '/' ? 1 : 0), '/');
             if (delim) {
-                size_t path_info_len = delim - r->path_info;
+                apr_size_t path_info_len = delim - r->path_info;
                 *delim = '\0';
                 memcpy(seg_name, r->path_info, path_info_len + 1);
                 filename_len += path_info_len;
@@ -1041,7 +1041,7 @@ AP_DECLARE(int) ap_directory_walk(reques
                 *delim = '/';
             }
             else {
-                size_t path_info_len = strlen(r->path_info);
+                apr_size_t path_info_len = strlen(r->path_info);
                 memcpy(seg_name, r->path_info, path_info_len + 1);
                 filename_len += path_info_len;
                 r->path_info += path_info_len;

Modified: httpd/httpd/trunk/server/util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util.c?rev=1228323&r1=1228322&r2=1228323&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util.c (original)
+++ httpd/httpd/trunk/server/util.c Fri Jan  6 18:15:08 2012
@@ -372,13 +372,13 @@ AP_DECLARE(const char *) ap_stripprefix(
 
 static apr_status_t regsub_core(apr_pool_t *p, char **result,
                                 struct ap_varbuf *vb, const char *input,
-                                const char *source, size_t nmatch,
+                                const char *source, apr_size_t nmatch,
                                 ap_regmatch_t pmatch[], apr_size_t maxlen)
 {
     const char *src = input;
     char *dst;
     char c;
-    size_t no;
+    apr_size_t no;
     apr_size_t len = 0;
 
     AP_DEBUG_ASSERT((result && p && !vb) || (vb && !p &&
!result));
@@ -465,7 +465,7 @@ static apr_status_t regsub_core(apr_pool
 #define AP_PREGSUB_MAXLEN   (HUGE_STRING_LEN * 8)
 #endif
 AP_DECLARE(char *) ap_pregsub(apr_pool_t *p, const char *input,
-                              const char *source, size_t nmatch,
+                              const char *source, apr_size_t nmatch,
                               ap_regmatch_t pmatch[])
 {
     char *result;
@@ -478,7 +478,7 @@ AP_DECLARE(char *) ap_pregsub(apr_pool_t
 
 AP_DECLARE(apr_status_t) ap_pregsub_ex(apr_pool_t *p, char **result,
                                        const char *input, const char *source,
-                                       size_t nmatch, ap_regmatch_t pmatch[],
+                                       apr_size_t nmatch, ap_regmatch_t pmatch[],
                                        apr_size_t maxlen)
 {
     apr_status_t rc = regsub_core(p, result, NULL, input, source, nmatch,
@@ -725,7 +725,7 @@ AP_DECLARE(char *) ap_getword_nulls(apr_
     char *res;
 
     if (!pos) {
-        size_t len = strlen(*line);
+        apr_size_t len = strlen(*line);
         res = apr_pstrmemdup(atrans, *line, len);
         *line += len;
         return res;
@@ -836,7 +836,7 @@ static apr_status_t cfg_getch(char *ch, 
     return apr_file_getc(ch, param);
 }
 
-static apr_status_t cfg_getstr(void *buf, size_t bufsiz, void *param)
+static apr_status_t cfg_getstr(void *buf, apr_size_t bufsiz, void *param)
 {
     return apr_file_gets(buf, bufsiz, param);
 }
@@ -926,7 +926,7 @@ AP_DECLARE(apr_status_t) ap_pcfg_openfil
 AP_DECLARE(ap_configfile_t *) ap_pcfg_open_custom(
             apr_pool_t *p, const char *descr, void *param,
             apr_status_t (*getc_func) (char *ch, void *param),
-            apr_status_t (*gets_func) (void *buf, size_t bufsize, void *param),
+            apr_status_t (*gets_func) (void *buf, apr_size_t bufsize, void *param),
             apr_status_t (*close_func) (void *param))
 {
     ap_configfile_t *new_cfg = apr_palloc(p, sizeof(*new_cfg));
@@ -962,7 +962,7 @@ AP_DECLARE(const char *) ap_pcfg_strerro
 
 /* Read one line from open ap_configfile_t, strip LF, increase line number */
 /* If custom handler does not define a getstr() function, read char by char */
-static apr_status_t ap_cfg_getline_core(char *buf, size_t bufsize,
+static apr_status_t ap_cfg_getline_core(char *buf, apr_size_t bufsize,
                                         ap_configfile_t *cfp)
 {
     apr_status_t rc;
@@ -970,7 +970,7 @@ static apr_status_t ap_cfg_getline_core(
     if (cfp->getstr != NULL) {
         char *cp;
         char *cbuf = buf;
-        size_t cbufsize = bufsize;
+        apr_size_t cbufsize = bufsize;
 
         while (1) {
             ++cfp->line_number;
@@ -1016,7 +1016,7 @@ static apr_status_t ap_cfg_getline_core(
         }
     } else {
         /* No "get string" function defined; read character by character */
-        size_t i = 0;
+        apr_size_t i = 0;
 
         if (bufsize < 2) {
             /* too small, assume caller is crazy */
@@ -1081,7 +1081,8 @@ static int cfg_trim_line(char *buf)
 
 /* Read one line from open ap_configfile_t, strip LF, increase line number */
 /* If custom handler does not define a getstr() function, read char by char */
-AP_DECLARE(apr_status_t) ap_cfg_getline(char *buf, size_t bufsize, ap_configfile_t *cfp)
+AP_DECLARE(apr_status_t) ap_cfg_getline(char *buf, apr_size_t bufsize,
+                                        ap_configfile_t *cfp)
 {
     apr_status_t rc = ap_cfg_getline_core(buf, bufsize, cfp);
     if (rc == APR_SUCCESS)
@@ -2723,7 +2724,8 @@ AP_DECLARE(char *) ap_varbuf_pdup(apr_po
 
 AP_DECLARE(apr_status_t) ap_varbuf_regsub(struct ap_varbuf *vb,
                                           const char *input,
-                                          const char *source, size_t nmatch,
+                                          const char *source,
+                                          apr_size_t nmatch,
                                           ap_regmatch_t pmatch[],
                                           apr_size_t maxlen)
 {

Modified: httpd/httpd/trunk/server/util_cookies.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_cookies.c?rev=1228323&r1=1228322&r2=1228323&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_cookies.c (original)
+++ httpd/httpd/trunk/server/util_cookies.c Fri Jan  6 18:15:08 2012
@@ -179,7 +179,7 @@ static int extract_cookie_line(ap_cookie
     char *last1, *last2;
     char *cookie = apr_pstrdup(v->r->pool, val);
     const char *name = apr_pstrcat(v->r->pool, v->name ? v->name : "", "=", NULL);
-    size_t len = strlen(name);
+    apr_size_t len = strlen(name);
     const char *new_cookie = "";
     const char *comma = ",";
     char *next1;



Mime
View raw message