Revision cc176feb asi-http-request-with-pithos/Classes/ASIDataCompressor.m
b/asi-http-request-with-pithos/Classes/ASIDataCompressor.m | ||
---|---|---|
88 | 88 |
[outputData increaseLengthBy:halfLength]; |
89 | 89 |
} |
90 | 90 |
|
91 |
zStream.next_out = [outputData mutableBytes] + zStream.total_out-bytesProcessedAlready; |
|
91 |
zStream.next_out = (Bytef*)[outputData mutableBytes] + zStream.total_out-bytesProcessedAlready;
|
|
92 | 92 |
zStream.avail_out = (unsigned int)([outputData length] - (zStream.total_out-bytesProcessedAlready)); |
93 | 93 |
status = deflate(&zStream, shouldFinish ? Z_FINISH : Z_NO_FLUSH); |
94 | 94 |
|
... | ... | |
184 | 184 |
} |
185 | 185 |
|
186 | 186 |
// Write the deflated data out to the destination file |
187 |
[outputStream write:[outputData bytes] maxLength:[outputData length]]; |
|
187 |
[outputStream write:(const uint8_t *)[outputData bytes] maxLength:[outputData length]];
|
|
188 | 188 |
|
189 | 189 |
// Make sure nothing went wrong |
190 | 190 |
if ([inputStream streamStatus] == NSStreamEventErrorOccurred) { |
191 | 191 |
if (err) { |
192 |
*err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of %@ failed because we were unable to write to the destination data file at &@",sourcePath,destinationPath],NSLocalizedDescriptionKey,[outputStream streamError],NSUnderlyingErrorKey,nil]];
|
|
192 |
*err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of %@ failed because we were unable to write to the destination data file at %@",sourcePath,destinationPath],NSLocalizedDescriptionKey,[outputStream streamError],NSUnderlyingErrorKey,nil]];
|
|
193 | 193 |
} |
194 | 194 |
[compressor closeStream]; |
195 | 195 |
return NO; |
... | ... | |
212 | 212 |
|
213 | 213 |
+ (NSError *)deflateErrorWithCode:(int)code |
214 | 214 |
{ |
215 |
return [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of data failed with code %hi",code],NSLocalizedDescriptionKey,nil]];
|
|
215 |
return [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of data failed with code %d",code],NSLocalizedDescriptionKey,nil]];
|
|
216 | 216 |
} |
217 | 217 |
|
218 | 218 |
@synthesize streamReady; |
Also available in: Unified diff