View | Details | Raw Unified | Return to bug 81495 | Differences between
and this patch

Collapse All | Expand All

(-)parse.c (-5 / +29 lines)
Lines 209-217 Link Here
209
	enum { NOTOKAY, USEBCNT, USEPREC } sokay;
209
	enum { NOTOKAY, USEBCNT, USEPREC } sokay;
210
	PR *pr, **nextpr;
210
	PR *pr, **nextpr;
211
	FU *fu;
211
	FU *fu;
212
	char stop_scanning;
212
	unsigned char *p1, *p2, *fmtp;
213
	unsigned char *p1, *p2, *fmtp;
213
	char savech, cs[3];
214
	char savech, cs[3];
214
	int nconv, prec;
215
	int nconv, nprecs, prec;
215
	size_t len;
216
	size_t len;
216
217
217
	nextpr = NULL;
218
	nextpr = NULL;
Lines 230-240 Link Here
230
			else
231
			else
231
				*nextpr = pr;
232
				*nextpr = pr;
232
233
233
			/* Skip preceding text and up to the next % sign. */
234
			/*
234
			for (p1 = fmtp; *p1 && *p1 != '%'; ++p1);
235
			 * Skip preceding text and up to the next unescaped
236
			 * % sign.
237
			 */
238
			nprecs = 0;
239
			p1 = fmtp;
240
			stop_scanning = 0;
241
			do {
235
242
236
			/* Only text in the string. */
243
				if (*p1 == '\0')
237
			if (!*p1) {
244
					stop_scanning = 1;
245
				else if (*p1 == '%') {
246
					nprecs++;
247
					if (*(p1+1) != '%')
248
						stop_scanning = 1;
249
				}
250
251
				if (stop_scanning == 0)
252
					p1++;
253
254
			} while (stop_scanning == 0);
255
256
			/*
257
			 * Only text in the string. This occurs when:
258
			 * 1. The contents of the string are exhausted.
259
			 * 2. The number of precision qualifiers (%) is even.
260
			 */
261
			if (!*p1 || (nprecs % 2 == 0)) {
238
				pr->fmt = fmtp;
262
				pr->fmt = fmtp;
239
				pr->flags = F_TEXT;
263
				pr->flags = F_TEXT;
240
				break;
264
				break;

Return to bug 81495