RFR: 8256828: ostream::print_cr() truncates buffer in copy-through case [v4]
Matias Saavedra Silva
matsaave at openjdk.org
Wed Jun 5 19:51:58 UTC 2024
On Tue, 4 Jun 2024 07:34:34 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Clarifies the behaviour of this function in regards to truncation when adding a CR. Ensures a truncation warning is always issued.
>>
>> Adds unit testing for the specialized cases.
>>
>> See JBS for discussion of other suggestions.
>>
>> Testing: - tiers 1-4
>>
>> Thanks
>
> David Holmes has updated the pull request incrementally with one additional commit since the last revision:
>
> Simplified the test code - thanks @tstuefe!
> Rewrote the comment block describing do_vsnprintf.
test/hotspot/gtest/utilities/test_ostream.cpp line 161:
> 159: size_t initial_len = strlen(str);
> 160: ASSERT_TRUE(initial_len < max_len);
> 161: result = test(&buffer[0], buflen, false, result_len, str);
I must have forgotten to add this comment before but here it is again:
Is there a reason you chose to use `&buffer[0]` rather than simple `buffer`?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19512#discussion_r1628355549
More information about the hotspot-dev
mailing list