[Libreoffice-commits] core.git: svl/source

Mike Kaganski mike.kaganski at collabora.com
Fri Sep 15 04:21:06 UTC 2017


 svl/source/crypto/cryptosign.cxx |   30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

New commits:
commit ebb985be4462981904cca72727d1872347022d0d
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date:   Thu Sep 14 21:28:42 2017 +0300

    cryptosign: don't use 8-bit string functions
    
    Change-Id: I5f0414c85001043cd746bab364a84a00ac9c85e4
    Reviewed-on: https://gerrit.libreoffice.org/42305
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Tested-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx
index a6758519b7cd..8c2d18e0ac87 100644
--- a/svl/source/crypto/cryptosign.cxx
+++ b/svl/source/crypto/cryptosign.cxx
@@ -1912,12 +1912,12 @@ OUString GetSubjectName(PCCERT_CONTEXT pCertContext)
     OUString subjectName;
 
     // Get Subject name size.
-    DWORD dwData = CertGetNameString(pCertContext,
-                                     CERT_NAME_SIMPLE_DISPLAY_TYPE,
-                                     0,
-                                     nullptr,
-                                     nullptr,
-                                     0);
+    DWORD dwData = CertGetNameStringW(pCertContext,
+                                      CERT_NAME_SIMPLE_DISPLAY_TYPE,
+                                      0,
+                                      nullptr,
+                                      nullptr,
+                                      0);
     if (!dwData)
     {
         SAL_WARN("svl.crypto", "ValidateSignature: CertGetNameString failed");
@@ -1925,8 +1925,8 @@ OUString GetSubjectName(PCCERT_CONTEXT pCertContext)
     }
 
     // Allocate memory for subject name.
-    LPTSTR szName = static_cast<LPTSTR>(
-        LocalAlloc(LPTR, dwData * sizeof(TCHAR)));
+    LPWSTR szName = static_cast<LPWSTR>(
+        LocalAlloc(LPTR, dwData * sizeof(WCHAR)));
     if (!szName)
     {
         SAL_WARN("svl.crypto", "ValidateSignature: Unable to allocate memory for subject name");
@@ -1934,18 +1934,18 @@ OUString GetSubjectName(PCCERT_CONTEXT pCertContext)
     }
 
     // Get subject name.
-    if (!CertGetNameString(pCertContext,
-                           CERT_NAME_SIMPLE_DISPLAY_TYPE,
-                           0,
-                           nullptr,
-                           szName,
-                           dwData))
+    if (!CertGetNameStringW(pCertContext,
+                            CERT_NAME_SIMPLE_DISPLAY_TYPE,
+                            0,
+                            nullptr,
+                            szName,
+                            dwData))
     {
         SAL_WARN("svl.crypto", "ValidateSignature: CertGetNameString failed");
         return subjectName;
     }
 
-    subjectName = OUString::fromUtf8(OString(szName));
+    subjectName = OUString(reinterpret_cast<sal_Unicode*>(szName));
 
     if (szName != nullptr)
         LocalFree(szName);


More information about the Libreoffice-commits mailing list