Mercurial > hg > nginx
comparison src/core/ngx_file.c @ 290:87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 16 Mar 2004 07:10:12 +0000 |
parents | 70e1c7d2b83d |
children | a472bfb778b3 |
comparison
equal
deleted
inserted
replaced
289:0750faf8d7e3 | 290:87e73f067470 |
---|---|
1 | 1 |
2 #include <ngx_config.h> | 2 #include <ngx_config.h> |
3 #include <ngx_core.h> | 3 #include <ngx_core.h> |
4 | 4 |
5 | 5 |
6 static int ngx_temp_number; | 6 static ngx_uint_t ngx_temp_number; |
7 static int ngx_random; | 7 static ngx_uint_t ngx_random; |
8 | 8 |
9 | 9 |
10 int ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain) | 10 int ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain) |
11 { | 11 { |
12 int rc; | 12 int rc; |
48 ngx_memcpy(file->name.data, path->name.data, path->name.len); | 48 ngx_memcpy(file->name.data, path->name.data, path->name.len); |
49 | 49 |
50 num = ngx_next_temp_number(0); | 50 num = ngx_next_temp_number(0); |
51 | 51 |
52 for ( ;; ) { | 52 for ( ;; ) { |
53 ngx_snprintf(file->name.data + path->name.len + 1 + path->len, 11, | 53 ngx_snprintf((char *) |
54 "%010u", num); | 54 (file->name.data + path->name.len + 1 + path->len), |
55 11, "%010u", num); | |
55 | 56 |
56 ngx_create_hashed_filename(file, path); | 57 ngx_create_hashed_filename(file, path); |
57 | 58 |
58 #if 0 | 59 #if 0 |
59 #if (WIN32) | 60 #if (WIN32) |
181 ngx_random = 123456; | 182 ngx_random = 123456; |
182 } | 183 } |
183 } | 184 } |
184 | 185 |
185 | 186 |
186 int ngx_next_temp_number(int collision) | 187 ngx_uint_t ngx_next_temp_number(ngx_uint_t collision) |
187 { | 188 { |
188 if (collision) { | 189 if (collision) { |
189 ngx_temp_number += ngx_random; | 190 ngx_temp_number += ngx_random; |
190 } | 191 } |
191 | 192 |
195 | 196 |
196 char *ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 197 char *ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
197 { | 198 { |
198 char *p = conf; | 199 char *p = conf; |
199 | 200 |
200 int i, n, level; | 201 ngx_int_t level; |
202 ngx_uint_t i, n; | |
201 ngx_str_t *value; | 203 ngx_str_t *value; |
202 ngx_path_t *path, **pp; | 204 ngx_path_t *path, **pp; |
203 | 205 |
204 pp = (ngx_path_t **) (p + cmd->offset); | 206 pp = (ngx_path_t **) (p + cmd->offset); |
205 | 207 |