Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YnWcx-0005aF-FJ for pgsql-committers@arkaria.postgresql.org; Wed, 29 Apr 2015 18:22:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YnWcw-00052W-Ec for pgsql-committers@arkaria.postgresql.org; Wed, 29 Apr 2015 18:22:30 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YnWcs-0004ug-2Z for pgsql-committers@postgresql.org; Wed, 29 Apr 2015 18:22:26 +0000 Received: from tamriel.snowman.net ([2001:4830:167b::11]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1YnWcp-0002Mb-Es for pgsql-committers@postgresql.org; Wed, 29 Apr 2015 18:22:24 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 0FC2C5F7A0; Wed, 29 Apr 2015 14:22:23 -0400 (EDT) Date: Wed, 29 Apr 2015 14:22:22 -0400 From: Stephen Frost To: Robert Haas Cc: Bruce Momjian , pgsql-committers Subject: Re: Re: pgsql: to_char(): have format 'OF' only show the leading negative sign Message-ID: <20150429182222.GB30322@tamriel.snowman.net> References: <20150429141102.GX30322@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="cMRp6r1K6JdiUiOM" Content-Disposition: inline In-Reply-To: X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.13.0-46-generic (x86_64) X-Uptime: 14:22:08 up 41 days, 10 min, 24 users, load average: 0.09, 0.16, 0.16 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org --cMRp6r1K6JdiUiOM Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Robert Haas (robertmhaas@gmail.com) wrote: > On Wed, Apr 29, 2015 at 10:11 AM, Stephen Frost wrot= e: > > * 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 =E2=80=98DCH_to_char=E2=80=99: > > /home/sfrost/git/pg/dev/postgresql/src/backend/utils/adt/formatting.c:2= 510:6: warning: format =E2=80=98%ld=E2=80=99 expects argument of type =E2= =80=98long int=E2=80=99, but argument 3 has type =E2=80=98int=E2=80=99 [-Wf= ormat=3D] > > sprintf(s, ":%02ld", abs(tm->tm_gmtoff % SECS_PER_HOUR) / SECS_PE= R_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? >=20 > 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 --cMRp6r1K6JdiUiOM Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJVQSFeAAoJEO1sijiDR2RV1IQQAI5qfHiJvmAUk6W8NhhFoZV7 PAl4VW4arOwfge3a1vaJ+sFQIH16w4H6ic7xVu+QVcbGJDyolabDv8nTtxGGj5n5 qS4+Qm+QU47mBNSJYLxqGgOXNij9q79OFyLGTsZyQgN3O4xzthv/HSRUoTCSjAYn R+nqr6VbQCfk765KuH3yjEDCXmxTxn16mP7RCYTF1271dtZ898oaJ7M31YRrzTtD Xi67J6VVY+cLy+Wvznce4Ig8E0KXiCiqcK5yJ1Cto3erofJxJhUEJ9K2k0QhcCs9 JeofL0wF4eMan5NX/m26cUvywwM/x2lXETu/9j/HuvhpOTFW6xOZ2k+5sAhSt2on f0UCbKwiifwZx8wKcIxGGjgRJdCV1iDqkaY5xRqyoKYJQ2EcObSkYkKHPPIwtNmo Jv6x9S6ibpemoJcpdyOha2hDI3AnyEPRisFjGMN33n8JLXnmznkDT/PuakPchKY0 RVdU0Gk5FMyMZNVVW+x+uSIAaTh6GBiptKsMfvqLaz6F75I+GEYIktecFv7oYj+9 NtekiQGkMj1U0auT90wnSkJh7BFPSai4pzm4vbBavtALjeuIZFNm37hK0d25h9Mw CeGGs12SQejkWEytjxIYgREBatCbHe6zqJHegRyqwTi/NuiuHUvp+MuIb5JVSHWL DdPvLgF28HS+hsJ22HhK =3LGC -----END PGP SIGNATURE----- --cMRp6r1K6JdiUiOM--