comparison src/core/ngx_string.c @ 1863:8382d94ba6ae

allow zero length in %*s
author Igor Sysoev <igor@sysoev.ru>
date Tue, 22 Jan 2008 15:13:01 +0000
parents d85879105d35
children d5557e6a4224
comparison
equal deleted inserted replaced
1862:04b04e6d60f4 1863:8382d94ba6ae
145 zero = (u_char) ((*++fmt == '0') ? '0' : ' '); 145 zero = (u_char) ((*++fmt == '0') ? '0' : ' ');
146 width = 0; 146 width = 0;
147 sign = 1; 147 sign = 1;
148 hexadecimal = 0; 148 hexadecimal = 0;
149 max_width = 0; 149 max_width = 0;
150 slen = 0; 150 slen = (size_t) -1;
151 151
152 p = temp + NGX_INT64_LEN; 152 p = temp + NGX_INT64_LEN;
153 153
154 while (*fmt >= '0' && *fmt <= '9') { 154 while (*fmt >= '0' && *fmt <= '9') {
155 width = width * 10 + *fmt++ - '0'; 155 width = width * 10 + *fmt++ - '0';
219 continue; 219 continue;
220 220
221 case 's': 221 case 's':
222 p = va_arg(args, u_char *); 222 p = va_arg(args, u_char *);
223 223
224 if (slen == 0) { 224 if (slen == (size_t) -1) {
225 while (*p && buf < last) { 225 while (*p && buf < last) {
226 *buf++ = *p++; 226 *buf++ = *p++;
227 } 227 }
228 228
229 } else { 229 } else {