Skip to content

Commit f747a4b

Browse files
author
Allan K. Edwards
committed
WIN64: API changes to clean up Windows 64bit compile warnings
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@105545 13f79535-47bb-0310-9956-ffa450edef68
1 parent f674ab7 commit f747a4b

13 files changed

Lines changed: 84 additions & 68 deletions

File tree

CHANGES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev
22

33
[Remove entries to the current 2.0 section below, when backported]
44

5+
*) WIN64: API changes to clean up Windows 64bit compile warnings
6+
[Allan Edwards]
7+
58
*) mod_cache: CacheDisable will only disable the URLs it was meant to
69
disable, not all caching. PR 31128.
710
[Edward Rudd <eddie omegaware.com>, Paul Querna]

include/ap_mmn.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,15 @@
8484
* changed ap_add_module, ap_add_loaded_module,
8585
* ap_setup_prelinked_modules, ap_process_resource_config
8686
* 20040425.1 (2.1.0-dev) Added ap_module_symbol_t and ap_prelinked_module_symbols
87+
* 20041022 (2.1.0-dev) API changes to clean up 64bit compiles
8788
*/
8889

8990
#define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */
9091

9192
#ifndef MODULE_MAGIC_NUMBER_MAJOR
92-
#define MODULE_MAGIC_NUMBER_MAJOR 20040425
93+
#define MODULE_MAGIC_NUMBER_MAJOR 20041022
9394
#endif
94-
#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */
95+
#define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */
9596

9697
/**
9798
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a

include/http_protocol.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,9 @@ AP_DECLARE(int) ap_rputc(int c, request_rec *r);
338338
* @param str The string to output
339339
* @param r The current request
340340
* @return The number of bytes sent
341-
* @deffunc int ap_rputs(const char *str, request_rec *r)
341+
* @deffunc apr_ssize_t ap_rputs(const char *str, request_rec *r)
342342
*/
343-
AP_DECLARE(int) ap_rputs(const char *str, request_rec *r);
343+
AP_DECLARE(apr_ssize_t) ap_rputs(const char *str, request_rec *r);
344344

345345
/**
346346
* Write a buffer for the current request
@@ -357,29 +357,29 @@ AP_DECLARE(int) ap_rwrite(const void *buf, int nbyte, request_rec *r);
357357
* @param r The current request
358358
* @param ... The strings to write
359359
* @return The number of bytes sent
360-
* @deffunc int ap_rvputs(request_rec *r, ...)
360+
* @deffunc apr_ssize_t ap_rvputs(request_rec *r, ...)
361361
*/
362-
AP_DECLARE_NONSTD(int) ap_rvputs(request_rec *r,...);
362+
AP_DECLARE_NONSTD(apr_ssize_t) ap_rvputs(request_rec *r,...);
363363

364364
/**
365365
* Output data to the client in a printf format
366366
* @param r The current request
367367
* @param fmt The format string
368368
* @param vlist The arguments to use to fill out the format string
369369
* @return The number of bytes sent
370-
* @deffunc int ap_vrprintf(request_rec *r, const char *fmt, va_list vlist)
370+
* @deffunc apr_ssize_t ap_vrprintf(request_rec *r, const char *fmt, va_list vlist)
371371
*/
372-
AP_DECLARE(int) ap_vrprintf(request_rec *r, const char *fmt, va_list vlist);
372+
AP_DECLARE(apr_ssize_t) ap_vrprintf(request_rec *r, const char *fmt, va_list vlist);
373373

374374
/**
375375
* Output data to the client in a printf format
376376
* @param r The current request
377377
* @param fmt The format string
378378
* @param ... The arguments to use to fill out the format string
379379
* @return The number of bytes sent
380-
* @deffunc int ap_rprintf(request_rec *r, const char *fmt, ...)
380+
* @deffunc apr_ssize_t ap_rprintf(request_rec *r, const char *fmt, ...)
381381
*/
382-
AP_DECLARE_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt,...)
382+
AP_DECLARE_NONSTD(apr_ssize_t) ap_rprintf(request_rec *r, const char *fmt,...)
383383
__attribute__((format(printf,2,3)));
384384
/**
385385
* Flush all of the data for the current request to the client
@@ -443,9 +443,9 @@ AP_DECLARE(int) ap_should_client_block(request_rec *r);
443443
* @param bufsiz The size of the buffer
444444
* @return Number of bytes inserted into the buffer. When done reading, 0
445445
* if EOF, or -1 if there was an error
446-
* @deffunc long ap_get_client_block(request_rec *r, char *buffer, apr_size_t bufsiz)
446+
* @deffunc apr_ssize_t ap_get_client_block(request_rec *r, char *buffer, apr_size_t bufsiz)
447447
*/
448-
AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, apr_size_t bufsiz);
448+
AP_DECLARE(apr_ssize_t) ap_get_client_block(request_rec *r, char *buffer, apr_size_t bufsiz);
449449

450450
/**
451451
* In HTTP/1.1, any method can have a body. However, most GET handlers

include/httpd.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ struct server_rec {
10911091
/** Pathname for ServerPath */
10921092
const char *path;
10931093
/** Length of path */
1094-
int pathlen;
1094+
apr_size_t pathlen;
10951095

