diff --git a/Texassemble/texassemble.cpp b/Texassemble/texassemble.cpp index 9fe602f..fc1914b 100644 --- a/Texassemble/texassemble.cpp +++ b/Texassemble/texassemble.cpp @@ -83,7 +83,7 @@ struct SValue ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// -SValue g_pCommands[] = +const SValue g_pCommands[] = { { L"cube", CMD_CUBE }, { L"volume", CMD_VOLUME }, @@ -96,7 +96,7 @@ SValue g_pCommands[] = { nullptr, 0 } }; -SValue g_pOptions[] = +const SValue g_pOptions [] = { { L"r", OPT_RECURSIVE }, { L"w", OPT_WIDTH }, @@ -119,7 +119,7 @@ SValue g_pOptions[] = #define DEFFMT(fmt) { L#fmt, DXGI_FORMAT_ ## fmt } -SValue g_pFormats[] = +const SValue g_pFormats [] = { // List does not include _TYPELESS or depth/stencil formats DEFFMT(R32G32B32A32_FLOAT), @@ -193,7 +193,7 @@ SValue g_pFormats[] = { nullptr, DXGI_FORMAT_UNKNOWN } }; -SValue g_pFilters[] = +const SValue g_pFilters [] = { { L"POINT", TEX_FILTER_POINT }, { L"LINEAR", TEX_FILTER_LINEAR }, @@ -220,7 +220,7 @@ SValue g_pFilters[] = #define CODEC_TGA 0xFFFF0002 #define CODEC_HDR 0xFFFF0005 -SValue g_pExtFileTypes[] = +const SValue g_pExtFileTypes [] = { { L".BMP", WIC_CODEC_BMP }, { L".JPG", WIC_CODEC_JPEG }, @@ -356,7 +356,7 @@ namespace void PrintFormat(DXGI_FORMAT Format) { - for (SValue *pFormat = g_pFormats; pFormat->pName; pFormat++) + for (const SValue *pFormat = g_pFormats; pFormat->pName; pFormat++) { if ((DXGI_FORMAT)pFormat->dwValue == Format) { @@ -422,7 +422,7 @@ namespace } - void PrintList(size_t cch, SValue *pValue) + void PrintList(size_t cch, const SValue *pValue) { while (pValue->pName) { @@ -516,9 +516,6 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) } // Process command line - DWORD dwOptions = 0; - std::list conversion; - if (argc < 2) { PrintUsage(); @@ -543,6 +540,9 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) return 1; } + DWORD dwOptions = 0; + std::list conversion; + for (int iArg = 2; iArg < argc; iArg++) { PWSTR pArg = argv[iArg]; diff --git a/Texconv/texconv.cpp b/Texconv/texconv.cpp index 5c153f0..cea7531 100644 --- a/Texconv/texconv.cpp +++ b/Texconv/texconv.cpp @@ -110,7 +110,7 @@ struct SValue ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// -SValue g_pOptions[] = +const SValue g_pOptions [] = { { L"r", OPT_RECURSIVE }, { L"w", OPT_WIDTH }, @@ -162,7 +162,7 @@ SValue g_pOptions[] = #define DEFFMT(fmt) { L#fmt, DXGI_FORMAT_ ## fmt } -SValue g_pFormats[] = +const SValue g_pFormats [] = { // List does not include _TYPELESS or depth/stencil formats DEFFMT(R32G32B32A32_FLOAT), @@ -249,7 +249,7 @@ SValue g_pFormats[] = { nullptr, DXGI_FORMAT_UNKNOWN } }; -SValue g_pReadOnlyFormats[] = +const SValue g_pReadOnlyFormats [] = { DEFFMT(R32G32B32A32_TYPELESS), DEFFMT(R32G32B32_TYPELESS), @@ -293,7 +293,7 @@ SValue g_pReadOnlyFormats[] = { nullptr, DXGI_FORMAT_UNKNOWN } }; -SValue g_pFilters[] = +const SValue g_pFilters [] = { { L"POINT", TEX_FILTER_POINT }, { L"LINEAR", TEX_FILTER_LINEAR }, @@ -322,7 +322,7 @@ SValue g_pFilters[] = #define CODEC_JXR 0xFFFF0004 #define CODEC_HDR 0xFFFF0005 -SValue g_pSaveFileTypes[] = // valid formats to write to +const SValue g_pSaveFileTypes [] = // valid formats to write to { { L"BMP", WIC_CODEC_BMP }, { L"JPG", WIC_CODEC_JPEG }, @@ -339,7 +339,7 @@ SValue g_pSaveFileTypes[] = // valid formats to write to { nullptr, CODEC_DDS } }; -SValue g_pFeatureLevels[] = // valid feature levels for -fl for maximimum size +const SValue g_pFeatureLevels [] = // valid feature levels for -fl for maximimum size { { L"9.1", 2048 }, { L"9.2", 2048 }, @@ -479,7 +479,7 @@ namespace void PrintFormat(DXGI_FORMAT Format) { - for (SValue *pFormat = g_pFormats; pFormat->pName; pFormat++) + for (const SValue *pFormat = g_pFormats; pFormat->pName; pFormat++) { if ((DXGI_FORMAT)pFormat->dwValue == Format) { @@ -488,7 +488,7 @@ namespace } } - for (SValue *pFormat = g_pReadOnlyFormats; pFormat->pName; pFormat++) + for (const SValue *pFormat = g_pReadOnlyFormats; pFormat->pName; pFormat++) { if ((DXGI_FORMAT)pFormat->dwValue == Format) { @@ -556,7 +556,7 @@ namespace } - void PrintList(size_t cch, SValue *pValue) + void PrintList(size_t cch, const SValue *pValue) { while (pValue->pName) {