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
827 if(o->td.eblc == nil && o->td.ebdt == nil)827 if(o->td.eblc == nil && o->td.ebdt == nil)
828 return g;828 return g;
829 }829 }
830
831 if(o->td.eblc != nil && o->td.ebdt != nil)830 if(o->td.eblc != nil && o->td.ebdt != nil)
832 return bitglyf(o, g, opts);831 return bitglyf(o, g, opts);
833 832
unix/otfsys.c+8−5
@@ -16,14 +16,17 @@ void · 15 unmodified lines
16werrstr(char *fmt, ...)16werrstr(char *fmt, ...)
17{17{
18 va_list a;18 va_list a;
19 char buf[ERRMAX];19 char f[ERRMAX], buf[ERRMAX];
20 int n;20 int n, withr;
21 21
22 va_start(a, fmt);22 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);
24 va_end(a);27 va_end(a);
25 if(n >= 2 && buf[n-2] == '%' && buf[n-1] == 'r')28 if(withr)
26 snprintf(buf+n-2, sizeof(buf)-n+2, "%s", errstr);29 snprintf(buf+n, sizeof(buf)-n, "%s", errstr);
27 snprintf(errstr, sizeof(errstr), "%s", buf);30 snprintf(errstr, sizeof(errstr), "%s", buf);
28}31}
29 32

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