Loading include/util_script.h +0 −11 Original line number Diff line number Diff line Loading @@ -160,17 +160,6 @@ AP_DECLARE(int) ap_scan_script_header_err_core(request_rec *r, char *buffer, 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 Loading modules/filters/mod_include.c +1 −28 Original line number Diff line number Diff line Loading @@ -1079,33 +1079,6 @@ static int find_file(request_rec *r, const char *directive, const char *tag, } } #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) { Loading Loading @@ -1134,7 +1107,7 @@ static int handle_fsize(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec 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 { Loading modules/generators/mod_autoindex.c +3 −2 Original line number Diff line number Diff line Loading @@ -1445,7 +1445,8 @@ static void output_directories(struct ent **ar, int n, } } 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)) { Loading modules/test/mod_autoindex.c +2 −1 Original line number Diff line number Diff line Loading @@ -1442,7 +1442,8 @@ static void output_directories(struct ent **ar, int n, } } 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)) { Loading server/util_script.c +0 −24 Original line number Diff line number Diff line Loading @@ -634,27 +634,3 @@ AP_DECLARE_NONSTD(int) ap_scan_script_header_err_strs(request_rec *r, 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); } } Loading
include/util_script.h +0 −11 Original line number Diff line number Diff line Loading @@ -160,17 +160,6 @@ AP_DECLARE(int) ap_scan_script_header_err_core(request_rec *r, char *buffer, 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 Loading
modules/filters/mod_include.c +1 −28 Original line number Diff line number Diff line Loading @@ -1079,33 +1079,6 @@ static int find_file(request_rec *r, const char *directive, const char *tag, } } #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) { Loading Loading @@ -1134,7 +1107,7 @@ static int handle_fsize(include_ctx_t *ctx, apr_bucket_brigade **bb, request_rec 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 { Loading
modules/generators/mod_autoindex.c +3 −2 Original line number Diff line number Diff line Loading @@ -1445,7 +1445,8 @@ static void output_directories(struct ent **ar, int n, } } 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)) { Loading
modules/test/mod_autoindex.c +2 −1 Original line number Diff line number Diff line Loading @@ -1442,7 +1442,8 @@ static void output_directories(struct ent **ar, int n, } } 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)) { Loading
server/util_script.c +0 −24 Original line number Diff line number Diff line Loading @@ -634,27 +634,3 @@ AP_DECLARE_NONSTD(int) ap_scan_script_header_err_strs(request_rec *r, 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); } }