Browse Source

more unsigned/sign compare fixes

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@861 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.8
Jan Kneschke 16 years ago
parent
commit
a4be52451f
  1. 4
      src/array.c
  2. 6
      src/connections.c
  3. 4
      src/fdevent_poll.c
  4. 2
      src/mod_cgi.c
  5. 3
      src/mod_cml.c
  6. 2
      src/mod_cml_lua.c
  7. 8
      src/mod_compress.c
  8. 14
      src/mod_fastcgi.c
  9. 6
      src/mod_proxy.c
  10. 6
      src/mod_scgi.c
  11. 5
      src/mod_webdav.c

4
src/array.c

@ -296,7 +296,7 @@ int array_print(array *a, int depth) {
int j;
if (i && (i % 5) == 0) {
fprintf(stderr, "# %d\n", i);
fprintf(stderr, "# %zd\n", i);
array_print_indent(depth + 1);
}
fprintf(stderr, "\"%s\"", du->key->ptr);
@ -310,7 +310,7 @@ int array_print(array *a, int depth) {
}
if (!(i && (i - 1 % 5) == 0)) {
array_print_indent(depth + 1);
fprintf(stderr, "# %d\n", i);
fprintf(stderr, "# %zd\n", i);
}
array_print_indent(depth);
fprintf(stderr, ")");

6
src/connections.c

@ -987,7 +987,7 @@ int connection_handle_read_state(server *srv, connection *con) {
}
break;
case CON_STATE_READ_POST:
for (c = cq->first; c && (dst_cq->bytes_in != con->request.content_length); c = c->next) {
for (c = cq->first; c && (dst_cq->bytes_in != (off_t)con->request.content_length); c = c->next) {
off_t weWant, weHave, toRead;
weWant = con->request.content_length - dst_cq->bytes_in;
@ -1078,7 +1078,7 @@ int connection_handle_read_state(server *srv, connection *con) {
dst_c->file.length += toRead;
if (dst_cq->bytes_in + toRead == con->request.content_length) {
if (dst_cq->bytes_in + toRead == (off_t)con->request.content_length) {
/* we read everything, close the chunk */
close(dst_c->file.fd);
dst_c->file.fd = -1;
@ -1095,7 +1095,7 @@ int connection_handle_read_state(server *srv, connection *con) {
}
/* Content is ready */
if (dst_cq->bytes_in == con->request.content_length) {
if (dst_cq->bytes_in == (off_t)con->request.content_length) {
connection_set_state(srv, con, CON_STATE_HANDLE_REQUEST);
}

4
src/fdevent_poll.c

@ -22,7 +22,7 @@ static int fdevent_poll_event_del(fdevents *ev, int fde_ndx, int fd) {
if (fde_ndx < 0) return -1;
if ((size_t)fde_ndx >= ev->used) {
fprintf(stderr, "%s.%d: del! out of range %d %u\n", __FILE__, __LINE__, fde_ndx, ev->used);
fprintf(stderr, "%s.%d: del! out of range %d %zd\n", __FILE__, __LINE__, fde_ndx, ev->used);
SEGFAULT();
}
@ -108,7 +108,7 @@ static int fdevent_poll_poll(fdevents *ev, int timeout_ms) {
static int fdevent_poll_event_get_revent(fdevents *ev, size_t ndx) {
int r, poll_r;
if (ndx >= ev->used) {
fprintf(stderr, "%s.%d: dying because: event: %u >= %u\n", __FILE__, __LINE__, ndx, ev->used);
fprintf(stderr, "%s.%d: dying because: event: %zd >= %zd\n", __FILE__, __LINE__, ndx, ev->used);
SEGFAULT();

2
src/mod_cgi.c

@ -962,7 +962,7 @@ static int cgi_create_env(server *srv, connection *con, plugin_data *p, buffer *
chunkqueue *cq = con->request_content_queue;
chunk *c;
assert(chunkqueue_length(cq) == con->request.content_length);
assert(chunkqueue_length(cq) == (off_t)con->request.content_length);
/* there is content to send */
for (c = cq->first; c; c = cq->first) {

3
src/mod_cml.c

@ -176,6 +176,8 @@ static int mod_cml_patch_connection(server *srv, connection *con, plugin_data *p
int cache_get_cookie_session_id(server *srv, connection *con, plugin_data *p) {
data_unset *d;
UNUSED(srv);
if (NULL != (d = array_get_element(con->request.headers, "Cookie"))) {
data_string *ds = (data_string *)d;
@ -238,6 +240,7 @@ int cache_get_url_session_id(server *srv, connection *con, plugin_data *p) {
size_t is_key = 1, is_sid = 0;
size_t i;
UNUSED(srv);
buffer_reset(p->session_id);
for (i = 0; i < con->uri.query->used; i++) {
switch(con->uri.query->ptr[i]) {

2
src/mod_cml_lua.c

@ -281,7 +281,7 @@ int cache_parse_lua(server *srv, connection *con, plugin_data *p, buffer *fn) {
/* key' is at index -2 and value' at index -1 */
if (lua_isstring(L, -1)) {
char *s = lua_tostring(L, -1);
const char *s = lua_tostring(L, -1);
/* the file is relative, make it absolute */
if (s[0] != '/') {

8
src/mod_compress.c

@ -330,12 +330,12 @@ static int deflate_file_to_file(server *srv, connection *con, plugin_data *p, bu
/* overflow */
if ((off_t)(sce->st.st_size * 1.1) < sce->st.st_size) return -1;
/* don't mmap files > size_t
/* don't mmap files > 128Mb
*
* we could use a sliding window, but currently there is no need for it
*/
if (sce->st.st_size > SIZE_MAX) return -1;
if (sce->st.st_size > 128 * 1024 * 1024) return -1;
buffer_reset(p->ofn);
buffer_copy_string_buffer(p->ofn, p->conf.compress_cache_dir);
@ -469,12 +469,12 @@ static int deflate_file_to_buffer(server *srv, connection *con, plugin_data *p,
/* overflow */
if ((off_t)(sce->st.st_size * 1.1) < sce->st.st_size) return -1;
/* don't mmap files > size_t
/* don't mmap files > 128M
*
* we could use a sliding window, but currently there is no need for it
*/
if (sce->st.st_size > SIZE_MAX) return -1;
if (sce->st.st_size > 128 * 1024 * 1024) return -1;
if (-1 == (ifd = open(fn->ptr, O_RDONLY | O_BINARY))) {

14
src/mod_fastcgi.c

@ -1880,13 +1880,13 @@ static int fcgi_create_env(server *srv, handler_ctx *hctx, size_t request_id) {
if (con->request.content_length) {
chunkqueue *req_cq = con->request_content_queue;
chunk *req_c;
size_t offset;
off_t offset;
/* something to send ? */
for (offset = 0, req_c = req_cq->first; offset != req_cq->bytes_in; ) {
size_t weWant = req_cq->bytes_in - offset > FCGI_MAX_LENGTH ? FCGI_MAX_LENGTH : req_cq->bytes_in - offset;
size_t written = 0;
size_t weHave = 0;
off_t weWant = req_cq->bytes_in - offset > FCGI_MAX_LENGTH ? FCGI_MAX_LENGTH : req_cq->bytes_in - offset;
off_t written = 0;
off_t weHave = 0;
/* we announce toWrite octects
* now take all the request_content chunk that we need to fill this request
@ -1898,12 +1898,12 @@ static int fcgi_create_env(server *srv, handler_ctx *hctx, size_t request_id) {
hctx->wb->bytes_in += sizeof(header);
if (p->conf.debug > 10) {
fprintf(stderr, "%s.%d: tosend: %d / %lld\n", __FILE__, __LINE__, offset, req_cq->bytes_in);
fprintf(stderr, "%s.%d: tosend: %lld / %lld\n", __FILE__, __LINE__, offset, req_cq->bytes_in);
}
for (written = 0; written != weWant; ) {
if (p->conf.debug > 10) {
fprintf(stderr, "%s.%d: chunk: %d / %d\n", __FILE__, __LINE__, written, weWant);
fprintf(stderr, "%s.%d: chunk: %lld / %lld\n", __FILE__, __LINE__, written, weWant);
}
switch (req_c->type) {
@ -1913,7 +1913,7 @@ static int fcgi_create_env(server *srv, handler_ctx *hctx, size_t request_id) {
if (weHave > weWant - written) weHave = weWant - written;
if (p->conf.debug > 10) {
fprintf(stderr, "%s.%d: sending %d bytes from (%lld / %lld) %s\n",
fprintf(stderr, "%s.%d: sending %lld bytes from (%lld / %lld) %s\n",
__FILE__, __LINE__,
weHave,
req_c->offset,

6
src/mod_proxy.c

@ -447,12 +447,12 @@ static int proxy_create_env(server *srv, handler_ctx *hctx) {
if (con->request.content_length) {
chunkqueue *req_cq = con->request_content_queue;
chunk *req_c;
size_t offset;
off_t offset;
/* something to send ? */
for (offset = 0, req_c = req_cq->first; offset != req_cq->bytes_in; req_c = req_c->next) {
size_t weWant = req_cq->bytes_in - offset;
size_t weHave = 0;
off_t weWant = req_cq->bytes_in - offset;
off_t weHave = 0;
/* we announce toWrite octects
* now take all the request_content chunk that we need to fill this request

6
src/mod_scgi.c

@ -1578,12 +1578,12 @@ static int scgi_create_env(server *srv, handler_ctx *hctx) {
if (con->request.content_length) {
chunkqueue *req_cq = con->request_content_queue;
chunk *req_c;
size_t offset;
off_t offset;
/* something to send ? */
for (offset = 0, req_c = req_cq->first; offset != req_cq->bytes_in; req_c = req_c->next) {
size_t weWant = req_cq->bytes_in - offset;
size_t weHave = 0;
off_t weWant = req_cq->bytes_in - offset;
off_t weHave = 0;
/* we announce toWrite octects
* now take all the request_content chunk that we need to fill this request

5
src/mod_webdav.c

@ -731,6 +731,7 @@ static int webdav_get_live_property(server *srv, connection *con, plugin_data *p
stat_cache_entry *sce = NULL;
int found = 0;
USUSED(p);
if (HANDLER_ERROR != (stat_cache_get_entry(srv, con, dst->path, &sce))) {
char ctime_buf[] = "2005-08-18T07:27:16Z";
char mtime_buf[] = "Thu, 18 Aug 2005 07:27:16 GMT";
@ -893,6 +894,8 @@ static int webdav_parse_chunkqueue(server *srv, connection *con, plugin_data *p,
chunk *c;
UNUSED(con);
/* read the chunks in to the XML document */
ctxt = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, NULL);
@ -1368,7 +1371,7 @@ URIHANDLER_FUNC(mod_webdav_subrequest_handler) {
return HANDLER_FINISHED;
}
assert(chunkqueue_length(cq) == con->request.content_length);
assert(chunkqueue_length(cq) == (off_t)con->request.content_length);
/* taken what we have in the request-body and write it to a file */
if (-1 == (fd = open(con->physical.path->ptr, O_WRONLY|O_CREAT|O_TRUNC, 0600))) {

Loading…
Cancel
Save