Browse Source

fixed unsigned compares

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@855 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.8
Jan Kneschke 16 years ago
parent
commit
60ccbd89f7
  1. 2
      src/base.h
  2. 2
      src/mod_dirlisting.c
  3. 16
      src/mod_proxy.c
  4. 2
      src/server.c

2
src/base.h

@ -508,7 +508,7 @@ typedef struct server {
int want_fds; /* waiting fds */
int sockets_disabled;
int max_conns;
size_t max_conns;
/* buffers */
buffer *parse_full_path;

2
src/mod_dirlisting.c

@ -637,7 +637,7 @@ static int http_list_directory(server *srv, connection *con, plugin_data *p, buf
/* NOTE: the manual says, d_name is never more than NAME_MAX
* so this should actually not be a buffer-overflow-risk
*/
if (i > name_max) continue;
if (i > (size_t)name_max) continue;
memcpy(path_file, dent->d_name, i + 1);
if (stat(path, &st) != 0)

16
src/mod_proxy.c

@ -1097,7 +1097,7 @@ static handler_t mod_proxy_check_extension(server *srv, connection *con, void *p
"proxy - used hash balancing, hosts:", extension->value->used);
}
for (k = 0, ndx = -1, last_max = ~0L; k < extension->value->used; k++) {
for (k = 0, ndx = -1, last_max = ULONG_MAX; k < extension->value->used; k++) {
data_proxy *host = (data_proxy *)extension->value->data[k];
unsigned long cur_max;
@ -1116,7 +1116,7 @@ static handler_t mod_proxy_check_extension(server *srv, connection *con, void *p
cur_max);
}
if ((last_max == ~0L) || /* first round */
if ((last_max == ULONG_MAX) || /* first round */
(cur_max > last_max)) {
last_max = cur_max;
@ -1132,12 +1132,12 @@ static handler_t mod_proxy_check_extension(server *srv, connection *con, void *p
"proxy - used fair balancing");
}
for (k = 0, ndx = -1, last_max = ~0L; k < extension->value->used; k++) {
for (k = 0, ndx = -1, last_max = ULONG_MAX; k < extension->value->used; k++) {
data_proxy *host = (data_proxy *)extension->value->data[k];
if (host->is_disabled) continue;
if (host->usage < last_max) {
if (host->usage < (int)last_max) {
last_max = host->usage;
ndx = k;
@ -1151,18 +1151,18 @@ static handler_t mod_proxy_check_extension(server *srv, connection *con, void *p
log_error_write(srv, __FILE__, __LINE__, "s",
"proxy - used round-robin balancing");
}
for (k = 0, ndx = -1, last_max = ~0L; k < extension->value->used; k++) {
for (k = 0, ndx = -1, last_max = ULONG_MAX; k < extension->value->used; k++) {
data_proxy *host = (data_proxy *)extension->value->data[k];
if (host->is_disabled) continue;
/* first usable ndx */
if (last_max == ~0L) {
if (last_max == ULONG_MAX) {
last_max = k;
}
/* get next ndx */
if (k > host->last_used_ndx) {
if ((int)k > host->last_used_ndx) {
ndx = k;
host->last_used_ndx = k;
@ -1171,7 +1171,7 @@ static handler_t mod_proxy_check_extension(server *srv, connection *con, void *p
}
/* didn't found a higher id, wrap to the start */
if (ndx != -1 && last_max != ~0L) {
if (ndx != -1 && last_max != ULONG_MAX) {
ndx = last_max;
}

2
src/server.c

@ -632,7 +632,7 @@ int main (int argc, char **argv) {
/* we can't have more connections than max-fds */
srv->max_conns = srv->max_fds;
} else if (srv->srvconf.max_conns) {
/* otherwise respect thw wishes of the user */
/* otherwise respect the wishes of the user */
srv->max_conns = srv->srvconf.max_conns;
} else {
/* or use the default */

Loading…
Cancel
Save