From 5c5a38af21b9bdf0bb3fbdbb538576112cbfb33e Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 20 Oct 2023 16:21:31 +0200 Subject: [PATCH] Update fixes for MacOS --- common/git/git_pull_handler.cpp | 1 + libs/kiplatform/osx/secrets.mm | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/common/git/git_pull_handler.cpp b/common/git/git_pull_handler.cpp index d72ffd589c..6e534d3fc8 100644 --- a/common/git/git_pull_handler.cpp +++ b/common/git/git_pull_handler.cpp @@ -25,6 +25,7 @@ #include #include +#include GIT_PULL_HANDLER::GIT_PULL_HANDLER( git_repository* aRepo ) : KIGIT_COMMON( aRepo ) {} diff --git a/libs/kiplatform/osx/secrets.mm b/libs/kiplatform/osx/secrets.mm index cac8d55bba..91f42e22eb 100644 --- a/libs/kiplatform/osx/secrets.mm +++ b/libs/kiplatform/osx/secrets.mm @@ -26,8 +26,8 @@ bool KIPLATFORM::SECRETS::StoreSecret(const wxString& aService, const wxString& // Create a query for the secret CFMutableDictionaryRef query = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CFDictionarySetValue(query, kSecClass, kSecClassGenericPassword); - CFDictionarySetValue(query, kSecAttrService, CFStringCreateWithCString(NULL, aService.utf8_str(), kCFStringEncodingUTF8)); - CFDictionarySetValue(query, kSecAttrAccount, CFStringCreateWithCString(NULL, aKey.utf8_str(), kCFStringEncodingUTF8)); + CFDictionarySetValue(query, kSecAttrService, CFStringCreateWithCString(NULL, aService.utf8_str().data(), kCFStringEncodingUTF8)); + CFDictionarySetValue(query, kSecAttrAccount, CFStringCreateWithCString(NULL, aKey.utf8_str().data(), kCFStringEncodingUTF8)); // Try to find the existing item OSStatus status = SecItemCopyMatching(query, NULL); @@ -35,14 +35,14 @@ bool KIPLATFORM::SECRETS::StoreSecret(const wxString& aService, const wxString& if (status == errSecItemNotFound) { // Add the new secret to the keychain - CFDictionarySetValue(query, kSecValueData, CFDataCreate(NULL, (const UInt8*)aValue.utf8_str(), aValue.length())); + CFDictionarySetValue(query, kSecValueData, CFDataCreate(NULL, (const UInt8*)aValue.utf8_str().data(), aValue.length())); status = SecItemAdd(query, NULL); } else if (status == errSecSuccess) { // Update the existing secret in the keychain CFMutableDictionaryRef updateQuery = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - CFDictionarySetValue(updateQuery, kSecValueData, CFDataCreate(NULL, (const UInt8*)aValue.utf8_str(), aValue.length())); + CFDictionarySetValue(updateQuery, kSecValueData, CFDataCreate(NULL, (const UInt8*)aValue.utf8_str().data(), aValue.length())); status = SecItemUpdate(query, updateQuery); CFRelease(updateQuery); } @@ -57,8 +57,8 @@ bool KIPLATFORM::SECRETS::GetSecret(const wxString& aService, const wxString& aK // Create a query for the secret CFMutableDictionaryRef query = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CFDictionarySetValue(query, kSecClass, kSecClassGenericPassword); - CFDictionarySetValue(query, kSecAttrService, CFStringCreateWithCString(NULL, aService.utf8_str(), kCFStringEncodingUTF8)); - CFDictionarySetValue(query, kSecAttrAccount, CFStringCreateWithCString(NULL, aKey.utf8_str(), kCFStringEncodingUTF8)); + CFDictionarySetValue(query, kSecAttrService, CFStringCreateWithCString(NULL, aService.utf8_str().data(), kCFStringEncodingUTF8)); + CFDictionarySetValue(query, kSecAttrAccount, CFStringCreateWithCString(NULL, aKey.utf8_str().data(), kCFStringEncodingUTF8)); CFDictionarySetValue(query, kSecReturnData, kCFBooleanTrue); // Return the secret data // Retrieve the secret from the keychain