[Pkg-owncloud-commits] [qtkeychain] 08/35: Fix windows issues with exotic compiler flags.

Sandro Knauß hefee-guest at moszumanska.debian.org
Tue May 24 17:39:58 UTC 2016


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository qtkeychain.

commit 36151aacc787b3695e886339312e382e5728edac
Author: Armin Novak <armin.novak at thincast.com>
Date:   Tue Jan 12 13:05:18 2016 +0100

    Fix windows issues with exotic compiler flags.
    
    If Qt is compiled with /Zc:wchar_t- no proper wchar_t type
    is available. To avoid compilation issues, the platform assumption
    of wchar_t being a unsigned short is used to cast to LPCWSTR.
---
 keychain_win.cpp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/keychain_win.cpp b/keychain_win.cpp
index 593dfca..3d79ff2 100644
--- a/keychain_win.cpp
+++ b/keychain_win.cpp
@@ -21,12 +21,12 @@ using namespace QKeychain;
 #include <wincred.h>
 
 void ReadPasswordJobPrivate::scheduledStart() {
-    std::wstring name = key.toStdWString();
+    LPCWSTR name = (LPCWSTR)key.utf16();
     //Use settings member if there, create local settings object if not
     std::auto_ptr<QSettings> local( !q->settings() ? new QSettings( q->service() ) : 0 );
     PCREDENTIALW cred;
 
-    if (!CredReadW(name.c_str(), CRED_TYPE_GENERIC, 0, &cred)) {
+    if (!CredReadW(name, CRED_TYPE_GENERIC, 0, &cred)) {
         Error error;
         QString msg;
         switch(GetLastError()) {
@@ -53,12 +53,12 @@ void ReadPasswordJobPrivate::scheduledStart() {
 void WritePasswordJobPrivate::scheduledStart() {
     CREDENTIALW cred;
     char *pwd = data.data();
-    std::wstring name = key.toStdWString();
+    LPWSTR name = (LPWSTR)key.utf16();
 
     memset(&cred, 0, sizeof(cred));
     cred.Comment = L"QtKeychain";
     cred.Type = CRED_TYPE_GENERIC;
-    cred.TargetName = (LPWSTR)name.c_str();
+    cred.TargetName = name;
     cred.CredentialBlobSize = data.size();
     cred.CredentialBlob = (LPBYTE)pwd;
     cred.Persist = CRED_PERSIST_LOCAL_MACHINE;
@@ -71,9 +71,9 @@ void WritePasswordJobPrivate::scheduledStart() {
 }
 
 void DeletePasswordJobPrivate::scheduledStart() {
-    std::wstring name = key.toStdWString();
+    LPCWSTR name = (LPCWSTR)key.utf16();
 
-    if (!CredDeleteW(name.c_str(), CRED_TYPE_GENERIC, 0)) {
+    if (!CredDeleteW(name, CRED_TYPE_GENERIC, 0)) {
         Error error;
         QString msg;
         switch(GetLastError()) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/qtkeychain.git



More information about the Pkg-owncloud-commits mailing list