Fix a few more type size issues

This commit is contained in:
rdb 2015-10-07 19:10:52 +02:00
parent 18ad6d1543
commit 7738294657
2 changed files with 16 additions and 16 deletions

View File

@ -3460,23 +3460,23 @@ write_function_for_name(ostream &out, Object *obj,
if (map_sets.size() > 1) { if (map_sets.size() > 1) {
switch (args_type) { switch (args_type) {
case AT_keyword_args: 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) << "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"; indent(out, 2) << "}\n";
break; break;
case AT_varargs: 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; break;
case AT_single_arg: case AT_single_arg:
// It shouldn't get here, but we'll handle these cases nonetheless. // 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; break;
default: default:
indent(out, 2) << "const Py_ssize_t parameter_count = 0;\n"; indent(out, 2) << "const int parameter_count = 0;\n";
break; break;
} }
@ -3571,19 +3571,19 @@ write_function_for_name(ostream &out, Object *obj,
switch (args_type) { switch (args_type) {
case AT_keyword_args: case AT_keyword_args:
out << " if (PyTuple_Size(args) > 0 || (kwds != NULL && PyDict_Size(kwds) > 0)) {\n"; 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 << " if (kwds != NULL) {\n";
out << " parameter_count += PyDict_Size(kwds);\n"; out << " parameter_count += (int)PyDict_Size(kwds);\n";
out << " }\n"; out << " }\n";
break; break;
case AT_varargs: case AT_varargs:
out << " if (PyTuple_Size(args) > 0) {\n"; 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; break;
case AT_single_arg: case AT_single_arg:
// Shouldn't happen, but let's handle this case nonetheless. // Shouldn't happen, but let's handle this case nonetheless.
out << " {\n"; out << " {\n";
out << " const Py_ssize_t parameter_count = 1;\n"; out << " const int parameter_count = 1;\n";
break; break;
case AT_no_args: case AT_no_args:
break; 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) { } 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 // Check this to be sure, as we handle the case of only 1 keyword arg
// in write_function_forset (not using ParseTupleAndKeywords). // 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" " if (kwds != NULL) {\n"
" parameter_count += PyDict_Size(kwds);\n" " parameter_count += (int)PyDict_Size(kwds);\n"
" }\n" " }\n"
" if (parameter_count != 1) {\n" " if (parameter_count != 1) {\n"
"#ifdef NDEBUG\n"; "#ifdef NDEBUG\n";

View File

@ -63,7 +63,7 @@ set_string_word(size_t n, const string &value) {
get_words(); get_words();
} }
while (n >= (int)_words.size()) { while (n >= _words.size()) {
Word w; Word w;
w._flags = 0; w._flags = 0;
_words.push_back(w); _words.push_back(w);
@ -207,7 +207,7 @@ check_bool_word(size_t n) {
get_words(); get_words();
} }
if (n >= 0 && n < (int)_words.size()) { if (n < _words.size()) {
Word &word = _words[n]; Word &word = _words[n];
if ((word._flags & F_checked_bool) == 0) { if ((word._flags & F_checked_bool) == 0) {
word._flags |= F_checked_bool; word._flags |= F_checked_bool;
@ -254,7 +254,7 @@ check_int_word(size_t n) {
get_words(); get_words();
} }
if (n >= 0 && n < (int)_words.size()) { if (n < _words.size()) {
Word &word = _words[n]; Word &word = _words[n];
if ((word._flags & F_checked_int) == 0) { if ((word._flags & F_checked_int) == 0) {
word._flags |= F_checked_int; word._flags |= F_checked_int;
@ -314,7 +314,7 @@ check_int64_word(size_t n) {
get_words(); get_words();
} }
if (n >= 0 && n < (int)_words.size()) { if (n < _words.size()) {
Word &word = _words[n]; Word &word = _words[n];
if ((word._flags & F_checked_int64) == 0) { if ((word._flags & F_checked_int64) == 0) {
word._flags |= F_checked_int64; word._flags |= F_checked_int64;
@ -372,7 +372,7 @@ check_double_word(size_t n) {
get_words(); get_words();
} }
if (n >= 0 && n < (int)_words.size()) { if (n < _words.size()) {
Word &word = _words[n]; Word &word = _words[n];
if ((word._flags & F_checked_double) == 0) { if ((word._flags & F_checked_double) == 0) {
word._flags |= F_checked_double; word._flags |= F_checked_double;