nginx-0.0.1-2003-11-21-09:30:49 import
diff --git a/src/core/nginx.c b/src/core/nginx.c
index ca056bd..26db6f8 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -230,7 +230,7 @@
cycle = ngx_init_cycle(cycle, cycle->log);
if (cycle == NULL) {
- cycle = (ngx_cycle_t*) ngx_cycle;
+ cycle = (ngx_cycle_t *) ngx_cycle;
continue;
}
diff --git a/src/core/ngx_alloc.c b/src/core/ngx_alloc.c
index 32aa25c..dff0593 100644
--- a/src/core/ngx_alloc.c
+++ b/src/core/ngx_alloc.c
@@ -5,10 +5,9 @@
void *ngx_alloc(size_t size, ngx_log_t *log)
{
- void *p;
+ void *p;
- p = malloc(size);
- if (p == NULL) {
+ if (!(p = malloc(size))) {
ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
"malloc() %d bytes failed", size);
}
@@ -23,7 +22,7 @@
void *ngx_calloc(size_t size, ngx_log_t *log)
{
- void *p;
+ void *p;
p = ngx_alloc(size, log);
if (p) {
@@ -36,9 +35,11 @@
ngx_pool_t *ngx_create_pool(size_t size, ngx_log_t *log)
{
- ngx_pool_t *p;
+ ngx_pool_t *p;
- ngx_test_null(p, ngx_alloc(size, log), NULL);
+ if (!(p = ngx_alloc(size, log))) {
+ return NULL;
+ }
p->last = (char *) p + sizeof(ngx_pool_t);
p->end = (char *) p + size;
@@ -115,7 +116,10 @@
/* alloc a new pool block */
- ngx_test_null(n, ngx_create_pool(p->end - (char *) p, p->log), NULL);
+ if (!(n = ngx_create_pool((size_t) (p->end - (char *) p), p->log))) {
+ return NULL;
+ }
+
p->next = n;
m = n->last;
n->last += size;
@@ -143,11 +147,16 @@
}
if (large == NULL) {
- ngx_test_null(large, ngx_palloc(pool, sizeof(ngx_pool_large_t)), NULL);
+ if (!(large = ngx_palloc(pool, sizeof(ngx_pool_large_t)))) {
+ return NULL;
+ }
+
large->next = NULL;
}
- ngx_test_null(p, ngx_alloc(size, pool->log), NULL);
+ if (!(p = ngx_alloc(size, pool->log))) {
+ return NULL;
+ }
if (pool->large == NULL) {
pool->large = large;
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
index 5ea364b..fd30216 100644
--- a/src/core/ngx_conf_file.c
+++ b/src/core/ngx_conf_file.c
@@ -315,12 +315,12 @@
}
if (h->pos - start) {
- ngx_memcpy(h->start, start, h->pos - start);
+ ngx_memcpy(h->start, start, (size_t) (h->pos - start));
}
n = ngx_read_file(&cf->conf_file->file,
h->start + (h->pos - start),
- h->end - (h->start + (h->pos - start)),
+ (size_t) (h->end - (h->start + (h->pos - start))),
cf->conf_file->file.offset);
if (n == NGX_ERROR) {
@@ -462,7 +462,8 @@
if (found) {
ngx_test_null(word, ngx_push_array(cf->args), NGX_ERROR);
ngx_test_null(word->data,
- ngx_palloc(cf->pool, h->pos - start + 1),
+ ngx_palloc(cf->pool,
+ (size_t) (h->pos - start + 1)),
NGX_ERROR);
for (dst = word->data, src = start, len = 0;
diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h
index da6f37a..9312fba 100644
--- a/src/core/ngx_connection.h
+++ b/src/core/ngx_connection.h
@@ -28,8 +28,8 @@
ngx_log_t *log;
int backlog;
- int pool_size;
- int post_accept_buffer_size; /* should be here because
+ size_t pool_size;
+ size_t post_accept_buffer_size; /* should be here because
of the AcceptEx() preread */
time_t post_accept_timeout; /* should be here because
of the deferred accept */
diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c
index ee4c653..4ae5378 100644
--- a/src/core/ngx_file.c
+++ b/src/core/ngx_file.c
@@ -105,7 +105,8 @@
void ngx_create_hashed_filename(ngx_file_t *file, ngx_path_t *path)
{
- int i, name, pos, level;
+ int i, name, pos;
+ size_t level;
name = file->name.len;
pos = path->name.len + 1;
@@ -192,7 +193,7 @@
{
char *p = conf;
- int i, n;
+ int i, n, level;
ngx_str_t *value;
ngx_path_t *path, **pp;
@@ -219,12 +220,12 @@
path->len = 0;
for (i = 0, n = 2; n < cf->args->nelts; i++, n++) {
- path->level[i] = ngx_atoi(value[n].data, value[n].len);
- if (path->level[i] == NGX_ERROR || path->level[i] == 0) {
+ level = ngx_atoi(value[n].data, value[n].len);
+ if (level == NGX_ERROR || level == 0) {
return "invalid value";
}
- path->len += path->level[i] + 1;
+ path->len += path->level[i] + level + 1;
}
while (i < 3) {
diff --git a/src/core/ngx_file.h b/src/core/ngx_file.h
index b1e5fb8..9042c61 100644
--- a/src/core/ngx_file.h
+++ b/src/core/ngx_file.h
@@ -27,8 +27,8 @@
struct ngx_path_s {
ngx_str_t name;
- int len;
- int level[3];
+ u_int len;
+ u_int level[3];
ngx_gc_handler_pt gc_handler;
};
diff --git a/src/core/ngx_garbage_collector.c b/src/core/ngx_garbage_collector.c
index e673acd..f60fae9 100644
--- a/src/core/ngx_garbage_collector.c
+++ b/src/core/ngx_garbage_collector.c
@@ -70,8 +70,9 @@
static int ngx_collect_garbage(ngx_gc_t *ctx, ngx_str_t *dname, int level)
{
- int rc, len;
+ int rc;
char *last;
+ size_t len;
ngx_err_t err;
ngx_str_t fname, buf;
ngx_dir_t dir;
diff --git a/src/core/ngx_hunk.c b/src/core/ngx_hunk.c
index de57a5d..2785c39 100644
--- a/src/core/ngx_hunk.c
+++ b/src/core/ngx_hunk.c
@@ -3,7 +3,7 @@
#include <ngx_core.h>
-ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, int size)
+ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, size_t size)
{
ngx_hunk_t *h;
diff --git a/src/core/ngx_hunk.h b/src/core/ngx_hunk.h
index 2c6664b..7dc0f0c 100644
--- a/src/core/ngx_hunk.h
+++ b/src/core/ngx_hunk.h
@@ -124,7 +124,7 @@
(size_t) (h->file_last - h->file_pos))
-ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, int size);
+ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, size_t size);
#define ngx_alloc_hunk(pool) ngx_palloc(pool, sizeof(ngx_hunk_t))
#define ngx_calloc_hunk(pool) ngx_pcalloc(pool, sizeof(ngx_hunk_t))
diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c
index f196937..46deab4 100644
--- a/src/core/ngx_output_chain.c
+++ b/src/core/ngx_output_chain.c
@@ -10,14 +10,13 @@
ngx_inline static int ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx,
ngx_hunk_t *hunk);
static int ngx_output_chain_copy_hunk(ngx_hunk_t *dst, ngx_hunk_t *src,
- int sendfile);
+ u_int sendfile);
int ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
{
int rc, last;
- size_t hsize;
- ssize_t size;
+ size_t size, hsize;
ngx_chain_t *cl, *out, **last_out;
/*
@@ -191,13 +190,14 @@
static int ngx_output_chain_copy_hunk(ngx_hunk_t *dst, ngx_hunk_t *src,
- int sendfile)
+ u_int sendfile)
{
- ssize_t n, size;
+ size_t size;
+ ssize_t n;
size = ngx_hunk_size(src);
- if (size > (dst->end - dst->pos)) {
+ if (size > (size_t) (dst->end - dst->pos)) {
size = dst->end - dst->pos;
}
@@ -233,7 +233,7 @@
}
#endif
- if (n != size) {
+ if ((size_t) n != size) {
ngx_log_error(NGX_LOG_ALERT, src->file->log, 0,
ngx_read_file_n " reads only %d of %d from file",
n, size);
diff --git a/src/core/ngx_parse.c b/src/core/ngx_parse.c
index 213b2f6..6a1f54b 100644
--- a/src/core/ngx_parse.c
+++ b/src/core/ngx_parse.c
@@ -5,8 +5,9 @@
int ngx_parse_size(ngx_str_t *line)
{
- int len, scale, size;
- char last;
+ int scale, size;
+ char last;
+ size_t len;
len = line->len;
last = line->data[len - 1];
@@ -41,8 +42,9 @@
int ngx_parse_time(ngx_str_t *line, int sec)
{
- int value, total, len, scale;
+ int value, total, scale;
u_int max, i;
+ size_t len;
char *start, last;
enum {
st_start = 0,