Re: Re: pgsql: to_char(): have format 'OF' only show the leading negative sign

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Re: pgsql: to_char(): have format 'OF' only show the leading negative sign
Дата
Msg-id CA+TgmoYAQ2H3RZoY0ipLg_7LjYMgqrdpEh_y4g_ruPhUhpSDnQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pgsql: to_char(): have format 'OF' only show the leading negative sign  (Stephen Frost <sfrost@snowman.net>)
Ответы Re: Re: pgsql: to_char(): have format 'OF' only show the leading negative sign  (Stephen Frost <sfrost@snowman.net>)
Список pgsql-committers
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
oftype ‘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.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


В списке pgsql-committers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: pgsql: Attempt to fix some compiler warnings.
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: Re: pgsql: to_char(): have format 'OF' only show the leading negative sign