pgsql: Cast to (void *) rather than (int *) when passing int64's to PQf

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Cast to (void *) rather than (int *) when passing int64's to PQf
Date: 2015-03-08 17:58:47
Message-ID: E1YUfTT-00080W-TP@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Cast to (void *) rather than (int *) when passing int64's to PQfn().

This is a possibly-vain effort to silence a Coverity warning about
bogus endianness dependency. The code's fine, because it takes care
of endianness issues for itself, but Coverity sees an int64 being
passed to an int* argument and not unreasonably suspects something's
wrong. I'm not sure if putting the void* cast in the way will shut it
up; but it can't hurt and seems better from a documentation standpoint
anyway, since the pointer is not used as an int* in this code path.

Just for a bit of additional safety, verify that the result length
is 8 bytes as expected.

Back-patch to 9.3 where the code in question was added.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/3d0d3c02fff4d0c919eed28fb0d6d4b45857a408

Modified Files
--------------
src/interfaces/libpq/fe-lobj.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2015-03-08 18:10:29 pgsql: Sort SUBDIRS variable in src/bin/Makefile
Previous Message Tom Lane 2015-03-08 17:43:03 pgsql: Remove struct PQArgBlock from server-side header libpq/libpq.h.