Mercurial > hg > th-libs
comparison th_string.c @ 323:63c5b1bf8b98
Rename a variable.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 23 Feb 2016 11:23:32 +0200 |
parents | 78825ff74195 |
children | 0084618812ee |
comparison
equal
deleted
inserted
replaced
322:78825ff74195 | 323:63c5b1bf8b98 |
---|---|
157 return 0; | 157 return 0; |
158 } | 158 } |
159 | 159 |
160 | 160 |
161 int th_printf_vput_intstr(th_printf_ctx *ctx, th_printf_vputch vputch, | 161 int th_printf_vput_intstr(th_printf_ctx *ctx, th_printf_vputch vputch, |
162 const char *buf, const int f_width, int pos, int f_prec, int f_flags, | 162 const char *buf, const int f_width, int f_len, int f_prec, int f_flags, |
163 const char f_sign) | 163 const char f_sign) |
164 { | 164 { |
165 // Calculate necessary padding, if any | 165 // Calculate necessary padding, if any |
166 int ret, nwidth = f_width - pos; | 166 int ret, nwidth = f_width - f_len; |
167 | 167 |
168 if (f_sign) | 168 if (f_sign) |
169 nwidth--; | 169 nwidth--; |
170 | 170 |
171 if (f_prec > 0 && f_prec > pos) | 171 if (f_prec > 0 && f_prec > f_len) |
172 { | 172 { |
173 nwidth = nwidth - f_prec + 1; | 173 nwidth = nwidth - f_prec + 1; |
174 f_flags &= ~TH_PF_ZERO; | 174 f_flags &= ~TH_PF_ZERO; |
175 } | 175 } |
176 | 176 |
179 return ret; | 179 return ret; |
180 | 180 |
181 if (f_sign && (ret = vputch(ctx, f_sign)) == EOF) | 181 if (f_sign && (ret = vputch(ctx, f_sign)) == EOF) |
182 return ret; | 182 return ret; |
183 | 183 |
184 if (f_prec > 0 && f_prec > pos) | 184 if (f_prec > 0 && f_prec > f_len) |
185 { | 185 { |
186 while (--f_prec) | 186 while (--f_prec) |
187 { | 187 { |
188 int ret; | 188 int ret; |
189 if ((ret = vputch(ctx, '0')) == EOF) | 189 if ((ret = vputch(ctx, '0')) == EOF) |
190 return ret; | 190 return ret; |
191 } | 191 } |
192 } | 192 } |
193 | 193 |
194 // Output the value | 194 // Output the value |
195 while (pos--) | 195 while (f_len--) |
196 { | 196 { |
197 if ((ret = vputch(ctx, buf[pos])) == EOF) | 197 if ((ret = vputch(ctx, buf[f_len])) == EOF) |
198 return ret; | 198 return ret; |
199 } | 199 } |
200 | 200 |
201 // Postfix padding? | 201 // Postfix padding? |
202 return th_printf_pad_post(ctx, vputch, nwidth, f_flags); | 202 return th_printf_pad_post(ctx, vputch, nwidth, f_flags); |