Commit c618b8fa authored by unknown's avatar unknown

Just a few cleanup points in azio. Should solve Ubuntu compile problem.


storage/archive/azio.c:
  Cleanup.
storage/archive/azlib.h:
  Moved include lines about.
parent 2f35e785
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include <stdio.h> #include <stdio.h>
#include "zutil.h"
#include "azlib.h" #include "azlib.h"
static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
...@@ -26,13 +25,13 @@ static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ ...@@ -26,13 +25,13 @@ static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
#define COMMENT 0x10 /* bit 4 set: file comment present */ #define COMMENT 0x10 /* bit 4 set: file comment present */
#define RESERVED 0xE0 /* bits 5..7: reserved */ #define RESERVED 0xE0 /* bits 5..7: reserved */
local int az_open(azio_stream *s, const char *path, int Flags, File fd); int az_open(azio_stream *s, const char *path, int Flags, File fd);
local int do_flush(azio_stream *file, int flush); int do_flush(azio_stream *file, int flush);
local int get_byte(azio_stream *s); int get_byte(azio_stream *s);
local void check_header(azio_stream *s); void check_header(azio_stream *s);
local int destroy(azio_stream *s); int destroy(azio_stream *s);
local void putLong(File file, uLong x); void putLong(File file, uLong x);
local uLong getLong(azio_stream *s); uLong getLong(azio_stream *s);
/* =========================================================================== /* ===========================================================================
Opens a gzip (.gz) file for reading or writing. The mode parameter Opens a gzip (.gz) file for reading or writing. The mode parameter
...@@ -43,7 +42,7 @@ local uLong getLong(azio_stream *s); ...@@ -43,7 +42,7 @@ local uLong getLong(azio_stream *s);
can be checked to distinguish the two cases (if errno is zero, the can be checked to distinguish the two cases (if errno is zero, the
zlib error is Z_MEM_ERROR). zlib error is Z_MEM_ERROR).
*/ */
local int az_open (azio_stream *s, const char *path, int Flags, File fd) int az_open (azio_stream *s, const char *path, int Flags, File fd)
{ {
int err; int err;
int level = Z_DEFAULT_COMPRESSION; /* compression level */ int level = Z_DEFAULT_COMPRESSION; /* compression level */
...@@ -155,7 +154,7 @@ int azdopen(azio_stream *s, File fd, int Flags) ...@@ -155,7 +154,7 @@ int azdopen(azio_stream *s, File fd, int Flags)
for end of file. for end of file.
IN assertion: the stream s has been sucessfully opened for reading. IN assertion: the stream s has been sucessfully opened for reading.
*/ */
local int get_byte(s) int get_byte(s)
azio_stream *s; azio_stream *s;
{ {
if (s->z_eof) return EOF; if (s->z_eof) return EOF;
...@@ -184,7 +183,7 @@ local int get_byte(s) ...@@ -184,7 +183,7 @@ local int get_byte(s)
s->stream.avail_in is zero for the first time, but may be non-zero s->stream.avail_in is zero for the first time, but may be non-zero
for concatenated .gz files. for concatenated .gz files.
*/ */
local void check_header(azio_stream *s) void check_header(azio_stream *s)
{ {
int method; /* method byte */ int method; /* method byte */
int flags; /* flags byte */ int flags; /* flags byte */
...@@ -250,7 +249,7 @@ local void check_header(azio_stream *s) ...@@ -250,7 +249,7 @@ local void check_header(azio_stream *s)
* Cleanup then free the given azio_stream. Return a zlib error code. * Cleanup then free the given azio_stream. Return a zlib error code.
Try freeing in the reverse order of allocations. Try freeing in the reverse order of allocations.
*/ */
local int destroy (s) int destroy (s)
azio_stream *s; azio_stream *s;
{ {
int err = Z_OK; int err = Z_OK;
...@@ -426,7 +425,7 @@ int azwrite (azio_stream *s, voidpc buf, unsigned len) ...@@ -426,7 +425,7 @@ int azwrite (azio_stream *s, voidpc buf, unsigned len)
Flushes all pending output into the compressed file. The parameter Flushes all pending output into the compressed file. The parameter
flush is as in the deflate() function. flush is as in the deflate() function.
*/ */
local int do_flush (s, flush) int do_flush (s, flush)
azio_stream *s; azio_stream *s;
int flush; int flush;
{ {
...@@ -524,7 +523,6 @@ my_off_t azseek (s, offset, whence) ...@@ -524,7 +523,6 @@ my_off_t azseek (s, offset, whence)
if (whence == SEEK_SET) { if (whence == SEEK_SET) {
offset -= s->in; offset -= s->in;
} }
if (offset < 0) return -1L;
/* At this point, offset is the number of zero bytes to write. */ /* At this point, offset is the number of zero bytes to write. */
/* There was a zmemzero here if inbuf was null -Brian */ /* There was a zmemzero here if inbuf was null -Brian */
...@@ -546,7 +544,6 @@ my_off_t azseek (s, offset, whence) ...@@ -546,7 +544,6 @@ my_off_t azseek (s, offset, whence)
if (whence == SEEK_CUR) { if (whence == SEEK_CUR) {
offset += s->out; offset += s->out;
} }
if (offset < 0) return -1L;
if (s->transparent) { if (s->transparent) {
/* map to my_seek */ /* map to my_seek */
...@@ -599,7 +596,7 @@ my_off_t ZEXPORT aztell (file) ...@@ -599,7 +596,7 @@ my_off_t ZEXPORT aztell (file)
/* =========================================================================== /* ===========================================================================
Outputs a long in LSB order to the given file Outputs a long in LSB order to the given file
*/ */
local void putLong (File file, uLong x) void putLong (File file, uLong x)
{ {
int n; int n;
byte buffer[1]; byte buffer[1];
...@@ -616,7 +613,7 @@ local void putLong (File file, uLong x) ...@@ -616,7 +613,7 @@ local void putLong (File file, uLong x)
Reads a long in LSB order from the given azio_stream. Sets z_err in case Reads a long in LSB order from the given azio_stream. Sets z_err in case
of error. of error.
*/ */
local uLong getLong (azio_stream *s) uLong getLong (azio_stream *s)
{ {
uLong x = (uLong)get_byte(s); uLong x = (uLong)get_byte(s);
int c; int c;
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
(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