Skip to content

Commit

Permalink
Minor code review
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed Feb 7, 2019
1 parent a35fb23 commit 0311154
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
26 changes: 13 additions & 13 deletions DDSView/ddsview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,

if ( !*lpCmdLine )
{
MessageBox( nullptr, L"Usage: ddsview <filename>", L"DDSView", MB_OK | MB_ICONEXCLAMATION );
MessageBoxW( nullptr, L"Usage: ddsview <filename>", L"DDSView", MB_OK | MB_ICONEXCLAMATION );
return 0;
}

Expand All @@ -118,7 +118,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
{
wchar_t buff[2048] = {};
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 );
MessageBoxW( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION );
return 0;
}

Expand All @@ -139,7 +139,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
{
wchar_t buff[2048] = {};
swprintf_s( buff, L"Arrays of volume textures are not supported\n\nFilename = %ls\nArray size %zu", lpCmdLine, mdata.arraySize );
MessageBox( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION );
MessageBoxW( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION );
return 0;
}

Expand All @@ -162,7 +162,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
{
wchar_t buff[2048] = {};
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 );
MessageBoxW( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION );
return 0;
}
break;
Expand All @@ -175,7 +175,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
{
wchar_t buff[2048] = {};
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 );
MessageBoxW( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION );
return 0;
}
}
Expand All @@ -188,7 +188,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
{
wchar_t buff[2048] = {};
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 );
MessageBoxW( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION );
return 0;
}

Expand All @@ -200,7 +200,7 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
{
wchar_t buff[2048] = {};
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 );
MessageBoxW( nullptr, buff, L"DDSView", MB_OK | MB_ICONEXCLAMATION );
return 0;
}

Expand Down Expand Up @@ -228,8 +228,8 @@ int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
HRESULT InitWindow( HINSTANCE hInstance, int nCmdShow, const TexMetadata& mdata )
{
// Register class
WNDCLASSEX wcex;
wcex.cbSize = sizeof( WNDCLASSEX );
WNDCLASSEXW wcex;
wcex.cbSize = sizeof( WNDCLASSEXW );
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
Expand All @@ -241,7 +241,7 @@ HRESULT InitWindow( HINSTANCE hInstance, int nCmdShow, const TexMetadata& mdata
wcex.lpszMenuName = nullptr;
wcex.lpszClassName = L"DDSViewWindowClass";
wcex.hIconSm = LoadIcon( wcex.hInstance, ( LPCTSTR )IDI_MAIN_ICON );
if( !RegisterClassEx( &wcex ) )
if( !RegisterClassExW( &wcex ) )
return E_FAIL;

// Create window
Expand All @@ -265,9 +265,9 @@ HRESULT InitWindow( HINSTANCE hInstance, int nCmdShow, const TexMetadata& mdata
rc.bottom = screenY;

AdjustWindowRect( &rc, WS_OVERLAPPEDWINDOW, FALSE );
g_hWnd = CreateWindow( L"DDSViewWindowClass", L"DDS View", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, rc.right - rc.left, rc.bottom - rc.top, nullptr, nullptr, hInstance,
nullptr );
g_hWnd = CreateWindowW( L"DDSViewWindowClass", L"DDS View", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, rc.right - rc.left, rc.bottom - rc.top, nullptr, nullptr, hInstance,
nullptr );
if( !g_hWnd )
return E_FAIL;

Expand Down
6 changes: 3 additions & 3 deletions Texassemble/texassemble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ namespace
void SearchForFiles(const wchar_t* path, std::list<SConversion>& files, bool recursive)
{
// Process files
WIN32_FIND_DATA findData = {};
WIN32_FIND_DATAW findData = {};
ScopedFindHandle hFile(safe_handle(FindFirstFileExW(path,
FindExInfoBasic, &findData,
FindExSearchNameMatch, nullptr,
Expand All @@ -349,7 +349,7 @@ namespace
files.push_back(conv);
}

if (!FindNextFile(hFile.get(), &findData))
if (!FindNextFileW(hFile.get(), &findData))
break;
}
}
Expand Down Expand Up @@ -394,7 +394,7 @@ namespace
}
}

if (!FindNextFile(hFile.get(), &findData))
if (!FindNextFileW(hFile.get(), &findData))
break;
}
}
Expand Down
10 changes: 5 additions & 5 deletions Texconv/texconv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ namespace
void SearchForFiles(const wchar_t* path, std::list<SConversion>& files, bool recursive)
{
// Process files
WIN32_FIND_DATA findData = {};
WIN32_FIND_DATAW findData = {};
ScopedFindHandle hFile(safe_handle(FindFirstFileExW(path,
FindExInfoBasic, &findData,
FindExSearchNameMatch, nullptr,
Expand All @@ -502,7 +502,7 @@ namespace
files.push_back(conv);
}

if (!FindNextFile(hFile.get(), &findData))
if (!FindNextFileW(hFile.get(), &findData))
break;
}
}
Expand Down Expand Up @@ -547,7 +547,7 @@ namespace
}
}

if (!FindNextFile(hFile.get(), &findData))
if (!FindNextFileW(hFile.get(), &findData))
break;
}
}
Expand Down Expand Up @@ -679,7 +679,7 @@ namespace

if (!s_CreateDXGIFactory1)
{
HMODULE hModDXGI = LoadLibrary(L"dxgi.dll");
HMODULE hModDXGI = LoadLibraryW(L"dxgi.dll");
if (!hModDXGI)
return false;

Expand Down Expand Up @@ -804,7 +804,7 @@ namespace

if (!s_DynamicD3D11CreateDevice)
{
HMODULE hModD3D11 = LoadLibrary(L"d3d11.dll");
HMODULE hModD3D11 = LoadLibraryW(L"d3d11.dll");
if (!hModD3D11)
return false;

Expand Down
6 changes: 3 additions & 3 deletions Texdiag/texdiag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ namespace
void SearchForFiles(const wchar_t* path, std::list<SConversion>& files, bool recursive)
{
// Process files
WIN32_FIND_DATA findData = {};
WIN32_FIND_DATAW findData = {};
ScopedFindHandle hFile(safe_handle(FindFirstFileExW(path,
FindExInfoBasic, &findData,
FindExSearchNameMatch, nullptr,
Expand All @@ -414,7 +414,7 @@ namespace
files.push_back(conv);
}

if (!FindNextFile(hFile.get(), &findData))
if (!FindNextFileW(hFile.get(), &findData))
break;
}
}
Expand Down Expand Up @@ -459,7 +459,7 @@ namespace
}
}

if (!FindNextFile(hFile.get(), &findData))
if (!FindNextFileW(hFile.get(), &findData))
break;
}
}
Expand Down

0 comments on commit 0311154

Please sign in to comment.