Commit 5bfbfb24 authored by unknown's avatar unknown

build fixes for azio on systems without zutil.h


storage/archive/azio.c:
  Build fixes for not having zutil.h
  
  use memset instead of zmemzero.
  
  use 8 as memory usage level (the default, which we were using anyway)
  
  in the .gz header, just say we're UNIX.
  
  use memcpy instead of zmemcpy.
storage/archive/azlib.h:
  don't use zutil.h, it's private to zlib
parent 94cbe6fd
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
/* @(#) $Id$ */ /* @(#) $Id$ */
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include "azlib.h" #include "azlib.h"
...@@ -51,8 +52,8 @@ int az_open (azio_stream *s, const char *path, int Flags, File fd) ...@@ -51,8 +52,8 @@ int az_open (azio_stream *s, const char *path, int Flags, File fd)
s->stream.zalloc = (alloc_func)0; s->stream.zalloc = (alloc_func)0;
s->stream.zfree = (free_func)0; s->stream.zfree = (free_func)0;
s->stream.opaque = (voidpf)0; s->stream.opaque = (voidpf)0;
zmemzero(s->inbuf, Z_BUFSIZE); memset(s->inbuf, 0, Z_BUFSIZE);
zmemzero(s->outbuf, Z_BUFSIZE); memset(s->outbuf, 0, Z_BUFSIZE);
s->stream.next_in = s->inbuf; s->stream.next_in = s->inbuf;
s->stream.next_out = s->outbuf; s->stream.next_out = s->outbuf;
s->stream.avail_in = s->stream.avail_out = 0; s->stream.avail_in = s->stream.avail_out = 0;
...@@ -73,7 +74,7 @@ int az_open (azio_stream *s, const char *path, int Flags, File fd) ...@@ -73,7 +74,7 @@ int az_open (azio_stream *s, const char *path, int Flags, File fd)
err = Z_STREAM_ERROR; err = Z_STREAM_ERROR;
#else #else
err = deflateInit2(&(s->stream), level, err = deflateInit2(&(s->stream), level,
Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy); Z_DEFLATED, -MAX_WBITS, 8, strategy);
/* windowBits is passed < 0 to suppress zlib header */ /* windowBits is passed < 0 to suppress zlib header */
s->stream.next_out = s->outbuf; s->stream.next_out = s->outbuf;
...@@ -114,7 +115,7 @@ int az_open (azio_stream *s, const char *path, int Flags, File fd) ...@@ -114,7 +115,7 @@ int az_open (azio_stream *s, const char *path, int Flags, File fd)
/* Write a very simple .gz header: /* Write a very simple .gz header:
*/ */
snprintf(buffer, 10, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1], snprintf(buffer, 10, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1],
Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE); Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, 0x03);
s->start = 10L; s->start = 10L;
my_write(s->file, buffer, s->start, MYF(0)); my_write(s->file, buffer, s->start, MYF(0));
/* We use 10L instead of ftell(s->file) to because ftell causes an /* We use 10L instead of ftell(s->file) to because ftell causes an
...@@ -317,7 +318,7 @@ int ZEXPORT azread ( azio_stream *s, voidp buf, unsigned len) ...@@ -317,7 +318,7 @@ int ZEXPORT azread ( azio_stream *s, voidp buf, unsigned len)
uInt n = s->stream.avail_in; uInt n = s->stream.avail_in;
if (n > s->stream.avail_out) n = s->stream.avail_out; if (n > s->stream.avail_out) n = s->stream.avail_out;
if (n > 0) { if (n > 0) {
zmemcpy(s->stream.next_out, s->stream.next_in, n); memcpy(s->stream.next_out, s->stream.next_in, n);
next_out += n; next_out += n;
s->stream.next_out = (Bytef *)next_out; s->stream.next_out = (Bytef *)next_out;
s->stream.next_in += n; s->stream.next_in += n;
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
*/ */
#include <zutil.h>
#include <zlib.h> #include <zlib.h>
#include "../../mysys/mysys_priv.h" #include "../../mysys/mysys_priv.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment