RFR: 8254270: linux 32 bit build doesn't compile libjdwp/log_messages.c [v3]

Coleen Phillimore coleenp at openjdk.java.net
Fri Nov 6 13:42:56 UTC 2020


On Fri, 6 Nov 2020 13:16:54 GMT, Claes Redestad <redestad at openjdk.org> wrote:

>> unsigned millisecs[] = { 2, 20, 200, 1000 };
>>   get_time_stamp(millisecs[i], buf, sizeof(buf));
>> 
>> gets:
>> 
>> timestamp 06.11.2020 06:56:08.002 EST
>> timestamp 06.11.2020 06:56:08.020 EST
>> timestamp 06.11.2020 06:56:08.200 EST
>> timestamp 06.11.2020 06:56:08.1000 EST
>> 
>> with
>> 
>>     char tmp[10 + 1];
>>     snprintf(tmp, sizeof(tmp), "%.3d", millisecs);
>>     snprintf(tbuf, ltbuf, "%s.%s %s", timestamp_date_time, tmp, timestamp_timezone);
>> 
>> Is this what you want?
>
> I think you need .3 in both places, otherwise I expect the warning will still be there? (We don't need to worry about values of millisecs larger than 999):
> 
> char tmp[11 + 1];
> snprintf(tmp, sizeof(tmp), "%.3d", millisecs);
> snprintf(tbuf, ltbuf, "%s.%.3s %s", timestamp_date_time, tmp, timestamp_timezone);

You're right.

-------------

PR: https://git.openjdk.java.net/jdk/pull/1067


More information about the serviceability-dev mailing list