From b7b89b3b013b9b065090c2e74e04a2e6f62f5811 Mon Sep 17 00:00:00 2001 From: waylonis Date: Thu, 14 Dec 2006 23:23:21 +0000 Subject: Changed files_ to be a Dictionary. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@87 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/common/mac/HTTPMultipartUpload.h | 4 ++-- src/common/mac/HTTPMultipartUpload.m | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/common/mac/HTTPMultipartUpload.h b/src/common/mac/HTTPMultipartUpload.h index 8de32b49..ce9956f0 100644 --- a/src/common/mac/HTTPMultipartUpload.h +++ b/src/common/mac/HTTPMultipartUpload.h @@ -38,7 +38,7 @@ @protected NSURL *url_; // The destination URL (STRONG) NSDictionary *parameters_; // The key/value pairs for sending data (STRONG) - NSMutableArray *files_; // Array of NSDictionaries file/name (STRONG) + NSMutableDictionary *files_; // Dictionary of name/file-path (STRONG) NSString *boundary_; // The boundary string (STRONG) NSHTTPURLResponse *response_; // The response from the send (STRONG) } @@ -51,7 +51,7 @@ - (NSDictionary *)parameters; - (void)addFileAtPath:(NSString *)path name:(NSString *)name; -- (NSArray *)files; +- (NSDictionary *)files; // Set the data and return the response - (NSData *)send:(NSError **)error; diff --git a/src/common/mac/HTTPMultipartUpload.m b/src/common/mac/HTTPMultipartUpload.m index e91cd0af..623bde6f 100644 --- a/src/common/mac/HTTPMultipartUpload.m +++ b/src/common/mac/HTTPMultipartUpload.m @@ -120,13 +120,13 @@ //============================================================================= - (void)addFileAtPath:(NSString *)path name:(NSString *)name { if (!files_) - files_ = [[NSMutableArray alloc] init]; + files_ = [[NSMutableDictionary alloc] init]; - [files_ addObject:[NSDictionary dictionaryWithObject:name forKey:path]]; + [files_ setObject:path forKey:name]; } //============================================================================= -- (NSArray *)files { +- (NSDictionary *)files { return files_; } @@ -151,11 +151,11 @@ } // Add any files to the message - count = [files_ count]; + NSArray *fileNames = [files_ allKeys]; + count = [fileNames count]; for (i = 0; i < count; ++i) { - NSDictionary *dict = [files_ objectAtIndex:i]; - NSString *file = [[dict allKeys] objectAtIndex:0]; - NSString *name = [dict objectForKey:file]; + NSString *name = [fileNames objectAtIndex:i]; + NSString *file = [files_ objectForKey:name]; [postBody appendData:[self formDataForFile:file name:name]]; } -- cgit v1.2.1