pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Andres Freund <andres@anarazel.de>
To: pgsql-committers@postgresql.org
Subject: Re: [COMMITTERS] pgsql: Add more efficient functions to pqformat API.
Date: Thu, 30 Nov 2017 14:49:13 -0500
Message-ID: <dc9002f7-2be1-b0a4-9106-76be2ebf0537@2ndquadrant.com> (raw)
In-Reply-To: <E1e2Q9j-000186-LB@gemulon.postgresql.org>
References: <E1e2Q9j-000186-LB@gemulon.postgresql.org>

On 10/11/17 19:11, Andres Freund wrote:
> 3) Add pq_writeint$width(), pq_writestring(). These rely on sufficient
>    space in the StringInfo's buffer, avoiding individual space checks
>    & potential individual resizing.  To allow this to be used for
>    strings, expose mbutil.c's MAX_CONVERSION_GROWTH.

This has been causing warnings from cpluspluscheck.  I suggest the
attached patch to address that.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

0001-Fix-warnings-from-cpluspluscheck.patch (text/plain, 1.8K) download From 36afad4cd4ade040ae91b6a20041fba5edb98dd5 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter_e@gmx.net> Date: Thu, 30 Nov 2017 14:46:22 -0500 Subject: [PATCH] Fix warnings from cpluspluscheck Fix warnings about "comparison between signed and unsigned integer expressions" in inline functions in header files by adding some casts. --- src/include/libpq/pqformat.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/include/libpq/pqformat.h b/src/include/libpq/pqformat.h index 4de9e6dd21..9f56d184fd 100644 --- a/src/include/libpq/pqformat.h +++ b/src/include/libpq/pqformat.h @@ -51,7 +51,7 @@ pq_writeint8(StringInfoData *pg_restrict buf, int8 i) { int8 ni = i; - Assert(buf->len + sizeof(int8) <= buf->maxlen); + Assert(buf->len + (int) sizeof(int8) <= buf->maxlen); memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(int8)); buf->len += sizeof(int8); } @@ -65,7 +65,7 @@ pq_writeint16(StringInfoData *pg_restrict buf, int16 i) { int16 ni = pg_hton16(i); - Assert(buf->len + sizeof(int16) <= buf->maxlen); + Assert(buf->len + (int) sizeof(int16) <= buf->maxlen); memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(int16)); buf->len += sizeof(int16); } @@ -79,7 +79,7 @@ pq_writeint32(StringInfoData *pg_restrict buf, int32 i) { int32 ni = pg_hton32(i); - Assert(buf->len + sizeof(int32) <= buf->maxlen); + Assert(buf->len + (int) sizeof(int32) <= buf->maxlen); memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(int32)); buf->len += sizeof(int32); } @@ -93,7 +93,7 @@ pq_writeint64(StringInfoData *pg_restrict buf, int64 i) { int64 ni = pg_hton64(i); - Assert(buf->len + sizeof(int64) <= buf->maxlen); + Assert(buf->len + (int) sizeof(int64) <= buf->maxlen); memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(int64)); buf->len += sizeof(int64); } -- 2.15.0

view thread (4+ messages)  latest in thread

Message-ID: <dc9002f7-2be1-b0a4-9106-76be2ebf0537@2ndquadrant.com>
Permalink:  ../dc9002f7-2be1-b0a4-9106-76be2ebf0537@2ndquadrant.com/
Also on:    postgresql.org/message-id/dc9002f7-2be1-b0a4-9106-76be2ebf0537@2ndquadrant.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com, andres@anarazel.de
  Subject: Re: [COMMITTERS] pgsql: Add more efficient functions to pqformat API.
  In-Reply-To: <dc9002f7-2be1-b0a4-9106-76be2ebf0537@2ndquadrant.com>
  References: <E1e2Q9j-000186-LB@gemulon.postgresql.org> <dc9002f7-2be1-b0a4-9106-76be2ebf0537@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox