Using the universal libValidate. Fixed a small Audioscrobbler crash that could happen...
authorKent Sutherland <ksuther@ithinksw.com>
Thu, 23 Feb 2006 22:26:21 +0000 (22:26 +0000)
committerKent Sutherland <ksuther@ithinksw.com>
Thu, 23 Feb 2006 22:26:21 +0000 (22:26 +0000)
AudioscrobblerController.m
MenuTunes.xcodeproj/project.pbxproj
libValidate.a
libValidateUniversal.a [new file with mode: 0755]
validate.h

index bc56007..05a3a07 100644 (file)
@@ -43,7 +43,7 @@ static AudioscrobblerController *_sharedController = nil;
                _postURL = [NSURL URLWithString:@"http://audioscrobbler.com/"];*/
                
                _delayDate = [[NSDate date] retain];
                _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];
                _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;
                [[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];
        }
 }
                [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;
        [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];
        [NSURLConnection connectionWithRequest:request delegate:self];
        [requestString release];
        [request release];
@@ -247,7 +248,7 @@ static AudioscrobblerController *_sharedController = nil;
 
 - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
 {
 
 - (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"]];
        [_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];
        _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
 }
 
 -(NSCachedURLResponse *)connection:(NSURLConnection *)connection willCacheResponse:(NSCachedURLResponse *)cachedResponse
index cac7557..4dd83a4 100755 (executable)
@@ -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 */; };
                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 */; };
                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 */; };
                32CA4F630368D1EE00C91783 /* MenuTunes_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuTunes_Prefix.pch; sourceTree = "<group>"; };
                3739DDA108CFA0C600CCFBC6 /* PlaylistNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlaylistNode.h; sourceTree = "<group>"; };
                3739DDA208CFA0C600CCFBC6 /* PlaylistNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PlaylistNode.m; sourceTree = "<group>"; };
                32CA4F630368D1EE00C91783 /* MenuTunes_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuTunes_Prefix.pch; sourceTree = "<group>"; };
                3739DDA108CFA0C600CCFBC6 /* PlaylistNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlaylistNode.h; sourceTree = "<group>"; };
                3739DDA208CFA0C600CCFBC6 /* PlaylistNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PlaylistNode.m; sourceTree = "<group>"; };
-               3740716C05ACE20500CC2142 /* libValidate.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libValidate.a; sourceTree = "<group>"; };
+               3769DD1609A01C0700573A04 /* libValidateUniversal.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libValidateUniversal.a; sourceTree = "<group>"; };
                3798C6B4091874600004C420 /* AudioscrobblerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioscrobblerController.h; sourceTree = "<group>"; };
                3798C6B5091874600004C420 /* AudioscrobblerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AudioscrobblerController.m; sourceTree = "<group>"; };
                37A1EBDA091F07F700C2CE55 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = "<absolute>"; };
                3798C6B4091874600004C420 /* AudioscrobblerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioscrobblerController.h; sourceTree = "<group>"; };
                3798C6B5091874600004C420 /* AudioscrobblerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AudioscrobblerController.m; sourceTree = "<group>"; };
                37A1EBDA091F07F700C2CE55 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = "<absolute>"; };
                                8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
                                7C95A0E905A92B0700B4F576 /* libcrypto.dylib in Frameworks */,
                                7C95A0F005A92B4800B4F576 /* Carbon.framework in Frameworks */,
                                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 */,
                                37A1EBDB091F07F700C2CE55 /* Security.framework in Frameworks */,
+                               3769DD1709A01C0700573A04 /* libValidateUniversal.a in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
                                7C95A0EF05A92B4800B4F576 /* Carbon.framework */,
                                37A1EBDA091F07F700C2CE55 /* Security.framework */,
                                1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
                                7C95A0EF05A92B4800B4F576 /* Carbon.framework */,
                                37A1EBDA091F07F700C2CE55 /* Security.framework */,
