From 7738294657d41b9661dd5bf556eb94785748ff85 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 7 Oct 2015 19:10:52 +0200 Subject: [PATCH] Fix a few more type size issues --- .../interfaceMakerPythonNative.cxx | 22 +++++++++---------- dtool/src/prc/configDeclaration.cxx | 10 ++++----- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index 7f5859a233..3c74c066bb 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -3460,23 +3460,23 @@ write_function_for_name(ostream &out, Object *obj, if (map_sets.size() > 1) { switch (args_type) { case AT_keyword_args: - indent(out, 2) << "Py_ssize_t parameter_count = PyTuple_Size(args);\n"; + indent(out, 2) << "int parameter_count = (int)PyTuple_Size(args);\n"; indent(out, 2) << "if (kwds != NULL) {\n"; - indent(out, 2) << " parameter_count += PyDict_Size(kwds);\n"; + indent(out, 2) << " parameter_count += (int)PyDict_Size(kwds);\n"; indent(out, 2) << "}\n"; break; case AT_varargs: - indent(out, 2) << "Py_ssize_t parameter_count = PyTuple_Size(args);\n"; + indent(out, 2) << "int parameter_count = (int)PyTuple_Size(args);\n"; break; case AT_single_arg: // It shouldn't get here, but we'll handle these cases nonetheless. - indent(out, 2) << "const Py_ssize_t parameter_count = 1;\n"; + indent(out, 2) << "const int parameter_count = 1;\n"; break; default: - indent(out, 2) << "const Py_ssize_t parameter_count = 0;\n"; + indent(out, 2) << "const int parameter_count = 0;\n"; break; } @@ -3571,19 +3571,19 @@ write_function_for_name(ostream &out, Object *obj, switch (args_type) { case AT_keyword_args: out << " if (PyTuple_Size(args) > 0 || (kwds != NULL && PyDict_Size(kwds) > 0)) {\n"; - out << " Py_ssize_t parameter_count = PyTuple_Size(args);\n"; + out << " int parameter_count = (int)PyTuple_Size(args);\n"; out << " if (kwds != NULL) {\n"; - out << " parameter_count += PyDict_Size(kwds);\n"; + out << " parameter_count += (int)PyDict_Size(kwds);\n"; out << " }\n"; break; case AT_varargs: out << " if (PyTuple_Size(args) > 0) {\n"; - out << " const Py_ssize_t parameter_count = PyTuple_GET_SIZE(args);\n"; + out << " const int parameter_count = (int)PyTuple_GET_SIZE(args);\n"; break; case AT_single_arg: // Shouldn't happen, but let's handle this case nonetheless. out << " {\n"; - out << " const Py_ssize_t parameter_count = 1;\n"; + out << " const int parameter_count = 1;\n"; break; case AT_no_args: break; @@ -3603,9 +3603,9 @@ write_function_for_name(ostream &out, Object *obj, } else if (args_type == AT_keyword_args && max_required_args == 1 && mii->first == 1) { // Check this to be sure, as we handle the case of only 1 keyword arg // in write_function_forset (not using ParseTupleAndKeywords). - out << " Py_ssize_t parameter_count = PyTuple_Size(args);\n" + out << " int parameter_count = (int)PyTuple_Size(args);\n" " if (kwds != NULL) {\n" - " parameter_count += PyDict_Size(kwds);\n" + " parameter_count += (int)PyDict_Size(kwds);\n" " }\n" " if (parameter_count != 1) {\n" "#ifdef NDEBUG\n"; diff --git a/dtool/src/prc/configDeclaration.cxx b/dtool/src/prc/configDeclaration.cxx index c2661e0035..f299e63d54 100644 --- a/dtool/src/prc/configDeclaration.cxx +++ b/dtool/src/prc/configDeclaration.cxx @@ -63,7 +63,7 @@ set_string_word(size_t n, const string &value) { get_words(); } - while (n >= (int)_words.size()) { + while (n >= _words.size()) { Word w; w._flags = 0; _words.push_back(w); @@ -207,7 +207,7 @@ check_bool_word(size_t n) { get_words(); } - if (n >= 0 && n < (int)_words.size()) { + if (n < _words.size()) { Word &word = _words[n]; if ((word._flags & F_checked_bool) == 0) { word._flags |= F_checked_bool; @@ -254,7 +254,7 @@ check_int_word(size_t n) { get_words(); } - if (n >= 0 && n < (int)_words.size()) { + if (n < _words.size()) { Word &word = _words[n]; if ((word._flags & F_checked_int) == 0) { word._flags |= F_checked_int; @@ -314,7 +314,7 @@ check_int64_word(size_t n) { get_words(); } - if (n >= 0 && n < (int)_words.size()) { + if (n < _words.size()) { Word &word = _words[n]; if ((word._flags & F_checked_int64) == 0) { word._flags |= F_checked_int64; @@ -372,7 +372,7 @@ check_double_word(size_t n) { get_words(); } - if (n >= 0 && n < (int)_words.size()) { + if (n < _words.size()) { Word &word = _words[n]; if ((word._flags & F_checked_double) == 0) { word._flags |= F_checked_double;