예제 #1
0
파일: td0.c 프로젝트: samstyle/Xpeccy
size_t lhaDepack(void* buf, size_t len, void* data) {
	size_t res;
	if (buf == NULL) {
		unsigned char* tbuf = (unsigned char*)malloc(len);
		res = lha_decoder_read((LHADecoder*)data, tbuf, len);
		free(tbuf);
	} else {
		res = lha_decoder_read((LHADecoder*)data, buf, len);
	}
	return res;
}
예제 #2
0
파일: lha_reader.c 프로젝트: djdron/zxtune
size_t lha_reader_read(LHAReader *reader, void *buf, size_t buf_len)
{
	// The first time that we try to read the current file, we
	// must create the decoder to decompress it.

	if (reader->decoder == NULL) {
		if (!open_decoder(reader, NULL, NULL)) {
			return 0;
		}
	}

	// Read from decoder and return the result.

	return lha_decoder_read(reader->decoder, buf, buf_len);
}