나는 코드목표 - C 경고, 선언되지 않은 식별자를 사용하는 '새로운'
Byte* decompressedBytes = new Byte[COMPRESSION_BLOCK];
이을의이 라인에이 오류를 '새로운'
선언되지 않은 식별자의
사용을 얻고있다 이 코드 줄이 나타나는 내 방법입니다.
// Returns the decompressed version if the zlib compressed input data or nil if there was an error
+ (NSData*) dataByDecompressingData:(NSData*)data{
Byte* bytes = (Byte*)[data bytes];
NSInteger len = [data length];
NSMutableData *decompressedData = [[NSMutableData alloc] initWithCapacity:COMPRESSION_BLOCK];
Byte* decompressedBytes = new Byte[COMPRESSION_BLOCK];
z_stream stream;
int err;
stream.zalloc = (alloc_func)0;
stream.zfree = (free_func)0;
stream.opaque = (voidpf)0;
stream.next_in = bytes;
err = inflateInit(&stream);
CHECK_ERR(err, @"inflateInit");
while (true) {
stream.avail_in = len - stream.total_in;
stream.next_out = decompressedBytes;
stream.avail_out = COMPRESSION_BLOCK;
err = inflate(&stream, Z_NO_FLUSH);
[decompressedData appendBytes:decompressedBytes length:(stream.total_out-[decompressedData length])];
if(err == Z_STREAM_END)
break;
CHECK_ERR(err, @"inflate");
}
err = inflateEnd(&stream);
CHECK_ERR(err, @"inflateEnd");
delete[] decompressedBytes;
return decompressedData;
}
이것이 왜 이렇게 나타나는지 확신 할 수 없습니다. 이 코드는 ObjectiveZlib에서 왔으며 여러 번 읽었고 zlib NSData 객체의 압축을 풀기 위해 내 자신의 코드에서 사용하지 않으려 고하지만이 작업을 진행하는 것을 막을 수 있습니다.
모든 도움을 주시면 대단히 감사하겠습니다.
이 방법이 작동 했습니까? 파일이 zip 형식 –