11#ifdef LIBXML_LZMA_ENABLED
17#ifdef HAVE_SYS_TYPES_H
29#ifdef LIBXML_ZLIB_ENABLED
32#ifdef LIBXML_LZMA_ENABLED
74#ifdef LIBXML_ZLIB_ENABLED
81} xz_state, *xz_statep;
88 if (
state->err != LZMA_MEM_ERROR)
99 if (
err == LZMA_MEM_ERROR) {
107 state->err = LZMA_MEM_ERROR;
108 state->msg = (
char *)
"out of memory";
118xz_reset(xz_statep
state)
127 state->strm.avail_in = 0;
128#ifdef LIBXML_ZLIB_ENABLED
129 state->zstrm.avail_in = 0;
164 if (
state->fd == -1) {
189 if (
state->init <= 0)
192 switch (
state->how) {
210 return xz_compressed(
f);
228xz_load(xz_statep
state,
unsigned char *
buf,
unsigned int len,
239 }
while (*have <
len);
250xz_avail(xz_statep
state)
252 lzma_stream *strm = &(
state->strm);
254 if (
state->err != LZMA_OK)
256 if (
state->eof == 0) {
258 unsigned tmp = strm->avail_in;
261 strm->avail_in = tmp;
264 strm->avail_in = tmp;
265 strm->next_in =
state->in;
270#ifdef LIBXML_ZLIB_ENABLED
272xz_avail_zstrm(xz_statep
state)
285is_format_xz(xz_statep
state)
287 lzma_stream *strm = &(
state->strm);
289 return strm->avail_in >= 6 &&
memcmp(
state->in,
"\3757zXZ", 6) == 0;
293is_format_lzma(xz_statep
state)
295 lzma_stream *strm = &(
state->strm);
298 lzma_options_lzma *opt;
303 if (strm->avail_in < 13)
306 filter.id = LZMA_FILTER_LZMA1;
311 dict_size = opt->dict_size;
328 if (
d != dict_size || dict_size == 0)
336 uncompressed_size = 0;
337 for (
i = 0;
i < 8; ++
i)
341 && uncompressed_size > (
UINT64_C(1) << 38))
347#ifdef LIBXML_ZLIB_ENABLED
350#define NEXT() ((strm->avail_in == 0 && xz_avail(state) == -1) ? -1 : \
351 (strm->avail_in == 0 ? -1 : \
352 (strm->avail_in--, *(strm->next_in)++)))
354#define NEXTZ() ((strm->avail_in == 0 && xz_avail_zstrm(state) == -1) ? -1 : \
355 (strm->avail_in == 0 ? -1 : \
356 (strm->avail_in--, *(strm->next_in)++)))
361gz_next4(xz_statep
state,
unsigned long *
ret)
369 val += (
unsigned long) NEXTZ() << 16;
373 val += (
unsigned long) ch << 24;
380xz_head(xz_statep
state)
382 lzma_stream *strm = &(
state->strm);
383 lzma_stream
init = LZMA_STREAM_INIT;
392 if (
state->size == 0) {
401 xz_error(
state, LZMA_MEM_ERROR,
"out of memory");
408 state->strm.avail_in = 0;
410 if (lzma_auto_decoder(&
state->strm, 100000000, 0) != LZMA_OK) {
414 xz_error(
state, LZMA_MEM_ERROR,
"out of memory");
417#ifdef LIBXML_ZLIB_ENABLED
422 state->zstrm.avail_in = 0;
424 if (
state->init == 0) {
429 xz_error(
state, LZMA_MEM_ERROR,
"out of memory");
438 if (strm->avail_in == 0) {
439 if (xz_avail(
state) == -1)
441 if (strm->avail_in == 0)
446 if (is_format_xz(
state) || is_format_lzma(
state)) {
451#ifdef LIBXML_ZLIB_ENABLED
453 if (strm->next_in[0] == 31) {
456 if (strm->avail_in == 0 && xz_avail(
state) == -1)
458 if (strm->avail_in && strm->next_in[0] == 139) {
465 xz_error(
state, LZMA_DATA_ERROR,
466 "unknown compression method");
471 xz_error(
state, LZMA_DATA_ERROR,
472 "unknown header flags set");
518 if (strm->avail_in) {
520 state->have += strm->avail_in;
529xz_decomp(xz_statep
state)
533 unsigned long crc,
len;
534 lzma_stream *strm = &(
state->strm);
536 lzma_action
action = LZMA_RUN;
543 had = strm->avail_out;
546 if (strm->avail_in == 0 && xz_avail(
state) == -1)
548 if (strm->avail_in == 0) {
549 xz_error(
state, LZMA_DATA_ERROR,
"unexpected end of file");
556#ifdef LIBXML_ZLIB_ENABLED
565 "internal error: inflate stream corrupt");
573 ret = LZMA_MEM_ERROR;
575 ret = LZMA_DATA_ERROR;
577 ret = LZMA_STREAM_END;
580 state->strm.avail_out =
state->zstrm.avail_out;
585 if (
ret == LZMA_MEM_ERROR) {
586 xz_error(
state, LZMA_MEM_ERROR,
"out of memory");
589 if (
ret == LZMA_DATA_ERROR) {
590 xz_error(
state, LZMA_DATA_ERROR,
"compressed data error");
593 if (
ret == LZMA_PROG_ERROR) {
594 xz_error(
state, LZMA_PROG_ERROR,
"compression error");
598 (
ret != LZMA_OK) && (
ret != LZMA_STREAM_END)) {
602 }
while (strm->avail_out &&
ret != LZMA_STREAM_END);
605 state->have = had - strm->avail_out;
607#ifdef LIBXML_ZLIB_ENABLED
612 if (
ret == LZMA_STREAM_END) {
613#ifdef LIBXML_ZLIB_ENABLED
615 if (gz_next4(
state, &crc) == -1 || gz_next4(
state, &
len) == -1) {
616 xz_error(
state, LZMA_DATA_ERROR,
"unexpected end of file");
619 if (crc !=
state->zstrm.adler) {
620 xz_error(
state, LZMA_DATA_ERROR,
"incorrect data check");
623 if (
len != (
state->zstrm.total_out & 0xffffffffL)) {
624 xz_error(
state, LZMA_DATA_ERROR,
"incorrect length check");
627 state->strm.avail_in = 0;
629 state->strm.avail_out = 0;
633 if (strm->avail_in != 0 || !
state->eof) {
634 xz_error(
state, LZMA_DATA_ERROR,
"trailing garbage");
646xz_make(xz_statep
state)
648 lzma_stream *strm = &(
state->strm);
651 if (xz_head(
state) == -1)
662 strm->avail_out =
state->size << 1;
663 strm->next_out =
state->out;
664 if (xz_decomp(
state) == -1)
688 else if (
state->eof &&
state->strm.avail_in == 0)
694 if (xz_make(
state) == -1)
711 strm = &(
state->strm);
714 if (
state->err != LZMA_OK)
720 xz_error(
state, LZMA_BUF_ERROR,
721 "requested length does not fit in int");
748 else if (
state->eof && strm->avail_in == 0)
755 if (xz_make(
state) == -1)
770 strm->avail_out =
len;
771 strm->next_out =
buf;
772 if (xz_decomp(
state) == -1)
797 return LZMA_DATA_ERROR;
802 lzma_end(&(
state->strm));
803#ifdef LIBXML_ZLIB_ENABLED
804 if (
state->init == 1)
816 return ret ?
ret : LZMA_OK;
char * strcat(char *DstString, const char *SrcString)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
ACPI_SIZE strlen(const char *String)
char * strcpy(char *DstString, const char *SrcString)
#define crc32(crc, buf, len)
static int inflateReset(z_streamp strm)
int inflate(z_streamp strm, int flush)
int inflateEnd(z_streamp strm)
GLenum GLuint GLenum GLsizei const GLchar * buf
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define memcpy(s1, s2, n)
#define sprintf(buf, format,...)
static const DWORD padding1[]
static unsigned(__cdecl *hash_bstr)(bstr_t s)
const char * strerror(int err)
static unsigned __int64 next
_Check_return_ _CRTIMP int __cdecl __cdecl eof(_In_ int _FileHandle)
XMLPUBVAR xmlMallocFunc xmlMalloc
XMLPUBVAR xmlFreeFunc xmlFree
#define inflateInit2(strm, windowBits)
int seek(void *fd, ulong off, int mode)
xzFile __libxml2_xzopen(const char *path, const char *mode)
xzFile __libxml2_xzdopen(int fd, const char *mode)
int __libxml2_xzclose(xzFile file)
int __libxml2_xzread(xzFile file, void *buf, unsigned len)
int __libxml2_xzcompressed(xzFile f)