Remove xdelta3 since it doesn't fit in with our current networking plans anymore

git-svn-id: https://svn.eduke32.com/eduke32@3193 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2012-11-16 15:40:28 +00:00
parent ed464aaadc
commit 2ab811cd9b
11 changed files with 8 additions and 8742 deletions

View file

@ -35,7 +35,7 @@ else
endif endif
OURCOMMONFLAGS=$(BASECOMMONFLAGS) \ OURCOMMONFLAGS=$(BASECOMMONFLAGS) \
-I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(JAUDIOLIBDIR)/include -I$(ENETDIR)/include -I$(SRC)/xdelta3 -I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(JAUDIOLIBDIR)/include -I$(ENETDIR)/include
OURCFLAGS=$(OURCOMMONFLAGS) $(BASECFLAGS) OURCFLAGS=$(OURCOMMONFLAGS) $(BASECFLAGS)
OURCXXFLAGS=$(BASECXXFLAGS) OURCXXFLAGS=$(BASECXXFLAGS)
OURCONLYFLAGS=$(BASECONLYFLAGS) OURCONLYFLAGS=$(BASECONLYFLAGS)
@ -134,7 +134,6 @@ GAMEOBJS=$(OBJ)/game.$o \
$(OBJ)/osdcmds.$o \ $(OBJ)/osdcmds.$o \
$(OBJ)/grpscan.$o \ $(OBJ)/grpscan.$o \
$(OBJ)/sounds.$o \ $(OBJ)/sounds.$o \
$(OBJ)/xdelta3.$o \
$(JMACTOBJ) $(JMACTOBJ)
EDITOROBJS=$(OBJ)/astub.$o \ EDITOROBJS=$(OBJ)/astub.$o \
@ -450,10 +449,6 @@ $(OBJ)/%.$o: $(SRC)/lunatic/%.c
$(COMPILE_STATUS) $(COMPILE_STATUS)
if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
$(OBJ)/%.$o: $(SRC)/xdelta3/%.c
$(COMPILE_STATUS)
if $(COMPILER) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
# TODO: _m32 # TODO: _m32
# List of exported symbols, OS X # List of exported symbols, OS X
$(SRC)/lunatic/dynsymlist_osx: $(SRC)/lunatic/dynsymlist $(SRC)/lunatic/dynsymlist_osx: $(SRC)/lunatic/dynsymlist

View file

@ -55,7 +55,6 @@ $(OBJ)/config.$o: $(SRC)/config.c $(duke3d_h) $(SRC)/jmact/scriplib.h $(INC)/_fu
$(OBJ)/winbits.$o: $(SRC)/winbits.c $(OBJ)/winbits.$o: $(SRC)/winbits.c
$(OBJ)/osdfuncs.$o: $(SRC)/names.h $(EINC)/build.h $(EINC)/osd.h $(OBJ)/osdfuncs.$o: $(SRC)/names.h $(EINC)/build.h $(EINC)/osd.h
$(OBJ)/osdcmds.$o: $(SRC)/osdcmds.c $(INC)/osdcmds.h $(EINC)/osd.h $(duke3d_h) $(OBJ)/osdcmds.$o: $(SRC)/osdcmds.c $(INC)/osdcmds.h $(EINC)/osd.h $(duke3d_h)
$(OBJ)/xdelta3.$o: $(SRC)/xdelta3/xdelta3.c $(SRC)/xdelta3/xdelta3.h
$(OBJ)/animvpx.$o: $(SRC)/animvpx.c $(SRC)/animvpx.h $(duke3d_h) $(EINC)/glbuild.h $(OBJ)/animvpx.$o: $(SRC)/animvpx.c $(SRC)/animvpx.h $(duke3d_h) $(EINC)/glbuild.h
$(OBJ)/lunatic_game.$o: $(EINC)/lunatic.h $(SRC)/lunatic/lunatic_game.c $(SRC)/lunatic/lunatic_game.h $(SRC)/gamedef.h $(SRC)/gameexec.h $(EINC)/cache1d.h $(EINC)/osd.h $(OBJ)/lunatic_game.$o: $(EINC)/lunatic.h $(SRC)/lunatic/lunatic_game.c $(SRC)/lunatic/lunatic_game.h $(SRC)/gamedef.h $(SRC)/gameexec.h $(EINC)/cache1d.h $(EINC)/osd.h