-                               3740716C05ACE20500CC2142 /* libValidate.a */,
+                               3769DD1609A01C0700573A04 /* libValidateUniversal.a */,
                                7C95A0E805A92B0700B4F576 /* libcrypto.dylib */,
                        );
                        name = "Linked Frameworks";
                                7C95A0E805A92B0700B4F576 /* libcrypto.dylib */,
                        );
                        name = "Linked Frameworks";
                                GCC_WARN_UNKNOWN_PRAGMAS = NO;
                                INFOPLIST_FILE = Info.plist;
                                INSTALL_PATH = "$(HOME)/Applications";
                                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;
                                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",
                                WARNING_CFLAGS = (
                                        "-Wmost",
                                        "-Wno-four-char-constants",
                                GCC_WARN_UNKNOWN_PRAGMAS = NO;
                                INFOPLIST_FILE = Info.plist;
                                INSTALL_PATH = "$(HOME)/Applications";
                                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;
                                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",
                                WARNING_CFLAGS = (
                                        "-Wmost",
                                        "-Wno-four-char-constants",
                                GCC_WARN_UNKNOWN_PRAGMAS = NO;
                                INFOPLIST_FILE = Info.plist;
                                INSTALL_PATH = "$(HOME)/Applications";
                                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;
                                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",
                                WARNING_CFLAGS = (
                                        "-Wmost",
                                        "-Wno-four-char-constants",
                7C182AD408A84C6300A098F8 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
                7C182AD408A84C6300A098F8 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               ARCHS = (
+                                       ppc,
+                                       i386,
+                               );
                                MACOSX_DEPLOYMENT_TARGET = 10.2;
                                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 = {
                        };
                        name = Debug;
                };
                7C182AD508A84C6300A098F8 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               ARCHS = (
+                                       ppc,
+                                       i386,
+                               );
                                MACOSX_DEPLOYMENT_TARGET = 10.2;
                                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 = {
                        };
                        name = Release;
                };
                7C182AD608A84C6300A098F8 /* Default */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               ARCHS = (
+                                       ppc,
+                                       i386,
+                               );
                                MACOSX_DEPLOYMENT_TARGET = 10.2;
                                MACOSX_DEPLOYMENT_TARGET = 10.2;
-                               SDKROOT = /Developer/SDKs/MacOSX10.2.8.sdk;
+                               SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
                        };
                        name = Default;
                };
                        };
                        name = Default;
                };
index d241364..c370fb3 100755 (executable)
Binary files a/libValidate.a and b/libValidate.a differ
diff --git a/libValidateUniversal.a b/libValidateUniversal.a
new file mode 100755 (executable)
index 0000000..0cdead4
Binary files /dev/null and b/libValidateUniversal.a differ
index 4e5f639..bfc3627 100755 (executable)
@@ -11,6 +11,7 @@
 extern "C" {\r
 #endif\r
 \r
 extern "C" {\r
 #endif\r
 \r
+\r
 typedef unsigned char* eSellerate_String;\r
 \r
 typedef short eSellerate_DaysSince2000;\r
 typedef unsigned char* eSellerate_String;\r
 \r
 typedef short eSellerate_DaysSince2000;\r
@@ -27,6 +28,19 @@ eSellerate_DaysSince2000 eSellerate_ValidateSerialNumber (
  *   if invalid: 0\r
  */\r
 \r
  *   if invalid: 0\r
  */\r
 \r
+eSellerate_DaysSince2000 eWeb_ValidateSerialNumber (\r
+  const char   *serialNumber, /* "C" string                   */\r
+  const char   *nameBasedKey, /* "C" string (nil if unneeded) */\r
+  const char   *extraDataKey, /* "C" string (nil if unneeded) */\r
+  const char   *publisherKey  /* "C" string (nil if unneeded) */\r
+);\r
+/*\r
+ * return codes:\r
+ *   if valid: date (days since January 1 2000) of expiration or (non-expiring) purchase\r
+ *   if invalid: 0\r
+ */\r
+\r
+\r
 eSellerate_DaysSince2000 eSellerate_Today ( ); /* days from 1/1/2000 to today */\r
 \r
 #ifdef __cplusplus\r
 eSellerate_DaysSince2000 eSellerate_Today ( ); /* days from 1/1/2000 to today */\r
 \r
 #ifdef __cplusplus\r