mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-30 16:17:02 +01:00
common: Avoid pointer arithmetic on string literals.
* common/gettime.c (rfctimestamp): Use indexing instead. * common/signal.c (got_fatal_signal): Likewise.
This commit is contained in:
parent
b0d2526bc4
commit
4aadc751f2
@ -740,10 +740,10 @@ rfctimestamp (u32 stamp)
|
||||
if (!tp)
|
||||
return NULL;
|
||||
return xtryasprintf ("%.3s, %02d %.3s %04d %02d:%02d:%02d +0000",
|
||||
("SunMonTueWedThuFriSat" + (tp->tm_wday%7)*3),
|
||||
&"SunMonTueWedThuFriSat"[(tp->tm_wday%7)*3],
|
||||
tp->tm_mday,
|
||||
("JanFebMarAprMayJunJulAugSepOctNovDec"
|
||||
+ (tp->tm_mon%12)*3),
|
||||
&"JanFebMarAprMayJunJulAugSepOctNovDec"
|
||||
[(tp->tm_mon%12)*3],
|
||||
tp->tm_year + 1900,
|
||||
tp->tm_hour,
|
||||
tp->tm_min,
|
||||
|
@ -134,7 +134,7 @@ got_fatal_signal (int sig)
|
||||
{
|
||||
if (value >= i || ((any || i==1) && !(value/i)))
|
||||
{
|
||||
(void)write (2, "0123456789"+(value/i), 1);
|
||||
(void)write (2, &"0123456789"[value/i], 1);
|
||||
if ((value/i))
|
||||
any = 1;
|
||||
value %= i;
|
||||
|
Loading…
x
Reference in New Issue
Block a user