On Wed, 23 Aug 2023 00:42:47 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:

> This patch addresses two issues:
>  * For Windows: The snprintf is available with Visual Studio 2015 and above, 
> so we do not need to use the windows speciific "_snprintf". We also do not 
> need to set a zero at the end of the string since the "new" snprintf works 
> according c99: see this 
> [link](https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l?view=msvc-170#behavior-summary)
>  for details.
>  * For unix: It seems the standard snprintf does not guaratier that the zero 
> is set at the start of the string if error is occured and the negative value 
> is returned. It could be fixed by checking the return value and set zero 
> manually, but I just decided to memset the whole array to zero, that is 
> shorte and should not affect the performance in this error handler.
> 
> See some discussin at the end of 
> [this](https://github.com/openjdk/jdk/pull/10625) PR
> 
> The new test just covered the changed code path and verifies that it works as 
> expected.

This pull request has now been integrated.

Changeset: 0dce4c17
Author:    Sergey Bylokhov <s...@openjdk.org>
URL:       
https://git.openjdk.org/jdk/commit/0dce4c1758d05832e20380cff28d7ed47d693a6e
Stats:     94 lines in 3 files changed: 80 ins; 11 del; 3 mod

8313220: Remove Windows specific workaround in LCMS.c for _snprintf

Reviewed-by: prr

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

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

Reply via email to