10961096
/** Normal names for ServerAlias servers */
10971097
apr_array_header_t *names;
@@ -1244,7 +1244,7 @@ AP_DECLARE(const char *) ap_resolve_env(apr_pool_t *p, const char * word);
12441244
* address of field is shifted to the next non-comma, non-whitespace
12451245
* character. len is the length of the item excluding any beginning whitespace.
12461246
*/
1247-
AP_DECLARE(const char *) ap_size_list_item(const char **field, int *len);
1247+
AP_DECLARE(const char *) ap_size_list_item(const char **field, apr_size_t *len);
12481248

12491249
/**
12501250
* Retrieve an HTTP header field list item, as separated by a comma,
@@ -1587,7 +1587,7 @@ AP_DECLARE(void) ap_str_tolower(char *s);
15871587
* @param c The character to search for
15881588
* @return The index of the first occurrence of c in str
15891589
*/
1590-
AP_DECLARE(int) ap_ind(const char *str, char c); /* Sigh... */
1590+
AP_DECLARE(apr_ssize_t) ap_ind(const char *str, char c); /* Sigh... */
15911591

15921592
/**
15931593
* Search a string from right to left for the first occurrence of a
@@ -1596,7 +1596,7 @@ AP_DECLARE(int) ap_ind(const char *str, char c); /* Sigh... */
15961596
* @param c The character to search for
15971597
* @return The index of the first occurrence of c in str
15981598
*/
1599-
AP_DECLARE(int) ap_rind(const char *str, char c);
1599+
AP_DECLARE(apr_ssize_t) ap_rind(const char *str, char c);
16001600

16011601
/**
16021602
* Given a string, replace any bare " with \" .

include/scoreboard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ AP_DECLARE(void) ap_increment_counts(ap_sb_handle_t *sbh, request_rec *r);
164164
int ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e t);
165165
apr_status_t ap_reopen_scoreboard(apr_pool_t *p, apr_shm_t **shm, int detached);
166166
void ap_init_scoreboard(void *shared_score);
167-
AP_DECLARE(int) ap_calc_scoreboard_size(void);
167+
AP_DECLARE(apr_size_t) ap_calc_scoreboard_size(void);
168168
apr_status_t ap_cleanup_scoreboard(void *d);
169169

170170
AP_DECLARE(void) ap_create_sb_handle(ap_sb_handle_t **new_sbh, apr_pool_t *p,

include/util_script.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ AP_DECLARE(char **) ap_create_environment(apr_pool_t *p, apr_table_t *t);
5353
* @return The length of the path info
5454
* @deffunc int ap_find_path_info(const char *uri, const char *path_info)
5555
*/
56-
AP_DECLARE(int) ap_find_path_info(const char *uri, const char *path_info);
56+
AP_DECLARE(apr_size_t) ap_find_path_info(const char *uri, const char *path_info);
5757

5858
/**
5959
* Add CGI environment variables required by HTTP/1.1 to the request's
@@ -131,7 +131,7 @@ AP_DECLARE_NONSTD(int) ap_scan_script_header_err_strs(request_rec *r,
131131
* @deffunc int ap_scan_script_header_err_core(request_rec *r, char *buffer, int (*getsfunc)(char *, int, void *), void *getsfunc_data)
132132
*/
133133
AP_DECLARE(int) ap_scan_script_header_err_core(request_rec *r, char *buffer,
134-
int (*getsfunc) (char *, int, void *),
134+
int (*getsfunc) (char *, apr_size_t, void *),
135135
void *getsfunc_data);
136136

137137
#ifdef __cplusplus

modules/http/http_protocol.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ static int lookup_builtin_method(const char *method, apr_size_t len)
662662
*/
663663
AP_DECLARE(int) ap_method_number_of(const char *method)
664664
{
665-
int len = strlen(method);
665+
apr_size_t len = strlen(method);
666666
int which = lookup_builtin_method(method, len);
667667

668668
if (which != UNKNOWN_METHOD)
@@ -1858,7 +1858,7 @@ static long get_chunk_size(char *b)
18581858
* Returns 0 on End-of-body, -1 on error or premature chunk end.
18591859
*
18601860
*/
1861-
AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer,
1861+
AP_DECLARE(apr_ssize_t) ap_get_client_block(request_rec *r, char *buffer,
18621862
apr_size_t bufsiz)
18631863
{
18641864
apr_status_t rv;

server/core.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2298,7 +2298,7 @@ static const char *set_serverpath(cmd_parms *cmd, void *dummy,
22982298
}
22992299

23002300
cmd->server->path = arg;
2301-
cmd->server->pathlen = (int)strlen(arg);
2301+
cmd->server->pathlen = strlen(arg);
23022302
return NULL;
23032303
}
23042304

@@ -3009,19 +3009,20 @@ void ap_add_output_filters_by_type(request_rec *r)
30093009
}
30103010

