Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Jan 2014 13:37:38 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-branches@freebsd.org
Subject:   svn commit: r339126 - in branches/2014Q1/sysutils/zidrav: . files
Message-ID:  <201401081337.s08Dbcrb090928@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Wed Jan  8 13:37:38 2014
New Revision: 339126
URL: http://svnweb.freebsd.org/changeset/ports/339126

Log:
  MFH: r338974
  
  - fix crc problems on 64bit
  - fix crc problems on big endian systems

Added:
  branches/2014Q1/sysutils/zidrav/files/patch-core.cpp
     - copied unchanged from r338974, head/sysutils/zidrav/files/patch-core.cpp
  branches/2014Q1/sysutils/zidrav/files/patch-core.h
     - copied unchanged from r338974, head/sysutils/zidrav/files/patch-core.h
Modified:
  branches/2014Q1/sysutils/zidrav/Makefile
Directory Properties:
  branches/2014Q1/   (props changed)

Modified: branches/2014Q1/sysutils/zidrav/Makefile
==============================================================================
--- branches/2014Q1/sysutils/zidrav/Makefile	Wed Jan  8 13:35:38 2014	(r339125)
+++ branches/2014Q1/sysutils/zidrav/Makefile	Wed Jan  8 13:37:38 2014	(r339126)
@@ -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>

Copied: branches/2014Q1/sysutils/zidrav/files/patch-core.cpp (from r338974, head/sysutils/zidrav/files/patch-core.cpp)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2014Q1/sysutils/zidrav/files/patch-core.cpp	Wed Jan  8 13:37:38 2014	(r339126, copy of r338974, head/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;
+ 

Copied: branches/2014Q1/sysutils/zidrav/files/patch-core.h (from r338974, head/sysutils/zidrav/files/patch-core.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2014Q1/sysutils/zidrav/files/patch-core.h	Wed Jan  8 13:37:38 2014	(r339126, copy of r338974, head/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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401081337.s08Dbcrb090928>