Commit 05eb019
committed
Use reliable int type for mesh size in draw_quad_mesh (matplotlib#7788)
In the agg backend, `PyRendererAgg.draw_quad_mesh` takes mesh
dimension arguments (`mesh_width` and `mesh_height`). When
converting those from Python to C, we were declaring the C
types as `size_t`, but converting from Python using the 'I'
format specifier, which converts a Python integer to a C
unsigned int. As @QuLogic spotted, this isn't safe, because
`size_t` is not necessarily the same size as an int. On Fedora
with GCC, for instance, `size_t` is an alias for long unsigned
int.
On LE arches this usually won't cause a problem, but on a BE
arch where `size_t` isn't an int type, the mismatch causes
rendering errors (see matplotlib#7788).
This addresses the problem by just changing the types for these
values to be `unsigned int` instead.1 parent 109251f commit 05eb019
2 files changed
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
186 | | - | |
| 185 | + | |
| 186 | + | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| |||
1148 | 1148 | | |
1149 | 1149 | | |
1150 | 1150 | | |
1151 | | - | |
1152 | | - | |
| 1151 | + | |
| 1152 | + | |
1153 | 1153 | | |
1154 | 1154 | | |
1155 | 1155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
393 | | - | |
394 | | - | |
| 393 | + | |
| 394 | + | |
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
| |||
0 commit comments