httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: httpd-2.0/server util_script.c
Date Wed, 25 Jul 2001 21:34:15 GMT
wrowe       01/07/25 14:34:15

  Modified:    include  util_script.h
               modules/filters mod_include.c
               modules/generators mod_autoindex.c
               modules/test mod_autoindex.c
               server   util_script.c
  Log:
    Change over to apr_strfsize() for apr_off_t file size formatting.
  
  Revision  Changes    Path
  1.15      +0 -11     httpd-2.0/include/util_script.h
  
  Index: util_script.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/util_script.h,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- util_script.h	2001/02/16 04:26:31	1.14
  +++ util_script.h	2001/07/25 21:34:15	1.15
  @@ -160,17 +160,6 @@
   				       int (*getsfunc) (char *, int, void *),
   				       void *getsfunc_data);
   
  -/**
  - * Convert the file size given in size into a formatted string and send the
  - * string to the client.  The size should always be in bytes, although the
  - * string sent to the client may be in bytes, kb, or MB, depending on the size
  - * of the file.
  - * @param size The size of the file
  - * @param r The currnt request
  - * @deffunc void ap_send_size(apr_ssize_t size, request_rec *r)
  - */
  -AP_DECLARE(void) ap_send_size(apr_ssize_t size, request_rec *r);
  -
   #ifdef __cplusplus
   }
   #endif
  
  
  
  1.115     +1 -28     httpd-2.0/modules/filters/mod_include.c
  
  Index: mod_include.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/filters/mod_include.c,v
  retrieving revision 1.114
  retrieving revision 1.115
  diff -u -r1.114 -r1.115
  --- mod_include.c	2001/07/23 13:45:44	1.114
  +++ mod_include.c	2001/07/25 21:34:15	1.115
  @@ -1079,33 +1079,6 @@
       }
   }
   
  -#define NEG_SIGN  "    -"
  -#define ZERO_K    "   0k"
  -#define ONE_K     "   1k"
  -
  -static void generate_size(apr_ssize_t size, char *buff, apr_size_t buff_size)
  -{
  -    /* XXX: this -1 thing is a gross hack */
  -    if (size == (apr_ssize_t)-1) {
  -	memcpy (buff, NEG_SIGN, sizeof(NEG_SIGN)+1);
  -    }
  -    else if (!size) {
  -	memcpy (buff, ZERO_K, sizeof(ZERO_K)+1);
  -    }
  -    else if (size < 1024) {
  -	memcpy (buff, ONE_K, sizeof(ONE_K)+1);
  -    }
  -    else if (size < 1048576) {
  -        apr_snprintf(buff, buff_size, "%4" APR_SSIZE_T_FMT "k", (size + 512) / 1024);
  -    }
  -    else if (size < 103809024) {
  -        apr_snprintf(buff, buff_size, "%4.1fM", size / 1048576.0);
  -    }
  -    else {
  -        apr_snprintf(buff, buff_size, "%4" APR_SSIZE_T_FMT "M", (size + 524288) / 1048576);
  -    }
  -}
  -
   static int handle_fsize(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec *r,
                           ap_filter_t *f, apr_bucket *head_ptr, apr_bucket **inserted_head)
   {
  @@ -1134,7 +1107,7 @@
                       char buff[50];
   
                       if (!(ctx->flags & FLAG_SIZE_IN_BYTES)) {
  -                        generate_size(finfo.size, buff, sizeof(buff));
  +                        apr_strfsize(finfo.size, buff);
                           s_len = strlen (buff);
                       }
                       else {
  
  
  
  1.67      +3 -2      httpd-2.0/modules/generators/mod_autoindex.c
  
  Index: mod_autoindex.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_autoindex.c,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- mod_autoindex.c	2001/07/24 20:38:01	1.66
  +++ mod_autoindex.c	2001/07/25 21:34:15	1.67
  @@ -1355,7 +1355,7 @@
   	if (!(autoindex_opts & SUPPRESS_LAST_MOD)) {
               emit_link(r, "Last modified", K_LAST_MOD, keyid, direction,
                         static_columns);
  -	    ap_rputs("       ", r);
  +	    ap_rputs("      ", r);
   	}
   	if (!(autoindex_opts & SUPPRESS_SIZE)) {
               emit_link(r, "Size", K_SIZE, keyid, direction, static_columns);
  @@ -1445,7 +1445,8 @@
   		}
   	    }
   	    if (!(autoindex_opts & SUPPRESS_SIZE)) {
  -		ap_send_size(ar[x]->size, r);
  +                char buf[5];
  +		ap_rputs(apr_strfsize(ar[x]->size, buf), r);
   		ap_rputs("  ", r);
   	    }
   	    if (!(autoindex_opts & SUPPRESS_DESC)) {
  
  
  
  1.12      +2 -1      httpd-2.0/modules/test/mod_autoindex.c
  
  Index: mod_autoindex.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/test/mod_autoindex.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- mod_autoindex.c	2001/02/28 15:24:08	1.11
  +++ mod_autoindex.c	2001/07/25 21:34:15	1.12
  @@ -1442,7 +1442,8 @@
   		}
   	    }
   	    if (!(autoindex_opts & SUPPRESS_SIZE)) {
  -		ap_send_size(ar[x]->size, r);
  +		char buf[5];
  +		ap_rputs(apr_strfsize(ar[x]->size, buf), r);
   		ap_rputs("  ", r);
   	    }
   	    if (!(autoindex_opts & SUPPRESS_DESC)) {
  
  
  
  1.60      +0 -24     httpd-2.0/server/util_script.c
  
  Index: util_script.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/util_script.c,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- util_script.c	2001/07/25 00:49:36	1.59
  +++ util_script.c	2001/07/25 21:34:15	1.60
  @@ -634,27 +634,3 @@
       va_end(strs.args);
       return res;
   }
  -
  -AP_DECLARE(void) ap_send_size(apr_ssize_t size, request_rec *r)
  -{
  -    /* XXX: this -1 thing is a gross hack */
  -    if (size == (apr_ssize_t)-1) {
  -	ap_rputs("    -", r);
  -    }
  -    else if (!size) {
  -	ap_rputs("   0k", r);
  -    }
  -    else if (size < 1024) {
  -	ap_rputs("   1k", r);
  -    }
  -    else if (size < 1048576) {
  -	ap_rprintf(r, "%4" APR_SSIZE_T_FMT "k", (size + 512) / 1024);
  -    }
  -    else if (size < 103809024) {
  -	ap_rprintf(r, "%4.1fM", size / 1048576.0);
  -    }
  -    else {
  -	ap_rprintf(r, "%4" APR_SSIZE_T_FMT "M", (size + 524288) / 1048576);
  -    }
  -}
  -
  
  
  

Mime
View raw message