Dropped compiler warning about signed/unsigned comparisons

This commit is contained in:
Daniele Varrazzo 2017-02-07 19:07:58 +00:00
parent 3e12522bc9
commit d2cd1236a8
2 changed files with 3 additions and 3 deletions

View File

@ -77,7 +77,7 @@ qstring_quote(qstringObject *self)
goto exit; goto exit;
} }
if (qlen > (size_t) PY_SSIZE_T_MAX) { if (qlen > PY_SSIZE_T_MAX) {
PyErr_SetString(PyExc_IndexError, PyErr_SetString(PyExc_IndexError,
"PG buffer too large to fit in Python buffer."); "PG buffer too large to fit in Python buffer.");
goto exit; goto exit;

View File

@ -713,7 +713,7 @@ pq_get_guc_locked(
Dprintf("pq_get_guc_locked: reading %s", param); Dprintf("pq_get_guc_locked: reading %s", param);
size = PyOS_snprintf(query, sizeof(query), "SHOW %s", param); size = PyOS_snprintf(query, sizeof(query), "SHOW %s", param);
if (size >= sizeof(query)) { if (size < 0 || (size_t)size >= sizeof(query)) {
*error = strdup("SHOW: query too large"); *error = strdup("SHOW: query too large");
goto cleanup; goto cleanup;
} }
@ -778,7 +778,7 @@ pq_set_guc_locked(
size = PyOS_snprintf(query, sizeof(query), size = PyOS_snprintf(query, sizeof(query),
"SET %s TO '%s'", param, value); "SET %s TO '%s'", param, value);
} }
if (size >= sizeof(query)) { if (size < 0 || (size_t)size >= sizeof(query)) {
*error = strdup("SET: query too large"); *error = strdup("SET: query too large");
} }