RFR: 8347576: Error output in libjsound has non matching format strings [v4]
Matthias Baesken
mbaesken at openjdk.org
Wed Jan 15 14:35:40 UTC 2025
On Wed, 15 Jan 2025 14:19:51 GMT, Julian Waters <jwaters at openjdk.org> wrote:
>> 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
>> ......
>
> Ah, I just checked, UINT_PTR confusingly differs depending on certain defines. Alright, makes sense, though I still haven't figured out what type HMIDIIN is. I think you could just do %llx directly instead of doing the dance with uintptr_t and inttypes.h though
Regarding HMIDIIN , according to https://learn.microsoft.com/en-us/windows/win32/multimedia/midi-input-data-types it seems to be a HANDLE type/typedef.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23076#discussion_r1916761469
More information about the client-libs-dev
mailing list