Skip to content

Commit

Permalink
Remove FAR definition
Browse files Browse the repository at this point in the history
Remove a few leftovers from the legacy OS support removal
  • Loading branch information
Dead2 committed Oct 9, 2014
1 parent e88676a commit 0db1040
Show file tree
Hide file tree
Showing 16 changed files with 155 additions and 202 deletions.
36 changes: 18 additions & 18 deletions crc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# endif /* !DYNAMIC_CRC_TABLE */
#endif /* MAKECRCH */

#include "zutil.h" /* for STDC and FAR definitions */
#include "zutil.h" /* for STDC definitions */

#define local static

Expand All @@ -38,9 +38,9 @@
#endif
#ifdef BYFOUR
local unsigned long crc32_little OF((unsigned long,
const unsigned char FAR *, unsigned));
const unsigned char *, unsigned));
local unsigned long crc32_big OF((unsigned long,
const unsigned char FAR *, unsigned));
const unsigned char *, unsigned));
# define TBLS 8
#else
# define TBLS 1
Expand All @@ -56,10 +56,10 @@ local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2));
#ifdef DYNAMIC_CRC_TABLE

local volatile int crc_table_empty = 1;
local z_crc_t FAR crc_table[TBLS][256];
local z_crc_t crc_table[TBLS][256];
local void make_crc_table OF((void));
#ifdef MAKECRCH
local void write_table OF((FILE *, const z_crc_t FAR *));
local void write_table OF((FILE *, const z_crc_t *));
#endif /* MAKECRCH */
/*
Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
Expand Down Expand Up @@ -146,7 +146,7 @@ local void make_crc_table()
if (out == NULL) return;
fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
fprintf(out, "local const z_crc_t FAR ");
fprintf(out, "local const z_crc_t ");
fprintf(out, "crc_table[TBLS][256] =\n{\n {\n");
write_table(out, crc_table[0]);
# ifdef BYFOUR
Expand All @@ -166,7 +166,7 @@ local void make_crc_table()
#ifdef MAKECRCH
local void write_table(out, table)
FILE *out;
const z_crc_t FAR *table;
const z_crc_t *table;
{
int n;

Expand All @@ -187,13 +187,13 @@ local void write_table(out, table)
/* =========================================================================
* This function can be used by asm versions of crc32()
*/
const z_crc_t FAR * ZEXPORT get_crc_table()
const z_crc_t * ZEXPORT get_crc_table()
{
#ifdef DYNAMIC_CRC_TABLE
if (crc_table_empty)
make_crc_table();
#endif /* DYNAMIC_CRC_TABLE */
return (const z_crc_t FAR *)crc_table;
return (const z_crc_t *)crc_table;
}

