aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwaylonis <waylonis@4c0a9323-5329-0410-9bdc-e9ce6186880e>2006-12-14 23:23:21 +0000
committerwaylonis <waylonis@4c0a9323-5329-0410-9bdc-e9ce6186880e>2006-12-14 23:23:21 +0000
commitb7b89b3b013b9b065090c2e74e04a2e6f62f5811 (patch)
tree881a4549ff122cec8d8c652d90b98bf3cb3aed73
parentAdd the HTTP uploading class for Mac. (diff)
downloadbreakpad-b7b89b3b013b9b065090c2e74e04a2e6f62f5811.tar.xz
Changed files_ to be a Dictionary.
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@87 4c0a9323-5329-0410-9bdc-e9ce6186880e
-rw-r--r--src/common/mac/HTTPMultipartUpload.h4
-rw-r--r--src/common/mac/HTTPMultipartUpload.m14
2 files changed, 9 insertions, 9 deletions
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]];
}