History

unix: fix completely broken %r

Sigrid Solveig Haflínudóttir committed 2 years ago

Commit f16c52c1 parent b8dd2862 files · +8 −6Browse files

Unified · Split

2 files
  1. otf.c.in +0 −1
  2. unix/otfsys.c +8 −5
otf.c.in+0−1
@@ -827,7 +827,6 @@ err: · 826 unmodified lines
827827 if(o->td.eblc == nil && o->td.ebdt == nil)
828828 return g;
829829 }
830−
831830 if(o->td.eblc != nil && o->td.ebdt != nil)
832831 return bitglyf(o, g, opts);
833832
unix/otfsys.c+8−5
@@ -16,14 +16,17 @@ void · 15 unmodified lines
1616 werrstr(char *fmt, ...)
1717 {
1818 va_list a;
19− char buf[ERRMAX];
20− int n;
19+ char f[ERRMAX], buf[ERRMAX];
20+ int n, withr;
2121
2222 va_start(a, fmt);
23− n = vsnprintf(buf, sizeof(buf), fmt, a);
23+ n = snprintf(f, sizeof(f), "%s", fmt);
24+ if((withr = (n >= 2 && f[n-2] == '%' && f[n-1] == 'r')) != 0)
25+ f[n-2] = 0;
26+ n = vsnprintf(buf, sizeof(buf), f, a);
2427 va_end(a);
25− if(n >= 2 && buf[n-2] == '%' && buf[n-1] == 'r')
26− snprintf(buf+n-2, sizeof(buf)-n+2, "%s", errstr);
28+ if(withr)
29+ snprintf(buf+n, sizeof(buf)-n, "%s", errstr);
2730 snprintf(errstr, sizeof(errstr), "%s", buf);
2831 }
2932

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t