]> granicus.if.org Git - apache/commitdiff
Convert a lot of apr_ssize_t to apr_size_t. We don't ever accept or return
authorRyan Bloom <rbb@apache.org>
Tue, 7 Nov 2000 20:21:55 +0000 (20:21 +0000)
committerRyan Bloom <rbb@apache.org>
Tue, 7 Nov 2000 20:21:55 +0000 (20:21 +0000)
signed values in these integers, and we return the error codes directly,
so we should always report the number of bytes read/written correctly.  If
we have an error, that is 0 bytes.  If that is true, then using signed
values doesn't make any sense.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86857 13f79535-47bb-0310-9956-ffa450edef68

modules/http/http_core.c
modules/http/http_protocol.c
server/connection.c
server/rfc1413.c
server/util_md5.c

index 5c9553479d371b5cfd028e75d1d8c068b35e0f28..5a58faed8f10e51ce72729a30a1a2fe371552b67 100644 (file)
@@ -2560,12 +2560,12 @@ static const char *set_limit_nproc(cmd_parms *cmd, void *conf_,
 #endif
 
 static apr_status_t writev_it_all(apr_socket_t *s, struct iovec *vec, int nvec, 
-                                  apr_ssize_t len, apr_ssize_t *nbytes)
+                                  apr_size_t len, apr_size_t *nbytes)
 {
     apr_size_t bytes_written = 0;
     apr_status_t rv;
-    apr_ssize_t n = len;
-    apr_ssize_t i = 0;
+    apr_size_t n = len;
+    apr_size_t i = 0;
 
     *nbytes = 0;
 
@@ -2607,12 +2607,12 @@ static apr_status_t writev_it_all(apr_socket_t *s, struct iovec *vec, int nvec,
  */
 static apr_status_t send_the_file(conn_rec *c, apr_file_t *fd, 
                                   apr_hdtr_t *hdtr, apr_off_t offset, 
-                                  apr_ssize_t length, apr_ssize_t *nbytes) 
+                                  apr_size_t length, apr_size_t *nbytes) 
 {
     apr_status_t rv = APR_SUCCESS;
     apr_int32_t togo;         /* Remaining number of bytes in the file to send */
-    apr_ssize_t sendlen = 0;
-    apr_ssize_t bytes_sent;
+    apr_size_t sendlen = 0;
+    apr_size_t bytes_sent;
     apr_int32_t i;
     apr_off_t o;              /* Track the file offset for partial writes */
     char buffer[8192];
@@ -3071,8 +3071,8 @@ static int default_handler(request_rec *r)
 typedef struct COALESCE_FILTER_CTX {
     char *buf;           /* Start of buffer */
     char *cur;           /* Pointer to next location to write */
-    apr_ssize_t cnt;     /* Number of bytes put in buf */
-    apr_ssize_t avail;   /* Number of bytes available in the buf */
+    apr_size_t cnt;     /* Number of bytes put in buf */
+    apr_size_t avail;   /* Number of bytes available in the buf */
 } coalesce_filter_ctx_t;
 #define FILTER_BUFF_SIZE 8192
 #define MIN_BUCKET_SIZE 200
@@ -3107,7 +3107,7 @@ static apr_status_t coalesce_filter(ap_filter_t *f, ap_bucket_brigade *b)
         }
         else {
             const char *str;
-            apr_ssize_t n;
+            apr_size_t n;
             rv = ap_bucket_read(e, &str, &n, AP_BLOCK_READ);
             if (rv != APR_SUCCESS) {
                 /* XXX: log error */
@@ -3220,7 +3220,7 @@ static apr_status_t chunk_filter(ap_filter_t *f, ap_bucket_brigade *b)
            else if (e->length == -1) {
                 /* unknown amount of data (e.g. a pipe) */
                const char *data;
-               apr_ssize_t len;
+               apr_size_t len;
 
                rv = ap_bucket_read(e, &data, &len, AP_BLOCK_READ);
                if (rv != APR_SUCCESS) {
@@ -3343,18 +3343,18 @@ static apr_status_t core_output_filter(ap_filter_t *f, ap_bucket_brigade *b)
 {
     apr_status_t rv;
     ap_bucket_brigade *more = NULL;
-    apr_ssize_t bytes_sent = 0, nbytes;
+    apr_size_t bytes_sent = 0, nbytes;
     ap_bucket *e;
     conn_rec *c = f->c;
     core_output_filter_ctx_t *ctx = f->ctx;
 
-    apr_ssize_t nvec = 0;
-    apr_ssize_t nvec_trailers= 0;
+    apr_size_t nvec = 0;
+    apr_size_t nvec_trailers= 0;
     struct iovec vec[MAX_IOVEC_TO_WRITE];
     struct iovec vec_trailers[MAX_IOVEC_TO_WRITE];
 
     apr_file_t *fd = NULL;
-    apr_ssize_t flen = 0;
+    apr_size_t flen = 0;
     apr_off_t foffset = 0;
 
     if (ctx == NULL) {
@@ -3384,7 +3384,7 @@ static apr_status_t core_output_filter(ap_filter_t *f, ap_bucket_brigade *b)
             }
             else {
                 const char *str;
-                apr_ssize_t n;
+                apr_size_t n;
                 rv = ap_bucket_read(e, &str, &n, AP_BLOCK_READ);
                 if (n) {
                     nbytes += n;
index b18d2583164abb9118690a32019f163c4f8b4ebc..56fa330d06c8f4c4490e42564b61dddc2e539e8a 100644 (file)
@@ -806,8 +806,8 @@ AP_DECLARE(const char *) ap_method_name_of(int methnum)
 }
 
 struct dechunk_ctx {
-    apr_ssize_t chunk_size;
-    apr_ssize_t bytes_delivered;
+    apr_size_t chunk_size;
+    apr_size_t bytes_delivered;
     enum {WANT_HDR /* must have value zero */, WANT_BODY, WANT_TRL} state;
 };
 
@@ -821,7 +821,7 @@ apr_status_t ap_dechunk_filter(ap_filter_t *f, ap_bucket_brigade *bb,
     struct dechunk_ctx *ctx = f->ctx;
     ap_bucket *b;
     const char *buf;
-    apr_ssize_t len;
+    apr_size_t len;
 
     if (!ctx) {
         f->ctx = ctx = apr_pcalloc(f->r->pool, sizeof(struct dechunk_ctx));
@@ -907,7 +907,7 @@ apr_status_t ap_http_filter(ap_filter_t *f, ap_bucket_brigade *b, ap_input_mode_
 #define ASCII_TAB    '\011' 
     ap_bucket *e;
     char *buff;
-    apr_ssize_t len;
+    apr_size_t len;
     char *pos;
     http_ctx_t *ctx = f->ctx;
     apr_status_t rv;
@@ -1031,7 +1031,7 @@ static int getline(char *s, int n, request_rec *r, int fold)
     int retval;
     int total = 0;
     int looking_ahead = 0;
-    apr_ssize_t length;
+    apr_size_t length;
     conn_rec *c = r->connection;
     core_request_config *req_cfg;
     ap_bucket_brigade *b;
@@ -2278,7 +2278,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(ap_filter_t *f,
 
     AP_BRIGADE_FOREACH(e, b) {
         const char *ignored;
-        apr_ssize_t length;
+        apr_size_t length;
 
         if (AP_BUCKET_IS_EOS(e) || AP_BUCKET_IS_FLUSH(e)) {
             ctx->hold_data = 0;
@@ -2629,7 +2629,7 @@ static long get_chunk_size(char *b)
  */
 AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz)
 {
-    apr_ssize_t len_read, total;
+    apr_size_t len_read, total;
     apr_status_t rv;
     ap_bucket *b, *old;
     const char *tempbuf;
@@ -2841,7 +2841,7 @@ AP_DECLARE(int) ap_rwrite(const void *buf, int nbyte, request_rec *r)
 AP_DECLARE(int) ap_vrprintf(request_rec *r, const char *fmt, va_list va)
 {
     ap_bucket_brigade *bb = NULL;
-    apr_ssize_t written;
+    apr_size_t written;
 
     if (r->connection->aborted)
         return EOF;
@@ -2874,7 +2874,7 @@ AP_DECLARE_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt, ...)
 AP_DECLARE_NONSTD(int) ap_rvputs(request_rec *r, ...)
 {
     ap_bucket_brigade *bb = NULL;
-    apr_ssize_t written;
+    apr_size_t written;
     va_list va;
 
     if (r->connection->aborted)
index 27812d58d51acc6e4498eadde6508c54d5985296..b6a1b1a53cd0495170b8e6c0ec64407a9edd931f 100644 (file)
@@ -156,7 +156,7 @@ void ap_lingering_close(conn_rec *c)
 {
     char dummybuf[512];
     apr_time_t start;
-    apr_ssize_t nbytes;
+    apr_size_t nbytes;
     apr_status_t rc;
     int timeout;
 
index 500553334c3114dd3fdf17ce0483f43e1dcdbfc5..100870572392e96d92ebe18cf4c7f2f6437c5665 100644 (file)
@@ -158,7 +158,7 @@ static int get_rfc1413(apr_socket_t *sock, const char *local_ip,
     /* send query to server. Handle short write. */
     i = 0;
     while(i < strlen(buffer)) {
-        apr_ssize_t j = strlen(buffer + i);
+        apr_size_t j = strlen(buffer + i);
         apr_status_t status;
        status  = apr_send(sock, buffer+i, &j);
        if (status != APR_SUCCESS && !APR_STATUS_IS_EINTR(status)) {
@@ -184,7 +184,7 @@ static int get_rfc1413(apr_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) {
-        apr_ssize_t j = sizeof(buffer) - 1 - i;
+        apr_size_t j = sizeof(buffer) - 1 - i;
         apr_status_t status;
        status = apr_recv(sock, buffer+i, &j);
        if (status != APR_SUCCESS && !APR_STATUS_IS_EINTR(status)) {
index 03cbb104b62b0a10d5327eb03b26e52318d282bc..b1957a84270d1a12b3ecc9c5558e871921875c27 100644 (file)
@@ -200,7 +200,7 @@ AP_DECLARE(char *) ap_md5digest(apr_pool_t *p, apr_file_t *infile)
     apr_md5_ctx_t context;
     unsigned char buf[1000];
     long length = 0;
-    apr_ssize_t nbytes;
+    apr_size_t nbytes;
     apr_off_t offset = 0L;
 
     apr_MD5Init(&context);