pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: pgsql-committers <pgsql-committers@postgresql.org>
Subject: Re: Re: pgsql: to_char(): have format 'OF' only show the leading negative sign
Date: Wed, 29 Apr 2015 14:22:22 -0400
Message-ID: <20150429182222.GB30322@tamriel.snowman.net> (raw)
In-Reply-To: <CA+TgmoYAQ2H3RZoY0ipLg_7LjYMgqrdpEh_y4g_ruPhUhpSDnQ@mail.gmail.com>
References: <E1YnGP2-0007iQ-C7@gemulon.postgresql.org>
	<20150429141102.GX30322@tamriel.snowman.net>
	<CA+TgmoYAQ2H3RZoY0ipLg_7LjYMgqrdpEh_y4g_ruPhUhpSDnQ@mail.gmail.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

* Robert Haas (robertmhaas@gmail.com) wrote:
> On Wed, Apr 29, 2015 at 10:11 AM, Stephen Frost <sfrost@snowman.net> wrote:
> > * Bruce Momjian (bruce@momjian.us) wrote:
> >> to_char():  have format 'OF' only show the leading negative sign
> >>
> >> Previously both hours and minutes displayed as negative.
> >>
> >> Report by David Pozsar
> >
> > This is causing the following error for me:
> >
> > /home/sfrost/git/pg/dev/postgresql/src/backend/utils/adt/formatting.c: In function ‘DCH_to_char’:
> > /home/sfrost/git/pg/dev/postgresql/src/backend/utils/adt/formatting.c:2510:6: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘int’ [-Wformat=]
> >       sprintf(s, ":%02ld", abs(tm->tm_gmtoff % SECS_PER_HOUR) / SECS_PER_MINUTE);
> >       ^
> >
> > Since abs() is declared to return just an int.  I don't see it anywhere
> > in our tree and I'm not sure how portable it actually is, but labs() is
> > supposedly in C89, so perhaps that should be used here instead?
> 
> I just removed the "l" for now, since %02d is used to print the result
> of abs() elsewhere.  If that isn't right, someone can re-fix my fix.

Works for me.  I'm no longer seeing the warning.

	Thanks!

		Stephen

Attachments:

  signature.asc (application/pgp-signature, 818B) download

view thread (8+ messages)  latest in thread

Message-ID: <20150429182222.GB30322@tamriel.snowman.net>
Permalink:  ../20150429182222.GB30322@tamriel.snowman.net/
Also on:    postgresql.org/message-id/20150429182222.GB30322@tamriel.snowman.net

 · 

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: sfrost@snowman.net, robertmhaas@gmail.com, bruce@momjian.us
  Subject: Re: pgsql: to_char(): have format 'OF' only show the leading negative sign
  In-Reply-To: <20150429182222.GB30322@tamriel.snowman.net>
  References: <E1YnGP2-0007iQ-C7@gemulon.postgresql.org> <20150429141102.GX30322@tamriel.snowman.net> <CA+TgmoYAQ2H3RZoY0ipLg_7LjYMgqrdpEh_y4g_ruPhUhpSDnQ@mail.gmail.com> <20150429182222.GB30322@tamriel.snowman.net>

* 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