diff options
author | Dirk Meyer <dinoex@FreeBSD.org> | 2014-01-07 06:02:26 +0000 |
---|---|---|
committer | Dirk Meyer <dinoex@FreeBSD.org> | 2014-01-07 06:02:26 +0000 |
commit | 9422b10842b0e30c724f7c984da91150923f3ba5 (patch) | |
tree | ca42925c3eb516341b817904b5f51349b0c250fd /sysutils/zidrav | |
parent | 1c7e67e1a0640515924aec4dbd9957fe6289372f (diff) | |
download | ports-9422b10842b0e30c724f7c984da91150923f3ba5.tar.gz ports-9422b10842b0e30c724f7c984da91150923f3ba5.zip |
Notes
Diffstat (limited to 'sysutils/zidrav')
-rw-r--r-- | sysutils/zidrav/Makefile | 15 | ||||
-rw-r--r-- | sysutils/zidrav/files/patch-core.cpp | 105 | ||||
-rw-r--r-- | sysutils/zidrav/files/patch-core.h | 20 |
3 files changed, 140 insertions, 0 deletions
diff --git a/sysutils/zidrav/Makefile b/sysutils/zidrav/Makefile index ddba37fa39d8..6e9b4167077c 100644 --- a/sysutils/zidrav/Makefile +++ b/sysutils/zidrav/Makefile @@ -3,6 +3,7 @@ PORTNAME= zidrav PORTVERSION= 1.2.0 +PORTREVISION= 1 CATEGORIES= sysutils MASTER_SITES= SF/${PORTNAME}/${PORTNAME}4unix/${PORTVERSION} DISTNAME= zidrav4unix-${PORTVERSION} @@ -19,4 +20,18 @@ do-install: ${INSTALL_PROGRAM} ${WRKSRC}/zidrav ${STAGEDIR}${PREFIX}/bin/ ${INSTALL_MAN} ${WRKSRC}/zidrav.1 ${STAGEDIR}${MANPREFIX}/man/man1/ +.include <bsd.port.options.mk> + +.if ${ARCH} == "i386" +CFLAGS+= -Dcrc32_type=long +.else +CFLAGS+= -Dcrc32_type=int +.endif + +.if ${ARCH} == "amd64" || ${ARCH} == "arm" || ${ARCH} == "i386" || ${ARCH} == "ia64" +.else +# mips*eb, powerpc, powerpc64 and sparc +CFLAGS+= -DCPU_BIGENDIAN +.endif + .include <bsd.port.mk> diff --git a/sysutils/zidrav/files/patch-core.cpp b/sysutils/zidrav/files/patch-core.cpp new file mode 100644 index 000000000000..c48de15e8ff1 --- /dev/null +++ b/sysutils/zidrav/files/patch-core.cpp @@ -0,0 +1,105 @@ +--- core.cpp.orig 2005-05-21 22:16:50.000000000 +0200 ++++ core.cpp 2014-01-07 06:41:30.000000000 +0100 +@@ -38,7 +38,7 @@ + + void be_write32le(iostream &output, char *buf) + { +- int data; ++ int data = 0; + data = *(int*)buf; + + data = SwapBO32(data); +@@ -48,7 +48,7 @@ + + void be_read32le(istream &input, char *buf) + { +- int data; ++ int data = 0; + input.read((char *)&data, 4); + + data = SwapBO32(data); +@@ -59,7 +59,7 @@ + + char *buffer; + int i; +- long crc; ++ crc32_type crc; + short oldprc = 0; + + output.write( ZC, 8 ); +@@ -105,11 +105,11 @@ + + void MakePatchCore( istream &cdti, istream &vstr, iostream &output, int cdtlen, int vstrlen, int * efound) { + +- long filesize; +- long blocksize; ++ long filesize = 0; // reset all 64bit ++ long blocksize = 0; // reset all 64bit + +- long crc; +- long cdtcrc; ++ crc32_type crc; ++ crc32_type cdtcrc = 0; // reset all 64bit + + long curbs; + +@@ -207,12 +207,12 @@ + + void ApplyPatchCore( istream &cdpi, iostream &pstr, int cdplen, int pstrlen) { + +- long filesize; +- long blocksize; ++ long filesize = 0; // reset all 64bit ++ long blocksize = 0; // reset all 64bit + + long curbs = 0; + +- long offset; ++ long offset = 0; // reset all 64bit + + char *buffer = NULL; + +@@ -266,7 +266,8 @@ + + char minibuff[9]; + +- long crc; ++ crc32_type crc; ++ crc32_type filecrc = 0; // reset all 64bit + + buffer = new char[10]; + +@@ -317,12 +318,12 @@ + } + + input.seekg( 0 ); // go to the beginning +- input.read( buffer, datalen ); // and pull it all ++ input.read( buffer, datalen - 4 ); // and pull it all ++ read32le(input, (char *)&filecrc); + + CreateChecksum( buffer, datalen - 4, &crc ); + +- if( crc != int32tole(*(int *)&buffer[ datalen - 4 ]) ) { +- delete [] buffer; ++ if( crc != filecrc ) { + switch(emsg) + { + case IDS_UPT_INVCDT: +@@ -342,7 +343,7 @@ + void MakeOverallChecksum( iostream &st, long size ) { + + char *buffer; +- long crc; ++ crc32_type crc; + + // FIXME: trying to load whole file... again... :( + buffer = new char[size]; +@@ -367,7 +368,7 @@ + #define DO8( buffer ) DO4( buffer ); DO4( buffer ); + #define DO16( buffer ) DO8( buffer ); DO8( buffer ); + +-void CreateChecksum( char *buffer, long size, long *crc ) { ++void CreateChecksum( char *buffer, long size, crc32_type *crc ) { + + *crc = 0; + diff --git a/sysutils/zidrav/files/patch-core.h b/sysutils/zidrav/files/patch-core.h new file mode 100644 index 000000000000..16819ee95f7d --- /dev/null +++ b/sysutils/zidrav/files/patch-core.h @@ -0,0 +1,20 @@ +--- core.h.orig 2005-05-19 22:58:40.000000000 +0200 ++++ core.h 2014-01-07 06:40:24.000000000 +0100 +@@ -48,7 +48,7 @@ + #define QSV KSigver( ZQ, QVER ) + + +-const long crc_table[256] = { // it's just easier this way, alright? It's one K of data, I'm allowed a global if I want one ++const crc32_type crc_table[256] = { // it's just easier this way, alright? It's one K of data, I'm allowed a global if I want one + 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, + 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, + 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, +@@ -111,7 +111,6 @@ + int VerifyStream( istream &input, int datalen, int emsg, KSigver sigver ); + + void MakeOverallChecksum( iostream &st, long size ); +-void CreateChecksum( char *buffer, long size, unsigned long *crc ); +-void CreateChecksum( char *buffer, long size, signed long *crc ); ++void CreateChecksum( char *buffer, long size, crc32_type *crc ); + + #endif |