View file

@ -44,7 +44,7 @@ AS=ml
LINK=link /nologo /opt:ref LINK=link /nologo /opt:ref
MT=mt MT=mt
CFLAGS= /MT /J /nologo $(flags_cl) \ CFLAGS= /MT /J /nologo $(flags_cl) \
/I$(INC) /I$(EINC)\msvc /I$(EINC)\ /I$(SRC)\jmact /I$(SRC)\xdelta3 /I$(JAUDIOLIBDIR)\include /I$(ENETDIR)\include \ /I$(INC) /I$(EINC)\msvc /I$(EINC)\ /I$(SRC)\jmact /I$(JAUDIOLIBDIR)\include /I$(ENETDIR)\include \
/W2 $(ENGINEOPTS) \ /W2 $(ENGINEOPTS) \
/I$(DXROOT)\include /DRENDERTYPEWIN=1 /I$(DXROOT)\include /DRENDERTYPEWIN=1
@ -106,7 +106,6 @@ GAMEOBJS=$(OBJ)\game.$o \
$(JMACTOBJ) \ $(JMACTOBJ) \
$(AUDIOLIBOBJ) \ $(AUDIOLIBOBJ) \
$(OBJ)\sounds.$o \ $(OBJ)\sounds.$o \
$(OBJ)\xdelta3.$o \
!ifdef DEBUG !ifdef DEBUG
$(OBJ)\mdump.$o $(OBJ)\mdump.$o
!endif !endif
@ -134,9 +133,6 @@ EDITOROBJS=$(OBJ)\astub.$o \
{$(SRC)\jmact}.c{$(OBJ)\}.$o: {$(SRC)\jmact}.c{$(OBJ)\}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $< $(CC) /c $(CFLAGS) /Fo$@ $<
{$(SRC)\xdelta3}.c{$(OBJ)\}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $<
{$(SRC)\util}.c{$(OBJ)\}.$o: {$(SRC)\util}.c{$(OBJ)\}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $< $(CC) /c $(CFLAGS) /Fo$@ $<

View file

