mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-17 21:24:28 +00:00
Fixed GCC-9 build error
-Werror=format-overflow
This commit is contained in:
parent
f1afc98e0c
commit
6fe59aea14
@ -773,7 +773,9 @@ inline void writeDateTimeText(DateTime64 datetime64, UInt32 scale, WriteBuffer &
|
|||||||
|
|
||||||
buf.write(fractional_time_delimiter);
|
buf.write(fractional_time_delimiter);
|
||||||
|
|
||||||
char data[MaxScale];
|
// trenary to fix GCC-9 build error:
|
||||||
|
// error: '%0*ld' directive writing between 1 and 20 bytes into a region of size 18 [-Werror=format-overflow=]
|
||||||
|
char data[MaxScale > 20 ? MaxScale : 20];
|
||||||
int written = sprintf(data, "%0*ld", scale, c.fractional); // TODO(nemkov): can it be negative ? if yes, do abs() on it.
|
int written = sprintf(data, "%0*ld", scale, c.fractional); // TODO(nemkov): can it be negative ? if yes, do abs() on it.
|
||||||
writeText(&data[0], static_cast<size_t>(written), buf);
|
writeText(&data[0], static_cast<size_t>(written), buf);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user