update to 0.4
This commit is contained in:
parent
b6b19a14e2
commit
483e3852ca
@ -1,7 +1,7 @@
|
|||||||
# $OpenBSD: Makefile,v 1.2 2004/02/25 02:35:15 naddy Exp $
|
# $OpenBSD: Makefile,v 1.3 2004/06/27 23:06:47 jolan Exp $
|
||||||
|
|
||||||
COMMENT= "command line implementation of the PAR v2.0 specification"
|
COMMENT= "command line implementation of the PAR v2.0 specification"
|
||||||
DISTNAME= par2cmdline-0.3
|
DISTNAME= par2cmdline-0.4
|
||||||
CATEGORIES= archivers
|
CATEGORIES= archivers
|
||||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=parchive/}
|
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=parchive/}
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
MD5 (par2cmdline-0.3.tar.gz) = 705c97bc41b862d281dd41c219a60849
|
MD5 (par2cmdline-0.4.tar.gz) = 1551b63e57e3c232254dc62073b723a9
|
||||||
RMD160 (par2cmdline-0.3.tar.gz) = d4bd5a5c8f3bd1218f1e61fa1b981c5b22c26ed1
|
RMD160 (par2cmdline-0.4.tar.gz) = e98dc84fa7a4304b8d71c1d373fdce0bca1e6290
|
||||||
SHA1 (par2cmdline-0.3.tar.gz) = 4202ffec5d5fa1e9d83da8e0c6e936832082f17d
|
SHA1 (par2cmdline-0.4.tar.gz) = 2fcdc932b5d7b4b1c68c4a4ca855ca913d464d2f
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
$OpenBSD: patch-Makefile_in,v 1.1.1.1 2004/01/23 05:20:48 jolan Exp $
|
$OpenBSD: patch-Makefile_in,v 1.2 2004/06/27 23:06:47 jolan Exp $
|
||||||
--- Makefile.in.orig 2003-07-15 05:34:19.000000000 -0500
|
--- Makefile.in.orig Mon Apr 12 11:44:18 2004
|
||||||
+++ Makefile.in 2004-01-19 01:50:36.000000000 -0600
|
+++ Makefile.in Sun Jun 27 17:56:29 2004
|
||||||
@@ -637,7 +637,6 @@ install-data-am:
|
@@ -669,7 +669,6 @@ install-data-am:
|
||||||
|
|
||||||
install-exec-am: install-binPROGRAMS
|
install-exec-am: install-binPROGRAMS
|
||||||
@$(NORMAL_INSTALL)
|
@$(NORMAL_INSTALL)
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
$OpenBSD: patch-commandline_cpp,v 1.1.1.1 2004/01/23 05:20:48 jolan Exp $
|
|
||||||
--- commandline.cpp.orig 2003-06-24 08:11:02.000000000 -0500
|
|
||||||
+++ commandline.cpp 2004-01-19 01:47:14.000000000 -0600
|
|
||||||
@@ -82,12 +82,6 @@ void CommandLine::usage(void)
|
|
||||||
" par2 v(erify) [options] <par2 file> [files] : Verify files using PAR2 file\n"
|
|
||||||
" par2 r(epair) [options] <par2 file> [files] : Repair files using PAR2 files\n"
|
|
||||||
"\n"
|
|
||||||
- "Also:\n"
|
|
||||||
- "\n"
|
|
||||||
- " par2create [options] <par2 file> [files]\n"
|
|
||||||
- " par2verify [options] <par2 file> [files]\n"
|
|
||||||
- " par2repair [options] <par2 file> [files]\n"
|
|
||||||
- "\n"
|
|
||||||
"Options:\n"
|
|
||||||
"\n"
|
|
||||||
" -b<n> : Set the Block-Count\n"
|
|
@ -1,6 +1,6 @@
|
|||||||
$OpenBSD: patch-diskfile_cpp,v 1.1.1.1 2004/01/23 05:20:48 jolan Exp $
|
$OpenBSD: patch-diskfile_cpp,v 1.2 2004/06/27 23:06:47 jolan Exp $
|
||||||
--- diskfile.cpp.orig 2003-05-26 13:01:14.000000000 -0500
|
--- diskfile.cpp.orig Mon Apr 12 06:25:37 2004
|
||||||
+++ diskfile.cpp 2004-01-19 02:04:20.000000000 -0600
|
+++ diskfile.cpp Sun Jun 27 17:56:29 2004
|
||||||
@@ -17,6 +17,8 @@
|
@@ -17,6 +17,8 @@
|
||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
@ -10,7 +10,7 @@ $OpenBSD: patch-diskfile_cpp,v 1.1.1.1 2004/01/23 05:20:48 jolan Exp $
|
|||||||
#include "par2cmdline.h"
|
#include "par2cmdline.h"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@@ -550,7 +552,7 @@ string DiskFile::GetCanonicalPathname(st
|
@@ -562,7 +564,7 @@ string DiskFile::GetCanonicalPathname(st
|
||||||
return filename;
|
return filename;
|
||||||
|
|
||||||
// Get the current directory
|
// Get the current directory
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
$OpenBSD: patch-galois_h,v 1.1.1.1 2004/01/23 05:20:48 jolan Exp $
|
|
||||||
--- galois.h.orig 2003-06-13 18:22:04.000000000 -0500
|
|
||||||
+++ galois.h 2004-01-21 18:06:05.000000000 -0600
|
|
||||||
@@ -156,7 +156,7 @@ GaloisTable<bits,generator,valuetype> Ga
|
|
||||||
|
|
||||||
|
|
||||||
template <const unsigned int bits, const unsigned int generator, typename valuetype>
|
|
||||||
-inline Galois<bits,generator,valuetype>::Galois(Galois<bits,generator,valuetype>::ValueType v)
|
|
||||||
+inline Galois<bits,generator,valuetype>::Galois(typename Galois<bits,generator,valuetype>::ValueType v)
|
|
||||||
{
|
|
||||||
value = v;
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
$OpenBSD: patch-md5_h,v 1.1.1.1 2004/01/23 05:20:48 jolan Exp $
|
|
||||||
--- md5.h.orig 2003-05-26 13:01:20.000000000 -0500
|
|
||||||
+++ md5.h 2004-01-22 15:52:42.000000000 -0600
|
|
||||||
@@ -114,14 +114,7 @@ protected:
|
|
||||||
|
|
||||||
inline bool MD5Hash::operator==(const MD5Hash &other) const
|
|
||||||
{
|
|
||||||
- for (unsigned int i=0; i<4; i++)
|
|
||||||
- {
|
|
||||||
- if (((u32*)&hash)[i] != ((u32*)&other.hash)[i])
|
|
||||||
- {
|
|
||||||
- return false;
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
- return true;
|
|
||||||
+ return (0==memcmp(&hash, &other.hash, sizeof(hash)));
|
|
||||||
}
|
|
||||||
inline bool MD5Hash::operator!=(const MD5Hash &other) const
|
|
||||||
{
|
|
||||||
@@ -130,25 +123,13 @@ inline bool MD5Hash::operator!=(const MD
|
|
||||||
|
|
||||||
inline bool MD5Hash::operator<(const MD5Hash &other) const
|
|
||||||
{
|
|
||||||
- if (*(u32*)(&hash[12]) < *(u32*)(&other.hash[12]))
|
|
||||||
- return true;
|
|
||||||
- else if (*(u32*)(&hash[12]) > *(u32*)(&other.hash[12]))
|
|
||||||
- return false;
|
|
||||||
-
|
|
||||||
- else if (*(u32*)(&hash[8]) < *(u32*)(&other.hash[8]))
|
|
||||||
- return true;
|
|
||||||
- else if (*(u32*)(&hash[8]) > *(u32*)(&other.hash[8]))
|
|
||||||
- return false;
|
|
||||||
-
|
|
||||||
- else if (*(u32*)(&hash[4]) < *(u32*)(&other.hash[4]))
|
|
||||||
- return true;
|
|
||||||
- else if (*(u32*)(&hash[4]) > *(u32*)(&other.hash[4]))
|
|
||||||
- return false;
|
|
||||||
-
|
|
||||||
- else if (*(u32*)(&hash[0]) < *(u32*)(&other.hash[0]))
|
|
||||||
- return true;
|
|
||||||
- else
|
|
||||||
- return false;
|
|
||||||
+ size_t index = 15;
|
|
||||||
+ while (index > 0 && hash[index] == other.hash[index])
|
|
||||||
+ {
|
|
||||||
+ index--;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return hash[index] < other.hash[index];
|
|
||||||
}
|
|
||||||
inline bool MD5Hash::operator>=(const MD5Hash &other) const
|
|
||||||
{
|
|
@ -1,13 +0,0 @@
|
|||||||
$OpenBSD: patch-par1fileformat_h,v 1.1.1.1 2004/01/23 05:20:48 jolan Exp $
|
|
||||||
--- par1fileformat.h.orig 2003-05-26 13:01:20.000000000 -0500
|
|
||||||
+++ par1fileformat.h 2004-01-21 18:06:05.000000000 -0600
|
|
||||||
@@ -77,8 +77,7 @@ enum FILEENTRYSTATUS
|
|
||||||
|
|
||||||
inline bool operator == (const PAR1MAGIC &left, const PAR1MAGIC &right)
|
|
||||||
{
|
|
||||||
- return ((u32*)&left)[0] == ((u32*)&right)[0] &&
|
|
||||||
- ((u32*)&left)[1] == ((u32*)&right)[1];
|
|
||||||
+ return (0==memcmp(&left, &right, sizeof(left)));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool operator != (const PAR1MAGIC &left, const PAR1MAGIC &right)
|
|
@ -1,12 +0,0 @@
|
|||||||
$OpenBSD: patch-par1repairer_cpp,v 1.1.1.1 2004/01/23 05:20:48 jolan Exp $
|
|
||||||
--- par1repairer.cpp.orig 2003-06-11 08:45:01.000000000 -0500
|
|
||||||
+++ par1repairer.cpp 2004-01-21 18:06:05.000000000 -0600
|
|
||||||
@@ -372,7 +372,7 @@ bool Par1Repairer::LoadRecoveryFile(stri
|
|
||||||
blocksize = fileentry->filesize;
|
|
||||||
|
|
||||||
// Copy whole of file entry
|
|
||||||
- memcpy((void*)fileentry, (void*)current, fileentry->entrysize);
|
|
||||||
+ memcpy((void*)fileentry, (void*)current, (size_t)(u64)fileentry->entrysize);
|
|
||||||
|
|
||||||
// Create source file and add it to the appropriate list
|
|
||||||
Par1RepairerSourceFile *sourcefile = new Par1RepairerSourceFile(fileentry, searchpath);
|
|
@ -1,19 +0,0 @@
|
|||||||
$OpenBSD: patch-par1repairersourcefile_cpp,v 1.1.1.1 2004/01/23 05:20:48 jolan Exp $
|
|
||||||
--- par1repairersourcefile.cpp.orig 2003-05-26 13:01:20.000000000 -0500
|
|
||||||
+++ par1repairersourcefile.cpp 2004-01-21 18:06:05.000000000 -0600
|
|
||||||
@@ -60,9 +60,12 @@ Par1RepairerSourceFile::Par1RepairerSour
|
|
||||||
|
|
||||||
// Strip the path from the filename
|
|
||||||
string::size_type where;
|
|
||||||
- if (string::npos != (where = filename.find_last_of('\\')) ||
|
|
||||||
- string::npos != (where = filename.find_last_of('/')) ||
|
|
||||||
- string::npos != (where = filename.find_last_of(':')))
|
|
||||||
+ if (string::npos != (where = filename.find_last_of('\\'))
|
|
||||||
+ || string::npos != (where = filename.find_last_of('/'))
|
|
||||||
+#ifdef WIN32
|
|
||||||
+ || string::npos != (where = filename.find_last_of(':'))
|
|
||||||
+#endif
|
|
||||||
+ )
|
|
||||||
{
|
|
||||||
filename = filename.substr(where+1);
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
$OpenBSD: patch-par2cmdline_h,v 1.1.1.1 2004/01/23 05:20:48 jolan Exp $
|
|
||||||
--- par2cmdline.h.orig 2003-06-07 17:43:38.000000000 -0500
|
|
||||||
+++ par2cmdline.h 2004-01-21 18:06:05.000000000 -0600
|
|
||||||
@@ -35,6 +35,7 @@
|
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <iostream>
|
|
||||||
+#include <iomanip>
|
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
@@ -105,7 +106,7 @@ typedef unsigned int size_t;
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-#if STC_HEADERS
|
|
||||||
+#if STDC_HEADERS
|
|
||||||
# include <string.h>
|
|
||||||
#else
|
|
||||||
# if !HAVE_STRCHR
|
|
@ -1,12 +0,0 @@
|
|||||||
$OpenBSD: patch-par2creator_cpp,v 1.1.1.1 2004/01/23 05:20:48 jolan Exp $
|
|
||||||
--- par2creator.cpp.orig 2003-06-24 09:13:59.000000000 -0500
|
|
||||||
+++ par2creator.cpp 2004-01-21 18:06:05.000000000 -0600
|
|
||||||
@@ -835,7 +835,7 @@ bool Par2Creator::ProcessData(u64 blocko
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
- cout << "Wrote " << recoveryblockcount * chunksize << " bytes to disk" << endl;
|
|
||||||
+ cout << "Wrote " << recoveryblockcount * blocklength << " bytes to disk" << endl;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
$OpenBSD: patch-par2fileformat_h,v 1.1.1.1 2004/01/23 05:20:48 jolan Exp $
|
|
||||||
--- par2fileformat.h.orig 2003-05-26 13:01:25.000000000 -0500
|
|
||||||
+++ par2fileformat.h 2004-01-21 18:06:05.000000000 -0600
|
|
||||||
@@ -169,8 +169,7 @@ struct RECOVERYBLOCKPACKET
|
|
||||||
|
|
||||||
inline bool operator == (const MAGIC &left, const MAGIC &right)
|
|
||||||
{
|
|
||||||
- return ((u32*)&left)[0] == ((u32*)&right)[0] &&
|
|
||||||
- ((u32*)&left)[1] == ((u32*)&right)[1];
|
|
||||||
+ return (0==memcmp(&left, &right, sizeof(left)));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool operator != (const MAGIC &left, const MAGIC &right)
|
|
||||||
@@ -180,10 +179,7 @@ inline bool operator != (const MAGIC &le
|
|
||||||
|
|
||||||
inline bool operator == (const PACKETTYPE &left, const PACKETTYPE &right)
|
|
||||||
{
|
|
||||||
- return ((u32*)&left)[0] == ((u32*)&right)[0] &&
|
|
||||||
- ((u32*)&left)[1] == ((u32*)&right)[1] &&
|
|
||||||
- ((u32*)&left)[2] == ((u32*)&right)[2] &&
|
|
||||||
- ((u32*)&left)[3] == ((u32*)&right)[3];
|
|
||||||
+ return (0==memcmp(&left, &right, sizeof(left)));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool operator != (const PACKETTYPE &left, const PACKETTYPE &right)
|
|
@ -1,153 +0,0 @@
|
|||||||
$OpenBSD: patch-par2repairer_cpp,v 1.1.1.1 2004/01/23 05:20:48 jolan Exp $
|
|
||||||
--- par2repairer.cpp.orig 2003-05-26 13:01:26.000000000 -0500
|
|
||||||
+++ par2repairer.cpp 2004-01-21 18:06:05.000000000 -0600
|
|
||||||
@@ -341,7 +341,7 @@ bool Par2Repairer::LoadPacketsFromFile(s
|
|
||||||
// Did we find the magic
|
|
||||||
if (current <= limit)
|
|
||||||
{
|
|
||||||
- header = *(PACKET_HEADER*)current;
|
|
||||||
+ memcpy(&header, current, sizeof(header));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -820,6 +820,9 @@ bool Par2Repairer::CheckPacketConsistenc
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Compute and store the block count from the filesize and blocksize
|
|
||||||
+ sf->second->SetBlockCount(blocksize);
|
|
||||||
+
|
|
||||||
// Do we have a verification packet
|
|
||||||
VerificationPacket *verificationpacket = sf->second->GetVerificationPacket();
|
|
||||||
if (verificationpacket == 0)
|
|
||||||
@@ -916,14 +919,14 @@ bool Par2Repairer::AllocateSourceBlocks(
|
|
||||||
Par2RepairerSourceFile *sourcefile = *sf;
|
|
||||||
if (sourcefile)
|
|
||||||
{
|
|
||||||
- sourceblockcount += sourcefile->GetVerificationPacket()->BlockCount();
|
|
||||||
+ sourceblockcount += sourcefile->BlockCount();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// No details for this source file so we don't know what the
|
|
||||||
// total number of source blocks is
|
|
||||||
- sourceblockcount = 0;
|
|
||||||
- break;
|
|
||||||
+// sourceblockcount = 0;
|
|
||||||
+// break;
|
|
||||||
}
|
|
||||||
|
|
||||||
++sf;
|
|
||||||
@@ -955,16 +958,19 @@ bool Par2Repairer::AllocateSourceBlocks(
|
|
||||||
{
|
|
||||||
Par2RepairerSourceFile *sourcefile = *sf;
|
|
||||||
|
|
||||||
- totalsize += sourcefile->GetDescriptionPacket()->FileSize();
|
|
||||||
- u32 blockcount = sourcefile->GetVerificationPacket()->BlockCount();
|
|
||||||
+ if (sourcefile)
|
|
||||||
+ {
|
|
||||||
+ totalsize += sourcefile->GetDescriptionPacket()->FileSize();
|
|
||||||
+ u32 blockcount = sourcefile->BlockCount();
|
|
||||||
|
|
||||||
- // Allocate the source and target DataBlocks to the sourcefile
|
|
||||||
- sourcefile->SetBlocks(blocknumber, blockcount, sourceblock, targetblock, blocksize);
|
|
||||||
+ // Allocate the source and target DataBlocks to the sourcefile
|
|
||||||
+ sourcefile->SetBlocks(blocknumber, blockcount, sourceblock, targetblock, blocksize);
|
|
||||||
|
|
||||||
- blocknumber++;
|
|
||||||
+ blocknumber++;
|
|
||||||
|
|
||||||
- sourceblock += blockcount;
|
|
||||||
- targetblock += blockcount;
|
|
||||||
+ sourceblock += blockcount;
|
|
||||||
+ targetblock += blockcount;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
++sf;
|
|
||||||
++filenumber;
|
|
||||||
@@ -1069,7 +1075,7 @@ bool Par2Repairer::VerifySourceFiles(voi
|
|
||||||
// Was this one of the recoverable files
|
|
||||||
if (filenumber < mainpacket->RecoverableFileCount())
|
|
||||||
{
|
|
||||||
- cerr << "No details available for recoverable file number " << filenumber+1 << ". Recovery will not be possible." << endl;
|
|
||||||
+ cerr << "No details available for recoverable file number " << filenumber+1 << "." << endl << "Recovery will not be possible." << endl;
|
|
||||||
|
|
||||||
// Set error but let verification of other files continue
|
|
||||||
finalresult = false;
|
|
||||||
@@ -1676,42 +1682,49 @@ void Par2Repairer::UpdateVerificationRes
|
|
||||||
{
|
|
||||||
Par2RepairerSourceFile *sourcefile = *sf;
|
|
||||||
|
|
||||||
- // Was a perfect match for the file found
|
|
||||||
- if (sourcefile->GetCompleteFile() != 0)
|
|
||||||
+ if (sourcefile)
|
|
||||||
{
|
|
||||||
- // Is it the target file or a different one
|
|
||||||
- if (sourcefile->GetCompleteFile() == sourcefile->GetTargetFile())
|
|
||||||
+ // Was a perfect match for the file found
|
|
||||||
+ if (sourcefile->GetCompleteFile() != 0)
|
|
||||||
{
|
|
||||||
- completefilecount++;
|
|
||||||
+ // Is it the target file or a different one
|
|
||||||
+ if (sourcefile->GetCompleteFile() == sourcefile->GetTargetFile())
|
|
||||||
+ {
|
|
||||||
+ completefilecount++;
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ renamedfilecount++;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ availableblockcount += sourcefile->BlockCount();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
- renamedfilecount++;
|
|
||||||
- }
|
|
||||||
+ // Count the number of blocks that have been found
|
|
||||||
+ vector<DataBlock>::iterator sb = sourcefile->SourceBlocks();
|
|
||||||
+ for (u32 blocknumber=0; blocknumber<sourcefile->BlockCount(); ++blocknumber, ++sb)
|
|
||||||
+ {
|
|
||||||
+ DataBlock &datablock = *sb;
|
|
||||||
+
|
|
||||||
+ if (datablock.IsSet())
|
|
||||||
+ availableblockcount++;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- availableblockcount += sourcefile->BlockCount();
|
|
||||||
+ // Does the target file exist
|
|
||||||
+ if (sourcefile->GetTargetExists())
|
|
||||||
+ {
|
|
||||||
+ damagedfilecount++;
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ missingfilecount++;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
- // Count the number of blocks that have been found
|
|
||||||
- vector<DataBlock>::iterator sb = sourcefile->SourceBlocks();
|
|
||||||
- for (u32 blocknumber=0; blocknumber<sourcefile->BlockCount(); ++blocknumber, ++sb)
|
|
||||||
- {
|
|
||||||
- DataBlock &datablock = *sb;
|
|
||||||
-
|
|
||||||
- if (datablock.IsSet())
|
|
||||||
- availableblockcount++;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- // Does the target file exist
|
|
||||||
- if (sourcefile->GetTargetExists())
|
|
||||||
- {
|
|
||||||
- damagedfilecount++;
|
|
||||||
- }
|
|
||||||
- else
|
|
||||||
- {
|
|
||||||
- missingfilecount++;
|
|
||||||
- }
|
|
||||||
+ missingfilecount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
++filenumber;
|
|
@ -1,36 +0,0 @@
|
|||||||
$OpenBSD: patch-par2repairersourcefile_cpp,v 1.1.1.1 2004/01/23 05:20:48 jolan Exp $
|
|
||||||
--- par2repairersourcefile.cpp.orig 2003-05-26 13:01:27.000000000 -0500
|
|
||||||
+++ par2repairersourcefile.cpp 2004-01-21 18:06:05.000000000 -0600
|
|
||||||
@@ -68,9 +68,12 @@ void Par2RepairerSourceFile::ComputeTarg
|
|
||||||
|
|
||||||
// Strip the path from the filename
|
|
||||||
string::size_type where;
|
|
||||||
- if (string::npos != (where = filename.find_last_of('\\')) ||
|
|
||||||
- string::npos != (where = filename.find_last_of('/')) ||
|
|
||||||
- string::npos != (where = filename.find_last_of(':')))
|
|
||||||
+ if (string::npos != (where = filename.find_last_of('\\'))
|
|
||||||
+ || string::npos != (where = filename.find_last_of('/'))
|
|
||||||
+#ifdef WIN32
|
|
||||||
+ || string::npos != (where = filename.find_last_of(':'))
|
|
||||||
+#endif
|
|
||||||
+ )
|
|
||||||
{
|
|
||||||
filename = filename.substr(where+1);
|
|
||||||
}
|
|
||||||
@@ -141,3 +144,16 @@ void Par2RepairerSourceFile::SetBlocks(u
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+// Determine the block count from the file size and block size.
|
|
||||||
+void Par2RepairerSourceFile::SetBlockCount(u64 blocksize)
|
|
||||||
+{
|
|
||||||
+ if (descriptionpacket)
|
|
||||||
+ {
|
|
||||||
+ blockcount = (u32)((descriptionpacket->FileSize() + blocksize-1) / blocksize);
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ blockcount = 0;
|
|
||||||
+ }
|
|
||||||
+}
|
|
@ -1,13 +0,0 @@
|
|||||||
$OpenBSD: patch-par2repairersourcefile_h,v 1.1.1.1 2004/01/23 05:20:48 jolan Exp $
|
|
||||||
--- par2repairersourcefile.h.orig 2003-05-26 13:01:28.000000000 -0500
|
|
||||||
+++ par2repairersourcefile.h 2004-01-21 18:06:05.000000000 -0600
|
|
||||||
@@ -55,6 +55,9 @@ public:
|
|
||||||
vector<DataBlock>::iterator _targetblocks,
|
|
||||||
u64 blocksize);
|
|
||||||
|
|
||||||
+ // Determine the block count from the file size and block size.
|
|
||||||
+ void SetBlockCount(u64 blocksize);
|
|
||||||
+
|
|
||||||
// Set/Get which DiskFile will contain the final repaired version of the file
|
|
||||||
void SetTargetFile(DiskFile *diskfile);
|
|
||||||
DiskFile* GetTargetFile(void) const;
|
|
@ -1,73 +0,0 @@
|
|||||||
$OpenBSD: patch-reedsolomon_h,v 1.1.1.1 2004/01/23 05:20:48 jolan Exp $
|
|
||||||
--- reedsolomon.h.orig 2003-05-26 13:01:31.000000000 -0500
|
|
||||||
+++ reedsolomon.h 2004-01-21 18:06:05.000000000 -0600
|
|
||||||
@@ -326,9 +326,7 @@ inline bool ReedSolomon<g>::Compute(void
|
|
||||||
// Perform Gaussian Elimination and then delete the right matrix (which
|
|
||||||
// will no longer be required).
|
|
||||||
bool success = GaussElim(outcount, incount, leftmatrix, rightmatrix, datamissing);
|
|
||||||
-cout << "GaussElim done" << endl;
|
|
||||||
delete [] rightmatrix;
|
|
||||||
-cout << "Exiting RS::Compute" << endl;
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -339,6 +337,29 @@ cout << "Exiting RS::Compute" << endl;
|
|
||||||
template<class g>
|
|
||||||
inline bool ReedSolomon<g>::GaussElim(unsigned int rows, unsigned int leftcols, G *leftmatrix, G *rightmatrix, unsigned int datamissing)
|
|
||||||
{
|
|
||||||
+#ifdef DUMPRSMATRIX
|
|
||||||
+ for (unsigned int row=0; row<rows; row++)
|
|
||||||
+ {
|
|
||||||
+ cout << ((row==0) ? "/" : (row==rows-1) ? "\\" : "|");
|
|
||||||
+ for (unsigned int col=0; col<leftcols; col++)
|
|
||||||
+ {
|
|
||||||
+ cout << " "
|
|
||||||
+ << hex << setw(G::Bits>8?4:2) << setfill('0')
|
|
||||||
+ << (unsigned int)leftmatrix[row*leftcols+col];
|
|
||||||
+ }
|
|
||||||
+ cout << ((row==0) ? " \\ /" : (row==rows-1) ? " / \\" : " | |");
|
|
||||||
+ for (unsigned int col=0; col<rows; col++)
|
|
||||||
+ {
|
|
||||||
+ cout << " "
|
|
||||||
+ << hex << setw(G::Bits>8?4:2) << setfill('0')
|
|
||||||
+ << (unsigned int)rightmatrix[row*rows+col];
|
|
||||||
+ }
|
|
||||||
+ cout << ((row==0) ? " \\" : (row==rows-1) ? " /" : " | |");
|
|
||||||
+ cout << endl;
|
|
||||||
+
|
|
||||||
+ cout << dec << setw(0) << setfill(' ');
|
|
||||||
+ }
|
|
||||||
+#endif
|
|
||||||
// Because the matrices being operated on are Vandermonde matrices
|
|
||||||
// they are guaranteed not to be singular.
|
|
||||||
|
|
||||||
@@ -442,7 +463,29 @@ inline bool ReedSolomon<g>::GaussElim(un
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cout << "Solving: done." << endl;
|
|
||||||
+#ifdef DUMPRSMATRIX
|
|
||||||
+ for (unsigned int row=0; row<rows; row++)
|
|
||||||
+ {
|
|
||||||
+ cout << ((row==0) ? "/" : (row==rows-1) ? "\\" : "|");
|
|
||||||
+ for (unsigned int col=0; col<leftcols; col++)
|
|
||||||
+ {
|
|
||||||
+ cout << " "
|
|
||||||
+ << hex << setw(G::Bits>8?4:2) << setfill('0')
|
|
||||||
+ << (unsigned int)leftmatrix[row*leftcols+col];
|
|
||||||
+ }
|
|
||||||
+ cout << ((row==0) ? " \\ /" : (row==rows-1) ? " / \\" : " | |");
|
|
||||||
+ for (unsigned int col=0; col<rows; col++)
|
|
||||||
+ {
|
|
||||||
+ cout << " "
|
|
||||||
+ << hex << setw(G::Bits>8?4:2) << setfill('0')
|
|
||||||
+ << (unsigned int)rightmatrix[row*rows+col];
|
|
||||||
+ }
|
|
||||||
+ cout << ((row==0) ? " \\" : (row==rows-1) ? " /" : " | |");
|
|
||||||
+ cout << endl;
|
|
||||||
|
|
||||||
+ cout << dec << setw(0) << setfill(' ');
|
|
||||||
+ }
|
|
||||||
+#endif
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user