X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/d7c39a05d1ea7368700d2140c7f042cc72cf0d0d..e62f72407268a63e92892454648467a55f9e57a4:/PreferencesController.m?ds=inline diff --git a/PreferencesController.m b/PreferencesController.m index 612faf9..2b1bbf8 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; @@ -183,16 +183,15 @@ static PreferencesController *prefs = nil; if (status != noErr) { 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]; } /*************************************************************************/