Changed files_ to be a Dictionary.

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@87 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
waylonis 2006-12-14 23:23:21 +00:00
parent 5b9bc2fd5e
commit b7b89b3b01
2 changed files with 9 additions and 9 deletions

View file

@ -38,7 +38,7 @@
@protected @protected
NSURL *url_; // The destination URL (STRONG) NSURL *url_; // The destination URL (STRONG)
NSDictionary *parameters_; // The key/value pairs for sending data (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) NSString *boundary_; // The boundary string (STRONG)
NSHTTPURLResponse *response_; // The response from the send (STRONG) NSHTTPURLResponse *response_; // The response from the send (STRONG)
} }
@ -51,7 +51,7 @@
- (NSDictionary *)parameters; - (NSDictionary *)parameters;
- (void)addFileAtPath:(NSString *)path name:(NSString *)name; - (void)addFileAtPath:(NSString *)path name:(NSString *)name;
- (NSArray *)files; - (NSDictionary *)files;
// Set the data and return the response // Set the data and return the response
- (NSData *)send:(NSError **)error; - (NSData *)send:(NSError **)error;

View file

@ -120,13 +120,13 @@
//============================================================================= //=============================================================================
- (void)addFileAtPath:(NSString *)path name:(NSString *)name { - (void)addFileAtPath:(NSString *)path name:(NSString *)name {
if (!files_) 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_; return files_;
} }
@ -151,11 +151,11 @@
} }
// Add any files to the message // Add any files to the message
count = [files_ count]; NSArray *fileNames = [files_ allKeys];
count = [fileNames count];
for (i = 0; i < count; ++i) { for (i = 0; i < count; ++i) {
NSDictionary *dict = [files_ objectAtIndex:i]; NSString *name = [fileNames objectAtIndex:i];
NSString *file = [[dict allKeys] objectAtIndex:0]; NSString *file = [files_ objectForKey:name];
NSString *name = [dict objectForKey:file];
[postBody appendData:[self formDataForFile:file name:name]]; [postBody appendData:[self formDataForFile:file name:name]];
} }