- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit47bdd80
committed
Work around a subtle portability problem in use of printf %s format.
Depending on which spec you read, field widths and precisions in %s may becounted either in bytes or characters. Our code was assuming bytes, whichis wrong at least for glibc's implementation, and in any case libc mighthave a different idea of the prevailing encoding than we do. Hence, forportable results we must avoid using anything more complex than just "%s"unless the string to be printed is known to be all-ASCII.This patch fixes the cases I could find, including the psql formattingfailure reported by Hernan Gonzalez. In HEAD only, I also added commentsto some places where it appears safe to continue using "%.*s".1 parent79c712a commit47bdd80
2 files changed
+38
-6
lines changedLines changed: 13 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
9 | 9 |
| |
10 | 10 |
| |
11 | 11 |
| |
12 |
| - | |
| 12 | + | |
13 | 13 |
| |
14 | 14 |
| |
15 | 15 |
| |
| |||
176 | 176 |
| |
177 | 177 |
| |
178 | 178 |
| |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
179 | 188 |
| |
180 | 189 |
| |
181 |
| - | |
182 |
| - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
183 | 193 |
| |
184 | 194 |
| |
185 | 195 |
|
Lines changed: 25 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
23 | 23 |
| |
24 | 24 |
| |
25 | 25 |
| |
26 |
| - | |
| 26 | + | |
27 | 27 |
| |
28 | 28 |
| |
29 | 29 |
| |
| |||
69 | 69 |
| |
70 | 70 |
| |
71 | 71 |
| |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
72 | 86 |
| |
73 | 87 |
| |
74 | 88 |
| |
| |||
175 | 189 |
| |
176 | 190 |
| |
177 | 191 |
| |
178 |
| - | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
179 | 197 |
| |
180 | 198 |
| |
181 | 199 |
| |
| |||
191 | 209 |
| |
192 | 210 |
| |
193 | 211 |
| |
194 |
| - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
195 | 217 |
| |
196 | 218 |
| |
197 | 219 |
| |
|
0 commit comments
Comments
(0)