1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-26 12:21:12 +03:00

libpq: use pgsocket for socket values, for portability

Previously, 'int' was used for socket values in libpq, but socket values
are unsigned on Windows.  This is a style correction.

Initial patch and previous PGINVALID_SOCKET initial patch by Joel
Jacobson, modified by me

Report from PVS-Studio
This commit is contained in:
Bruce Momjian
2014-04-16 19:46:51 -04:00
parent be5f7fff47
commit 5d305d86bd
6 changed files with 16 additions and 32 deletions

View File

@ -604,7 +604,7 @@ pqReadData(PGconn *conn)
int someread = 0;
int nread;
if (conn->sock < 0)
if (conn->sock == PGINVALID_SOCKET)
{
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("connection not open\n"));
@ -800,7 +800,7 @@ pqSendSome(PGconn *conn, int len)
int remaining = conn->outCount;
int result = 0;
if (conn->sock < 0)
if (conn->sock == PGINVALID_SOCKET)
{
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("connection not open\n"));
@ -1011,7 +1011,7 @@ pqSocketCheck(PGconn *conn, int forRead, int forWrite, time_t end_time)
if (!conn)
return -1;
if (conn->sock < 0)
if (conn->sock == PGINVALID_SOCKET)
{
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("socket not open\n"));