mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-23 04:24:49 +02:00
8139116: Fixes for warning "format not a string literal"
Reviewed-by: ddmitriev, david, simonis
This commit is contained in:
parent
af7bf9a76a
commit
4aad17f807
14 changed files with 49 additions and 110 deletions
|
@ -96,8 +96,7 @@ char* os::iso8601_time(char* buffer, size_t buffer_length) {
|
|||
// Output will be of the form "YYYY-MM-DDThh:mm:ss.mmm+zzzz\0"
|
||||
// 1 2
|
||||
// 12345678901234567890123456789
|
||||
static const char* iso8601_format =
|
||||
"%04d-%02d-%02dT%02d:%02d:%02d.%03d%c%02d%02d";
|
||||
// format string: "%04d-%02d-%02dT%02d:%02d:%02d.%03d%c%02d%02d"
|
||||
static const size_t needed_buffer = 29;
|
||||
|
||||
// Sanity check the arguments
|
||||
|
@ -158,7 +157,8 @@ char* os::iso8601_time(char* buffer, size_t buffer_length) {
|
|||
// Print an ISO 8601 date and time stamp into the buffer
|
||||
const int year = 1900 + time_struct.tm_year;
|
||||
const int month = 1 + time_struct.tm_mon;
|
||||
const int printed = jio_snprintf(buffer, buffer_length, iso8601_format,
|
||||
const int printed = jio_snprintf(buffer, buffer_length,
|
||||
"%04d-%02d-%02dT%02d:%02d:%02d.%03d%c%02d%02d",
|
||||
year,
|
||||
month,
|
||||
time_struct.tm_mday,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue