Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix egregiously bad comments that were frustrating #551

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading