RFR: 8347576: Error output in libjsound has non matching format strings [v4]
Matthias Baesken
mbaesken at openjdk.org
Wed Jan 15 14:22:47 UTC 2025
On Wed, 15 Jan 2025 14:02:00 GMT, Julian Waters <jwaters at openjdk.org> wrote:
>> 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/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp line 60:
>
>> 58: MidiDeviceHandle* handle = (MidiDeviceHandle*) dwInstance;
>> 59:
>> 60: TRACE3("> MIDI_IN_PutMessage, hMidiIn: 0x%" PRIxPTR ", wMsg: %x, dwInstance: 0x%" PRIxPTR "\n", (uintptr_t)hMidiIn, wMsg, (uintptr_t)dwInstance);
>
> It's surprisingly difficult to find the type of HMIDIIN, but the rest of the types here are UINT_PTR and hence %x seems correct
Here the compile error we get ; %x does not work for HMIDIIN or UINT_PTR.
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(58): error C2220: the following warning is treated as an error
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(58): warning C4477: 'fprintf' : format string '%x' requires an argument of type 'unsigned int', but variadic argument 1 has type 'HMIDIIN'
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(58): warning C4313: 'fprintf': '%x' in format string conflicts with argument 1 of type 'HMIDIIN'
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(58): warning C4477: 'fprintf' : format string '%x' requires an argument of type 'unsigned int', but variadic argument 3 has type 'UINT_PTR'
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(58): note: consider using '%llx' in the format string
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(58): note: consider using '%Ix' in the format string
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(58): note: consider using '%I64x' in the format string
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(59): warning C4477: 'fprintf' : format string '%x' requires an argument of type 'unsigned int', but variadic argument 1 has type 'UINT_PTR'
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(59): note: consider using '%llx' in the format string
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(59): note: consider using '%Ix' in the format string
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(59): note: consider using '%I64x' in the format string
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(59): warning C4477: 'fprintf' : format string '%x' requires an argument of type 'unsigned int', but variadic argument 2 has type 'UINT_PTR'
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(59): note: consider using '%llx' in the format string
c:\builddir\jdk\src\java.desktop\windows\native\libjsound\PLATFORM_API_WinOS_MidiIn.cpp(59): note: consider using '%Ix' in the format string
... (rest of output omitted)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23076#discussion_r1916723519
More information about the client-libs-dev
mailing list