From: Kent Sutherland Date: Thu, 23 Feb 2006 22:26:21 +0000 (+0000) Subject: Using the universal libValidate. Fixed a small Audioscrobbler crash that could happen... X-Git-Tag: v1.7~2 X-Git-Url: http://git.ithinksw.org/MenuTunes.git/commitdiff_plain/b837b70f50ce4d33628f406380c447ff8e70d85a Using the universal libValidate. Fixed a small Audioscrobbler crash that could happen if the Audioscrobbler servers died. --- diff --git a/AudioscrobblerController.m b/AudioscrobblerController.m index bc56007..05a3a07 100644 --- a/AudioscrobblerController.m +++ b/AudioscrobblerController.m @@ -43,7 +43,7 @@ static AudioscrobblerController *_sharedController = nil; _postURL = [NSURL URLWithString:@"http://audioscrobbler.com/"];*/ _delayDate = [[NSDate date] retain]; - _responseData = nil; + _responseData = [[NSMutableData alloc] init]; _tracks = [[NSMutableArray alloc] init]; _submitTracks = [[NSMutableArray alloc] init]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleAudioscrobblerNotification:) name:@"AudioscrobblerHandshakeComplete" object:self]; @@ -96,7 +96,7 @@ static AudioscrobblerController *_sharedController = nil; [[NSNotificationCenter defaultCenter] postNotificationName:@"AudioscrobblerStatusChanged" object:nil userInfo:[NSDictionary dictionaryWithObject:_lastStatus forKey:@"StatusString"]]; _currentStatus = AudioscrobblerRequestingHandshakeStatus; - _responseData = [[NSMutableData alloc] init]; + //_responseData = [[NSMutableData alloc] init]; [NSURLConnection connectionWithRequest:[NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15] delegate:self]; } } @@ -223,7 +223,8 @@ static AudioscrobblerController *_sharedController = nil; [request setHTTPMethod:@"POST"]; [request setHTTPBody:[requestString dataUsingEncoding:NSUTF8StringEncoding]]; _currentStatus = AudioscrobblerSubmittingTracksStatus; - _responseData = [[NSMutableData alloc] init]; + //_responseData = [[NSMutableData alloc] init]; + [_responseData setData:nil]; [NSURLConnection connectionWithRequest:request delegate:self]; [requestString release]; [request release]; @@ -247,7 +248,7 @@ static AudioscrobblerController *_sharedController = nil; - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { - [_responseData release]; + [_responseData setData:nil]; [_lastStatus release]; _lastStatus = [[NSString stringWithFormat:NSLocalizedString(@"audioscrobbler_error", @"Error - %@"), [error localizedDescription]] retain]; [[NSNotificationCenter defaultCenter] postNotificationName:@"AudioscrobblerStatusChanged" object:self userInfo:[NSDictionary dictionaryWithObject:_lastStatus forKey:@"StatusString"]]; @@ -338,7 +339,7 @@ static AudioscrobblerController *_sharedController = nil; _lastStatus = [NSLocalizedString(key, comment) retain]; [[NSNotificationCenter defaultCenter] postNotificationName:@"AudioscrobblerStatusChanged" object:nil userInfo:[NSDictionary dictionaryWithObject:_lastStatus forKey:@"StatusString"]]; [string release]; - [_responseData release]; + [_responseData setData:nil]; } -(NSCachedURLResponse *)connection:(NSURLConnection *)connection willCacheResponse:(NSCachedURLResponse *)cachedResponse diff --git a/MenuTunes.xcodeproj/project.pbxproj b/MenuTunes.xcodeproj/project.pbxproj index cac7557..4dd83a4 100755 --- a/MenuTunes.xcodeproj/project.pbxproj +++ b/MenuTunes.xcodeproj/project.pbxproj @@ -11,7 +11,7 @@ 3739DDA408CFA0C600CCFBC6 /* PlaylistNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 3739DDA208CFA0C600CCFBC6 /* PlaylistNode.m */; }; 3739DDA508CFA0C600CCFBC6 /* PlaylistNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 3739DDA108CFA0C600CCFBC6 /* PlaylistNode.h */; }; 3739DDA608CFA0C600CCFBC6 /* PlaylistNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 3739DDA208CFA0C600CCFBC6 /* PlaylistNode.m */; }; - 3740716D05ACE20500CC2142 /* libValidate.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3740716C05ACE20500CC2142 /* libValidate.a */; }; + 3769DD1709A01C0700573A04 /* libValidateUniversal.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3769DD1609A01C0700573A04 /* libValidateUniversal.a */; }; 3798C6B6091874600004C420 /* AudioscrobblerController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3798C6B4091874600004C420 /* AudioscrobblerController.h */; }; 3798C6B7091874600004C420 /* AudioscrobblerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3798C6B5091874600004C420 /* AudioscrobblerController.m */; }; 37A1EBDB091F07F700C2CE55 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 37A1EBDA091F07F700C2CE55 /* Security.framework */; }; @@ -242,7 +242,7 @@ 32CA4F630368D1EE00C91783 /* MenuTunes_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuTunes_Prefix.pch; sourceTree = ""; }; 3739DDA108CFA0C600CCFBC6 /* PlaylistNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlaylistNode.h; sourceTree = ""; }; 3739DDA208CFA0C600CCFBC6 /* PlaylistNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PlaylistNode.m; sourceTree = ""; }; - 3740716C05ACE20500CC2142 /* libValidate.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libValidate.a; sourceTree = ""; }; + 3769DD1609A01C0700573A04 /* libValidateUniversal.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libValidateUniversal.a; sourceTree = ""; }; 3798C6B4091874600004C420 /* AudioscrobblerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioscrobblerController.h; sourceTree = ""; }; 3798C6B5091874600004C420 /* AudioscrobblerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AudioscrobblerController.m; sourceTree = ""; }; 37A1EBDA091F07F700C2CE55 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = ""; }; @@ -343,8 +343,8 @@ 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, 7C95A0E905A92B0700B4F576 /* libcrypto.dylib in Frameworks */, 7C95A0F005A92B4800B4F576 /* Carbon.framework in Frameworks */, - 3740716D05ACE20500CC2142 /* libValidate.a in Frameworks */, 37A1EBDB091F07F700C2CE55 /* Security.framework in Frameworks */, + 3769DD1709A01C0700573A04 /* libValidateUniversal.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -398,7 +398,7 @@ 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, 7C95A0EF05A92B4800B4F576 /* Carbon.framework */, 37A1EBDA091F07F700C2CE55 /* Security.framework */, - 3740716C05ACE20500CC2142 /* libValidate.a */, + 3769DD1609A01C0700573A04 /* libValidateUniversal.a */, 7C95A0E805A92B0700B4F576 /* libcrypto.dylib */, ); name = "Linked Frameworks"; @@ -1169,12 +1169,16 @@ GCC_WARN_UNKNOWN_PRAGMAS = NO; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Applications"; - LIBRARY_SEARCH_PATHS = .; + LIBRARY_SEARCH_PATHS = ( + ., + "$(SRCROOT)", + ); MACOSX_DEPLOYMENT_TARGET = 10.2; OPTIMIZATION_CFLAGS = "-O0"; OTHER_CFLAGS = ""; OTHER_LDFLAGS = "-bind_at_load"; PRODUCT_NAME = MenuTunes; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; WARNING_CFLAGS = ( "-Wmost", "-Wno-four-char-constants", @@ -1200,11 +1204,15 @@ GCC_WARN_UNKNOWN_PRAGMAS = NO; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Applications"; - LIBRARY_SEARCH_PATHS = .; + LIBRARY_SEARCH_PATHS = ( + ., + "$(SRCROOT)", + ); MACOSX_DEPLOYMENT_TARGET = 10.2; OTHER_CFLAGS = ""; OTHER_LDFLAGS = "-bind_at_load"; PRODUCT_NAME = MenuTunes; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; WARNING_CFLAGS = ( "-Wmost", "-Wno-four-char-constants", @@ -1228,11 +1236,15 @@ GCC_WARN_UNKNOWN_PRAGMAS = NO; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Applications"; - LIBRARY_SEARCH_PATHS = .; + LIBRARY_SEARCH_PATHS = ( + ., + "$(SRCROOT)", + ); MACOSX_DEPLOYMENT_TARGET = 10.2; OTHER_CFLAGS = ""; OTHER_LDFLAGS = "-bind_at_load"; PRODUCT_NAME = MenuTunes; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; WARNING_CFLAGS = ( "-Wmost", "-Wno-four-char-constants", @@ -1245,24 +1257,36 @@ 7C182AD408A84C6300A098F8 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = ( + ppc, + i386, + ); MACOSX_DEPLOYMENT_TARGET = 10.2; - SDKROOT = /Developer/SDKs/MacOSX10.2.8.sdk; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; }; name = Debug; }; 7C182AD508A84C6300A098F8 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = ( + ppc, + i386, + ); MACOSX_DEPLOYMENT_TARGET = 10.2; - SDKROOT = /Developer/SDKs/MacOSX10.2.8.sdk; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; }; name = Release; }; 7C182AD608A84C6300A098F8 /* Default */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = ( + ppc, + i386, + ); MACOSX_DEPLOYMENT_TARGET = 10.2; - SDKROOT = /Developer/SDKs/MacOSX10.2.8.sdk; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; }; name = Default; }; diff --git a/libValidate.a b/libValidate.a index d241364..c370fb3 100755 Binary files a/libValidate.a and b/libValidate.a differ diff --git a/libValidateUniversal.a b/libValidateUniversal.a new file mode 100755 index 0000000..0cdead4 Binary files /dev/null and b/libValidateUniversal.a differ diff --git a/validate.h b/validate.h index 4e5f639..bfc3627 100755 --- a/validate.h +++ b/validate.h @@ -11,6 +11,7 @@ extern "C" { #endif + typedef unsigned char* eSellerate_String; typedef short eSellerate_DaysSince2000; @@ -27,6 +28,19 @@ eSellerate_DaysSince2000 eSellerate_ValidateSerialNumber ( * if invalid: 0 */ +eSellerate_DaysSince2000 eWeb_ValidateSerialNumber ( + const char *serialNumber, /* "C" string */ + const char *nameBasedKey, /* "C" string (nil if unneeded) */ + const char *extraDataKey, /* "C" string (nil if unneeded) */ + const char *publisherKey /* "C" string (nil if unneeded) */ +); +/* + * return codes: + * if valid: date (days since January 1 2000) of expiration or (non-expiring) purchase + * if invalid: 0 + */ + + eSellerate_DaysSince2000 eSellerate_Today ( ); /* days from 1/1/2000 to today */ #ifdef __cplusplus