Skip to content

Commit 898dc8e

Browse files
committed
Code review
1 parent 43443b6 commit 898dc8e

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

Texconv/texconv.cpp

+14-7
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ namespace
315315
{ L"wiclossless", L"wic-lossless" },
316316
{ L"wicmulti", L"wic-multiframe" },
317317
{ L"x2bias", L"x2-bias" },
318+
{ nullptr, nullptr }
318319
};
319320

320321
#define DEFFMT(fmt) { L## #fmt, DXGI_FORMAT_ ## fmt }
@@ -1292,6 +1293,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
12921293
if (allowOpts && (('-' == pArg[0]) || ('/' == pArg[0])))
12931294
{
12941295
uint64_t dwOption = 0;
1296+
PWSTR pValue = nullptr;
12951297

12961298
if (('-' == pArg[0]) && ('-' == pArg[1]))
12971299
{
@@ -1304,6 +1306,12 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
13041306
else
13051307
{
13061308
pArg += 2;
1309+
1310+
for (pValue = pArg; *pValue && (':' != *pValue) && ('=' != *pValue); ++pValue);
1311+
1312+
if (*pValue)
1313+
*pValue++ = 0;
1314+
13071315
dwOption = LookupByName(pArg, g_pOptionsLong);
13081316

13091317
if (dwOption == OPT_VERSION)
@@ -1321,6 +1329,12 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
13211329
else
13221330
{
13231331
pArg++;
1332+
1333+
for (pValue = pArg; *pValue && (':' != *pValue) && ('=' != *pValue); ++pValue);
1334+
1335+
if (*pValue)
1336+
*pValue++ = 0;
1337+
13241338
dwOption = LookupByName(pArg, g_pOptions);
13251339

13261340
if (!dwOption)
@@ -1348,13 +1362,6 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
13481362
return 1;
13491363
}
13501364

1351-
PWSTR pValue = pArg;
1352-
1353-
for (; *pValue && (':' != *pValue); ++pValue);
1354-
1355-
if (*pValue)
1356-
*pValue++ = 0;
1357-
13581365
if (dwOptions & (uint64_t(1) << dwOption))
13591366
{
13601367
wprintf(L"ERROR: Duplicate option: `%ls`\n\n", pArg);

0 commit comments

Comments
 (0)