@@ -621,9 +621,10 @@ const char *PyFT2Font_get_kerning__doc__ =
621
621
622
622
static PyObject *PyFT2Font_get_kerning (PyFT2Font *self, PyObject *args, PyObject *kwds)
623
623
{
624
- int left, right, mode, result;
624
+ FT_UInt left, right, mode;
625
+ int result;
625
626
626
- if (!PyArg_ParseTuple (args, " iii :get_kerning" , &left, &right, &mode)) {
627
+ if (!PyArg_ParseTuple (args, " III :get_kerning" , &left, &right, &mode)) {
627
628
return NULL ;
628
629
}
629
630
@@ -643,12 +644,15 @@ static PyObject *PyFT2Font_set_text(PyFT2Font *self, PyObject *args, PyObject *k
643
644
{
644
645
PyObject *textobj;
645
646
double angle = 0.0 ;
646
- FT_UInt32 flags = FT_LOAD_FORCE_AUTOHINT;
647
+ FT_Int32 flags = FT_LOAD_FORCE_AUTOHINT;
647
648
std::vector<double > xys;
648
649
const char *names[] = { " string" , " angle" , " flags" , NULL };
649
650
651
+ /* This makes a technically incorrect assumption that FT_Int32 is
652
+ int. In theory it can also be long, if the size of int is less
653
+ than 32 bits. This is very unlikely on modern platforms. */
650
654
if (!PyArg_ParseTupleAndKeywords (
651
- args, kwds, " O|dI :set_text" , (char **)names, &textobj, &angle, &flags)) {
655
+ args, kwds, " O|di :set_text" , (char **)names, &textobj, &angle, &flags)) {
652
656
return NULL ;
653
657
}
654
658
@@ -712,11 +716,14 @@ const char *PyFT2Font_load_char__doc__ =
712
716
static PyObject *PyFT2Font_load_char (PyFT2Font *self, PyObject *args, PyObject *kwds)
713
717
{
714
718
long charcode;
715
- FT_UInt32 flags = FT_LOAD_FORCE_AUTOHINT;
719
+ FT_Int32 flags = FT_LOAD_FORCE_AUTOHINT;
716
720
const char *names[] = { " charcode" , " flags" , NULL };
717
721
722
+ /* This makes a technically incorrect assumption that FT_Int32 is
723
+ int. In theory it can also be long, if the size of int is less
724
+ than 32 bits. This is very unlikely on modern platforms. */
718
725
if (!PyArg_ParseTupleAndKeywords (
719
- args, kwds, " k|I :load_char" , (char **)names, &charcode, &flags)) {
726
+ args, kwds, " l|i :load_char" , (char **)names, &charcode, &flags)) {
720
727
return NULL ;
721
728
}
722
729
@@ -747,11 +754,14 @@ const char *PyFT2Font_load_glyph__doc__ =
747
754
static PyObject *PyFT2Font_load_glyph (PyFT2Font *self, PyObject *args, PyObject *kwds)
748
755
{
749
756
FT_UInt glyph_index;
750
- FT_UInt32 flags = FT_LOAD_FORCE_AUTOHINT;
757
+ FT_Int32 flags = FT_LOAD_FORCE_AUTOHINT;
751
758
const char *names[] = { " glyph_index" , " flags" , NULL };
752
759
760
+ /* This makes a technically incorrect assumption that FT_Int32 is
761
+ int. In theory it can also be long, if the size of int is less
762
+ than 32 bits. This is very unlikely on modern platforms. */
753
763
if (!PyArg_ParseTupleAndKeywords (
754
- args, kwds, " I|I :load_glyph" , (char **)names, &glyph_index, &flags)) {
764
+ args, kwds, " I|i :load_glyph" , (char **)names, &glyph_index, &flags)) {
755
765
return NULL ;
756
766
}
757
767
@@ -901,7 +911,7 @@ static PyObject *PyFT2Font_get_glyph_name(PyFT2Font *self, PyObject *args, PyObj
901
911
unsigned int glyph_number;
902
912
char buffer[128 ];
903
913
904
- if (!PyArg_ParseTuple (args, " i :get_glyph_name" , &glyph_number)) {
914
+ if (!PyArg_ParseTuple (args, " I :get_glyph_name" , &glyph_number)) {
905
915
return NULL ;
906
916
}
907
917
0 commit comments