Skip to content

Commit

Permalink
Fix egregiously bad comments that were frustrating
Browse files Browse the repository at this point in the history
  • Loading branch information
barnson committed Jul 15, 2024
1 parent 6bd80b5 commit bb975d3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
56 changes: 28 additions & 28 deletions src/libs/dutil/WixToolset.DUtil/locutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ extern "C" HRESULT DAPI LocProbeForFile(
LocExitOnFailure(hr, "Failed to parse langId.");

langid = MAKEWORD(HIBYTE(langid), LOBYTE(langid));
hr = StrAllocFormatted(&sczLangIdFile, L"%u\\%ls", langid, wzLocFileName);
hr = StrAllocFormatted(&sczLangIdFile, L"%u\\%ls", langid, wzLocFileName);
LocExitOnFailure(hr, "Failed to format user preferred langid.");

hr = PathConcat(wzBasePath, sczLangIdFile, &sczProbePath);
hr = PathConcat(wzBasePath, sczLangIdFile, &sczProbePath);
LocExitOnFailure(hr, "Failed to concat user preferred langid file name to base path.");

if (FileExistsEx(sczProbePath, NULL))
{
ExitFunction();
if (FileExistsEx(sczProbePath, NULL))
{
ExitFunction();
}
}
}
Expand All @@ -142,20 +142,20 @@ extern "C" HRESULT DAPI LocProbeForFile(
ExitFunction();
}

if (MAKELANGID(langid & 0x3FF, SUBLANG_DEFAULT) != langid)
{
langid = MAKELANGID(langid & 0x3FF, SUBLANG_DEFAULT);
hr = StrAllocFormatted(&sczLangIdFile, L"%u\\%ls", langid, wzLocFileName);
if (MAKELANGID(langid & 0x3FF, SUBLANG_DEFAULT) != langid)
{
langid = MAKELANGID(langid & 0x3FF, SUBLANG_DEFAULT);

hr = StrAllocFormatted(&sczLangIdFile, L"%u\\%ls", langid, wzLocFileName);
LocExitOnFailure(hr, "Failed to format user langid (default sublang).");

hr = PathConcat(wzBasePath, sczLangIdFile, &sczProbePath);
hr = PathConcat(wzBasePath, sczLangIdFile, &sczProbePath);
LocExitOnFailure(hr, "Failed to concat user langid file name to base path (default sublang).");

if (FileExistsEx(sczProbePath, NULL))
{
ExitFunction();
}
if (FileExistsEx(sczProbePath, NULL))
{
ExitFunction();
}
}

langid = ::GetSystemDefaultUILanguage();
Expand All @@ -171,20 +171,20 @@ extern "C" HRESULT DAPI LocProbeForFile(
ExitFunction();
}

if (MAKELANGID(langid & 0x3FF, SUBLANG_DEFAULT) != langid)
{
langid = MAKELANGID(langid & 0x3FF, SUBLANG_DEFAULT);
hr = StrAllocFormatted(&sczLangIdFile, L"%u\\%ls", langid, wzLocFileName);
if (MAKELANGID(langid & 0x3FF, SUBLANG_DEFAULT) != langid)
{
langid = MAKELANGID(langid & 0x3FF, SUBLANG_DEFAULT);

hr = StrAllocFormatted(&sczLangIdFile, L"%u\\%ls", langid, wzLocFileName);
LocExitOnFailure(hr, "Failed to format user langid (default sublang).");

hr = PathConcat(wzBasePath, sczLangIdFile, &sczProbePath);
hr = PathConcat(wzBasePath, sczLangIdFile, &sczProbePath);
LocExitOnFailure(hr, "Failed to concat user langid file name to base path (default sublang).");

if (FileExistsEx(sczProbePath, NULL))
{
ExitFunction();
}
if (FileExistsEx(sczProbePath, NULL))
{
ExitFunction();
}
}

// Finally, look for the loc file in the base path.
Expand Down Expand Up @@ -242,13 +242,13 @@ extern "C" HRESULT DAPI LocLoadFromResource(
IXMLDOMDocument* pixd = NULL;

hr = ResReadData(hModule, szResource, &pvResource, &cbResource);
LocExitOnFailure(hr, "Failed to read theme from resource.");
LocExitOnFailure(hr, "Failed to read localization from resource.");

hr = StrAllocStringAnsi(&sczXml, reinterpret_cast<LPCSTR>(pvResource), cbResource, CP_UTF8);
LocExitOnFailure(hr, "Failed to convert XML document data from UTF-8 to unicode string.");
LocExitOnFailure(hr, "Failed to convert XML document data from UTF-8 to Unicode string.");

hr = XmlLoadDocument(sczXml, &pixd);
LocExitOnFailure(hr, "Failed to load theme resource as XML document.");
LocExitOnFailure(hr, "Failed to load localization resource as XML document.");

hr = ParseWxl(pixd, ppWixLoc);
LocExitOnFailure(hr, "Failed to parse WXL.");
Expand Down
2 changes: 1 addition & 1 deletion src/libs/dutil/WixToolset.DUtil/thmutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ DAPI_(HRESULT) ThemeLoadFromFile(
LPWSTR sczRelativePath = NULL;

hr = XmlLoadDocumentFromFile(wzThemeFile, &pixd);
ThmExitOnFailure(hr, "Failed to load theme resource as XML document.");
ThmExitOnFailure(hr, "Failed to load theme file as XML document.");

hr = PathGetDirectory(wzThemeFile, &sczRelativePath);
ThmExitOnFailure(hr, "Failed to get relative path from theme file.");
Expand Down

0 comments on commit bb975d3

Please sign in to comment.