On Thu, 30 Jun 2022 20:05:05 GMT, Naoto Sato <na...@openjdk.org> wrote:

>> Gaurav Chaudhari has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   8288377: Simplified TZ offset calc and consolidate MACOS impl.
>
> src/java.base/unix/native/libjava/TimeZone_md.c line 569:
> 
>> 567:     }
>> 568: 
>> 569:     strftime(offset, 6, "%z", &localtm);
> 
> Return value has to be examined. If it is not `5`, then I'd expect falling 
> back to "GMT".

Added check to verify output is as expected before proceeding, with fallback

> src/java.base/unix/native/libjava/TimeZone_md.c line 572:
> 
>> 570:     char gmt_offset[] = {offset[0], offset[1], offset[2], ':', 
>> offset[3], offset[4], '\0'};
>> 571: 
>> 572:     sprintf(buf, (const char *)"GMT%s", gmt_offset);
> 
> You could use the format string as "GMT%c%c%c:%c%c" so that the extra 
> `gmt_offset` variable can be eliminated.

Adjusted, forgot that the final string returned was able to be formatted itself 
as well.

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

PR: https://git.openjdk.org/jdk/pull/9312

Reply via email to