Skip to content

Commit

Permalink
Purge WCHAR typedef
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed May 11, 2016
1 parent 5e5a8e0 commit 649c5e5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
12 changes: 6 additions & 6 deletions DDSView/ddsview.cpp
Expand Up @@ -110,7 +110,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
HRESULT hr = GetMetadataFromDDSFile( lpCmdLine, DDS_FLAGS_NONE, mdata );
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 );
MessageBox( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION );
return 0;
Expand All @@ -131,7 +131,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
{
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 );
MessageBox( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION );
return 0;
Expand All @@ -154,7 +154,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
case DXGI_FORMAT_BC7_UNORM_SRGB:
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 );
MessageBox( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION );
return 0;
Expand All @@ -167,7 +167,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
hr = g_pd3dDevice->CheckFormatSupport ( mdata.format, &flags );
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 );
MessageBox( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION );
return 0;
Expand All @@ -180,7 +180,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
hr = LoadFromDDSFile( lpCmdLine, DDS_FLAGS_NONE, &mdata, image );
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 );
MessageBox( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION );
return 0;
Expand All @@ -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 );
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 );
MessageBox( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION );
return 0;
Expand Down
12 changes: 6 additions & 6 deletions Texassemble/texassemble.cpp
Expand Up @@ -44,7 +44,7 @@ static_assert( OPT_MAX <= 32, "dwOptions is a DWORD bitfield" );

struct SConversion
{
WCHAR szSrc [MAX_PATH];
wchar_t szSrc [MAX_PATH];
};

struct SValue
Expand Down Expand Up @@ -172,7 +172,7 @@ SValue g_pFilters[] =

#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)
{
Expand All @@ -185,7 +185,7 @@ DWORD LookupByName(const WCHAR *pName, const SValue *pArray)
return 0;
}

const WCHAR* LookupByValue(DWORD pValue, const SValue *pArray)
const wchar_t* LookupByValue(DWORD pValue, const SValue *pArray)
{
while(pArray->pName)
{
Expand Down Expand Up @@ -325,7 +325,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
DWORD dwFilter = TEX_FILTER_DEFAULT;
DWORD dwFilterOpts = 0;

WCHAR szOutputFile[MAX_PATH] = { 0 };
wchar_t szOutputFile[MAX_PATH] = { 0 };

// Initialize COM (needed for WIC)
HRESULT hr = hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
Expand Down Expand Up @@ -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 )
{
WCHAR ext[_MAX_EXT];
WCHAR fname[_MAX_FNAME];
wchar_t ext[_MAX_EXT];
wchar_t fname[_MAX_FNAME];
_wsplitpath_s( pConv->szSrc, nullptr, 0, nullptr, 0, fname, _MAX_FNAME, ext, _MAX_EXT );

// Load source image
Expand Down
22 changes: 11 additions & 11 deletions Texconv/texconv.cpp
Expand Up @@ -69,8 +69,8 @@ static_assert( OPT_MAX <= 64, "dwOptions is a DWORD64 bitfield" );

struct SConversion
{
WCHAR szSrc [MAX_PATH];
WCHAR szDest[MAX_PATH];
wchar_t szSrc [MAX_PATH];
wchar_t szDest[MAX_PATH];
};

struct SValue
Expand Down Expand Up @@ -324,7 +324,7 @@ inline static bool ispow2(size_t x)

#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)
{
Expand All @@ -337,7 +337,7 @@ DWORD LookupByName(const WCHAR *pName, const SValue *pArray)
return 0;
}

const WCHAR* LookupByValue(DWORD pValue, const SValue *pArray)
const wchar_t* LookupByValue(DWORD pValue, const SValue *pArray)
{
while(pArray->pName)
{
Expand Down Expand Up @@ -656,9 +656,9 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
DWORD dwNormalMap = 0;
float nmapAmplitude = 1.f;

WCHAR szPrefix [MAX_PATH];
WCHAR szSuffix [MAX_PATH];
WCHAR szOutputDir[MAX_PATH];
wchar_t szPrefix [MAX_PATH];
wchar_t szSuffix [MAX_PATH];
wchar_t szOutputDir[MAX_PATH];

szPrefix[0] = 0;
szSuffix[0] = 0;
Expand Down Expand Up @@ -984,7 +984,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])

wcscpy_s(szPrefix, MAX_PATH, szOutputDir);

const WCHAR* fileTypeName = LookupByValue(FileType, g_pSaveFileTypes);
const wchar_t* fileTypeName = LookupByValue(FileType, g_pSaveFileTypes);

if (fileTypeName)
{
Expand Down Expand Up @@ -1028,8 +1028,8 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
wprintf( L"reading %ls", pConv->szSrc );
fflush(stdout);

WCHAR ext[_MAX_EXT];
WCHAR fname[_MAX_FNAME];
wchar_t ext[_MAX_EXT];
wchar_t fname[_MAX_FNAME];
_wsplitpath_s( pConv->szSrc, nullptr, 0, nullptr, 0, fname, _MAX_FNAME, ext, _MAX_EXT );

TexMetadata info;
Expand Down Expand Up @@ -1737,7 +1737,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
wprintf( L"\n");

// Figure out dest filename
WCHAR *pchSlash, *pchDot;
wchar_t *pchSlash, *pchDot;

wcscpy_s(pConv->szDest, MAX_PATH, szPrefix);

Expand Down

0 comments on commit 649c5e5

Please sign in to comment.