- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit2e51555
committed
Fix cidin() to handle values above 2^31 platform-independently.
CommandId is declared as uint32, and values up to 4G are indeed legal.cidout() handles them properly by treating the value as unsigned int.But cidin() was just using atoi(), which has platform-dependent behaviorfor values outside the range of signed int, as reported by Bart Lengkeekin bug #14379. Use strtoul() instead, as xidin() does.In passing, make some purely cosmetic changes to make xidin/xidoutlook more like cidin/cidout; the former didn't have a monopoly onbest practice IMO.Neither xidin nor cidin make any attempt to throw error for invalid input.I didn't change that here, and am not sure it's worth worrying aboutsince neither is really a user-facing type. The point is just to ensurethat indubitably-valid inputs work as expected.It's been like this for a long time, so back-patch to all supportedbranches.Report: <20161018152550.1413.6439@wrigleys.postgresql.org>1 parent253e30c commit2e51555
1 file changed
+6
-12
lines changedLines changed: 6 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
40 | 40 |
| |
41 | 41 |
| |
42 | 42 |
| |
| 43 | + | |
43 | 44 |
| |
44 |
| - | |
45 |
| - | |
46 |
| - | |
47 |
| - | |
48 |
| - | |
49 |
| - | |
| 45 | + | |
| 46 | + | |
50 | 47 |
| |
51 | 48 |
| |
52 | 49 |
| |
| |||
132 | 129 |
| |
133 | 130 |
| |
134 | 131 |
| |
135 |
| - | |
136 |
| - | |
137 |
| - | |
138 |
| - | |
| 132 | + | |
139 | 133 |
| |
140 |
| - | |
| 134 | + | |
141 | 135 |
| |
142 | 136 |
| |
143 | 137 |
| |
| |||
149 | 143 |
| |
150 | 144 |
| |
151 | 145 |
| |
152 |
| - | |
| 146 | + | |
153 | 147 |
| |
154 | 148 |
| |
155 | 149 |
| |
|
0 commit comments
Comments
(0)