/* ========================================================================= */
Expand All @@ -204,7 +204,7 @@ const z_crc_t FAR * ZEXPORT get_crc_table()
/* ========================================================================= */
unsigned long ZEXPORT crc32(crc, buf, len)
unsigned long crc;
const unsigned char FAR *buf;
const unsigned char *buf;
uInt len;
{
if (buf == Z_NULL) return 0UL;
Expand Down Expand Up @@ -256,11 +256,11 @@ unsigned long ZEXPORT crc32(crc, buf, len)
/* ========================================================================= */
local unsigned long crc32_little(crc, buf, len)
unsigned long crc;
const unsigned char FAR *buf;
const unsigned char *buf;
unsigned len;
{
register z_crc_t c;
register const z_crc_t FAR *buf4;
register const z_crc_t *buf4;

c = (z_crc_t)crc;
c = ~c;
Expand All @@ -269,7 +269,7 @@ local unsigned long crc32_little(crc, buf, len)
len--;
}

buf4 = (const z_crc_t FAR *)(const void FAR *)buf;
buf4 = (const z_crc_t *)(const void *)buf;

#ifndef CRC32_UNROLL_LESS
while (len >= 32) {
Expand All @@ -282,7 +282,7 @@ local unsigned long crc32_little(crc, buf, len)
DOLIT4;
len -= 4;
}
buf = (const unsigned char FAR *)buf4;
buf = (const unsigned char *)buf4;

if (len) do {
c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
Expand All @@ -300,11 +300,11 @@ local unsigned long crc32_little(crc, buf, len)
/* ========================================================================= */
local unsigned long crc32_big(crc, buf, len)
unsigned long crc;
const unsigned char FAR *buf;
const unsigned char *buf;
unsigned len;
{
register z_crc_t c;
register const z_crc_t FAR *buf4;
register const z_crc_t *buf4;

c = ZSWAP32((z_crc_t)crc);
c = ~c;
Expand All @@ -313,7 +313,7 @@ local unsigned long crc32_big(crc, buf, len)
len--;
}

buf4 = (const z_crc_t FAR *)(const void FAR *)buf;
buf4 = (const z_crc_t *)(const void *)buf;
buf4--;
while (len >= 32) {
DOBIG32;
Expand All @@ -324,7 +324,7 @@ local unsigned long crc32_big(crc, buf, len)
len -= 4;
}
buf4++;
buf = (const unsigned char FAR *)buf4;
buf = (const unsigned char *)buf4;

if (len) do {
c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
Expand Down
2 changes: 1 addition & 1 deletion crc32.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Generated automatically by crc32.c
*/

local const z_crc_t FAR crc_table[TBLS][256] =
local const z_crc_t crc_table[TBLS][256] =
{
{
0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
Expand Down
4 changes: 2 additions & 2 deletions deflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,

s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
if (s == Z_NULL) return Z_MEM_ERROR;
strm->state = (struct internal_state FAR *)s;
strm->state = (struct internal_state *)s;
s->strm = strm;

s->wrap = wrap;
Expand Down Expand Up @@ -1114,7 +1114,7 @@ int ZEXPORT deflateCopy (dest, source)

ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
if (ds == Z_NULL) return Z_MEM_ERROR;
dest->state = (struct internal_state FAR *) ds;
dest->state = (struct internal_state *) ds;
zmemcpy((voidpf)ds, (voidpf)ss, sizeof(deflate_state));
ds->strm = dest;

Expand Down
8 changes: 4 additions & 4 deletions deflate.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ typedef struct ct_data_s {
ush dad; /* father node in Huffman tree */
ush len; /* length of bit string */
} dl;
} FAR ct_data;
} ct_data;

#define Freq fc.freq
#define Code fc.code
Expand All @@ -87,10 +87,10 @@ typedef struct tree_desc_s {
ct_data *dyn_tree; /* the dynamic tree */
int max_code; /* largest code with non zero frequency */
static_tree_desc *stat_desc; /* the corresponding static tree */
} FAR tree_desc;
} tree_desc;

typedef ush Pos;
typedef Pos FAR Posf;
typedef Pos Posf;
typedef unsigned IPos;

/* A Pos is an index in the character window. We use short instead of int to
Expand Down Expand Up @@ -277,7 +277,7 @@ typedef struct internal_state {
* updated to the new high water mark.
*/

} FAR deflate_state;
} deflate_state;

