new = ap_pcalloc(p, sizeof(listen_rec));
new->local_addr.sin_family = AF_INET;
new->local_addr.sin_addr = ap_bind_address;
- new->local_addr.sin_port = htons(s->port ? s->port : DEFAULT_HTTP_PORT);
+ /* Buck ugly cast to get around terniary op bug in some (MS) compilers */
+ new->local_addr.sin_port = htons((unsigned short)(s->port ? s->port
+ : DEFAULT_HTTP_PORT));
new->fd = -1;
new->used = 0;
new->next = NULL;
char *value;
char *copy;
int len;
- unsigned int fields_read = 0;
+ int fields_read = 0;
table *tmp_headers;
/* We'll use ap_overlap_tables later to merge these into r->headers_in. */
}
max_body = ap_get_limit_req_body(r);
- if (max_body && (r->remaining > max_body)) {
+ if (max_body && ((unsigned long)r->remaining > max_body)
+ && (r->remaining >= 0)) {
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
"Request content-length of %s is larger than the configured "
"limit of %lu", lenp, max_body);
* length requests and nobody cares if it goes over by one buffer.
*/
max_body = ap_get_limit_req_body(r);
- if (max_body && (r->read_length > max_body)) {
+ if (max_body && ((unsigned long) r->read_length > max_body)
+ && (r->read_length >= 0)) {
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
"Chunked request body is larger than the configured limit of %lu",
max_body);
ebcdic2ascii(buffer, buffer, buflen);
#endif
i = 0;
- while(i < strlen(buffer)) {
+ while(i < (int)strlen(buffer)) {
int j;
j = write(sock, buffer+i, (strlen(buffer+i)));
if (j < 0 && errno != EINTR) {
++s;
uptr->port_str = ap_pstrdup(p, s);
if (*s != '\0') {
- uptr->port = strtol(uptr->port_str, &endstr, 10);
+ uptr->port = (unsigned short)strtol(uptr->port_str, &endstr, 10);
if (*endstr == '\0') {
return HTTP_OK;
}
ps->cache.dirlevels_set = 0;
ps->cache.dirlength = 1;
ps->cache.dirlength_set = 0;
- ps->cache.cache_completion = DEFAULT_CACHE_COMPLETION;
+ ps->cache.cache_completion = (float)DEFAULT_CACHE_COMPLETION;
ps->cache.cache_completion_set = 0;
return ps;
"CONNECT to %s on port %d", host, port);
}
- server.sin_port = (proxyport ? htons(proxyport) : htons(port));
+ /* Nasty cast to work around broken terniary expressions on MSVC */
+ server.sin_port = htons((unsigned short)(proxyport ? proxyport : port));
err = ap_proxy_host2addr(proxyhost ? proxyhost : host, &server_hp);
if (err != NULL)
memset(&server, 0, sizeof(struct sockaddr_in));
server.sin_family = AF_INET;
- server.sin_port = htons(port);
+ server.sin_port = htons((unsigned short)port);
err = ap_proxy_host2addr(host, &server_hp);
if (err != NULL)
return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, err);
}
if (proxyhost != NULL) {
- server.sin_port = htons(proxyport);
+ server.sin_port = htons((unsigned short)proxyport);
err = ap_proxy_host2addr(proxyhost, &server_hp);
if (err != NULL)
return DECLINED; /* try another */
}
else {
- server.sin_port = htons(destport);
+ server.sin_port = htons((unsigned short)destport);
err = ap_proxy_host2addr(desthost, &server_hp);
if (err != NULL)
return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, err);
}
/* now get directive */
while (1) {
- if (d - dest == len) {
+ if (d == len + dest) {
return 1;
}
*d++ = ap_tolower(c);
/* zero-length variable name causes just the $ to be copied */
l = 1;
}
- l = (l > end_out - next) ? (end_out - next) : l;
+ l = (l + next > end_out) ? (end_out - next) : l;
memcpy(next, expansion, l);
next += l;
break;
return (s);
}
-static int is_token(char c)
+static int is_token(int c)
{
int res;
return res;
}
-static int is_qtext(char c)
+static int is_qtext(int c)
{
int res;
{
long offset = m->offset;
- if (offset + sizeof(union VALUETYPE) > nbytes)
+ if (offset + (long)sizeof(union VALUETYPE) > nbytes)
return 0;
memcpy(p, s + offset, sizeof(union VALUETYPE));
break;
}
- if (offset + sizeof(union VALUETYPE) > nbytes)
+ if (offset + (long)sizeof(union VALUETYPE) > nbytes)
return 0;
memcpy(p, s + offset, sizeof(union VALUETYPE));
if (parm[0] == 'q'
&& (parm[1] == '\0' || (parm[1] == 's' && parm[2] == '\0'))) {
- result->quality = atof(cp);
+ result->quality = (float)atof(cp);
}
else if (parm[0] == 'l' && !strcmp(&parm[1], "evel")) {
- result->level = atof(cp);
+ result->level = (float)atof(cp);
}
else if (!strcmp(parm, "charset")) {
result->charset = cp;
has_content = 1;
}
else if (!strncmp(buffer, "content-length:", 15)) {
- mime_info.bytes = atof(body);
+ mime_info.bytes = (float)atof(body);
has_content = 1;
}
else if (!strncmp(buffer, "content-language:", 17)) {
float fiddle_q = 0.0f;
int any_match_on_star = 0;
int i, j, alen, longest_lang_range_len;
-
+
for (j = 0; j < variant->content_languages->nelts; ++j) {
p = NULL;
bestthistag = NULL;
alen = strlen(accs[i].name);
- if ((strlen(lang) >= alen) &&
+ if (((int)strlen(lang) >= alen) &&
!strncmp(lang, accs[i].name, alen) &&
((lang[alen] == 0) || (lang[alen] == '-')) ) {
cp = ap_http_method(r);
l = strlen(cp);
- if ( strlen(r->filename) > l+3
+ if ( (int)strlen(r->filename) > l+3
&& strncasecmp(r->filename, cp, l) == 0
&& r->filename[l] == ':'
&& r->filename[l+1] == '/'
* result. Doing an integer modulus would only use the lower-order bits
* which may not be as uniformly random.
*/
- return ((double)(rand() % RAND_MAX) / RAND_MAX) * (h - l + 1) + l;
+ return (int)((double)(rand() % RAND_MAX) / RAND_MAX) * (h - l + 1) + l;
}
static char *select_random_value_part(request_rec *r, char *value)
(float) count / (float) up_time);
if (up_time > 0) {
- format_byte_out(r, KBYTE * (float) kbcount / (float) up_time);
+ format_byte_out(r, (unsigned long) (KBYTE * (float) kbcount
+ / (float) up_time));
ap_rputs("/second - ", r);
}
if (count > 0) {
- format_byte_out(r, KBYTE * (float) kbcount / (float) count);
+ format_byte_out(r, (unsigned long) (KBYTE * (float) kbcount
+ / (float) count));
ap_rputs("/request", r);
}