From 5f95b87ddf3515c1446a0293c78cacd7865e0d1c Mon Sep 17 00:00:00 2001 From: walbourn_cp Date: Sat, 24 Jan 2015 01:17:54 -0800 Subject: [PATCH] Updated libraries for VS 2015 C99 and legacy printf conformance - Static libraries built with _CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS --- DDSView/ddsview.cpp | 12 +++++----- DirectXTex/DirectXTex_Desktop_2015.vcxproj | 12 +++++----- Texassemble/texassemble.cpp | 14 ++++++------ Texconv/texconv.cpp | 26 +++++++++++----------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/DDSView/ddsview.cpp b/DDSView/ddsview.cpp index 5d3d7cb..e8df425 100644 --- a/DDSView/ddsview.cpp +++ b/DDSView/ddsview.cpp @@ -111,7 +111,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, if ( FAILED(hr) ) { WCHAR buff[2048]; - swprintf_s( buff, L"Failed to open texture file\n\nFilename = %s\nHRESULT %08X", lpCmdLine, hr ); + swprintf_s( buff, L"Failed to open texture file\n\nFilename = %ls\nHRESULT %08X", lpCmdLine, hr ); MessageBox( NULL, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION ); return 0; } @@ -132,7 +132,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, if ( mdata.arraySize > 1 ) { WCHAR buff[2048]; - swprintf_s( buff, L"Arrays of volume textures are not supported\n\nFilename = %s\nArray size %Iu", lpCmdLine, mdata.arraySize ); + swprintf_s( buff, L"Arrays of volume textures are not supported\n\nFilename = %ls\nArray size %Iu", lpCmdLine, mdata.arraySize ); MessageBox( NULL, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION ); return 0; } @@ -155,7 +155,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, if ( g_featureLevel < D3D_FEATURE_LEVEL_11_0 ) { WCHAR buff[2048]; - swprintf_s( buff, L"BC6H/BC7 requires DirectX 11 hardware\n\nFilename = %s\nDXGI Format %d\nFeature Level %d", lpCmdLine, mdata.format, g_featureLevel ); + swprintf_s( buff, L"BC6H/BC7 requires DirectX 11 hardware\n\nFilename = %ls\nDXGI Format %d\nFeature Level %d", lpCmdLine, mdata.format, g_featureLevel ); MessageBox( NULL, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION ); return 0; } @@ -168,7 +168,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, if ( FAILED(hr) || !(flags & (D3D11_FORMAT_SUPPORT_TEXTURE1D|D3D11_FORMAT_SUPPORT_TEXTURE2D|D3D11_FORMAT_SUPPORT_TEXTURE3D)) ) { WCHAR buff[2048]; - swprintf_s( buff, L"Format not supported by DirectX hardware\n\nFilename = %s\nDXGI Format %d\nFeature Level %d\nHRESULT = %08X", lpCmdLine, mdata.format, g_featureLevel, hr ); + swprintf_s( buff, L"Format not supported by DirectX hardware\n\nFilename = %ls\nDXGI Format %d\nFeature Level %d\nHRESULT = %08X", lpCmdLine, mdata.format, g_featureLevel, hr ); MessageBox( NULL, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION ); return 0; } @@ -181,7 +181,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, if ( FAILED(hr) ) { WCHAR buff[2048]; - swprintf_s( buff, L"Failed to load texture file\n\nFilename = %s\nHRESULT %08X", lpCmdLine, hr ); + swprintf_s( buff, L"Failed to load texture file\n\nFilename = %ls\nHRESULT %08X", lpCmdLine, hr ); MessageBox( NULL, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION ); return 0; } @@ -193,7 +193,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, if ( FAILED(hr) ) { WCHAR buff[2048]; - swprintf_s( buff, L"Failed creating texture from file\n\nFilename = %s\nHRESULT = %08X", lpCmdLine, hr ); + swprintf_s( buff, L"Failed creating texture from file\n\nFilename = %ls\nHRESULT = %08X", lpCmdLine, hr ); MessageBox( NULL, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION ); return 0; } diff --git a/DirectXTex/DirectXTex_Desktop_2015.vcxproj b/DirectXTex/DirectXTex_Desktop_2015.vcxproj index a6e0c90..033b9ce 100644 --- a/DirectXTex/DirectXTex_Desktop_2015.vcxproj +++ b/DirectXTex/DirectXTex_Desktop_2015.vcxproj @@ -141,7 +141,7 @@ StreamingSIMDExtensions2 Sync %(AdditionalOptions) - _UNICODE;UNICODE;WIN32;_DEBUG;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + _UNICODE;UNICODE;WIN32;_DEBUG;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) EditAndContinue EnableFastChecks Use @@ -182,7 +182,7 @@ Fast Sync %(AdditionalOptions) - _UNICODE;UNICODE;WIN32;_DEBUG;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + _UNICODE;UNICODE;WIN32;_DEBUG;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) EnableFastChecks Use DirectXTexP.h @@ -224,7 +224,7 @@ StreamingSIMDExtensions2 Sync %(AdditionalOptions) - _UNICODE;UNICODE;WIN32;NDEBUG;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + _UNICODE;UNICODE;WIN32;NDEBUG;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) Use DirectXTexP.h $(IntDir)$(TargetName).pdb @@ -266,7 +266,7 @@ Fast Sync %(AdditionalOptions) - _UNICODE;UNICODE;WIN32;NDEBUG;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + _UNICODE;UNICODE;WIN32;NDEBUG;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) Use DirectXTexP.h $(IntDir)$(TargetName).pdb @@ -309,7 +309,7 @@ StreamingSIMDExtensions2 Sync %(AdditionalOptions) - _UNICODE;UNICODE;WIN32;NDEBUG;PROFILE;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + _UNICODE;UNICODE;WIN32;NDEBUG;PROFILE;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) Use DirectXTexP.h $(IntDir)$(TargetName).pdb @@ -351,7 +351,7 @@ Fast Sync %(AdditionalOptions) - _UNICODE;UNICODE;WIN32;NDEBUG;PROFILE;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + _UNICODE;UNICODE;WIN32;NDEBUG;PROFILE;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0600;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) Use DirectXTexP.h $(IntDir)$(TargetName).pdb diff --git a/Texassemble/texassemble.cpp b/Texassemble/texassemble.cpp index 39808c2..c349d2f 100644 --- a/Texassemble/texassemble.cpp +++ b/Texassemble/texassemble.cpp @@ -258,7 +258,7 @@ void PrintList(size_t cch, SValue *pValue) cch = 6; } - wprintf( L"%s ", pValue->pName ); + wprintf( L"%ls ", pValue->pName ); cch += cchName + 2; pValue++; } @@ -378,7 +378,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) case OPT_WIDTH: if (swscanf_s(pValue, L"%Iu", &width) != 1) { - wprintf( L"Invalid value specified with -w (%s)\n", pValue); + wprintf( L"Invalid value specified with -w (%ls)\n", pValue); return 1; } break; @@ -386,7 +386,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) case OPT_HEIGHT: if (swscanf_s(pValue, L"%Iu", &height) != 1) { - wprintf( L"Invalid value specified with -h (%s)\n", pValue); + wprintf( L"Invalid value specified with -h (%ls)\n", pValue); return 1; } break; @@ -395,7 +395,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) format = (DXGI_FORMAT) LookupByName(pValue, g_pFormats); if ( !format ) { - wprintf( L"Invalid value specified with -f (%s)\n", pValue); + wprintf( L"Invalid value specified with -f (%ls)\n", pValue); return 1; } break; @@ -404,7 +404,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) dwFilter = LookupByName(pValue, g_pFilters); if ( !dwFilter ) { - wprintf( L"Invalid value specified with -if (%s)\n", pValue); + wprintf( L"Invalid value specified with -if (%ls)\n", pValue); return 1; } break; @@ -493,7 +493,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) _wmakepath_s( szOutputFile, nullptr, nullptr, fname, L".dds" ); } - wprintf( L"reading %s", pConv->szSrc ); + wprintf( L"reading %ls", pConv->szSrc ); fflush(stdout); TexMetadata info; @@ -710,7 +710,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) } // Write texture - wprintf( L"\nWriting %s ", szOutputFile); + wprintf( L"\nWriting %ls ", szOutputFile); PrintInfo( result.GetMetadata() ); wprintf( L"\n" ); fflush(stdout); diff --git a/Texconv/texconv.cpp b/Texconv/texconv.cpp index f69f50e..bd95352 100644 --- a/Texconv/texconv.cpp +++ b/Texconv/texconv.cpp @@ -406,7 +406,7 @@ void PrintList(size_t cch, SValue *pValue) cch = 6; } - wprintf( L"%s ", pValue->pName ); + wprintf( L"%ls ", pValue->pName ); cch += cchName + 2; pValue++; } @@ -550,7 +550,7 @@ bool CreateDevice( _Outptr_ ID3D11Device** pDevice ) hr = pAdapter->GetDesc( &desc ); if ( SUCCEEDED(hr) ) { - wprintf( L"\n[Using DirectCompute on \"%s\"]\n", desc.Description ); + wprintf( L"\n[Using DirectCompute on \"%ls\"]\n", desc.Description ); } } } @@ -691,7 +691,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) case OPT_WIDTH: if (swscanf_s(pValue, L"%Iu", &width) != 1) { - wprintf( L"Invalid value specified with -w (%s)\n", pValue); + wprintf( L"Invalid value specified with -w (%ls)\n", pValue); wprintf( L"\n"); PrintUsage(); return 1; @@ -701,7 +701,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) case OPT_HEIGHT: if (swscanf_s(pValue, L"%Iu", &height) != 1) { - wprintf( L"Invalid value specified with -h (%s)\n", pValue); + wprintf( L"Invalid value specified with -h (%ls)\n", pValue); printf("\n"); PrintUsage(); return 1; @@ -711,7 +711,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) case OPT_MIPLEVELS: if (swscanf_s(pValue, L"%Iu", &mipLevels) != 1) { - wprintf( L"Invalid value specified with -m (%s)\n", pValue); + wprintf( L"Invalid value specified with -m (%ls)\n", pValue); wprintf( L"\n"); PrintUsage(); return 1; @@ -722,7 +722,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) format = (DXGI_FORMAT) LookupByName(pValue, g_pFormats); if ( !format ) { - wprintf( L"Invalid value specified with -f (%s)\n", pValue); + wprintf( L"Invalid value specified with -f (%ls)\n", pValue); wprintf( L"\n"); PrintUsage(); return 1; @@ -733,7 +733,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) dwFilter = LookupByName(pValue, g_pFilters); if ( !dwFilter ) { - wprintf( L"Invalid value specified with -if (%s)\n", pValue); + wprintf( L"Invalid value specified with -if (%ls)\n", pValue); wprintf( L"\n"); PrintUsage(); return 1; @@ -772,7 +772,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) FileType = LookupByName(pValue, g_pSaveFileTypes); if ( !FileType ) { - wprintf( L"Invalid value specified with -ft (%s)\n", pValue); + wprintf( L"Invalid value specified with -ft (%ls)\n", pValue); wprintf( L"\n"); PrintUsage(); return 1; @@ -803,7 +803,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) maxSize = LookupByName( pValue, g_pFeatureLevels ); if ( !maxSize ) { - wprintf( L"Invalid value specified with -fl (%s)\n", pValue); + wprintf( L"Invalid value specified with -fl (%ls)\n", pValue); wprintf( L"\n"); PrintUsage(); return 1; @@ -813,14 +813,14 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) case OPT_ALPHA_WEIGHT: if (swscanf_s(pValue, L"%f", &alphaWeight) != 1) { - wprintf( L"Invalid value specified with -aw (%s)\n", pValue); + wprintf( L"Invalid value specified with -aw (%ls)\n", pValue); wprintf( L"\n"); PrintUsage(); return 1; } else if ( alphaWeight < 0.f ) { - wprintf( L"-aw (%s) parameter must be positive\n", pValue); + wprintf( L"-aw (%ls) parameter must be positive\n", pValue); wprintf( L"\n"); return 1; } @@ -884,7 +884,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) wprintf( L"\n"); // Load source image - wprintf( L"reading %s", pConv->szSrc ); + wprintf( L"reading %ls", pConv->szSrc ); fflush(stdout); WCHAR ext[_MAX_EXT]; @@ -1573,7 +1573,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) wcscat_s(pConv->szDest, MAX_PATH, szSuffix); // Write texture - wprintf( L"writing %s", pConv->szDest); + wprintf( L"writing %ls", pConv->szDest); fflush(stdout); switch( FileType )