typedef enum {
need_more, /* block not completed, need more input or more output */
Expand Down
2 changes: 1 addition & 1 deletion gzguts.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ typedef struct {
/* zlib inflate or deflate stream */
z_stream strm; /* stream structure in-place (not a pointer) */
} gz_state;
typedef gz_state FAR *gz_statep;
typedef gz_state *gz_statep;

/* shared functions */
void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
Expand Down
32 changes: 16 additions & 16 deletions infback.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "inffast.h"

/* function prototypes */
local void fixedtables OF((struct inflate_state FAR *state));
local void fixedtables OF((struct inflate_state *state));

/*
strm provides memory allocation functions in zalloc and zfree, or
Expand All @@ -28,11 +28,11 @@ local void fixedtables OF((struct inflate_state FAR *state));
int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
z_streamp strm;
int windowBits;
unsigned char FAR *window;
unsigned char *window;
const char *version;
int stream_size;
{
struct inflate_state FAR *state;
struct inflate_state *state;

if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
stream_size != (int)(sizeof(z_stream)))
Expand All @@ -55,11 +55,11 @@ int stream_size;
#else
strm->zfree = zcfree;
#endif
state = (struct inflate_state FAR *)ZALLOC(strm, 1,
state = (struct inflate_state *)ZALLOC(strm, 1,
sizeof(struct inflate_state));
if (state == Z_NULL) return Z_MEM_ERROR;
Tracev((stderr, "inflate: allocated\n"));
strm->state = (struct internal_state FAR *)state;
strm->state = (struct internal_state *)state;
state->dmax = 32768U;
state->wbits = windowBits;
state->wsize = 1U << windowBits;
Expand All @@ -80,7 +80,7 @@ int stream_size;
may not be thread-safe.
*/
local void fixedtables(state)
struct inflate_state FAR *state;
struct inflate_state *state;
{
#ifdef BUILDFIXED
static int virgin = 1;
Expand Down Expand Up @@ -250,18 +250,18 @@ struct inflate_state FAR *state;
int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)
z_streamp strm;
in_func in;
void FAR *in_desc;
void *in_desc;
out_func out;
void FAR *out_desc;
void *out_desc;
{
struct inflate_state FAR *state;
z_const unsigned char FAR *next; /* next input */
unsigned char FAR *put; /* next output */
struct inflate_state *state;
z_const unsigned char *next; /* next input */
unsigned char *put; /* next output */
unsigned have, left; /* available input and output */
unsigned long hold; /* bit buffer */
unsigned bits; /* bits in bit buffer */
unsigned copy; /* number of stored or match bytes to copy */
unsigned char FAR *from; /* where to copy match bytes from */
unsigned char *from; /* where to copy match bytes from */
code here; /* current decoding table entry */
code last; /* parent table entry */
unsigned len; /* length to copy for repeats, bits to drop */
Expand All @@ -272,7 +272,7 @@ void FAR *out_desc;
/* Check that the strm exists and that the state was initialized */
if (strm == Z_NULL || strm->state == Z_NULL)
return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state;
state = (struct inflate_state *)strm->state;

/* Reset the state */
strm->msg = Z_NULL;
Expand Down Expand Up @@ -383,7 +383,7 @@ void FAR *out_desc;
while (state->have < 19)
state->lens[order[state->have++]] = 0;
state->next = state->codes;
state->lencode = (code const FAR *)(state->next);
state->lencode = (code const *)(state->next);
state->lenbits = 7;
ret = inflate_table(CODES, state->lens, 19, &(state->next),
&(state->lenbits), state->work);
Expand Down Expand Up @@ -457,7 +457,7 @@ void FAR *out_desc;
values here (9 and 6) without reading the comments in inftrees.h
concerning the ENOUGH constants, which depend on those values */
state->next = state->codes;
state->lencode = (code const FAR *)(state->next);
state->lencode = (code const *)(state->next);
state->lenbits = 9;
ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
&(state->lenbits), state->work);
Expand All @@ -466,7 +466,7 @@ void FAR *out_desc;
state->mode = BAD;
break;
}
state->distcode = (code const FAR *)(state->next);
state->distcode = (code const *)(state->next);
state->distbits = 6;
ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
&(state->next), &(state->distbits), state->work);
Expand Down
22 changes: 11 additions & 11 deletions inffast.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,34 +68,34 @@ void ZLIB_INTERNAL inflate_fast(strm, start)
z_streamp strm;
unsigned start; /* inflate()'s starting value for strm->avail_out */
{
struct inflate_state FAR *state;
z_const unsigned char FAR *in; /* local strm->next_in */
z_const unsigned char FAR *last; /* have enough input while in < last */
unsigned char FAR *out; /* local strm->next_out */
unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
unsigned char FAR *end; /* while out < end, enough space available */
struct inflate_state *state;
z_const unsigned char *in; /* local strm->next_in */
z_const unsigned char *last; /* have enough input while in < last */
unsigned char *out; /* local strm->next_out */
unsigned char *beg; /* inflate()'s initial strm->next_out */
unsigned char *end; /* while out < end, enough space available */
#ifdef INFLATE_STRICT
unsigned dmax; /* maximum distance from zlib header */
#endif
unsigned wsize; /* window size or zero if not using window */
unsigned whave; /* valid bytes in the window */
unsigned wnext; /* window write index */
unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */
unsigned char *window; /* allocated sliding window, if wsize != 0 */
unsigned long hold; /* local strm->hold */
unsigned bits; /* local strm->bits */
code const FAR *lcode; /* local strm->lencode */
code const FAR *dcode; /* local strm->distcode */
code const *lcode; /* local strm->lencode */
code const *dcode; /* local strm->distcode */
unsigned lmask; /* mask for first level of length codes */
unsigned dmask; /* mask for first level of distance codes */
code here; /* retrieved table entry */
unsigned op; /* code bits, operation, extra bits, or */
/* window position, window bytes to copy */
unsigned len; /* match length, unused bytes */
unsigned dist; /* match distance */
unsigned char FAR *from; /* where to copy match from */
unsigned char *from; /* where to copy match from */

/* copy state to local variables */
state = (struct inflate_state FAR *)strm->state;
state = (struct inflate_state *)strm->state;
in = strm->next_in - OFF;
last = in + (strm->avail_in - 5);
out = strm->next_out - OFF;
Expand Down
Loading

0 comments on commit 0db1040

Please sign in to comment.