Skip to content

Commit d2cd123

Browse files
committed
Dropped compiler warning about signed/unsigned comparisons
1 parent 3e12522 commit d2cd123

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

psycopg/adapter_qstring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ qstring_quote(qstringObject *self)
7777
goto exit;
7878
}
7979

80-
if (qlen > (size_t) PY_SSIZE_T_MAX) {
80+
if (qlen > PY_SSIZE_T_MAX) {
8181
PyErr_SetString(PyExc_IndexError,
8282
"PG buffer too large to fit in Python buffer.");
8383
goto exit;

psycopg/pqpath.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ pq_get_guc_locked(
713713
Dprintf("pq_get_guc_locked: reading %s", param);
714714

715715
size = PyOS_snprintf(query, sizeof(query), "SHOW %s", param);
716-
if (size >= sizeof(query)) {
716+
if (size < 0 || (size_t)size >= sizeof(query)) {
717717
*error = strdup("SHOW: query too large");
718718
goto cleanup;
719719
}
@@ -778,7 +778,7 @@ pq_set_guc_locked(
778778
size = PyOS_snprintf(query, sizeof(query),
779779
"SET %s TO '%s'", param, value);
780780
}
781-
if (size >= sizeof(query)) {
781+
if (size < 0 || (size_t)size >= sizeof(query)) {
782782
*error = strdup("SET: query too large");
783783
}
784784

0 commit comments

Comments
 (0)