newbee with this lib and ios5

143 views
Skip to first unread message

Alonso

unread,
Jan 23, 2012, 7:02:27 AM1/23/12
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

Vítor Ferreira

unread,
Jan 27, 2012, 8:07:20 AM1/27/12
to ASIHTTPRequest
Hi

We just make return nil;

Best regards
Vitor Ferreira

Alonso Isidoro Roman

unread,
Jan 31, 2012, 5:16:14 AM1/31/12
to asihttp...@googlegroups.com
Hi Vitor, so you are using this lib on your project? is it secure, does it works?


2012/1/27 Vítor Ferreira <ferreira.m...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "ASIHTTPRequest" group.
To post to this group, send email to asihttp...@googlegroups.com.
To unsubscribe from this group, send email to asihttpreques...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/asihttprequest?hl=en.




--
Alonso Isidoro Roman.

Mis citas preferidas (de hoy) :
"Si depurar es el proceso de quitar los errores de software, entonces programar debe ser el proceso de introducirlos..."
 -  Edsger Dijkstra



Vitor Ferreira

unread,
Jan 31, 2012, 5:46:43 AM1/31/12
to asihttp...@googlegroups.com
Yes!, it works fine :)

VF

Alonso Isidoro Roman

unread,
Jan 31, 2012, 5:54:09 AM1/31/12
to asihttp...@googlegroups.com
Could you send me the correct download link?

thanx in advance! 

2012/1/31 Vitor Ferreira <ferreira.m...@gmail.com>
Reply all
Reply to author
Forward
0 new messages