From 9030edb03bb979dbc20aba87d69c75a3a175827f Mon Sep 17 00:00:00 2001 From: Ben Laurie Date: Sun, 24 Oct 1999 19:24:13 +0000 Subject: [PATCH] Size rigour. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84032 13f79535-47bb-0310-9956-ffa450edef68 --- include/util_script.h | 2 +- modules/generators/mod_autoindex.c | 6 ++++-- modules/http/http_protocol.c | 2 +- modules/loggers/mod_log_config.c | 2 +- server/rfc1413.c | 4 ++-- server/util_script.c | 8 ++++---- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/include/util_script.h b/include/util_script.h index 5fc64ccd38..6ef075aa9e 100644 --- a/include/util_script.h +++ b/include/util_script.h @@ -80,7 +80,7 @@ API_EXPORT(int) ap_scan_script_header_err_buff(request_rec *r, BUFF *f, API_EXPORT(int) ap_scan_script_header_err_core(request_rec *r, char *buffer, int (*getsfunc) (char *, int, void *), void *getsfunc_data); -API_EXPORT(void) ap_send_size(size_t size, request_rec *r); +API_EXPORT(void) ap_send_size(ap_ssize_t size, request_rec *r); API_EXPORT(int) ap_call_exec(request_rec *r, ap_child_info_t *pinfo, char *argv0, char **env, int shellcmd); diff --git a/modules/generators/mod_autoindex.c b/modules/generators/mod_autoindex.c index 6f1ea1c1c8..1077fe5c35 100644 --- a/modules/generators/mod_autoindex.c +++ b/modules/generators/mod_autoindex.c @@ -887,7 +887,8 @@ static int ignore_entry(autoindex_config_rec *d, char *path) static void do_emit_plain(request_rec *r, ap_file_t *f) { char buf[IOBUFSIZE + 1]; - int i, n, c, ch; + int i, c, ch; + ap_ssize_t n; ap_status_t stat; ap_rputs("
\n", r);
@@ -1080,7 +1081,8 @@ static char *find_title(request_rec *r)
 {
     char titlebuf[MAX_STRING_LEN], *find = "";
     ap_file_t *thefile = NULL;
-    int x, y, n, p;
+    int x, y, p;
+    ap_ssize_t n;
 
     if (r->status != HTTP_OK) {
 	return NULL;
diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c
index 4e5d2bac0a..66497f188f 100644
--- a/modules/http/http_protocol.c
+++ b/modules/http/http_protocol.c
@@ -2012,7 +2012,7 @@ API_EXPORT(long) ap_send_fd_length(ap_file_t *fd, request_rec *r, long length)
     char buf[IOBUFSIZE];
     long total_bytes_sent = 0;
     register int w, o;
-    int n;
+    ap_ssize_t n;
     ap_status_t status;
 
     if (length == 0)
diff --git a/modules/loggers/mod_log_config.c b/modules/loggers/mod_log_config.c
index 636645bbe9..4d173862e6 100644
--- a/modules/loggers/mod_log_config.c
+++ b/modules/loggers/mod_log_config.c
@@ -739,7 +739,7 @@ static int config_log_transaction(request_rec *r, config_log_state *cls,
     int *strl;
     request_rec *orig;
     int i;
-    int len = 0;
+    ap_ssize_t len = 0;
     ap_array_header_t *format;
     char *envar;
 
diff --git a/server/rfc1413.c b/server/rfc1413.c
index 30564dca82..8c73b912ef 100644
--- a/server/rfc1413.c
+++ b/server/rfc1413.c
@@ -155,7 +155,7 @@ static int get_rfc1413(ap_socket_t *sock, const char *local_ip,
 #endif
     i = 0;
     while(i < strlen(buffer)) {
-        int j = strlen(buffer + i);
+        ap_ssize_t j = strlen(buffer + i);
         ap_status_t status;
 	status  = ap_send(sock, buffer+i, &j);
 	if (status != APR_SUCCESS && status != APR_EINTR) {
@@ -181,7 +181,7 @@ static int get_rfc1413(ap_socket_t *sock, const char *local_ip,
      * this allows it to work on both ASCII and EBCDIC machines.
      */
     while((cp = strchr(buffer, '\012')) == NULL && i < sizeof(buffer) - 1) {
-        int j = sizeof(buffer) - 1 - i;
+        ap_ssize_t j = sizeof(buffer) - 1 - i;
         ap_status_t status;
 	status = ap_recv(sock, buffer+i, &j);
 	if (status != APR_SUCCESS && status != APR_EINTR) {
diff --git a/server/util_script.c b/server/util_script.c
index 08bf8dc399..187d9015e7 100644
--- a/server/util_script.c
+++ b/server/util_script.c
@@ -626,10 +626,10 @@ API_EXPORT(int) ap_scan_script_header_err_buff(request_rec *r, BUFF *fb,
 }
 
 
-API_EXPORT(void) ap_send_size(size_t size, request_rec *r)
+API_EXPORT(void) ap_send_size(ap_ssize_t size, request_rec *r)
 {
     /* XXX: this -1 thing is a gross hack */
-    if (size == (size_t)-1) {
+    if (size == (ap_ssize_t)-1) {
 	ap_rputs("    -", r);
     }
     else if (!size) {
@@ -639,13 +639,13 @@ API_EXPORT(void) ap_send_size(size_t size, request_rec *r)
 	ap_rputs("   1k", r);
     }
     else if (size < 1048576) {
-	ap_rprintf(r, "%4dk", (size + 512) / 1024);
+	ap_rprintf(r, "%4ldk", (size + 512) / 1024);
     }
     else if (size < 103809024) {
 	ap_rprintf(r, "%4.1fM", size / 1048576.0);
     }
     else {
-	ap_rprintf(r, "%4dM", (size + 524288) / 1048576);
+	ap_rprintf(r, "%4ldM", (size + 524288) / 1048576);
     }
 }