1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-27 23:00:10 +00:00

Purge WCHAR typedef

This commit is contained in:
Chuck Walbourn 2016-05-11 11:36:27 -07:00
parent 5e5a8e0863
commit 649c5e53dc
3 changed files with 23 additions and 23 deletions

View File

@ -110,7 +110,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
HRESULT hr = GetMetadataFromDDSFile( lpCmdLine, DDS_FLAGS_NONE, mdata ); HRESULT hr = GetMetadataFromDDSFile( lpCmdLine, DDS_FLAGS_NONE, mdata );
if ( FAILED(hr) ) if ( FAILED(hr) )
{ {
WCHAR buff[2048] = { 0 }; wchar_t buff[2048] = { 0 };
swprintf_s( buff, L"Failed to open texture file\n\nFilename = %ls\nHRESULT %08X", lpCmdLine, hr ); swprintf_s( buff, L"Failed to open texture file\n\nFilename = %ls\nHRESULT %08X", lpCmdLine, hr );
MessageBox( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION ); MessageBox( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION );
return 0; return 0;
@ -131,7 +131,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
{ {
if ( mdata.arraySize > 1 ) if ( mdata.arraySize > 1 )
{ {
WCHAR buff[2048] = { 0 }; wchar_t buff[2048] = { 0 };
swprintf_s( buff, L"Arrays of volume textures are not supported\n\nFilename = %ls\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( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION ); MessageBox( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION );
return 0; return 0;
@ -154,7 +154,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
case DXGI_FORMAT_BC7_UNORM_SRGB: case DXGI_FORMAT_BC7_UNORM_SRGB:
if ( g_featureLevel < D3D_FEATURE_LEVEL_11_0 ) if ( g_featureLevel < D3D_FEATURE_LEVEL_11_0 )
{ {
WCHAR buff[2048] = { 0 }; wchar_t buff[2048] = { 0 };
swprintf_s( buff, L"BC6H/BC7 requires DirectX 11 hardware\n\nFilename = %ls\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( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION ); MessageBox( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION );
return 0; return 0;
@ -167,7 +167,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
hr = g_pd3dDevice->CheckFormatSupport ( mdata.format, &flags ); hr = g_pd3dDevice->CheckFormatSupport ( mdata.format, &flags );
if ( FAILED(hr) || !(flags & (D3D11_FORMAT_SUPPORT_TEXTURE1D|D3D11_FORMAT_SUPPORT_TEXTURE2D|D3D11_FORMAT_SUPPORT_TEXTURE3D)) ) if ( FAILED(hr) || !(flags & (D3D11_FORMAT_SUPPORT_TEXTURE1D|D3D11_FORMAT_SUPPORT_TEXTURE2D|D3D11_FORMAT_SUPPORT_TEXTURE3D)) )
{ {
WCHAR buff[2048] = { 0 }; wchar_t buff[2048] = { 0 };
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 ); 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( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION ); MessageBox( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION );
return 0; return 0;
@ -180,7 +180,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
hr = LoadFromDDSFile( lpCmdLine, DDS_FLAGS_NONE, &mdata, image ); hr = LoadFromDDSFile( lpCmdLine, DDS_FLAGS_NONE, &mdata, image );
if ( FAILED(hr) ) if ( FAILED(hr) )
{ {
WCHAR buff[2048] = { 0 }; wchar_t buff[2048] = { 0 };
swprintf_s( buff, L"Failed to load texture file\n\nFilename = %ls\nHRESULT %08X", lpCmdLine, hr ); swprintf_s( buff, L"Failed to load texture file\n\nFilename = %ls\nHRESULT %08X", lpCmdLine, hr );
MessageBox( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION ); MessageBox( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION );
return 0; return 0;
@ -192,7 +192,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
hr = CreateShaderResourceView( g_pd3dDevice, image.GetImages(), image.GetImageCount(), mdata, &g_pSRV ); hr = CreateShaderResourceView( g_pd3dDevice, image.GetImages(), image.GetImageCount(), mdata, &g_pSRV );
if ( FAILED(hr) ) if ( FAILED(hr) )
{ {
WCHAR buff[2048] = { 0 }; wchar_t buff[2048] = { 0 };
swprintf_s( buff, L"Failed creating texture from file\n\nFilename = %ls\nHRESULT = %08X", lpCmdLine, hr ); swprintf_s( buff, L"Failed creating texture from file\n\nFilename = %ls\nHRESULT = %08X", lpCmdLine, hr );
MessageBox( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION ); MessageBox( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION );
return 0; return 0;

View File

@ -44,7 +44,7 @@ static_assert( OPT_MAX <= 32, "dwOptions is a DWORD bitfield" );
struct SConversion struct SConversion
{ {
WCHAR szSrc [MAX_PATH]; wchar_t szSrc [MAX_PATH];
}; };
struct SValue struct SValue
@ -172,7 +172,7 @@ SValue g_pFilters[] =
#pragma prefast(disable : 26018, "Only used with static internal arrays") #pragma prefast(disable : 26018, "Only used with static internal arrays")
DWORD LookupByName(const WCHAR *pName, const SValue *pArray) DWORD LookupByName(const wchar_t *pName, const SValue *pArray)
{ {
while(pArray->pName) while(pArray->pName)
{ {
@ -185,7 +185,7 @@ DWORD LookupByName(const WCHAR *pName, const SValue *pArray)
return 0; return 0;
} }
const WCHAR* LookupByValue(DWORD pValue, const SValue *pArray) const wchar_t* LookupByValue(DWORD pValue, const SValue *pArray)
{ {
while(pArray->pName) while(pArray->pName)
{ {
@ -325,7 +325,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
DWORD dwFilter = TEX_FILTER_DEFAULT; DWORD dwFilter = TEX_FILTER_DEFAULT;
DWORD dwFilterOpts = 0; DWORD dwFilterOpts = 0;
WCHAR szOutputFile[MAX_PATH] = { 0 }; wchar_t szOutputFile[MAX_PATH] = { 0 };
// Initialize COM (needed for WIC) // Initialize COM (needed for WIC)
HRESULT hr = hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED); HRESULT hr = hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
@ -462,8 +462,8 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
for( auto pConv = conversion.begin(); pConv != conversion.end(); ++pConv ) for( auto pConv = conversion.begin(); pConv != conversion.end(); ++pConv )
{ {
WCHAR ext[_MAX_EXT]; wchar_t ext[_MAX_EXT];
WCHAR fname[_MAX_FNAME]; wchar_t fname[_MAX_FNAME];
_wsplitpath_s( pConv->szSrc, nullptr, 0, nullptr, 0, fname, _MAX_FNAME, ext, _MAX_EXT ); _wsplitpath_s( pConv->szSrc, nullptr, 0, nullptr, 0, fname, _MAX_FNAME, ext, _MAX_EXT );
// Load source image // Load source image

View File

@ -69,8 +69,8 @@ static_assert( OPT_MAX <= 64, "dwOptions is a DWORD64 bitfield" );
struct SConversion struct SConversion
{ {
WCHAR szSrc [MAX_PATH]; wchar_t szSrc [MAX_PATH];
WCHAR szDest[MAX_PATH]; wchar_t szDest[MAX_PATH];
}; };
struct SValue struct SValue
@ -324,7 +324,7 @@ inline static bool ispow2(size_t x)
#pragma prefast(disable : 26018, "Only used with static internal arrays") #pragma prefast(disable : 26018, "Only used with static internal arrays")
DWORD LookupByName(const WCHAR *pName, const SValue *pArray) DWORD LookupByName(const wchar_t *pName, const SValue *pArray)
{ {
while(pArray->pName) while(pArray->pName)
{ {
@ -337,7 +337,7 @@ DWORD LookupByName(const WCHAR *pName, const SValue *pArray)
return 0; return 0;
} }
const WCHAR* LookupByValue(DWORD pValue, const SValue *pArray) const wchar_t* LookupByValue(DWORD pValue, const SValue *pArray)
{ {
while(pArray->pName) while(pArray->pName)
{ {
@ -656,9 +656,9 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
DWORD dwNormalMap = 0; DWORD dwNormalMap = 0;
float nmapAmplitude = 1.f; float nmapAmplitude = 1.f;
WCHAR szPrefix [MAX_PATH]; wchar_t szPrefix [MAX_PATH];
WCHAR szSuffix [MAX_PATH]; wchar_t szSuffix [MAX_PATH];
WCHAR szOutputDir[MAX_PATH]; wchar_t szOutputDir[MAX_PATH];
szPrefix[0] = 0; szPrefix[0] = 0;
szSuffix[0] = 0; szSuffix[0] = 0;
@ -984,7 +984,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
wcscpy_s(szPrefix, MAX_PATH, szOutputDir); wcscpy_s(szPrefix, MAX_PATH, szOutputDir);
const WCHAR* fileTypeName = LookupByValue(FileType, g_pSaveFileTypes); const wchar_t* fileTypeName = LookupByValue(FileType, g_pSaveFileTypes);
if (fileTypeName) if (fileTypeName)
{ {
@ -1028,8 +1028,8 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
wprintf( L"reading %ls", pConv->szSrc ); wprintf( L"reading %ls", pConv->szSrc );
fflush(stdout); fflush(stdout);
WCHAR ext[_MAX_EXT]; wchar_t ext[_MAX_EXT];
WCHAR fname[_MAX_FNAME]; wchar_t fname[_MAX_FNAME];
_wsplitpath_s( pConv->szSrc, nullptr, 0, nullptr, 0, fname, _MAX_FNAME, ext, _MAX_EXT ); _wsplitpath_s( pConv->szSrc, nullptr, 0, nullptr, 0, fname, _MAX_FNAME, ext, _MAX_EXT );
TexMetadata info; TexMetadata info;
@ -1737,7 +1737,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
wprintf( L"\n"); wprintf( L"\n");
// Figure out dest filename // Figure out dest filename
WCHAR *pchSlash, *pchDot; wchar_t *pchSlash, *pchDot;
wcscpy_s(pConv->szDest, MAX_PATH, szPrefix); wcscpy_s(pConv->szDest, MAX_PATH, szPrefix);