RFR: 8347576: Error output in libjsound has non matching format strings [v4]

Julian Waters jwaters at openjdk.org
Wed Jan 15 14:01:49 UTC 2025


On Wed, 15 Jan 2025 12:43:52 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> When enabling the jsound ERROR and TRACE reporting (see src/java.desktop/share/native/libjsound/Configure.h https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/native/libjsound/Configure.h#L32 ), we run into some build warnings as errors  (when building on Linux) because at 2 places the format specifiers do not match the number types .
>
> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
> 
>   change format specifiers at some places in Windows coding

src/java.desktop/share/native/libjsound/MidiOutDevice.c line 97:

> 95:     /* Handle error codes. */
> 96:     if (ret < -1) {
> 97:         ERROR1("Java_com_sun_media_sound_MidiOutDevice_nGetTimeStamp: MIDI_IN_GetTimeStamp returned %lld\n", (long long int) ret);

I wonder if we could use the format specifier for jlong here somehow, avoiding the cast here

src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp line 76:

> 74:     case MIM_DATA:
> 75:         TRACE3("  MIDI_IN_PutMessage: MIM_MOREDATA or MIM_DATA. status=0x%" PRIxPTR " data1=0x%" PRIxPTR " data2=0x%" PRIxPTR "\n",
> 76:                (uintptr_t)(dwParam1 & 0xFF), (uintptr_t)((dwParam1 & 0xFF00)>>8), (uintptr_t)((dwParam1 & 0xFF0000)>>16));

Why cast to uintptr_t? dwParam1's UINT_PTR type is really just an unsigned int, so the existing %x seems correct

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23076#discussion_r1916697942
PR Review Comment: https://git.openjdk.org/jdk/pull/23076#discussion_r1916695459


More information about the client-libs-dev mailing list