You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Victor J. Orlikowski" <v....@gte.net> on 2000/11/27 23:01:46 UTC
[PATCH] *Sigh* More apr_ssize_t/apr_size_t cleanups
Just a patch to clean-up variable usage.
Index: src/main/http_core.c
===================================================================
RCS file: /cvs/apache/apache-2.0/src/main/http_core.c,v
retrieving revision 1.225
diff -u -d -r1.225 http_core.c
--- http_core.c 2000/11/26 04:47:30 1.225
+++ http_core.c 2000/11/27 21:58:17
@@ -2596,7 +2596,7 @@
&timeout) == APR_SUCCESS) &&
timeout > 0); /* socket must be in timeout mode */
do {
- apr_ssize_t tmplen = file_bytes_left;
+ apr_size_t tmplen = file_bytes_left;
rv = apr_sendfile(c->client_socket, fd, hdtr, &file_offset, &tmplen,
flags);
Index: src/modules/standard/mod_include.c
===================================================================
RCS file: /cvs/apache/apache-2.0/src/modules/standard/mod_include.c,v
retrieving revision 1.77
diff -u -d -r1.77 mod_include.c
--- mod_include.c 2000/11/26 04:47:36 1.77
+++ mod_include.c 2000/11/27 21:58:17
@@ -165,7 +165,7 @@
static ap_bucket *find_start_sequence(ap_bucket *dptr, include_ctx_t *ctx,
ap_bucket_brigade *bb, int *do_cleanup)
{
- apr_ssize_t len;
+ apr_size_t len;
const char *c;
const char *buf;
const char *str = STARTING_SEQUENCE;
@@ -194,7 +194,7 @@
else {
if (str[ctx->parse_pos] == '\0') {
ap_bucket *tmp_bkt;
- apr_ssize_t start_index;
+ apr_size_t start_index;
/* We want to split the bucket at the '<'. */
ctx->state = PARSE_TAG;
@@ -245,7 +245,7 @@
static ap_bucket *find_end_sequence(ap_bucket *dptr, include_ctx_t *ctx, ap_bucket_brigade *bb)
{
- apr_ssize_t len;
+ apr_size_t len;
const char *c;
const char *buf;
const char *str = ENDING_SEQUENCE;
@@ -344,7 +344,7 @@
int done = 0;
ap_bucket *dptr;
const char *tmp_from;
- apr_ssize_t tmp_from_len;
+ apr_size_t tmp_from_len;
/* If the tag length is longer than the tmp buffer, allocate space. */
if (ctx->tag_length > tmp_buf_size-1) {
@@ -770,7 +771,7 @@
rr_status = ap_run_sub_req(rr);
if (ap_is_HTTP_REDIRECT(rr_status)) {
- apr_ssize_t len_loc, h_wrt;
+ apr_size_t len_loc, h_wrt;
const char *location = apr_table_get(rr->headers_out, "Location");
location = ap_escape_html(rr->pool, location);
@@ -1186,7 +1187,7 @@
char *tag_val = NULL;
const char *echo_text = NULL;
ap_bucket *tmp_buck;
- apr_ssize_t e_len, e_wrt;
+ apr_size_t e_len, e_wrt;
enum {E_NONE, E_URL, E_ENTITY} encode;
encode = E_ENTITY;
@@ -1426,10 +1427,10 @@
#define ZERO_K " 0k"
#define ONE_K " 1k"
-static void generate_size(apr_ssize_t size, char *buff, apr_ssize_t buff_size)
+static void generate_size(apr_size_t size, char *buff, apr_size_t buff_size)
{
/* XXX: this -1 thing is a gross hack */
- if (size == (apr_ssize_t)-1) {
+ if (size == (apr_size_t)-1) {
memcpy (buff, NEG_SIGN, sizeof(NEG_SIGN)+1);
}
else if (!size) {
@@ -1455,7 +1456,7 @@
char *tag = NULL;
char *tag_val = NULL;
apr_finfo_t finfo;
- apr_ssize_t s_len, s_wrt;
+ apr_size_t s_len, s_wrt;
ap_bucket *tmp_buck;
char parsed_string[MAX_STRING_LEN];
@@ -1517,7 +1518,7 @@
char *tag = NULL;
char *tag_val = NULL;
apr_finfo_t finfo;
- apr_ssize_t t_len, t_wrt;
+ apr_size_t t_len, t_wrt;
ap_bucket *tmp_buck;
char parsed_string[MAX_STRING_LEN];
@@ -1764,7 +1765,7 @@
char buffer[MAX_STRING_LEN];
apr_pool_t *expr_pool;
int retval = 0;
- apr_ssize_t debug_pos = 0;
+ apr_size_t debug_pos = 0;
debug[debug_pos] = '\0';
*was_error = 0;
@@ -2349,7 +2350,7 @@
#define LOG_COND_STATUS(cntx, t_buck, h_ptr, ins_head, tag_text) \
{ \
char *cond_txt = "**** X conditional_status=\"0\"\n"; \
- apr_ssize_t c_wrt; \
+ apr_size_t c_wrt; \
\
if (cntx->flags & FLAG_COND_TRUE) { \
cont_txt[31] = '1'; \
@@ -2364,7 +2365,7 @@
}
#define DUMP_PARSE_EXPR_DEBUG(t_buck, h_ptr, d_buf, ins_head) \
{ \
- apr_ssize_t b_wrt; \
+ apr_size_t b_wrt; \
if (d_buf[0] != '\0') { \
t_buck = ap_bucket_create_heap(d_buf, strlen(d_buf), 1, &b_wrt); \
AP_BUCKET_INSERT_BEFORE(h_ptr, t_buck); \
@@ -2433,7 +2434,7 @@
expr = tag_val;
#ifdef DEBUG_INCLUDE
if (1) {
- apr_ssize_t d_len = 0, d_wrt = 0;
+ apr_size_t d_len = 0, d_wrt = 0;
d_len = sprintf(debug_buf, "**** if expr=\"%s\"\n", expr);
tmp_buck = ap_bucket_create_heap(debug_buf, d_len, 1, &d_wrt);
AP_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck);
@@ -2506,7 +2507,7 @@
expr = tag_val;
#ifdef DEBUG_INCLUDE
if (1) {
- apr_ssize_t d_len = 0, d_wrt = 0;
+ apr_size_t d_len = 0, d_wrt = 0;
d_len = sprintf(debug_buf, "**** elif expr=\"%s\"\n", expr);
tmp_buck = ap_bucket_create_heap(debug_buf, d_len, 1, &d_wrt);
AP_BUCKET_INSERT_BEFORE(head_ptr, tmp_buck);
@@ -2647,7 +2648,7 @@
apr_table_entry_t *elts = (apr_table_entry_t *)arr->elts;
int i;
char *key_text, *val_text;
- apr_ssize_t k_len, v_len, t_wrt;
+ apr_size_t k_len, v_len, t_wrt;
*inserted_head = NULL;
for (i = 0; i < arr->nelts; ++i) {
@@ -2710,7 +2711,7 @@
/* State to check for the STARTING_SEQUENCE. */
if ((ctx->state == PRE_HEAD) || (ctx->state == PARSE_HEAD)) {
int do_cleanup = 0;
- apr_ssize_t cleanup_bytes = ctx->parse_pos;
+ apr_size_t cleanup_bytes = ctx->parse_pos;
tmp_dptr = find_start_sequence(dptr, ctx, *bb, &do_cleanup);
Index: src/modules/standard/mod_include.h
===================================================================
RCS file: /cvs/apache/apache-2.0/src/modules/standard/mod_include.h,v
retrieving revision 1.1
diff -u -d -r1.1 mod_include.h
--- mod_include.h 2000/11/22 19:49:20 1.1
+++ mod_include.h 2000/11/27 21:58:17
@@ -183,7 +183,7 @@
#define CREATE_ERROR_BUCKET(cntx, t_buck, h_ptr, ins_head) \
{ \
- apr_ssize_t e_wrt; \
+ apr_size_t e_wrt; \
t_buck = ap_bucket_create_heap(cntx->error_str, \
ctx->error_length, 1, &e_wrt); \
AP_BUCKET_INSERT_BEFORE(h_ptr, t_buck); \
Victor
--
Victor J. Orlikowski
======================
v.j.orlikowski@gte.net
vjo@raleigh.ibm.com
vjo@us.ibm.com
Re: [PATCH] *Sigh* More apr_ssize_t/apr_size_t cleanups
Posted by "Victor J. Orlikowski" <v....@gte.net>.
Yep. Just happened to miss them. *Sigh*. Mind on other things.....
Victor
--
Victor J. Orlikowski
======================
v.j.orlikowski@gte.net
vjo@raleigh.ibm.com
vjo@us.ibm.com
Re: [PATCH] *Sigh* More apr_ssize_t/apr_size_t cleanups
Posted by Jeff Trawick <tr...@bellsouth.net>.
"Victor J. Orlikowski" <v....@gte.net> writes:
> Just a patch to clean-up variable usage.
>
> Index: src/main/http_core.c
committed...
> Index: src/modules/standard/mod_include.c
I fixed many of these already, but see comments below...
> ===================================================================
> RCS file: /cvs/apache/apache-2.0/src/modules/standard/mod_include.c,v
> retrieving revision 1.77
> diff -u -d -r1.77 mod_include.c
> --- mod_include.c 2000/11/26 04:47:36 1.77
> +++ mod_include.c 2000/11/27 21:58:17
> @@ -194,7 +194,7 @@
> else {
> if (str[ctx->parse_pos] == '\0') {
> ap_bucket *tmp_bkt;
> - apr_ssize_t start_index;
> + apr_size_t start_index;
Wouldn't you want to change structure fields tag_start_index and
head_start_index too for this to make sense?
> @@ -1426,10 +1427,10 @@
> #define ZERO_K " 0k"
> #define ONE_K " 1k"
>
> -static void generate_size(apr_ssize_t size, char *buff, apr_ssize_t buff_size)
> +static void generate_size(apr_size_t size, char *buff, apr_size_t buff_size)
> {
> /* XXX: this -1 thing is a gross hack */
> - if (size == (apr_ssize_t)-1) {
> + if (size == (apr_size_t)-1) {
> memcpy (buff, NEG_SIGN, sizeof(NEG_SIGN)+1);
> }
> else if (!size) {
Maybe we can dispense with the check for -1 also. I don't see such
calls to generate_size().
...
Tonight or tomorrow I'll go through the stuff that isn't committed yet
and get it committed, maybe with some tweaks to the code I commented
on above.
Thanks,
--
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
http://www.geocities.com/SiliconValley/Park/9289/
Born in Roswell... married an alien...