30113011
static apr_status_t writev_it_all(apr_socket_t *s,
3012-
struct iovec *vec, int nvec,
3012+
struct iovec *vec, apr_size_t nvec,
30133013
apr_size_t len, apr_size_t *nbytes)
30143014
{
30153015
apr_size_t bytes_written = 0;
30163016
apr_status_t rv;
30173017
apr_size_t n = len;
3018-
int i = 0;
3018+
apr_size_t i = 0;
30193019

30203020
*nbytes = 0;
30213021

30223022
/* XXX handle checking for non-blocking socket */
30233023
while (bytes_written != len) {
3024-
rv = apr_socket_sendv(s, vec + i, nvec - i, &n);
3024+
/* Cast to eliminate 64 bit warning */
3025+
rv = apr_socket_sendv(s, vec + i, (apr_int32_t)(nvec - i), &n);
30253026
*nbytes += n;
30263027
bytes_written += n;
30273028
if (rv != APR_SUCCESS)
@@ -3793,7 +3794,7 @@ static int core_input_filter(ap_filter_t *f, apr_bucket_brigade *b,
37933794
core_net_rec *net = f->ctx;
37943795
core_ctx_t *ctx = net->in_ctx;
37953796
const char *str;
3796-
apr_size_t len;
3797+
apr_ssize_t len;
37973798

37983799
if (mode == AP_MODE_INIT) {
37993800
/*
@@ -4288,12 +4289,14 @@ static apr_status_t core_output_filter(ap_filter_t *f, apr_bucket_brigade *b)
42884289

42894290
memset(&hdtr, '\0', sizeof(hdtr));
42904291
if (nvec) {
4291-
hdtr.numheaders = nvec;
4292+
/* Cast to eliminate 64 bit warning */
4293+
hdtr.numheaders = (int)nvec;
42924294
hdtr.headers = vec;
42934295
}
42944296

42954297
if (nvec_trailers) {
4296-
hdtr.numtrailers = nvec_trailers;
4298+
/* Cast to eliminate 64 bit warning */
4299+
hdtr.numtrailers = (int)nvec_trailers;
42974300
hdtr.trailers = vec_trailers;
42984301
}
42994302

server/protocol.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,7 @@ AP_DECLARE(int) ap_rputc(int c, request_rec *r)
13871387
return c;
13881388
}
13891389

1390-
AP_DECLARE(int) ap_rputs(const char *str, request_rec *r)
1390+
AP_DECLARE(apr_ssize_t) ap_rputs(const char *str, request_rec *r)
13911391
{
13921392
apr_size_t len;
13931393

@@ -1441,9 +1441,9 @@ static apr_status_t r_flush(apr_vformatter_buff_t *buff)
14411441
return APR_SUCCESS;
14421442
}
14431443

1444-
AP_DECLARE(int) ap_vrprintf(request_rec *r, const char *fmt, va_list va)
1444+
AP_DECLARE(apr_ssize_t) ap_vrprintf(request_rec *r, const char *fmt, va_list va)
14451445
{
1446-
apr_size_t written;
1446+
apr_ssize_t written;
14471447
struct ap_vrprintf_data vd;
14481448
char vrprintf_buf[AP_IOBUFSIZE];
14491449

@@ -1461,7 +1461,7 @@ AP_DECLARE(int) ap_vrprintf(request_rec *r, const char *fmt, va_list va)
14611461
*(vd.vbuff.curpos) = '\0';
14621462

14631463
if (written != -1) {
1464-
int n = vd.vbuff.curpos - vrprintf_buf;
1464+
apr_size_t n = vd.vbuff.curpos - vrprintf_buf;
14651465

14661466
/* last call to buffer_output, to finish clearing the buffer */
14671467
if (buffer_output(r, vrprintf_buf,n) != APR_SUCCESS)
@@ -1473,10 +1473,10 @@ AP_DECLARE(int) ap_vrprintf(request_rec *r, const char *fmt, va_list va)
14731473
return written;
14741474
}
14751475

1476-
AP_DECLARE_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt, ...)
1476+
AP_DECLARE_NONSTD(apr_ssize_t) ap_rprintf(request_rec *r, const char *fmt, ...)
14771477
{
14781478
va_list va;
1479-
int n;
1479+
apr_ssize_t n;
14801480

14811481
if (r->connection->aborted)
14821482
return -1;
@@ -1488,7 +1488,7 @@ AP_DECLARE_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt, ...)
14881488
return n;
14891489
}
14901490

1491-
AP_DECLARE_NONSTD(int) ap_rvputs(request_rec *r, ...)
1491+
AP_DECLARE_NONSTD(apr_ssize_t) ap_rvputs(request_rec *r, ...)
14921492
{
14931493
va_list va;
14941494
const char *s;

server/request.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,8 @@ AP_DECLARE(int) ap_location_walk(request_rec *r)
12131213
/* We start now_merged from NULL since we want to build
12141214
* a locations list that can be merged to any vhost.
12151215
*/
1216-
int len, sec_idx;
1216+
apr_size_t len;
1217+
int sec_idx;
12171218
int matches = cache->walked->nelts;
12181219
walk_walked_t *last_walk = (walk_walked_t*)cache->walked->elts;
12191220
cache->cached = entry_uri;

0 commit comments

Comments
 (0)