Mercurial > hg > nginx-vendor-0-6
comparison src/core/ngx_string.c @ 26:45fe5b98a9de NGINX_0_1_13
nginx 0.1.13
*) Feature: the server_names_hash and server_names_hash_threshold
directives.
*) Bugfix: the *.domain.tld names in the "server_name" directive did
not work.
*) Bugfix: the %request_length log parameter logged the incorrect
length.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 21 Dec 2004 00:00:00 +0300 |
parents | 8b6db3bda591 |
children | 7ca9bdc82b3f |
comparison
equal
deleted
inserted
replaced
25:21488c53e135 | 26:45fe5b98a9de |
---|---|
84 } | 84 } |
85 | 85 |
86 | 86 |
87 u_char *ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) | 87 u_char *ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) |
88 { | 88 { |
89 u_char *p, zero, *last, temp[NGX_MAX_INT_LEN]; | 89 u_char *p, zero, *last, temp[NGX_INT64_LEN]; |
90 int d; | 90 int d; |
91 size_t len; | 91 size_t len; |
92 uint32_t ui32; | 92 uint32_t ui32; |
93 int64_t i64; | 93 int64_t i64; |
94 uint64_t ui64; | 94 uint64_t ui64; |
118 zero = (u_char) ((*++fmt == '0') ? '0' : ' '); | 118 zero = (u_char) ((*++fmt == '0') ? '0' : ' '); |
119 width = 0; | 119 width = 0; |
120 sign = 1; | 120 sign = 1; |
121 hexadecimal = 0; | 121 hexadecimal = 0; |
122 | 122 |
123 p = temp + NGX_MAX_INT_LEN; | 123 p = temp + NGX_INT64_LEN; |
124 | 124 |
125 while (*fmt >= '0' && *fmt <= '9') { | 125 while (*fmt >= '0' && *fmt <= '9') { |
126 width = width * 10 + *fmt++ - '0'; | 126 width = width * 10 + *fmt++ - '0'; |
127 } | 127 } |
128 | 128 |
335 do { | 335 do { |
336 *--p = (u_char) (ui64 % 10 + '0'); | 336 *--p = (u_char) (ui64 % 10 + '0'); |
337 } while (ui64 /= 10); | 337 } while (ui64 /= 10); |
338 } | 338 } |
339 | 339 |
340 len = (temp + NGX_MAX_INT_LEN) - p; | 340 len = (temp + NGX_INT64_LEN) - p; |
341 | 341 |
342 while (len++ < width && buf < last) { | 342 while (len++ < width && buf < last) { |
343 *buf++ = zero; | 343 *buf++ = zero; |
344 } | 344 } |
345 | 345 |
346 len = (temp + NGX_MAX_INT_LEN) - p; | 346 len = (temp + NGX_INT64_LEN) - p; |
347 if (buf + len > last) { | 347 if (buf + len > last) { |
348 len = last - buf; | 348 len = last - buf; |
349 } | 349 } |
350 | 350 |
351 buf = ngx_cpymem(buf, p, len); | 351 buf = ngx_cpymem(buf, p, len); |