@ -31,7 +31,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "enet/enet.h" #include "enet/enet.h"
#include "quicklz.h" #include "quicklz.h"
#include "crc32.h" #include "crc32.h"
#include "xdelta3.h"
/* /*
this should be lower than the MTU size by at least the size of the UDP and ENet headers this should be lower than the MTU size by at least the size of the UDP and ENet headers
@ -1313,7 +1312,7 @@ void Net_SendMapUpdate(void)
int32_t pi; int32_t pi;
int32_t siz = 0; int32_t siz = 0;
netmapstate_t *currentstate; netmapstate_t *currentstate;
usize_t osize = sizeof(netmapstate_t); size_t osize = sizeof(netmapstate_t);
if (!g_netServer || numplayers < 2) if (!g_netServer || numplayers < 2)
return; return;
@ -1346,11 +1345,13 @@ void Net_SendMapUpdate(void)
packbuf[0] = PACKET_MAP_STREAM; packbuf[0] = PACKET_MAP_STREAM;
*(uint32_t *)&packbuf[1] = g_player[playeridx].revision; // base revision for this update *(uint32_t *)&packbuf[1] = g_player[playeridx].revision; // base revision for this update
/*
xd3_encode_memory((const uint8_t *) currentstate, sizeof(netmapstate_t), xd3_encode_memory((const uint8_t *) currentstate, sizeof(netmapstate_t),
(const uint8_t *) g_multiMapState[playeridx], sizeof(netmapstate_t), (const uint8_t *) g_multiMapState[playeridx], sizeof(netmapstate_t),
(uint8_t *)tempnetbuf, &osize, sizeof(netmapstate_t), XD3_COMPLEVEL_1|XD3_NOCOMPRESS); (uint8_t *)tempnetbuf, &osize, sizeof(netmapstate_t), XD3_COMPLEVEL_1|XD3_NOCOMPRESS);
Bmemcpy(g_pendingMapState[playeridx], currentstate, sizeof(netmapstate_t)); Bmemcpy(g_pendingMapState[playeridx], currentstate, sizeof(netmapstate_t));
*/
siz = qlz_compress((char *)tempnetbuf, packbuf+1+sizeof(uint32_t), osize, state_compress); siz = qlz_compress((char *)tempnetbuf, packbuf+1+sizeof(uint32_t), osize, state_compress);
@ -1370,7 +1371,7 @@ void Net_SendMapUpdate(void)
void Net_ReceiveMapUpdate(uint8_t *pbuf, int32_t packbufleng) void Net_ReceiveMapUpdate(uint8_t *pbuf, int32_t packbufleng)
{ {
int ret; int ret;
usize_t osize = 0; size_t osize = 0;
netmapstate_t *receivedstate; netmapstate_t *receivedstate;
packbufleng = qlz_size_decompressed((char *)&pbuf[5]); packbufleng = qlz_size_decompressed((char *)&pbuf[5]);
@ -1379,6 +1380,7 @@ void Net_ReceiveMapUpdate(uint8_t *pbuf, int32_t packbufleng)
initprintf("packbufleng: %d\n", packbufleng); initprintf("packbufleng: %d\n", packbufleng);
/*
ret = xd3_decode_memory((const uint8_t *)pbuf, packbufleng, ret = xd3_decode_memory((const uint8_t *)pbuf, packbufleng,
(const uint8_t *)g_multiMapState[0], sizeof(netmapstate_t), (const uint8_t *)g_multiMapState[0], sizeof(netmapstate_t),
(uint8_t *)tempnetbuf, &osize, sizeof(netmapstate_t), XD3_COMPLEVEL_1|XD3_NOCOMPRESS); (uint8_t *)tempnetbuf, &osize, sizeof(netmapstate_t), XD3_COMPLEVEL_1|XD3_NOCOMPRESS);
@ -1389,7 +1391,7 @@ void Net_ReceiveMapUpdate(uint8_t *pbuf, int32_t packbufleng)
Bfree(pbuf); Bfree(pbuf);
return; return;
} }
*/
if (sizeof(netmapstate_t) != osize) if (sizeof(netmapstate_t) != osize)
{ {
initprintf("decompressed data size mismatch!\n"); initprintf("decompressed data size mismatch!\n");

View file

@ -1,173 +0,0 @@
/* xdelta 3 - delta compression tools and library
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007. Joshua P. MacDonald
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/******************************************************************
SOFT string matcher
******************************************************************/
#if XD3_BUILD_SOFT
#define TEMPLATE soft
#define LLOOK stream->smatcher.large_look
#define LSTEP stream->smatcher.large_step
#define SLOOK stream->smatcher.small_look
#define SCHAIN stream->smatcher.small_chain
#define SLCHAIN stream->smatcher.small_lchain
#define MAXLAZY stream->smatcher.max_lazy
#define LONGENOUGH stream->smatcher.long_enough
#define SOFTCFG 1
#include "xdelta3.c"
#undef SOFTCFG
#undef TEMPLATE
#undef LLOOK
#undef SLOOK
#undef LSTEP
#undef SCHAIN
#undef SLCHAIN
#undef MAXLAZY
#undef LONGENOUGH
#endif
#define SOFTCFG 0
/************************************************************
FASTEST string matcher
**********************************************************/
#if XD3_BUILD_FASTEST
#define TEMPLATE fastest
#define LLOOK 9
#define LSTEP 26
#define SLOOK 4U
#define SCHAIN 1
#define SLCHAIN 1
#define MAXLAZY 6
#define LONGENOUGH 6
#include "xdelta3.c"
#undef TEMPLATE
#undef LLOOK
#undef SLOOK
#undef LSTEP
#undef SCHAIN
#undef SLCHAIN
#undef MAXLAZY
#undef LONGENOUGH
#endif
/************************************************************
FASTER string matcher
**********************************************************/
#if XD3_BUILD_FASTER
#define TEMPLATE faster
#define LLOOK 9
#define LSTEP 15
#define SLOOK 4U
#define SCHAIN 1
#define SLCHAIN 1
#define MAXLAZY 18
#define LONGENOUGH 18
#include "xdelta3.c"
#undef TEMPLATE
#undef LLOOK
#undef SLOOK
#undef LSTEP
#undef SCHAIN
#undef SLCHAIN
#undef MAXLAZY
#undef LONGENOUGH
#endif
/******************************************************
FAST string matcher
********************************************************/
#if XD3_BUILD_FAST
#define TEMPLATE fast
#define LLOOK 9
#define LSTEP 8
#define SLOOK 4U
#define SCHAIN 4
#define SLCHAIN 1
#define MAXLAZY 18
#define LONGENOUGH 35
#include "xdelta3.c"
#undef TEMPLATE
#undef LLOOK
#undef SLOOK
#undef LSTEP
#undef SCHAIN
#undef SLCHAIN
#undef MAXLAZY
#undef LONGENOUGH
#endif
/**************************************************
SLOW string matcher
**************************************************************/
#if XD3_BUILD_SLOW
#define TEMPLATE slow
#define LLOOK 9
#define LSTEP 2
#define SLOOK 4U
#define SCHAIN 44
#define SLCHAIN 13
#define MAXLAZY 90
#define LONGENOUGH 70
#include "xdelta3.c"
#undef TEMPLATE
#undef LLOOK
#undef SLOOK
#undef LSTEP
#undef SCHAIN
#undef SLCHAIN
#undef MAXLAZY
#undef LONGENOUGH
#endif
/********************************************************
DEFAULT string matcher
************************************************************/
#if XD3_BUILD_DEFAULT
#define TEMPLATE default
#define LLOOK 9
#define LSTEP 3
#define SLOOK 4U
#define SCHAIN 8
#define SLCHAIN 2
#define MAXLAZY 36
#define LONGENOUGH 70
#include "xdelta3.c"
#undef TEMPLATE
#undef LLOOK
#undef SLOOK
#undef LSTEP
#undef SCHAIN
#undef SLCHAIN
#undef MAXLAZY
#undef LONGENOUGH
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,187 +0,0 @@
/* xdelta 3 - delta compression tools and library
* Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007. Joshua P. MacDonald
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _XDELTA3_HASH_H_
#define _XDELTA3_HASH_H_
#if XD3_DEBUG
#define SMALL_HASH_DEBUG1(s,inp) \
usize_t debug_state; \
usize_t debug_hval = xd3_checksum_hash (& (s)->small_hash, \
xd3_scksum (&debug_state, (inp), (s)->smatcher.small_look))
#define SMALL_HASH_DEBUG2(s,inp) \
XD3_ASSERT (debug_hval == xd3_checksum_hash (& (s)->small_hash, \
xd3_scksum (&debug_state, (inp), (s)->smatcher.small_look)))
#else
#define SMALL_HASH_DEBUG1(s,inp)
#define SMALL_HASH_DEBUG2(s,inp)
#endif /* XD3_DEBUG */
/* This is a good hash multiplier for 32-bit LCGs: see "linear
* congruential generators of different sizes and good lattice
* structure" */
static const uint32_t hash_multiplier = 1597334677U;
/***********************************************************************
Permute stuff
***********************************************************************/
#if HASH_PERMUTE == 0
#define PERMUTE(x) (x)
#else
#define PERMUTE(x) (__single_hash[(uint32_t)x])
extern const uint16_t __single_hash[256];
#endif
/* Update the checksum state. */
#if ADLER_LARGE_CKSUM
inline uint32_t
xd3_large_cksum_update (uint32_t cksum,
const uint8_t *base,
usize_t look) {
uint32_t old_c = PERMUTE(base[0]);
uint32_t new_c = PERMUTE(base[look]);
uint32_t low = ((cksum & 0xffff) - old_c + new_c) & 0xffff;
uint32_t high = ((cksum >> 16) - (old_c * look) + low) & 0xffff;
return (high << 16) | low;
}
#else
/* TODO: revisit this topic */
#endif
/* Note: small cksum is hard-coded for 4 bytes */
#if UNALIGNED_OK
static inline uint32_t
xd3_scksum (uint32_t *state,
const uint8_t *base,
const usize_t look ATTRIBUTE((unused)))
{
(*state) = *(uint32_t*)base;
return (*state) * hash_multiplier;
}
static inline uint32_t
xd3_small_cksum_update (uint32_t *state,
const uint8_t *base,
usize_t look ATTRIBUTE((unused)))
{
(*state) = *(uint32_t*)(base+1);
return (*state) * hash_multiplier;
}
#else
static inline uint32_t
xd3_scksum (uint32_t *state,
const uint8_t *base,
const usize_t look)
{
(*state) = (base[0] << 24 |
base[1] << 16 |
base[2] << 8 |
base[3]);
return (*state) * hash_multiplier;
}
static inline uint32_t
xd3_small_cksum_update (uint32_t *state,
const uint8_t *base,
const usize_t look)
{
(*state) <<= 8;
(*state) |= base[4];
return (*state) * hash_multiplier;
}
#endif
/***********************************************************************
Ctable stuff
***********************************************************************/
static inline usize_t
xd3_checksum_hash (const xd3_hash_cfg *cfg, const usize_t cksum)
{
return (cksum >> cfg->shift) ^ (cksum & cfg->mask);
}
/***********************************************************************
Cksum function
***********************************************************************/
#if ADLER_LARGE_CKSUM
static inline uint32_t
xd3_lcksum (const uint8_t *seg, const usize_t ln)
{
usize_t i = 0;
uint32_t low = 0;
uint32_t high = 0;
for (; i < ln; i += 1)
{
low += PERMUTE(*seg++);
high += low;
}
return ((high & 0xffff) << 16) | (low & 0xffff);
}
#else
static inline uint32_t
xd3_lcksum (const uint8_t *seg, const usize_t ln)
{
usize_t i, j;
uint32_t h = 0;
for (i = 0, j = ln - 1; i < ln; ++i, --j) {
h += PERMUTE(seg[i]) * hash_multiplier_powers[j];
}
return h;
}
#endif
#if XD3_ENCODER
static usize_t
xd3_size_log2 (usize_t slots)
{
int bits = 28; /* This should not be an unreasonable limit. */
int i;
for (i = 3; i <= bits; i += 1)
{
if (slots < (1U << i))
{
/* TODO: this is compaction=1 in checksum_test.cc and maybe should
* not be fixed at -1. */
bits = i - 1;
break;
}
}
return bits;
}
static void
xd3_size_hashtable (xd3_stream *stream ATTRIBUTE((unused)),
usize_t slots,
xd3_hash_cfg *cfg)
{
int bits = xd3_size_log2 (slots);
/* TODO: there's a 32-bit assumption here */
cfg->size = (1 << bits);
cfg->mask = (cfg->size - 1);
cfg->shift = 32 - bits;
}
#endif
#endif

View file

@ -1,142 +0,0 @@
/* xdelta3 - delta compression tools and library
* Copyright (C) 2011, 2012 Joshua P. MacDonald
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef XDELTA3_INTERNAL_H__
#define XDELTA3_INTERNAL_H__
#include "xdelta3.h"
typedef struct _main_file main_file;
typedef struct _main_extcomp main_extcomp;
void main_file_init (main_file *xfile);
int main_file_close (main_file *xfile);
void main_file_cleanup (main_file *xfile);
int main_file_isopen (main_file *xfile);
int main_file_open (main_file *xfile, const char* name, int mode);
int main_file_exists (main_file *xfile);
int xd3_whole_append_window (xd3_stream *stream);
int xd3_main_cmdline (int argc, char **argv);
int main_file_read (main_file *ifile,
uint8_t *buf,
usize_t size,
usize_t *nread,
const char *msg);
int main_file_write (main_file *ofile, uint8_t *buf,
usize_t size, const char *msg);
usize_t xd3_bytes_on_srcblk (xd3_source *src, xoff_t blkno);
xoff_t xd3_source_eof(const xd3_source *src);
uint32_t xd3_large_cksum_update (uint32_t cksum,
const uint8_t *base,
usize_t look);
int xd3_encode_init_full (xd3_stream *stream);
#if PYTHON_MODULE || SWIG_MODULE || NOT_MAIN
int xd3_main_cmdline (int argc, char **argv);
#endif
/* main_file->mode values */
typedef enum
{
XO_READ = 0,
XO_WRITE = 1
} main_file_modes;
struct _main_file
{
#if XD3_STDIO
FILE *file;
#elif XD3_POSIX
int file;
#elif XD3_WIN32
HANDLE file;
#endif
int mode; /* XO_READ and XO_WRITE */
const char *filename; /* File name or /dev/stdin,
* /dev/stdout, /dev/stderr. */
char *filename_copy; /* File name or /dev/stdin,
* /dev/stdout, /dev/stderr. */
const char *realname; /* File name or /dev/stdin,
* /dev/stdout, /dev/stderr. */
const main_extcomp *compressor; /* External compression struct. */
int flags; /* RD_FIRST, RD_NONEXTERNAL, ... */
xoff_t nread; /* for input position */
xoff_t nwrite; /* for output position */
uint8_t *snprintf_buf; /* internal snprintf() use */
int size_known; /* Set by main_set_souze */
xoff_t source_position; /* for avoiding seek in getblk_func */
int seek_failed; /* after seek fails once, try FIFO */
};
/* According to the internet, Windows vsnprintf() differs from most
* Unix implementations regarding the terminating 0 when the boundary
* condition is met. It doesn't matter here, we don't rely on the
* trailing 0. Besides, both Windows and DJGPP vsnprintf return -1
* upon truncation, which isn't C99 compliant. To overcome this,
* recent MinGW runtimes provided their own vsnprintf (notice the
* absence of the '_' prefix) but they were initially buggy. So,
* always use the native '_'-prefixed version with Win32. */
#ifdef _WIN32
#define vsnprintf_func(str,size,fmt,args) \
_vsnprintf_s(str,size,size-1,fmt,args)
#define snprintf_func(str,size,fmt,...) \
_snprintf_s(str,size,size-1,fmt,__VA_ARGS__)
#else
#define vsnprintf_func vsnprintf
#define snprintf_func snprintf
#endif
#define short_sprintf(sb,fmt,...) \
snprintf_func((sb).buf,sizeof((sb).buf),fmt,__VA_ARGS__)
/* Type used for short snprintf calls. */
typedef struct {
char buf[48];
} shortbuf;
/* Prior to SVN 303 this function was only defined in DJGPP and WIN32
* environments and other platforms would use the builtin snprintf()
* with an arrangement of macros below. In OS X 10.6, Apply made
* snprintf() a macro, which defeated those macros (since snprintf
* would be evaluated before its argument macros were expanded,
* therefore always define xsnprintf_func. */
#undef PRINTF_ATTRIBUTE
#ifdef __GNUC__
/* Let's just assume no one uses gcc 2.x! */
#define PRINTF_ATTRIBUTE(x,y) __attribute__ ((__format__ (__printf__, x, y)))
#else
#define PRINTF_ATTRIBUTE(x,y)
#endif
/* Underlying xprintf() */
int xsnprintf_func (char *str, int n, const char *fmt, ...)
PRINTF_ATTRIBUTE(3,4);
/* XPR(NT "", ...) (used by main) prefixes an "xdelta3: " to the output. */
void xprintf(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2);
#define XPR xprintf
#define NT "xdelta3: "
#define NTR ""
#ifndef UINT32_MAX
#define UINT32_MAX 4294967295U
#endif
#ifndef UINT64_MAX
#define UINT64_MAX 18446744073709551615ULL
#endif
#endif // XDELTA3_INTERNAL_H__

View file

@ -1,130 +0,0 @@
/* xdelta 3 - delta compression tools and library
* Copyright (C) 2002, 2006, 2007. Joshua P. MacDonald
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __XDELTA3_LIST__
#define __XDELTA3_LIST__
#define XD3_MAKELIST(LTYPE,ETYPE,LNAME) \
\
static inline ETYPE* \
LTYPE ## _entry (LTYPE* l) \
{ \
return (ETYPE*) ((char*) l - (ptrdiff_t) &((ETYPE*) 0)->LNAME); \
} \
\
static inline void \
LTYPE ## _init (LTYPE *l) \
{ \
l->next = l; \
l->prev = l; \
} \
\
static inline void \
LTYPE ## _add (LTYPE *prev, LTYPE *next, LTYPE *ins) \
{ \
next->prev = ins; \
prev->next = ins; \
ins->next = next; \
ins->prev = prev; \
} \
\
static inline void \
LTYPE ## _push_back (LTYPE *l, ETYPE *i) \
{ \
LTYPE ## _add (l->prev, l, & i->LNAME); \
} \
\
static inline void \
LTYPE ## _del (LTYPE *next, \
LTYPE *prev) \
{ \
next->prev = prev; \
prev->next = next; \
} \
\
static inline ETYPE* \
LTYPE ## _remove (ETYPE *f) \
{ \
LTYPE *i = f->LNAME.next; \
LTYPE ## _del (f->LNAME.next, f->LNAME.prev); \
return LTYPE ## _entry (i); \
} \
\
static inline ETYPE* \
LTYPE ## _pop_back (LTYPE *l) \
{ \
LTYPE *i = l->prev; \
LTYPE ## _del (i->next, i->prev); \
return LTYPE ## _entry (i); \
} \
\
static inline ETYPE* \
LTYPE ## _pop_front (LTYPE *l) \
{ \
LTYPE *i = l->next; \
LTYPE ## _del (i->next, i->prev); \
return LTYPE ## _entry (i); \
} \
\
static inline int \
LTYPE ## _empty (LTYPE *l) \
{ \
return l == l->next; \
} \
\
static inline ETYPE* \
LTYPE ## _front (LTYPE *f) \
{ \
return LTYPE ## _entry (f->next); \
} \
\
static inline ETYPE* \
LTYPE ## _back (LTYPE *f) \
{ \
return LTYPE ## _entry (f->prev); \
} \
\
static inline int \
LTYPE ## _end (LTYPE *f, ETYPE *i) \
{ \
return f == & i->LNAME; \
} \
\
static inline ETYPE* \
LTYPE ## _next (ETYPE *f) \
{ \
return LTYPE ## _entry (f->LNAME.next); \
} \
\
static inline usize_t \
LTYPE ## _length (LTYPE *l) \
{ \
LTYPE *p; \
int c = 0; \
\
for (p = l->next; p != l; p = p->next) \
{ \
c += 1; \
} \
\
return c; \
} \
\
typedef int unused_ ## LTYPE
#endif

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff