Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcd50cd3

Browse files
committed
Use convert_bool in more places.
This helps fix up some bool warnings.
1 parentdefc670 commitcd50cd3

File tree

4 files changed

+27
-25
lines changed

4 files changed

+27
-25
lines changed

‎src/_backend_agg_wrapper.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,11 @@ static PyObject *PyRendererAgg_draw_quad_mesh(PyRendererAgg *self, PyObject *arg
396396
numpy::array_view<constdouble,2> offsets;
397397
agg::trans_affine offset_trans;
398398
numpy::array_view<constdouble,2> facecolors;
399-
int antialiased;
399+
bool antialiased;
400400
numpy::array_view<constdouble,2> edgecolors;
401401

402402
if (!PyArg_ParseTuple(args,
403-
"O&O&IIO&O&O&O&iO&:draw_quad_mesh",
403+
"O&O&IIO&O&O&O&O&O&:draw_quad_mesh",
404404
&convert_gcagg,
405405
&gc,
406406
&convert_trans_affine,
@@ -415,6 +415,7 @@ static PyObject *PyRendererAgg_draw_quad_mesh(PyRendererAgg *self, PyObject *arg
415415
&offset_trans,
416416
&convert_colors,
417417
&facecolors,
418+
&convert_bool,
418419
&antialiased,
419420
&convert_colors,
420421
&edgecolors)) {

‎src/_contour_wrapper.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ static int PyQuadContourGenerator_init(PyQuadContourGenerator* self, PyObject* a
2929
{
3030
QuadContourGenerator::CoordinateArray x, y, z;
3131
QuadContourGenerator::MaskArray mask;
32-
int corner_mask;
32+
bool corner_mask;
3333
long chunk_size;
3434

35-
if (!PyArg_ParseTuple(args,"O&O&O&O&il",
35+
if (!PyArg_ParseTuple(args,"O&O&O&O&O&l",
3636
&x.converter_contiguous, &x,
3737
&y.converter_contiguous, &y,
3838
&z.converter_contiguous, &z,
3939
&mask.converter_contiguous, &mask,
40-
&corner_mask,
40+
&convert_bool, &corner_mask,
4141
&chunk_size)) {
4242
return -1;
4343
}

‎src/_image_wrapper.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ image_resample(PyObject *self, PyObject* args, PyObject *kwargs)
119119
PyObject *py_output_array =NULL;
120120
PyObject *py_transform =NULL;
121121
resample_params_t params;
122-
int resample_;
123-
int norm_;
124122

125123
PyArrayObject *input_array =NULL;
126124
PyArrayObject *output_array =NULL;
@@ -133,10 +131,10 @@ image_resample(PyObject *self, PyObject* args, PyObject *kwargs)
133131
"resample","alpha","norm","radius",NULL };
134132

135133
if (!PyArg_ParseTupleAndKeywords(
136-
args, kwargs,"OOO|iidid:resample", (char **)kwlist,
134+
args, kwargs,"OOO|iO&dO&d:resample", (char **)kwlist,
137135
&py_input_array, &py_output_array, &py_transform,
138-
&params.interpolation, &resample_, &params.alpha, &norm_,
139-
&params.radius)) {
136+
&params.interpolation, &convert_bool, &params.resample,
137+
&params.alpha, &convert_bool, &params.norm, &params.radius)) {
140138
returnNULL;
141139
}
142140

@@ -146,9 +144,6 @@ image_resample(PyObject *self, PyObject* args, PyObject *kwargs)
146144
goto error;
147145
}
148146

149-
params.resample = (resample_ !=0);
150-
params.norm = (norm_ !=0);
151-
152147
input_array = (PyArrayObject *)PyArray_FromAny(
153148
py_input_array,NULL,2,3, NPY_ARRAY_C_CONTIGUOUS,NULL);
154149
if (input_array ==NULL) {

‎src/_path_wrapper.cpp

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,12 @@ static PyObject *Py_point_in_path_collection(PyObject *self, PyObject *args, PyO
310310
numpy::array_view<constdouble,3> transforms;
311311
numpy::array_view<constdouble,2> offsets;
312312
agg::trans_affine offset_trans;
313-
int filled;
313+
bool filled;
314314
e_offset_position offset_position;
315315
std::vector<int> result;
316316

317317
if (!PyArg_ParseTuple(args,
318-
"dddO&OO&O&O&iO&:point_in_path_collection",
318+
"dddO&OO&O&O&O&O&:point_in_path_collection",
319319
&x,
320320
&y,
321321
&radius,
@@ -328,6 +328,7 @@ static PyObject *Py_point_in_path_collection(PyObject *self, PyObject *args, PyO
328328
&offsets,
329329
&convert_trans_affine,
330330
&offset_trans,
331+
&convert_bool,
331332
&filled,
332333
&convert_offset_position,
333334
&offset_position)) {
@@ -402,15 +403,16 @@ static PyObject *Py_clip_path_to_rect(PyObject *self, PyObject *args, PyObject *
402403
{
403404
py::PathIterator path;
404405
agg::rect_d rect;
405-
int inside;
406+
bool inside;
406407
std::vector<Polygon> result;
407408

408409
if (!PyArg_ParseTuple(args,
409-
"O&O&i:clip_path_to_rect",
410+
"O&O&O&:clip_path_to_rect",
410411
&convert_path,
411412
&path,
412413
&convert_rect,
413414
&rect,
415+
&convert_bool,
414416
&inside)) {
415417
returnNULL;
416418
}
@@ -527,20 +529,21 @@ static PyObject *Py_path_intersects_rectangle(PyObject *self, PyObject *args, Py
527529
{
528530
py::PathIterator path;
529531
double rect_x1, rect_y1, rect_x2, rect_y2;
530-
int filled =0;
532+
bool filled =false;
531533
constchar *names[] = {"path","rect_x1","rect_y1","rect_x2","rect_y2","filled",NULL };
532534
bool result;
533535

534536
if (!PyArg_ParseTupleAndKeywords(args,
535537
kwds,
536-
"O&dddd|i:path_intersects_rectangle",
538+
"O&dddd|O&:path_intersects_rectangle",
537539
(char **)names,
538540
&convert_path,
539541
&path,
540542
&rect_x1,
541543
&rect_y1,
542544
&rect_x2,
543545
&rect_y2,
546+
&convert_bool,
544547
&filled)) {
545548
returnNULL;
546549
}
@@ -594,28 +597,30 @@ static PyObject *Py_cleanup_path(PyObject *self, PyObject *args, PyObject *kwds)
594597
{
595598
py::PathIterator path;
596599
agg::trans_affine trans;
597-
int remove_nans;
600+
bool remove_nans;
598601
agg::rect_d clip_rect;
599602
e_snap_mode snap_mode;
600603
double stroke_width;
601604
PyObject *simplifyobj;
602605
bool simplify =false;
603-
int return_curves;
606+
bool return_curves;
604607
SketchParams sketch;
605608

606609
if (!PyArg_ParseTuple(args,
607-
"O&O&iO&O&dOiO&:cleanup_path",
610+
"O&O&O&O&O&dOO&O&:cleanup_path",
608611
&convert_path,
609612
&path,
610613
&convert_trans_affine,
611614
&trans,
615+
&convert_bool,
612616
&remove_nans,
613617
&convert_rect,
614618
&clip_rect,
615619
&convert_snap,
616620
&snap_mode,
617621
&stroke_width,
618622
&simplifyobj,
623+
&convert_bool,
619624
&return_curves,
620625
&convert_sketch_params,
621626
&sketch)) {
@@ -675,14 +680,14 @@ static PyObject *Py_convert_to_string(PyObject *self, PyObject *args, PyObject *
675680
int precision;
676681
PyObject *codesobj;
677682
char *codes[5];
678-
int postfix;
683+
bool postfix;
679684
char *buffer =NULL;
680685
size_t buffersize;
681686
PyObject *result;
682687
int status;
683688

684689
if (!PyArg_ParseTuple(args,
685-
"O&O&O&OO&iOi:convert_to_string",
690+
"O&O&O&OO&iOO&:convert_to_string",
686691
&convert_path,
687692
&path,
688693
&convert_trans_affine,
@@ -694,6 +699,7 @@ static PyObject *Py_convert_to_string(PyObject *self, PyObject *args, PyObject *
694699
&sketch,
695700
&precision,
696701
&codesobj,
702+
&convert_bool,
697703
&postfix)) {
698704
returnNULL;
699705
}
@@ -727,7 +733,7 @@ static PyObject *Py_convert_to_string(PyObject *self, PyObject *args, PyObject *
727733
CALL_CPP("convert_to_string",
728734
(status =convert_to_string(
729735
path, trans, cliprect, simplify, sketch,
730-
precision, codes,(bool)postfix, &buffer,
736+
precision, codes, postfix, &buffer,
731737
&buffersize)));
732738

733739
if (status) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp