comparison src/core/ngx_string.c @ 484:ed5e10fb40fc NGINX_0_7_54

nginx 0.7.54 *) Feature: the ngx_http_image_filter_module. *) Feature: the "proxy_ignore_headers" and "fastcgi_ignore_headers" directives. *) Bugfix: a segmentation fault might occur in worker process, if an "open_file_cache_errors off" directive was used; the bug had appeared in 0.7.53. *) Bugfix: the "port_in_redirect off" directive did not work; the bug had appeared in 0.7.39. *) Bugfix: improve handling of "select" method errors. *) Bugfix: of "select() failed (10022: ...)" error in nginx/Windows. *) Bugfix: in error text descriptions in nginx/Windows; the bug had appeared in 0.7.53.
author Igor Sysoev <http://sysoev.ru>
date Fri, 01 May 2009 00:00:00 +0400
parents 09b45263c817
children 207ae3ff0444
comparison
equal deleted inserted replaced
483:0a2f4b42ddad 484:ed5e10fb40fc
97 { 97 {
98 u_char *p; 98 u_char *p;
99 va_list args; 99 va_list args;
100 100
101 va_start(args, fmt); 101 va_start(args, fmt);
102 p = ngx_vsnprintf(buf, /* STUB */ 65536, fmt, args); 102 p = ngx_vslprintf(buf, (void *) -1, fmt, args);
103 va_end(args); 103 va_end(args);
104 104
105 return p; 105 return p;
106 } 106 }
107 107
111 { 111 {
112 u_char *p; 112 u_char *p;
113 va_list args; 113 va_list args;
114 114
115 va_start(args, fmt); 115 va_start(args, fmt);
116 p = ngx_vsnprintf(buf, max, fmt, args); 116 p = ngx_vslprintf(buf, buf + max, fmt, args);
117 va_end(args); 117 va_end(args);
118 118
119 return p; 119 return p;
120 } 120 }
121 121
122 122
123 u_char * ngx_cdecl
124 ngx_slprintf(u_char *buf, u_char *last, const char *fmt, ...)
125 {
126 u_char *p;
127 va_list args;
128
129 va_start(args, fmt);
130 p = ngx_vslprintf(buf, last, fmt, args);
131 va_end(args);
132
133 return p;
134 }
135
136
123 u_char * 137 u_char *
124 ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) 138 ngx_vslprintf(u_char *buf, u_char *last, const char *fmt, va_list args)
125 { 139 {
126 u_char *p, zero, *last; 140 u_char *p, zero;
127 int d; 141 int d;
128 float f, scale; 142 float f, scale;
129 size_t len, slen; 143 size_t len, slen;
130 int64_t i64; 144 int64_t i64;
131 uint64_t ui64; 145 uint64_t ui64;
132 ngx_msec_t ms; 146 ngx_msec_t ms;
133 ngx_uint_t width, sign, hex, max_width, frac_width, i; 147 ngx_uint_t width, sign, hex, max_width, frac_width, i;
134 ngx_str_t *v; 148 ngx_str_t *v;
135 ngx_variable_value_t *vv; 149 ngx_variable_value_t *vv;
136
137 if (max == 0) {
138 return buf;
139 }
140
141 last = buf + max;
142 150
143 while (*fmt && buf < last) { 151 while (*fmt && buf < last) {
144 152
145 /* 153 /*
146 * "buf < last" means that we could copy at least one character: 154 * "buf < last" means that we could copy at least one character: