summaryrefslogtreecommitdiff
path: root/xmlsecurity/source/xmlsec
diff options
context:
space:
mode:
authorvarshneydevansh <varshney.devansh614@gmail.com>2025-03-26 14:33:08 +0530
committerMike Kaganski <mike.kaganski@collabora.com>2025-03-26 15:11:33 +0100
commit2a20616d09709427e8cf2474d4721836bce66b8e (patch)
treed295e1435dee025cde67c280443ebf564cdb36b5 /xmlsecurity/source/xmlsec
parent437303ab97187116fcbed8a92f4a3fc38065e43c (diff)
Move Windows error helpers to comphelper namespace
Previously, WindowsErrorString and WindowsErrorStringFromHRESULT were defined in an anonymous namespace in windowserrorstring.hxx, which: 1. Made them unavailable to other translation units 2. Violate ODR by creating separate copies in each TU 3. Require workarounds to access them Changes: - Move functions to proper comphelper namespace - Keep implementations inline as they're simple utilities - Preserve all existing functionality - Update all call sites to use comphelper:: prefix This change enables proper use of these utilities across LibreOffice while maintaining current behavior and performance characteristics. Introduced in this commit: commit 94cdcaa4d8db8f03ac9a84dac54357efff3eb123 Author: Tor Lillqvist <tml@collabora.com> Date: Thu Aug 13 13:22:28 2015 +0300 Add a globally usable WindowsErrorString function Change-Id: I34df1c2b1f30c6204f107ca4792131d692203880 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183332 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'xmlsecurity/source/xmlsec')
-rw-r--r--xmlsecurity/source/xmlsec/errorcallback.cxx2
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx2
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx8
3 files changed, 6 insertions, 6 deletions
diff --git a/xmlsecurity/source/xmlsec/errorcallback.cxx b/xmlsecurity/source/xmlsec/errorcallback.cxx
index a2c429462e81..7f45413657e4 100644
--- a/xmlsecurity/source/xmlsec/errorcallback.cxx
+++ b/xmlsecurity/source/xmlsec/errorcallback.cxx
@@ -48,7 +48,7 @@ static void errorCallback(const char* file,
OUString systemErrorString;
#ifdef _WIN32
- systemErrorString = " " + WindowsErrorString(GetLastError());
+ systemErrorString = " " + comphelper::WindowsErrorString(GetLastError());
#endif
SAL_WARN("xmlsecurity.xmlsec", file << ":" << line << ": " << func << "() '" << pErrorObject << "' '" << pErrorSubject << "' " << reason << " '" << pMsg << "'" << systemErrorString);
diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index a6258f92ad76..8f5b46ad09ce 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -283,7 +283,7 @@ static BOOL WINAPI cert_enum_system_store_callback(const void *pvSystemStore,
if (!(ERROR_FILE_NOT_FOUND == dwErr ||
ERROR_NOT_SUPPORTED == dwErr))
{
- SAL_WARN("xmlsecurity.xmlsec", "CertEnumPhysicalStore failed:" << WindowsErrorString(GetLastError()));
+ SAL_WARN("xmlsecurity.xmlsec", "CertEnumPhysicalStore failed:" << comphelper::WindowsErrorString(GetLastError()));
}
}
return TRUE;
diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
index bd4ef701e6ed..05881195312e 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
@@ -612,7 +612,7 @@ sal_Int32 SAL_CALL X509Certificate_MSCryptImpl::getCertificateUsage( )
&length);
if (!rc)
- SAL_WARN("xmlsecurity.xmlsec", "CryptDecodeObject failed: " << WindowsErrorString(GetLastError()));
+ SAL_WARN("xmlsecurity.xmlsec", "CryptDecodeObject failed: " << comphelper::WindowsErrorString(GetLastError()));
else
{
std::vector<char>buffer(length);
@@ -628,7 +628,7 @@ sal_Int32 SAL_CALL X509Certificate_MSCryptImpl::getCertificateUsage( )
CRYPT_BIT_BLOB *blob = reinterpret_cast<CRYPT_BIT_BLOB*>(buffer.data());
if (!rc)
- SAL_WARN("xmlsecurity.xmlsec", "CryptDecodeObject failed: " << WindowsErrorString(GetLastError()));
+ SAL_WARN("xmlsecurity.xmlsec", "CryptDecodeObject failed: " << comphelper::WindowsErrorString(GetLastError()));
else if (blob->cbData == 1)
usage = blob->pbData[0];
else
@@ -727,7 +727,7 @@ static bool EncodeDistinguishedName(std::u16string_view const rName, CERT_NAME_B
reinterpret_cast<LPCWSTR>(rName.data()), CERT_X500_NAME_STR,
nullptr, nullptr, &rBlob.cbData, &pszError))
{
- SAL_INFO("xmlsecurity.xmlsec", "CertStrToNameW failed: " << WindowsErrorString(GetLastError()) << "; " << OUString(o3tl::toU(pszError)));
+ SAL_INFO("xmlsecurity.xmlsec", "CertStrToNameW failed: " << comphelper::WindowsErrorString(GetLastError()) << "; " << OUString(o3tl::toU(pszError)));
return false;
}
rBlob.pbData = new BYTE[rBlob.cbData];
@@ -735,7 +735,7 @@ static bool EncodeDistinguishedName(std::u16string_view const rName, CERT_NAME_B
reinterpret_cast<LPCWSTR>(rName.data()), CERT_X500_NAME_STR,
nullptr, rBlob.pbData, &rBlob.cbData, &pszError))
{
- SAL_INFO("xmlsecurity.xmlsec", "CertStrToNameW failed: " << WindowsErrorString(GetLastError()) << "; " << OUString(o3tl::toU(pszError)));
+ SAL_INFO("xmlsecurity.xmlsec", "CertStrToNameW failed: " << comphelper::WindowsErrorString(GetLastError()) << "; " << OUString(o3tl::toU(pszError)));
return false;
}
return true;