Alonso
unread,Jan 23, 2012, 7:02:27 AM1/23/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ASIHTTPRequest
Hi, i downloaded the library and then fixing some errors with
automatic counter (ARC) i still get this strange error:
error: implicit conversion of 'BOOL' (aka 'signed char') to 'NSData *'
is disallowed with ARC [4]
return NO;
this is the method when it crashes:
- (NSData *)compressBytes:(Bytef *)bytes length:(NSUInteger)length
error:(NSError **)err shouldFinish:(BOOL)shouldFinish
{
if (length == 0) return nil;
NSUInteger halfLength = length/2;
// We'll take a guess that the compressed data will fit in half the
size of the original (ie the max to compress at once is half
DATA_CHUNK_SIZE), if not, we'll increase it below
NSMutableData *outputData = [NSMutableData dataWithLength:length/2];
int status;
zStream.next_in = bytes;
zStream.avail_in = (unsigned int)length;
zStream.avail_out = 0;
NSInteger bytesProcessedAlready = zStream.total_out;
while (zStream.avail_out == 0) {
if (zStream.total_out-bytesProcessedAlready >= [outputData length])
{
[outputData increaseLengthBy:halfLength];
}
zStream.next_out = (Bytef*)[outputData mutableBytes] +
zStream.total_out-bytesProcessedAlready;
zStream.avail_out = (unsigned int)([outputData length] -
(zStream.total_out-bytesProcessedAlready));
status = deflate(&zStream, shouldFinish ? Z_FINISH : Z_NO_FLUSH);
if (status == Z_STREAM_END) {
break;
} else if (status != Z_OK) {
if (err) {
*err = [[self class] deflateErrorWithCode:status];
}
return NO; //this is the line when crash the build
}
}
// Set real length
[outputData setLength: zStream.total_out-bytesProcessedAlready];
return outputData;
}
Im using xcode 4.2