RFR: 8295017: Remove Windows specific workaround in JLI_Snprintf [v3]

Sergey Bylokhov serb at openjdk.org
Tue Jul 25 21:02:56 UTC 2023


On Thu, 13 Oct 2022 14:34:25 GMT, Julian Waters <jwaters at openjdk.org> wrote:

>> Looks good. Thanks.
>
> @dholmes-ora could I trouble you for a sponsor? Thanks!

@TheShermanTanker Working on a similar cleanup, and wonder if is it correct to assume that the "snprintf" adds "nul" even in case of error.
For example, this code was removed by this patch:


    if (rc < 0) {
        /* apply ansi semantics */
        buffer[size - 1] = '\0';
        return (int)size;
    } else if (rc == size) {
        /* force a null terminator */
        buffer[size - 1] = '\0';
    }


If the result of "snprintf" was negative we always set the '\0'. But what about default "snprintf"?

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

PR Comment: https://git.openjdk.org/jdk/pull/10625#issuecomment-1650553077


More information about the core-libs-dev mailing list