mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-19 12:52:37 +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);
|
||||
|
||||
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.
|
||||
writeText(&data[0], static_cast<size_t>(written), buf);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user