https://git.reactos.org/?p=reactos.git;a=commitdiff;h=58588b76e2bd464ebed4c…
commit 58588b76e2bd464ebed4c04791135ae3ad6f3205
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Mon Aug 20 17:42:27 2018 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Thu Aug 15 15:24:12 2019 +0200
[REACTOS] Fix MSVC printf format warnings
---
base/applications/cmdutils/fsutil/fsinfo.c | 2 +-
dll/cpl/timedate/timedate.c | 4 ++--
drivers/storage/class/disk_new/pnp.c | 12 ++++++------
drivers/wdm/audio/backpln/audio_test/audio_test.c | 2 +-
modules/rosapps/applications/cmdutils/vcdcli/vcdcli.c | 2 +-
.../applications/devutils/shlextdbg/shlextdbg.cpp | 2 +-
modules/rosapps/applications/net/netreg/netreg.cpp | 2 +-
modules/rosapps/applications/rosinternals/nfi/nfi.c | 2 +-
.../applications/rosinternals/ntfsinfo/ntfsinfo.c | 6 +++---
.../applications/sysutils/utils/driver/load/load.c | 2 +-
.../applications/sysutils/utils/driver/unload/unload.c | 2 +-
modules/rosapps/lib/win32err/win32err.c | 2 +-
.../apitests/ntdll/RtlDosPathNameToNtPathName_U.c | 18 +++++++++---------
modules/rostests/apitests/user32/CreateDialog.c | 2 +-
modules/rostests/apitests/user32/LoadImage.c | 4 ++--
modules/rostests/tests/mmixer_test/test.c | 4 ++--
sdk/lib/rtl/actctx.c | 2 +-
17 files changed, 35 insertions(+), 35 deletions(-)
diff --git a/base/applications/cmdutils/fsutil/fsinfo.c
b/base/applications/cmdutils/fsutil/fsinfo.c
index 2e5edd9a5e5..65bae0fde32 100644
--- a/base/applications/cmdutils/fsutil/fsinfo.c
+++ b/base/applications/cmdutils/fsutil/fsinfo.c
@@ -352,7 +352,7 @@ ValidateSizes(ULONG Length, DWORD ProcCount, DWORD BytesRead, DWORD
SpecificSize
/* Check whether this covers a specific entry and a generic entry for every processor
*/
if ((sizeof(FILESYSTEM_STATISTICS) + SpecificSize) * ProcCount > BytesRead)
{
- _ftprintf(stderr, _T("Only performed a partial read: %lu (expected:
%lu)\n"), BytesRead, (sizeof(FILESYSTEM_STATISTICS) + SpecificSize));
+ _ftprintf(stderr, _T("Only performed a partial read: %lu (expected:
%Iu)\n"), BytesRead, (sizeof(FILESYSTEM_STATISTICS) + SpecificSize));
return 1;
}
diff --git a/dll/cpl/timedate/timedate.c b/dll/cpl/timedate/timedate.c
index 52a03f41feb..5557a95f5b9 100644
--- a/dll/cpl/timedate/timedate.c
+++ b/dll/cpl/timedate/timedate.c
@@ -28,7 +28,7 @@ VOID DisplayWin32ErrorDbg(DWORD dwErrorCode, const char *file, int
line)
VOID DisplayWin32Error(DWORD dwErrorCode)
#endif
{
- LPVOID lpMsgBuf;
+ PWSTR lpMsgBuf;
#if DBG
WCHAR szMsg[255];
#endif
@@ -44,7 +44,7 @@ VOID DisplayWin32Error(DWORD dwErrorCode)
NULL );
#if DBG
- if (swprintf(szMsg, L"%hs:%d: %s", file, line, lpMsgBuf))
+ if (swprintf(szMsg, L"%hs:%d: %s", file, line, (PWSTR)lpMsgBuf))
{
MessageBoxW(NULL, szMsg, NULL, MB_OK | MB_ICONERROR);
}
diff --git a/drivers/storage/class/disk_new/pnp.c b/drivers/storage/class/disk_new/pnp.c
index 84f7f0f55c0..ecccc515b3f 100644
--- a/drivers/storage/class/disk_new/pnp.c
+++ b/drivers/storage/class/disk_new/pnp.c
@@ -724,13 +724,13 @@ Return Value:
if((Pdo->Characteristics & FILE_REMOVABLE_MEDIA) == 0) {
if (diskData->PartitionStyle == PARTITION_STYLE_MBR) {
- sprintf(string, "S%08lx_O%I64lx_L%I64lx",
+ sprintf(string, "S%08lx_O%I64x_L%I64x",
diskData->Mbr.Signature,
- commonExtension->StartingOffset,
- commonExtension->PartitionLength);
+ commonExtension->StartingOffset.QuadPart,
+ commonExtension->PartitionLength.QuadPart);
} else {
sprintf(string,
-
"S%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02xS_O%I64lx_L%I64lx",
+
"S%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02xS_O%I64x_L%I64x",
diskData->Efi.DiskId.Data1,
diskData->Efi.DiskId.Data2,
diskData->Efi.DiskId.Data3,
@@ -742,8 +742,8 @@ Return Value:
diskData->Efi.DiskId.Data4[5],
diskData->Efi.DiskId.Data4[6],
diskData->Efi.DiskId.Data4[7],
- commonExtension->StartingOffset,
- commonExtension->PartitionLength);
+ commonExtension->StartingOffset.QuadPart,
+ commonExtension->PartitionLength.QuadPart);
}
} else {
sprintf(string, "RM");
diff --git a/drivers/wdm/audio/backpln/audio_test/audio_test.c
b/drivers/wdm/audio/backpln/audio_test/audio_test.c
index da71a08dc06..cd2fc11a8d8 100644
--- a/drivers/wdm/audio/backpln/audio_test/audio_test.c
+++ b/drivers/wdm/audio/backpln/audio_test/audio_test.c
@@ -110,7 +110,7 @@ TestKs()
// Allocate a KS Pin Connection Request Structure
//
Length = sizeof(KSPIN_CONNECT) + sizeof(KSDATAFORMAT_WAVEFORMATEX);
- printf("Length %ld KSPIN %u DATAFORMAT %u\n", Length, sizeof(KSPIN_CONNECT),
sizeof(KSDATAFORMAT_WAVEFORMATEX));
+ printf("Length %ld KSPIN %Iu DATAFORMAT %Iu\n", Length, sizeof(KSPIN_CONNECT),
sizeof(KSDATAFORMAT_WAVEFORMATEX));
PinConnect = (PKSPIN_CONNECT)HeapAlloc(GetProcessHeap(), 0, Length);
DataFormat = (PKSDATAFORMAT_WAVEFORMATEX)(PinConnect + 1);
diff --git a/modules/rosapps/applications/cmdutils/vcdcli/vcdcli.c
b/modules/rosapps/applications/cmdutils/vcdcli/vcdcli.c
index db13566cb3a..f01b13265f7 100644
--- a/modules/rosapps/applications/cmdutils/vcdcli/vcdcli.c
+++ b/modules/rosapps/applications/cmdutils/vcdcli/vcdcli.c
@@ -362,7 +362,7 @@ _tmain(int argc, const TCHAR *argv[])
hFile = CreateFile(argv[3], FILE_READ_DATA, FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
- _ftprintf(stderr, _T("Failed to open file: %s\n"),
GetLastError());
+ _ftprintf(stderr, _T("Failed to open file: %lu\n"),
GetLastError());
return 1;
}
diff --git a/modules/rosapps/applications/devutils/shlextdbg/shlextdbg.cpp
b/modules/rosapps/applications/devutils/shlextdbg/shlextdbg.cpp
index b4d24a397a9..3e1a29feea2 100644
--- a/modules/rosapps/applications/devutils/shlextdbg/shlextdbg.cpp
+++ b/modules/rosapps/applications/devutils/shlextdbg/shlextdbg.cpp
@@ -164,7 +164,7 @@ static BOOL CALLBACK cb_AddPage(HPROPSHEETPAGE page, LPARAM lParam)
g_Pages.Add(page);
if (lParam != (LPARAM)&g_Pages)
{
- wprintf(L"Propsheet failed to pass lParam, got: 0x%x\n", lParam);
+ wprintf(L"Propsheet failed to pass lParam, got: 0x%Ix\n", lParam);
}
return TRUE;
}
diff --git a/modules/rosapps/applications/net/netreg/netreg.cpp
b/modules/rosapps/applications/net/netreg/netreg.cpp
index f7f5105761e..de836c972b1 100644
--- a/modules/rosapps/applications/net/netreg/netreg.cpp
+++ b/modules/rosapps/applications/net/netreg/netreg.cpp
@@ -417,7 +417,7 @@ SOCKET make_listening_socket( int port ) {
fprintf( stderr, "Creating the listener\n" );
SOCKET l = socket( PF_INET, SOCK_STREAM, 0 );
- fprintf( stderr, "Socket %x\n", l );
+ fprintf( stderr, "Socket %I64x\n", l );
if( l == INVALID_SOCKET ) return l;
if( bind( l, (struct sockaddr *)&sa, sizeof( sa ) ) < 0 ) {
diff --git a/modules/rosapps/applications/rosinternals/nfi/nfi.c
b/modules/rosapps/applications/rosinternals/nfi/nfi.c
index 377826b4375..aa0767effd6 100644
--- a/modules/rosapps/applications/rosinternals/nfi/nfi.c
+++ b/modules/rosapps/applications/rosinternals/nfi/nfi.c
@@ -618,7 +618,7 @@ _tmain(int argc, const TCHAR *argv[])
OutputBuffer = HeapAlloc(GetProcessHeap(), 0, VolumeInfo.BytesPerFileRecordSegment +
sizeof(NTFS_FILE_RECORD_OUTPUT_BUFFER));
if (OutputBuffer == NULL)
{
- _ftprintf(stderr, _T("Failed to allocate %x bytes\n"),
VolumeInfo.BytesPerFileRecordSegment + sizeof(NTFS_FILE_RECORD_OUTPUT_BUFFER));
+ _ftprintf(stderr, _T("Failed to allocate %Ix bytes\n"),
VolumeInfo.BytesPerFileRecordSegment + sizeof(NTFS_FILE_RECORD_OUTPUT_BUFFER));
CloseHandle(VolumeHandle);
return 1;
}
diff --git a/modules/rosapps/applications/rosinternals/ntfsinfo/ntfsinfo.c
b/modules/rosapps/applications/rosinternals/ntfsinfo/ntfsinfo.c
index c7022505c89..7db72c5f9c4 100644
--- a/modules/rosapps/applications/rosinternals/ntfsinfo/ntfsinfo.c
+++ b/modules/rosapps/applications/rosinternals/ntfsinfo/ntfsinfo.c
@@ -135,7 +135,7 @@ _tmain(int argc, const TCHAR *argv[])
_tprintf(_T("Total sectors\t\t: %I64u\n"),
VolumeInfo.NumberSectors.QuadPart);
_tprintf(_T("Total clusters\t\t: %I64u\n"),
VolumeInfo.TotalClusters.QuadPart);
_tprintf(_T("Free clusters\t\t: %I64u\n"),
VolumeInfo.FreeClusters.QuadPart);
- _tprintf(_T("Free space\t\t: %I64u MB (%u%% of drive)\n"),
(VolumeInfo.FreeClusters.QuadPart * VolumeInfo.BytesPerCluster) >> 20,
(VolumeInfo.FreeClusters.QuadPart * 100) / VolumeInfo.TotalClusters.QuadPart);
+ _tprintf(_T("Free space\t\t: %I64u MB (%I64u%% of drive)\n"),
(VolumeInfo.FreeClusters.QuadPart * VolumeInfo.BytesPerCluster) >> 20,
(VolumeInfo.FreeClusters.QuadPart * 100) / VolumeInfo.TotalClusters.QuadPart);
_tprintf(_T("\nAllocation Size\n---------------\n"));
_tprintf(_T("Bytes per sector\t: %lu\n"), VolumeInfo.BytesPerSector);
@@ -144,11 +144,11 @@ _tmain(int argc, const TCHAR *argv[])
_tprintf(_T("Clusters per MFT record\t: %lu\n"),
VolumeInfo.ClustersPerFileRecordSegment);
_tprintf(_T("\nMFT Information\n---------------\n"));
- _tprintf(_T("MFT size\t\t: %I64u MB (%u%% of drive)\n"),
VolumeInfo.MftValidDataLength.QuadPart >> 20,
(VolumeInfo.MftValidDataLength.QuadPart * 100) / VolumeSize);
+ _tprintf(_T("MFT size\t\t: %I64u MB (%I64u%% of drive)\n"),
VolumeInfo.MftValidDataLength.QuadPart >> 20,
(VolumeInfo.MftValidDataLength.QuadPart * 100) / VolumeSize);
_tprintf(_T("MFT start cluster\t: %I64u\n"),
VolumeInfo.MftStartLcn.QuadPart);
_tprintf(_T("MFT zone clusters\t: %I64u - %I64u\n"),
VolumeInfo.MftZoneStart.QuadPart, VolumeInfo.MftZoneEnd.QuadPart);
MftClusters = VolumeInfo.MftZoneEnd.QuadPart - VolumeInfo.MftZoneStart.QuadPart;
- _tprintf(_T("MFT zone size\t\t: %I64u MB (%u%% of drive)\n"), (MftClusters
* VolumeInfo.BytesPerCluster) >> 20, (MftClusters * 100) /
VolumeInfo.TotalClusters.QuadPart);
+ _tprintf(_T("MFT zone size\t\t: %I64u MB (%I64u%% of drive)\n"),
(MftClusters * VolumeInfo.BytesPerCluster) >> 20, (MftClusters * 100) /
VolumeInfo.TotalClusters.QuadPart);
_tprintf(_T("MFT mirror start\t: %I64u\n"),
VolumeInfo.Mft2StartLcn.QuadPart);
_tprintf(_T("\nMeta-Data files\n---------------\n"));
diff --git a/modules/rosapps/applications/sysutils/utils/driver/load/load.c
b/modules/rosapps/applications/sysutils/utils/driver/load/load.c
index 3ec87d32f46..557815adf4a 100644
--- a/modules/rosapps/applications/sysutils/utils/driver/load/load.c
+++ b/modules/rosapps/applications/sysutils/utils/driver/load/load.c
@@ -21,7 +21,7 @@ int wmain(int argc, WCHAR * argv[])
wsprintf(ServiceName.Buffer,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\%S",
argv[1]);
- wprintf(L"%s %u %d\n", ServiceName.Buffer, ServiceName.Length,
wcslen(ServiceName.Buffer));
+ wprintf(L"%s %u %Id\n", ServiceName.Buffer, ServiceName.Length,
wcslen(ServiceName.Buffer));
Status = NtLoadDriver(&ServiceName);
free(ServiceName.Buffer);
if (!NT_SUCCESS(Status))
diff --git a/modules/rosapps/applications/sysutils/utils/driver/unload/unload.c
b/modules/rosapps/applications/sysutils/utils/driver/unload/unload.c
index 8f6e655b251..6bc68c1890d 100644
--- a/modules/rosapps/applications/sysutils/utils/driver/unload/unload.c
+++ b/modules/rosapps/applications/sysutils/utils/driver/unload/unload.c
@@ -21,7 +21,7 @@ int wmain(int argc, WCHAR * argv[])
wsprintf(ServiceName.Buffer,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\%S",
argv[1]);
- wprintf(L"%s %d %d\n", ServiceName.Buffer, ServiceName.Length,
wcslen(ServiceName.Buffer));
+ wprintf(L"%s %d %Ud\n", ServiceName.Buffer, ServiceName.Length,
wcslen(ServiceName.Buffer));
Status = NtUnloadDriver(&ServiceName);
free(ServiceName.Buffer);
if (!NT_SUCCESS(Status))
diff --git a/modules/rosapps/lib/win32err/win32err.c
b/modules/rosapps/lib/win32err/win32err.c
index c68a20f3582..f05fbc6bef5 100644
--- a/modules/rosapps/lib/win32err/win32err.c
+++ b/modules/rosapps/lib/win32err/win32err.c
@@ -46,7 +46,7 @@ PrintWin32Error(
DWORD ErrorCode
)
{
- PVOID lpMsgBuf;
+ LPWSTR lpMsgBuf;
FormatMessageW(
(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM),
diff --git a/modules/rostests/apitests/ntdll/RtlDosPathNameToNtPathName_U.c
b/modules/rostests/apitests/ntdll/RtlDosPathNameToNtPathName_U.c
index 915b460bdcc..59a15523c1b 100644
--- a/modules/rostests/apitests/ntdll/RtlDosPathNameToNtPathName_U.c
+++ b/modules/rostests/apitests/ntdll/RtlDosPathNameToNtPathName_U.c
@@ -146,8 +146,8 @@ static void test2(LPCWSTR pwsz, LPCWSTR pwszExpected, LPCWSTR
pwszExpectedPartNa
if (!bOK)
{
printf("input: : %2Iu chars \"%S\"\n", wcslen(pwsz), pwsz);
- printf("Expected: %2u chars \"%S\"\n", lenExp, pwszExpected);
- printf("Actual : %2u chars \"%S\"\n", lenAct, lenAct ? pwszActual
: L"(null)");
+ printf("Expected: %2Iu chars \"%S\"\n", lenExp, pwszExpected);
+ printf("Actual : %2Iu chars \"%S\"\n", lenAct, lenAct ?
pwszActual : L"(null)");
return;
}
} else
@@ -156,8 +156,8 @@ static void test2(LPCWSTR pwsz, LPCWSTR pwszExpected, LPCWSTR
pwszExpectedPartNa
PWSTR pwszActual = NtName.Buffer + 4;
const size_t lenAct = (NtName.Length - 8) / 2;
check_result(FALSE, "Unexpected NtName (expected NULL)");
- printf("input: : %2u chars \"%S\"\n", wcslen(pwsz), pwsz);
- printf("Actual : %2u chars \"%S\"\n", lenAct, pwszActual);
+ printf("input: : %2Iu chars \"%S\"\n", wcslen(pwsz), pwsz);
+ printf("Actual : %2Iu chars \"%S\"\n", lenAct, pwszActual);
}
if (pwszExpectedPartName) {
@@ -167,17 +167,17 @@ static void test2(LPCWSTR pwsz, LPCWSTR pwszExpected, LPCWSTR
pwszExpectedPartNa
wcscmp(PartName, pwszExpectedPartName) == 0;
check_result(bOK, "PartName does not match expected");
if (!bOK) {
- printf("input: : %2u chars \"%S\"\n", wcslen(pwsz), pwsz);
- printf("Expected: %2u chars \"%S\"\n", lenExp,
pwszExpectedPartName);
- printf("Actual : %2u chars \"%S\"\n", lenAct, lenAct ? PartName :
L"(null)");
+ printf("input: : %2Iu chars \"%S\"\n", wcslen(pwsz), pwsz);
+ printf("Expected: %2Iu chars \"%S\"\n", lenExp,
pwszExpectedPartName);
+ printf("Actual : %2Iu chars \"%S\"\n", lenAct, lenAct ? PartName
: L"(null)");
return;
}
} else
if (PartName)
{
check_result(FALSE, "Unexpected PartName (expected NULL).");
- printf("input: : %2u chars \"%S\"\n", wcslen(pwsz), pwsz);
- printf("Actual : %2u chars %S\n", wcslen(PartName), PartName);
+ printf("input: : %2Iu chars \"%S\"\n", wcslen(pwsz), pwsz);
+ printf("Actual : %2Iu chars %S\n", wcslen(PartName), PartName);
}
}
diff --git a/modules/rostests/apitests/user32/CreateDialog.c
b/modules/rostests/apitests/user32/CreateDialog.c
index 0d7d718cc0c..136439ef655 100644
--- a/modules/rostests/apitests/user32/CreateDialog.c
+++ b/modules/rostests/apitests/user32/CreateDialog.c
@@ -60,7 +60,7 @@ void DumpMsgList(const char* lstName, const tagMsgList *ml)
for (i1 = 0; i1 < ml->msgCount; i1++)
{
dlgProcName = (ml->msgList[i1].DlgProc) ? "DlgProc" :
"WndProc";
- printf("#%.3d %s, msg 0x%x, wParam 0x%x, lParam 0x%Ix, result %d\n",
+ printf("#%.3d %s, msg 0x%x, wParam 0x%Ix, lParam 0x%Ix, result %d\n",
i1,
dlgProcName,
ml->msgList[i1].msg,
diff --git a/modules/rostests/apitests/user32/LoadImage.c
b/modules/rostests/apitests/user32/LoadImage.c
index 586e86988ad..0c0feaf4785 100644
--- a/modules/rostests/apitests/user32/LoadImage.c
+++ b/modules/rostests/apitests/user32/LoadImage.c
@@ -23,7 +23,7 @@ START_TEST(LoadImage)
HDC hdc, hdcScreen;
ICONINFO ii;
- sscanf (test_argv[2], "%lu", (ULONG_PTR*) &arg);
+ sscanf (test_argv[2], "%Iu", (ULONG_PTR*) &arg);
ok(handle != arg, "Got same handles\n");
@@ -81,7 +81,7 @@ START_TEST(LoadImage)
}
/* Start child process */
- sprintf( path, "%s LoadImage %lu", test_argv[0], (ULONG_PTR)handle );
+ sprintf( path, "%s LoadImage %Iu", test_argv[0], (ULONG_PTR)handle );
memset( &si, 0, sizeof(si) );
si.cb = sizeof(si);
CreateProcessA( NULL, path, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi );
diff --git a/modules/rostests/tests/mmixer_test/test.c
b/modules/rostests/tests/mmixer_test/test.c
index b44feeba94a..cb5338fc9b1 100644
--- a/modules/rostests/tests/mmixer_test/test.c
+++ b/modules/rostests/tests/mmixer_test/test.c
@@ -23,9 +23,9 @@ MixerThread(LPVOID Parameter)
while(GetMessage(&msg, NULL, 0, 0))
{
if (msg.message == MM_MIXM_CONTROL_CHANGE)
- printf("got MM_MIXM_CONTROL_CHANGE wParam %x lParam %lx\n", msg.wParam,
msg.lParam);
+ printf("got MM_MIXM_CONTROL_CHANGE wParam %Ix lParam %Ix\n", msg.wParam,
msg.lParam);
else if (msg.message == MM_MIXM_LINE_CHANGE)
- printf("got MM_MIXM_LINE_CHANGE wParam %x lParam %lx\n", msg.wParam,
msg.lParam);
+ printf("got MM_MIXM_LINE_CHANGE wParam %Ix lParam %Ix\n", msg.wParam,
msg.lParam);
}
return 1;
}
diff --git a/sdk/lib/rtl/actctx.c b/sdk/lib/rtl/actctx.c
index 8df2af46fc9..62a6af88c8d 100644
--- a/sdk/lib/rtl/actctx.c
+++ b/sdk/lib/rtl/actctx.c
@@ -3022,7 +3022,7 @@ static NTSTATUS get_manifest_in_pe_file( struct actctx_loader* acl,
struct assem
if ((!((ULONG_PTR)resname >> 16)))
{
- sprintfW(resnameBuf, L"#%u", (ULONG_PTR)resname);
+ sprintfW(resnameBuf, L"#%u", PtrToUlong(resname));
resptr = resnameBuf;
}