[WINESYNC] wininet: Import zlib inflate code.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id cee281a036cf5e9017d5a25e0cbe75c2bcd2c146 by Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
winesync 2020-12-08 17:58:35 +01:00 committed by Jérôme Gardou
parent 33fde115eb
commit 4eead52783
5 changed files with 2083 additions and 20 deletions

View file

@ -11,8 +11,7 @@ add_definitions(
-D_WINE
-Dclose=_close)
include_directories(BEFORE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine
${REACTOS_SOURCE_DIR}/sdk/include/reactos/libs/zlib)
include_directories(BEFORE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
spec2def(wininet.dll wininet.spec ADD_IMPORTLIB)
@ -22,6 +21,7 @@ list(APPEND SOURCE
ftp.c
gopher.c
http.c
inflate.c
internet.c
netconnection.c
urlcache.c
@ -37,7 +37,7 @@ add_library(wininet MODULE
${CMAKE_CURRENT_BINARY_DIR}/wininet.def)
set_module_type(wininet win32dll)
target_link_libraries(wininet wine ${PSEH_LIB} zlib)
target_link_libraries(wininet wine ${PSEH_LIB})
add_delay_importlibs(wininet secur32 crypt32 cryptui iphlpapi dhcpcsvc)
add_importlibs(wininet mpr shlwapi shell32 user32 advapi32 ws2_32 normaliz kernel32_vista msvcrt kernel32 ntdll)
add_pch(wininet precomp.h "${PCH_SKIP_SOURCE}")

View file

@ -31,10 +31,6 @@
#include <stdlib.h>
#ifdef HAVE_ZLIB
# include <zlib.h>
#endif
#include "winsock2.h"
#include "ws2ipdef.h"
@ -59,6 +55,7 @@
#include "winuser.h"
#include "internet.h"
#include "zlib.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "wine/unicode.h"
@ -436,8 +433,6 @@ static void remove_header( http_request_t *request, const WCHAR *str, BOOL from_
LeaveCriticalSection( &request->headers_section );
}
#ifdef HAVE_ZLIB
typedef struct {
data_stream_t stream;
data_stream_t *parent_stream;
@ -586,16 +581,6 @@ static DWORD init_gzip_stream(http_request_t *req, BOOL is_gzip)
return ERROR_SUCCESS;
}
#else
static DWORD init_gzip_stream(http_request_t *req, BOOL is_gzip)
{
ERR("gzip stream not supported, missing zlib.\n");
return ERROR_SUCCESS;
}
#endif
/***********************************************************************
* HTTP_FreeTokens (internal)
*

1916
dll/win32/wininet/inflate.c Normal file

File diff suppressed because it is too large Load diff

162
dll/win32/wininet/zlib.h Normal file
View file

@ -0,0 +1,162 @@
/* zlib.h -- interface of the 'zlib' general purpose compression library
* version 1.2.11, January 15th, 2017
*
* Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
* Jean-loup Gailly Mark Adler
* jloup@gzip.org madler@alumni.caltech.edu
*/
#ifndef ZLIB_H
#define ZLIB_H
#include "windef.h"
#undef FAR
#define FAR
#define z_const const
typedef unsigned char Byte; /* 8 bits */
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
typedef Byte FAR Bytef;
typedef void FAR *voidpf;
typedef char FAR charf;
typedef int FAR intf;
typedef unsigned char uch;
typedef uch FAR uchf;
typedef unsigned short ush;
typedef ush FAR ushf;
typedef unsigned long ulg;
typedef voidpf (*alloc_func)(voidpf opaque, uInt items, uInt size);
typedef void (*free_func)(voidpf opaque, voidpf address);
struct internal_state;
typedef struct z_stream_s {
z_const Bytef *next_in; /* next input byte */
uInt avail_in; /* number of bytes available at next_in */
uLong total_in; /* total number of input bytes read so far */
Bytef *next_out; /* next output byte will go here */
uInt avail_out; /* remaining free space at next_out */
uLong total_out; /* total number of bytes output so far */
z_const char *msg; /* last error message, NULL if no error */
struct internal_state FAR *state; /* not visible by applications */
alloc_func zalloc; /* used to allocate the internal state */
free_func zfree; /* used to free the internal state */
voidpf opaque; /* private data object passed to zalloc and zfree */
int data_type; /* best guess about the data type: binary or text
for deflate, or the decoding state for inflate */
uLong adler; /* Adler-32 or CRC-32 value of the uncompressed data */
uLong reserved; /* reserved for future use */
} z_stream;
typedef z_stream FAR *z_streamp;
/*
gzip header information passed to and from zlib routines. See RFC 1952
for more details on the meanings of these fields.
*/
typedef struct gz_header_s {
int text; /* true if compressed data believed to be text */
uLong time; /* modification time */
int xflags; /* extra flags (not used when writing a gzip file) */
int os; /* operating system */
Bytef *extra; /* pointer to extra field or Z_NULL if none */
uInt extra_len; /* extra field length (valid if extra != Z_NULL) */
uInt extra_max; /* space at extra (only when reading header) */
Bytef *name; /* pointer to zero-terminated file name or Z_NULL */
uInt name_max; /* space at name (only when reading header) */
Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */
uInt comm_max; /* space at comment (only when reading header) */
int hcrc; /* true if there was or will be a header crc */
int done; /* true when done reading gzip header (not used
when writing a gzip file) */
} gz_header;
typedef gz_header FAR *gz_headerp;
#define Z_NO_FLUSH 0
#define Z_PARTIAL_FLUSH 1
#define Z_SYNC_FLUSH 2
#define Z_FULL_FLUSH 3
#define Z_FINISH 4
#define Z_BLOCK 5
#define Z_TREES 6
/* Allowed flush values; see deflate() and inflate() below for details */
#define Z_OK 0
#define Z_STREAM_END 1
#define Z_NEED_DICT 2
#define Z_ERRNO (-1)
#define Z_STREAM_ERROR (-2)
#define Z_DATA_ERROR (-3)
#define Z_MEM_ERROR (-4)
#define Z_BUF_ERROR (-5)
#define Z_VERSION_ERROR (-6)
/* Return codes for the compression/decompression functions. Negative values
* are errors, positive values are used for special but normal events.
*/
#define Z_NO_COMPRESSION 0
#define Z_BEST_SPEED 1
#define Z_BEST_COMPRESSION 9
#define Z_DEFAULT_COMPRESSION (-1)
/* compression levels */
#define Z_FILTERED 1
#define Z_HUFFMAN_ONLY 2
#define Z_RLE 3
#define Z_FIXED 4
#define Z_DEFAULT_STRATEGY 0
/* compression strategy; see deflateInit2() below for details */
#define Z_BINARY 0
#define Z_TEXT 1
#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */
#define Z_UNKNOWN 2
/* Possible values of the data_type field for deflate() */
#define Z_DEFLATED 8
/* The deflate compression method (the only one supported in this version) */
#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
#define MAX_WBITS 15 /* 32K LZ77 window */
#define MAX_MEM_LEVEL 9
extern int inflateInit(z_streamp strm) DECLSPEC_HIDDEN;
extern int inflateInit2(z_streamp strm, int windowBits) DECLSPEC_HIDDEN;
extern int inflate(z_streamp strm, int flush) DECLSPEC_HIDDEN;
extern int inflateEnd(z_streamp strm) DECLSPEC_HIDDEN;
extern int deflateInit(z_streamp strm, int level) DECLSPEC_HIDDEN;
extern int deflateInit2(z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy) DECLSPEC_HIDDEN;
extern int deflate(z_streamp strm, int flush) DECLSPEC_HIDDEN;
extern int deflateEnd(z_streamp strm) DECLSPEC_HIDDEN;
#endif /* ZLIB_H */

View file

@ -5,4 +5,4 @@ files:
include/wininet.h: sdk/include/psdk/wininet.h
include/winineti.h: sdk/include/psdk/winineti.h
tags:
wine: a4357043ff9aa14f086207c239f0fc29c0a24b83
wine: cee281a036cf5e9017d5a25e0cbe75c2bcd2c146