shithub: scc

Download patch

ref: 71f0f0ddd99a88df4792a6c47bc06f4653231600
parent: 4bdc9b0b956344c2c4f1b9a044d386b462f50aca
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Dec 2 15:33:57 EST 2017

[lib/c] Fix test increment

It wasn't done in characters out of expansions.

--- a/lib/c/src/vfprintf.c
+++ b/lib/c/src/vfprintf.c
@@ -189,8 +189,8 @@
 	for (cnt = 0; ch = *fmt++; cnt += inc) {
 		if (ch != '%') {
 			putc(ch, fp);
-			++cnt;
-			continue;
+			inc = 1;
+			goto test_inc;
 		}
 
 		fill = ' ';
@@ -338,7 +338,7 @@
 			setcnt(va, flags, cnt);
 			break;
 		case '\0':
-			goto end_format;
+			--fmt;
 		}
 test_inc:
 		if (inc > INT_MAX - cnt) {
@@ -346,6 +346,6 @@
 			return EOF;
 		}
 	}
-end_format:
+
 	return (ferror(fp)) ? EOF : cnt;
 }