X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/d7c39a05d1ea7368700d2140c7f042cc72cf0d0d..57e47909ea593126a1055a5b077e7531c2fafb30:/PreferencesController.m diff --git a/PreferencesController.m b/PreferencesController.m index 612faf9..0a796dc 100755 --- a/PreferencesController.m +++ b/PreferencesController.m @@ -20,7 +20,7 @@ #import #define SENDER_STATE (([sender state] == NSOnState) ? YES : NO) -#define AUDIOSCROBBLER_KEYCHAIN_SERVICE(user) [NSString stringWithFormat:@"Audioscrobbler: %@", user] +#define AUDIOSCROBBLER_KEYCHAIN_SERVICE(user) [[NSString stringWithFormat:@"Audioscrobbler: %@", user] UTF8String] #define AUDIOSCROBBLER_KEYCHAIN_KIND "application password" /*************************************************************************/ @@ -84,8 +84,8 @@ static PreferencesController *prefs = nil; attributes[1].data = AUDIOSCROBBLER_KEYCHAIN_KIND; attributes[1].length = strlen(AUDIOSCROBBLER_KEYCHAIN_KIND); attributes[2].tag = kSecLabelItemAttr; - attributes[2].data = AUDIOSCROBBLER_KEYCHAIN_SERVICE(user); - attributes[2].length = [AUDIOSCROBBLER_KEYCHAIN_SERVICE(user) length]; + attributes[2].data = (char *)AUDIOSCROBBLER_KEYCHAIN_SERVICE(user); + attributes[2].length = strlen(AUDIOSCROBBLER_KEYCHAIN_SERVICE(user)); list.count = 3; list.attr = attributes; @@ -131,8 +131,8 @@ static PreferencesController *prefs = nil; attributes[1].data = AUDIOSCROBBLER_KEYCHAIN_KIND; attributes[1].length = strlen(AUDIOSCROBBLER_KEYCHAIN_KIND); attributes[2].tag = kSecLabelItemAttr; - attributes[2].data = AUDIOSCROBBLER_KEYCHAIN_SERVICE(user); - attributes[2].length = [AUDIOSCROBBLER_KEYCHAIN_SERVICE(user) length]; + attributes[2].data = (char *)AUDIOSCROBBLER_KEYCHAIN_SERVICE(user); + attributes[2].length = strlen(AUDIOSCROBBLER_KEYCHAIN_SERVICE(user)); list.count = 3; list.attr = attributes; @@ -184,15 +184,16 @@ static PreferencesController *prefs = nil; ITDebugLog(@"Audioscrobbler: Error getting keychain item password: %i", status); } else { NSLog(@"Audioscrobbler: password buffer: \"%s\" \"Length: %i\"", buffer, length); - pass = [NSString stringWithUTF8String:buffer]; + pass = [[NSString alloc] initWithBytes:buffer length:length encoding:NSUTF8StringEncoding]; } if (status != noErr) { ITDebugLog(@"Audioscrobbler: Error deleting keychain item: %i", status); } + SecKeychainItemFreeContent(NULL, buffer); CFRelease(item); } NSLog(@"Audioscrobbler: Retrieved password: \"%@\"", pass); - return pass; + return [pass autorelease]; } /*************************************************************************/