mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-18 22:54:00 +00:00
aur/par2cmdline to 0.4-18
This commit is contained in:
parent
695d9fda95
commit
3414642b30
18 changed files with 570 additions and 223 deletions
|
@ -0,0 +1,59 @@
|
|||
--- a/diskfile.cpp
|
||||
+++ b/diskfile.cpp
|
||||
@@ -340,7 +340,18 @@ list<string>* DiskFile::FindFiles(string path, string wildcard)
|
||||
return matches;
|
||||
}
|
||||
|
||||
-
|
||||
+u64 DiskFile::GetFileSize(string filename)
|
||||
+{
|
||||
+ struct _stati64 st;
|
||||
+ if ((0 == _stati64(filename.c_str(), &st)) && (0 != (st.st_mode & S_IFREG)))
|
||||
+ {
|
||||
+ return st.st_size;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ return 0;
|
||||
+ }
|
||||
+}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -689,6 +700,18 @@ list<string>* DiskFile::FindFiles(string path, string wildcard)
|
||||
return matches;
|
||||
}
|
||||
|
||||
+u64 DiskFile::GetFileSize(string filename)
|
||||
+{
|
||||
+ struct stat st;
|
||||
+ if ((0 == stat(filename.c_str(), &st)) && (0 != (st.st_mode & S_IFREG)))
|
||||
+ {
|
||||
+ return st.st_size;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ return 0;
|
||||
+ }
|
||||
+}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#endif
|
||||
|
||||
@@ -802,18 +825,6 @@ bool DiskFile::FileExists(string filename)
|
||||
return ((0 == stat(filename.c_str(), &st)) && (0 != (st.st_mode & S_IFREG)));
|
||||
}
|
||||
|
||||
-u64 DiskFile::GetFileSize(string filename)
|
||||
-{
|
||||
- struct stat st;
|
||||
- if ((0 == stat(filename.c_str(), &st)) && (0 != (st.st_mode & S_IFREG)))
|
||||
- {
|
||||
- return st.st_size;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- return 0;
|
||||
- }
|
||||
-}
|
||||
|
||||
|
51
aur/par2cmdline/02-Report-empty-files-when-verifying.patch
Normal file
51
aur/par2cmdline/02-Report-empty-files-when-verifying.patch
Normal file
|
@ -0,0 +1,51 @@
|
|||
--- a/par1repairer.cpp
|
||||
+++ b/par1repairer.cpp
|
||||
@@ -710,7 +710,13 @@ bool Par1Repairer::VerifyDataFile(DiskFile *diskfile, Par1RepairerSourceFile *so
|
||||
u64 filesize = diskfile->FileSize();
|
||||
|
||||
if (filesize == 0)
|
||||
+ {
|
||||
+ if (noiselevel > CommandLine::nlSilent)
|
||||
+ {
|
||||
+ cout << "Target: \"" << name << "\" - empty." << endl;
|
||||
+ }
|
||||
return true;
|
||||
+ }
|
||||
|
||||
// Search for the first file that is the correct size
|
||||
vector<Par1RepairerSourceFile*>::iterator sourceiterator = sourcefiles.begin();
|
||||
--- a/par2repairer.cpp
|
||||
+++ b/par2repairer.cpp
|
||||
@@ -1415,17 +1415,28 @@ bool Par2Repairer::ScanDataFile(DiskFile *diskfile, // [in]
|
||||
|
||||
matchtype = eNoMatch;
|
||||
|
||||
+ string path;
|
||||
+ string name;
|
||||
+ DiskFile::SplitFilename(diskfile->FileName(), path, name);
|
||||
+
|
||||
// Is the file empty
|
||||
if (diskfile->FileSize() == 0)
|
||||
{
|
||||
// If the file is empty, then just return
|
||||
+ if (noiselevel > CommandLine::nlSilent)
|
||||
+ {
|
||||
+ if (originalsourcefile != 0)
|
||||
+ {
|
||||
+ cout << "Target: \"" << name << "\" - empty." << endl;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ cout << "File: \"" << name << "\" - empty." << endl;
|
||||
+ }
|
||||
+ }
|
||||
return true;
|
||||
}
|
||||
|
||||
- string path;
|
||||
- string name;
|
||||
- DiskFile::SplitFilename(diskfile->FileName(), path, name);
|
||||
-
|
||||
string shortname;
|
||||
if (name.size() > 56)
|
||||
{
|
|
@ -0,0 +1,11 @@
|
|||
--- a/par2creatorsourcefile.cpp
|
||||
+++ b/par2creatorsourcefile.cpp
|
||||
@@ -319,7 +319,7 @@ void Par2CreatorSourceFile::UpdateHashes(u32 blocknumber, const void *buffer, si
|
||||
|
||||
|
||||
// Update the full file hash, but don't go beyond the end of the file
|
||||
- if (length > filesize - blocknumber * length)
|
||||
+ if ((u64)length > filesize - blocknumber * (u64)length)
|
||||
{
|
||||
length = (size_t)(filesize - blocknumber * (u64)length);
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
--- a/par2creatorsourcefile.cpp
|
||||
+++ b/par2creatorsourcefile.cpp
|
||||
@@ -224,6 +224,10 @@ bool Par2CreatorSourceFile::Open(CommandLine::NoiseLevel noiselevel, const Comma
|
||||
cout << newfraction/10 << '.' << newfraction%10 << "%\r" << flush;
|
||||
}
|
||||
}
|
||||
+ else
|
||||
+ {
|
||||
+ offset += want;
|
||||
+ }
|
||||
}
|
||||
|
||||
// Did we finish the last block
|
|
@ -0,0 +1,59 @@
|
|||
--- a/commandline.cpp
|
||||
+++ b/commandline.cpp
|
||||
@@ -642,30 +642,34 @@ bool CommandLine::Parse(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
- // All other files must exist
|
||||
+ // Originally, all specified files were supposed to exist, or the program
|
||||
+ // would stop with an error message. This was not practical, for example in
|
||||
+ // a directory with files appearing and disappearing (an active download directory).
|
||||
+ // So the new rule is: when a specified file doesn't exist, it is silently skipped.
|
||||
if (!DiskFile::FileExists(filename))
|
||||
{
|
||||
- cerr << "The source file does not exist: " << filename << endl;
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- u64 filesize = DiskFile::GetFileSize(filename);
|
||||
-
|
||||
- // Ignore all 0 byte files
|
||||
- if (filesize > 0)
|
||||
- {
|
||||
- extrafiles.push_back(ExtraFile(filename, filesize));
|
||||
-
|
||||
- // track the total size of the source files and how
|
||||
- // big the largest one is.
|
||||
- totalsourcesize += filesize;
|
||||
- if (largestsourcesize < filesize)
|
||||
- largestsourcesize = filesize;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- cout << "Skipping 0 byte file: " << filename << endl;
|
||||
- }
|
||||
+ cout << "Ignoring non-existent source file: " << filename << endl;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ u64 filesize = DiskFile::GetFileSize(filename);
|
||||
+
|
||||
+ // Ignore all 0 byte files
|
||||
+ if (filesize > 0)
|
||||
+ {
|
||||
+ extrafiles.push_back(ExtraFile(filename, filesize));
|
||||
+
|
||||
+ // track the total size of the source files and how
|
||||
+ // big the largest one is.
|
||||
+ totalsourcesize += filesize;
|
||||
+ if (largestsourcesize < filesize)
|
||||
+ largestsourcesize = filesize;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ cout << "Skipping 0 byte file: " << filename << endl;
|
||||
+ }
|
||||
+ } //end file exists
|
||||
}
|
||||
|
||||
++fn;
|
|
@ -0,0 +1,31 @@
|
|||
--- a/par2creatorsourcefile.cpp
|
||||
+++ b/par2creatorsourcefile.cpp
|
||||
@@ -213,21 +213,22 @@ bool Par2CreatorSourceFile::Open(CommandLine::NoiseLevel noiselevel, const Comma
|
||||
}
|
||||
}
|
||||
|
||||
+ // Define MPDL to skip reporting; speeds up things considerably
|
||||
+#ifndef MPDL
|
||||
if (noiselevel > CommandLine::nlQuiet)
|
||||
{
|
||||
// Display progress
|
||||
u32 oldfraction = (u32)(1000 * offset / filesize);
|
||||
- offset += want;
|
||||
- u32 newfraction = (u32)(1000 * offset / filesize);
|
||||
+ // The original source had here: offset += want;
|
||||
+ // That's definitely an error, because offset must always be incremented!
|
||||
+ u32 newfraction = (u32)(1000 * (offset + want) / filesize);
|
||||
if (oldfraction != newfraction)
|
||||
{
|
||||
cout << newfraction/10 << '.' << newfraction%10 << "%\r" << flush;
|
||||
}
|
||||
}
|
||||
- else
|
||||
- {
|
||||
- offset += want;
|
||||
- }
|
||||
+#endif
|
||||
+ offset += want;
|
||||
}
|
||||
|
||||
// Did we finish the last block
|
152
aur/par2cmdline/07-Optimization-by-inlining.patch
Normal file
152
aur/par2cmdline/07-Optimization-by-inlining.patch
Normal file
|
@ -0,0 +1,152 @@
|
|||
--- a/reedsolomon.cpp
|
||||
+++ b/reedsolomon.cpp
|
||||
@@ -51,7 +51,7 @@ u32 gcd(u32 a, u32 b)
|
||||
}
|
||||
}
|
||||
|
||||
-bool ReedSolomon<Galois8>::SetInput(const vector<bool> &present)
|
||||
+template<> bool ReedSolomon<Galois8>::SetInput(const vector<bool> &present)
|
||||
{
|
||||
inputcount = (u32)present.size();
|
||||
|
||||
@@ -80,7 +80,7 @@ bool ReedSolomon<Galois8>::SetInput(const vector<bool> &present)
|
||||
return true;
|
||||
}
|
||||
|
||||
-bool ReedSolomon<Galois8>::SetInput(u32 count)
|
||||
+template<> bool ReedSolomon<Galois8>::SetInput(u32 count)
|
||||
{
|
||||
inputcount = count;
|
||||
|
||||
@@ -101,15 +101,8 @@ bool ReedSolomon<Galois8>::SetInput(u32 count)
|
||||
return true;
|
||||
}
|
||||
|
||||
-bool ReedSolomon<Galois8>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
|
||||
+template<> bool ReedSolomon<Galois8>::InternalProcess(const Galois8 &factor, size_t size, const void *inputbuffer, void *outputbuffer)
|
||||
{
|
||||
- // Look up the appropriate element in the RS matrix
|
||||
- Galois8 factor = leftmatrix[outputindex * (datapresent + datamissing) + inputindex];
|
||||
-
|
||||
- // Do nothing if the factor happens to be 0
|
||||
- if (factor == 0)
|
||||
- return eSuccess;
|
||||
-
|
||||
#ifdef LONGMULTIPLY
|
||||
// The 8-bit long multiplication tables
|
||||
Galois8 *table = glmt->tables;
|
||||
@@ -189,7 +182,7 @@ bool ReedSolomon<Galois8>::Process(size_t size, u32 inputindex, const void *inpu
|
||||
|
||||
// Set which of the source files are present and which are missing
|
||||
// and compute the base values to use for the vandermonde matrix.
|
||||
-bool ReedSolomon<Galois16>::SetInput(const vector<bool> &present)
|
||||
+template<> bool ReedSolomon<Galois16>::SetInput(const vector<bool> &present)
|
||||
{
|
||||
inputcount = (u32)present.size();
|
||||
|
||||
@@ -233,7 +226,7 @@ bool ReedSolomon<Galois16>::SetInput(const vector<bool> &present)
|
||||
|
||||
// Record that the specified number of source files are all present
|
||||
// and compute the base values to use for the vandermonde matrix.
|
||||
-bool ReedSolomon<Galois16>::SetInput(u32 count)
|
||||
+template<> bool ReedSolomon<Galois16>::SetInput(u32 count)
|
||||
{
|
||||
inputcount = count;
|
||||
|
||||
@@ -267,15 +260,8 @@ bool ReedSolomon<Galois16>::SetInput(u32 count)
|
||||
return true;
|
||||
}
|
||||
|
||||
-bool ReedSolomon<Galois16>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
|
||||
+template<> bool ReedSolomon<Galois16>::InternalProcess(const Galois16 &factor, size_t size, const void *inputbuffer, void *outputbuffer)
|
||||
{
|
||||
- // Look up the appropriate element in the RS matrix
|
||||
-
|
||||
- Galois16 factor = leftmatrix[outputindex * (datapresent + datamissing) + inputindex];
|
||||
- // Do nothing if the factor happens to be 0
|
||||
- if (factor == 0)
|
||||
- return eSuccess;
|
||||
-
|
||||
#ifdef LONGMULTIPLY
|
||||
// The 8-bit long multiplication tables
|
||||
Galois16 *table = glmt->tables;
|
||||
--- a/reedsolomon.h
|
||||
+++ b/reedsolomon.h
|
||||
@@ -64,7 +64,8 @@ public:
|
||||
const void *inputbuffer, // Buffer containing input data
|
||||
u32 outputindex, // The row in the RS matrix
|
||||
void *outputbuffer); // Buffer containing output data
|
||||
-
|
||||
+private:
|
||||
+ bool InternalProcess(const g &factor, size_t size, const void *inputbuffer, void *outputbuffer); // Optimization
|
||||
protected:
|
||||
// Perform Gaussian Elimination
|
||||
bool GaussElim(CommandLine::NoiseLevel noiselevel,
|
||||
@@ -146,6 +147,20 @@ inline ReedSolomon<g>::~ReedSolomon(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
+template<class g>
|
||||
+inline bool ReedSolomon<g>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
|
||||
+{
|
||||
+ // Optimization: it occurs frequently the function exits early on, so inline the start.
|
||||
+ // This resulted in a speed gain of approx. 8% in repairing.
|
||||
+
|
||||
+ // Look up the appropriate element in the RS matrix
|
||||
+ g factor = leftmatrix[outputindex * (datapresent + datamissing) + inputindex];
|
||||
+ // Do nothing if the factor happens to be 0
|
||||
+ if (factor == 0)
|
||||
+ return eSuccess;
|
||||
+ return this->InternalProcess (factor, size, inputbuffer, outputbuffer);
|
||||
+}
|
||||
+
|
||||
u32 gcd(u32 a, u32 b);
|
||||
|
||||
// Record whether the recovery block with the specified
|
||||
@@ -242,11 +257,14 @@ inline bool ReedSolomon<g>::Compute(CommandLine::NoiseLevel noiselevel)
|
||||
// One row for each present recovery block that will be used for a missing data block
|
||||
for (unsigned int row=0; row<datamissing; row++)
|
||||
{
|
||||
+ // Define MPDL to skip reporting and speed things up
|
||||
+#ifndef MPDL
|
||||
if (noiselevel > CommandLine::nlQuiet)
|
||||
{
|
||||
int progress = row * 1000 / (datamissing+parmissing);
|
||||
cout << "Constructing: " << progress/10 << '.' << progress%10 << "%\r" << flush;
|
||||
}
|
||||
+#endif
|
||||
|
||||
// Get the exponent of the next present recovery block
|
||||
while (!outputrow->present)
|
||||
@@ -286,11 +304,14 @@ inline bool ReedSolomon<g>::Compute(CommandLine::NoiseLevel noiselevel)
|
||||
outputrow = outputrows.begin();
|
||||
for (unsigned int row=0; row<parmissing; row++)
|
||||
{
|
||||
+ // Define MPDL to skip reporting and speed things up
|
||||
+#ifndef MPDL
|
||||
if (noiselevel > CommandLine::nlQuiet)
|
||||
{
|
||||
int progress = (row+datamissing) * 1000 / (datamissing+parmissing);
|
||||
cout << "Constructing: " << progress/10 << '.' << progress%10 << "%\r" << flush;
|
||||
}
|
||||
+#endif
|
||||
|
||||
// Get the exponent of the next missing recovery block
|
||||
while (outputrow->present)
|
||||
@@ -420,6 +441,8 @@ inline bool ReedSolomon<g>::GaussElim(CommandLine::NoiseLevel noiselevel, unsign
|
||||
// For every other row in the matrix
|
||||
for (unsigned int row2=0; row2<rows; row2++)
|
||||
{
|
||||
+ // Define MPDL to skip reporting and speed things up
|
||||
+#ifndef MPDL
|
||||
if (noiselevel > CommandLine::nlQuiet)
|
||||
{
|
||||
int newprogress = (row*rows+row2) * 1000 / (datamissing*rows);
|
||||
@@ -429,6 +452,7 @@ inline bool ReedSolomon<g>::GaussElim(CommandLine::NoiseLevel noiselevel, unsign
|
||||
cout << "Solving: " << progress/10 << '.' << progress%10 << "%\r" << flush;
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
if (row != row2)
|
||||
{
|
|
@ -0,0 +1,34 @@
|
|||
--- a/commandline.cpp
|
||||
+++ b/commandline.cpp
|
||||
@@ -537,21 +537,18 @@ bool CommandLine::Parse(int argc, char *argv[])
|
||||
else
|
||||
{
|
||||
list<string> *filenames;
|
||||
+ filenames = new list<string>;
|
||||
|
||||
- // If the argument includes wildcard characters,
|
||||
- // search the disk for matching files
|
||||
- if (strchr(argv[0], '*') || strchr(argv[0], '?'))
|
||||
+ if (argv[0][0] == '-')
|
||||
{
|
||||
- string path;
|
||||
- string name;
|
||||
- DiskFile::SplitFilename(argv[0], path, name);
|
||||
-
|
||||
- filenames = DiskFile::FindFiles(path, name);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- filenames = new list<string>;
|
||||
- filenames->push_back(argv[0]);
|
||||
+ while(true)
|
||||
+ {
|
||||
+ string filename;
|
||||
+ if (std::getline(cin, filename))
|
||||
+ filenames->push_back(filename);
|
||||
+ else
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
|
||||
list<string>::iterator fn = filenames->begin();
|
|
@ -0,0 +1,20 @@
|
|||
--- a/commandline.cpp
|
||||
+++ b/commandline.cpp
|
||||
@@ -539,7 +539,7 @@ bool CommandLine::Parse(int argc, char *argv[])
|
||||
list<string> *filenames;
|
||||
filenames = new list<string>;
|
||||
|
||||
- if (argv[0][0] == '-')
|
||||
+ if (argv[0][0] == '-' && argv[0][1] == '\0')
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
@@ -550,6 +550,8 @@ bool CommandLine::Parse(int argc, char *argv[])
|
||||
break;
|
||||
}
|
||||
}
|
||||
+ else
|
||||
+ filenames->push_back(argv[0]);
|
||||
|
||||
list<string>::iterator fn = filenames->begin();
|
||||
while (fn != filenames->end())
|
69
aur/par2cmdline/10-Pack-and-simplify-MD5Hash.patch
Normal file
69
aur/par2cmdline/10-Pack-and-simplify-MD5Hash.patch
Normal file
|
@ -0,0 +1,69 @@
|
|||
--- a/md5.h
|
||||
+++ b/md5.h
|
||||
@@ -20,6 +20,13 @@
|
||||
#ifndef __MD5_H__
|
||||
#define __MD5_H__
|
||||
|
||||
+#ifdef WIN32
|
||||
+#pragma pack(push, 1)
|
||||
+#define PACKED
|
||||
+#else
|
||||
+#define PACKED __attribute__ ((packed))
|
||||
+#endif
|
||||
+
|
||||
// This file defines the MD5Hash and MD5Context objects which are used
|
||||
// to compute and manipulate the MD5 Hash values for a block of data.
|
||||
|
||||
@@ -35,12 +42,11 @@
|
||||
|
||||
// MD5 Hash value
|
||||
|
||||
-class MD5Hash
|
||||
-{
|
||||
-public:
|
||||
- // Constructor does not initialise the value
|
||||
- MD5Hash(void) {};
|
||||
+struct MD5Hash;
|
||||
+ostream& operator<<(ostream &s, const MD5Hash &hash);
|
||||
|
||||
+struct MD5Hash
|
||||
+{
|
||||
// Comparison operators
|
||||
bool operator==(const MD5Hash &other) const;
|
||||
bool operator!=(const MD5Hash &other) const;
|
||||
@@ -54,13 +60,8 @@ public:
|
||||
friend ostream& operator<<(ostream &s, const MD5Hash &hash);
|
||||
string print(void) const;
|
||||
|
||||
- // Copy and assignment
|
||||
- MD5Hash(const MD5Hash &other);
|
||||
- MD5Hash& operator=(const MD5Hash &other);
|
||||
-
|
||||
-public:
|
||||
u8 hash[16]; // 16 byte MD5 Hash value
|
||||
-};
|
||||
+} PACKED;
|
||||
|
||||
// Intermediate computation state
|
||||
|
||||
@@ -144,16 +145,9 @@ inline bool MD5Hash::operator<=(const MD5Hash &other) const
|
||||
return !other.operator<(*this);
|
||||
}
|
||||
|
||||
-inline MD5Hash::MD5Hash(const MD5Hash &other)
|
||||
-{
|
||||
- memcpy(&hash, &other.hash, sizeof(hash));
|
||||
-}
|
||||
-
|
||||
-inline MD5Hash& MD5Hash::operator=(const MD5Hash &other)
|
||||
-{
|
||||
- memcpy(&hash, &other.hash, sizeof(hash));
|
||||
-
|
||||
- return *this;
|
||||
-}
|
||||
+#ifdef WIN32
|
||||
+#pragma pack(pop)
|
||||
+#endif
|
||||
+#undef PACKED
|
||||
|
||||
#endif // __MD5_H__
|
|
@ -1,7 +1,6 @@
|
|||
diff -ur par2cmdline-0.4-orig/letype.h par2cmdline-0.4/letype.h
|
||||
--- par2cmdline-0.4-orig/letype.h 2003-05-26 20:01:17.000000000 +0200
|
||||
+++ par2cmdline-0.4/letype.h 2006-05-09 10:47:29.000000000 +0200
|
||||
@@ -28,44 +28,15 @@
|
||||
--- a/letype.h
|
||||
+++ b/letype.h
|
||||
@@ -28,44 +28,15 @@ typedef u64 leu64;
|
||||
|
||||
#else
|
||||
|
||||
|
@ -47,7 +46,7 @@ diff -ur par2cmdline-0.4-orig/letype.h par2cmdline-0.4/letype.h
|
|||
inline leu16& leu16::operator=(const u16 &other)
|
||||
{
|
||||
((unsigned char*)&value)[0] = (unsigned char)((other >> 0) & 0xff);
|
||||
@@ -81,46 +52,15 @@
|
||||
@@ -81,46 +52,15 @@ inline leu16::operator u16(void) const
|
||||
}
|
||||
|
||||
|
||||
|
@ -95,7 +94,7 @@ diff -ur par2cmdline-0.4-orig/letype.h par2cmdline-0.4/letype.h
|
|||
inline leu32& leu32::operator=(const u32 &other)
|
||||
{
|
||||
((unsigned char*)&value)[0] = (unsigned char)((other >> 0) & 0xff);
|
||||
@@ -140,50 +80,15 @@
|
||||
@@ -140,50 +80,15 @@ inline leu32::operator u32(void) const
|
||||
}
|
||||
|
||||
|
||||
|
@ -147,73 +146,3 @@ diff -ur par2cmdline-0.4-orig/letype.h par2cmdline-0.4/letype.h
|
|||
inline leu64& leu64::operator=(const u64 &other)
|
||||
{
|
||||
((unsigned char*)&value)[0] = (unsigned char)((other >> 0) & 0xff);
|
||||
diff -ur par2cmdline-0.4-orig/md5.h par2cmdline-0.4/md5.h
|
||||
--- par2cmdline-0.4-orig/md5.h 2003-08-02 01:41:04.000000000 +0200
|
||||
+++ par2cmdline-0.4/md5.h 2006-05-09 10:47:29.000000000 +0200
|
||||
@@ -20,6 +20,13 @@
|
||||
#ifndef __MD5_H__
|
||||
#define __MD5_H__
|
||||
|
||||
+#ifdef WIN32
|
||||
+#pragma pack(push, 1)
|
||||
+#define PACKED
|
||||
+#else
|
||||
+#define PACKED __attribute__ ((packed))
|
||||
+#endif
|
||||
+
|
||||
// This file defines the MD5Hash and MD5Context objects which are used
|
||||
// to compute and manipulate the MD5 Hash values for a block of data.
|
||||
|
||||
@@ -35,12 +42,11 @@
|
||||
|
||||
// MD5 Hash value
|
||||
|
||||
-class MD5Hash
|
||||
-{
|
||||
-public:
|
||||
- // Constructor does not initialise the value
|
||||
- MD5Hash(void) {};
|
||||
+struct MD5Hash;
|
||||
+ostream& operator<<(ostream &s, const MD5Hash &hash);
|
||||
|
||||
+struct MD5Hash
|
||||
+{
|
||||
// Comparison operators
|
||||
bool operator==(const MD5Hash &other) const;
|
||||
bool operator!=(const MD5Hash &other) const;
|
||||
@@ -54,13 +60,8 @@
|
||||
friend ostream& operator<<(ostream &s, const MD5Hash &hash);
|
||||
string print(void) const;
|
||||
|
||||
- // Copy and assignment
|
||||
- MD5Hash(const MD5Hash &other);
|
||||
- MD5Hash& operator=(const MD5Hash &other);
|
||||
-
|
||||
-public:
|
||||
u8 hash[16]; // 16 byte MD5 Hash value
|
||||
-};
|
||||
+} PACKED;
|
||||
|
||||
// Intermediate computation state
|
||||
|
||||
@@ -144,16 +145,9 @@
|
||||
return !other.operator<(*this);
|
||||
}
|
||||
|
||||
-inline MD5Hash::MD5Hash(const MD5Hash &other)
|
||||
-{
|
||||
- memcpy(&hash, &other.hash, sizeof(hash));
|
||||
-}
|
||||
-
|
||||
-inline MD5Hash& MD5Hash::operator=(const MD5Hash &other)
|
||||
-{
|
||||
- memcpy(&hash, &other.hash, sizeof(hash));
|
||||
-
|
||||
- return *this;
|
||||
-}
|
||||
+#ifdef WIN32
|
||||
+#pragma pack(pop)
|
||||
+#endif
|
||||
+#undef PACKED
|
||||
|
||||
#endif // __MD5_H__
|
|
@ -1,6 +1,6 @@
|
|||
--- ../orig/par2cmdline-0.4/par2cmdline.h 2004-04-15 15:30:02.000000000 +0200
|
||||
+++ ./par2cmdline.h 2007-03-24 13:25:43.000000000 +0100
|
||||
@@ -132,6 +132,10 @@
|
||||
--- a/par2cmdline.h
|
||||
+++ b/par2cmdline.h
|
||||
@@ -132,6 +132,10 @@ typedef unsigned int u32;
|
||||
typedef unsigned long long u64;
|
||||
#endif
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
|||
#if HAVE_SYS_STAT_H
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
@@ -179,6 +183,8 @@
|
||||
@@ -179,6 +183,8 @@ typedef unsigned long long u64;
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
|
@ -1,7 +1,7 @@
|
|||
--- Makefile.in 2004-04-12 18:44:18.000000000 +0200
|
||||
+++ Makefile.in.new 2010-02-10 21:08:17.799145528 +0100
|
||||
@@ -716,9 +716,9 @@ uninstall-am: uninstall-binPROGRAMS unin
|
||||
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -55,9 +55,9 @@ EXTRA_DIST = PORTING ROADMAP par2cmdline.sln par2cmdline.vcproj \
|
||||
TESTS = pretest test1 test2 test3 test4 test5 test6 posttest
|
||||
|
||||
install-exec-hook :
|
||||
- ln -f $(DESTDIR)$(bindir)/par2$(EXEEXT) $(DESTDIR)$(bindir)/par2create$(EXEEXT)
|
|
@ -1,5 +1,5 @@
|
|||
--- verificationhashtable.h 2003-06-03 13:48:52.000000000 +0200
|
||||
+++ verificationhashtable.h.new 2010-02-10 20:48:50.425580166 +0100
|
||||
--- a/verificationhashtable.h 2003-06-03 13:48:52.000000000 +0200
|
||||
+++ b/verificationhashtable.h.new 2010-02-10 20:48:50.425580166 +0100
|
||||
@@ -66,11 +66,11 @@ public:
|
||||
// Comparison operators for searching
|
||||
bool operator <(const VerificationHashEntry &r) const
|
||||
|
@ -57,8 +57,8 @@
|
|||
)
|
||||
)
|
||||
{
|
||||
--- par1repairer.cpp 2004-04-15 15:40:48.000000000 +0200
|
||||
+++ par1repairer.cpp.new 2010-02-10 21:04:43.288702325 +0100
|
||||
--- a/par1repairer.cpp 2004-04-15 15:40:48.000000000 +0200
|
||||
+++ b/par1repairer.cpp.new 2010-02-10 21:04:43.288702325 +0100
|
||||
@@ -324,7 +324,7 @@ bool Par1Repairer::LoadRecoveryFile(stri
|
||||
||
|
||||
(fileheader.datasize && (fileheader.dataoffset < sizeof(fileheader) || fileheader.dataoffset + fileheader.datasize > filesize))
|
|
@ -1,11 +1,10 @@
|
|||
# Maintainer: wide-eye <eyeswide@gmail.com>
|
||||
# Contributor: BlackEagle < ike DOT devolder AT herecura DOT be >
|
||||
# Maintainer: BlackEagle < ike DOT devolder AT gmail DOT com >
|
||||
|
||||
plugrel=1
|
||||
|
||||
pkgname=par2cmdline
|
||||
pkgver=0.4
|
||||
pkgrel=14
|
||||
pkgrel=18
|
||||
pkgdesc="Providing a tool to apply the data-recovery capability concepts of RAID-like systems to the posting & recovery of multi-part archives on Usenet."
|
||||
url="http://sourceforge.net/projects/parchive/"
|
||||
license="GPL"
|
||||
|
@ -14,44 +13,65 @@ makedepends=()
|
|||
arch=('i686' 'x86_64')
|
||||
source=(
|
||||
"http://downloads.sourceforge.net/sourceforge/parchive/${pkgname}-${pkgver}.tar.gz"
|
||||
'par2cmdline-0.4-autoconf.patch'
|
||||
'par2cmdline-0.4-wildcard-fix.patch'
|
||||
'par2cmdline-0.4-offset.patch'
|
||||
'par2cmdline-0.4-letype.patch'
|
||||
'par2cmdline-0.4-gcc4.patch'
|
||||
'par2cmdline-0.4-cosmetic.patch'
|
||||
'par2cmdline-0.4-hardlinks.patch'
|
||||
"01-Use-_stati64-under-WIN32-to-get-file-size.patch"
|
||||
"02-Report-empty-files-when-verifying.patch"
|
||||
"03-Correct-error-in-Par2CreatorSourceFile-UpdateHashes-.patch"
|
||||
"04-offset-must-always-be-updated-even-when-progress-is-.patch"
|
||||
"05-When-a-file-is-specified-to-be-scanned-but-it-dooen-.patch"
|
||||
"06-Introduced-conditional-compilation-to-speed-up-thing.patch"
|
||||
"07-Optimization-by-inlining.patch"
|
||||
"08-Allowing-commandline-passing-of-files.patch"
|
||||
"09-Fixing-processing-of-the-first-file-parameter-the-ou.patch"
|
||||
"10-Pack-and-simplify-MD5Hash.patch"
|
||||
"11-Use-autogenerated-methods-in-letype.patch"
|
||||
"12-Fix-headers-in-par2cmdline.h.patch"
|
||||
"13-hardlinks.patch"
|
||||
"14-fixes-stupid-warnings.patch"
|
||||
)
|
||||
md5sums=(
|
||||
'1551b63e57e3c232254dc62073b723a9'
|
||||
'8a0fad41e3c3165e3c788d2693797557'
|
||||
'c823d25f8862531e6e435ce0c76f8384'
|
||||
'cd54801b5107f03982c2b01ead21f02a'
|
||||
'1f7adb9308d4e972a5630eb56a42f8d5'
|
||||
'd52515669d3bc43f19c545fd6405dacc'
|
||||
'986d44b0cdba449459f9cfd93322144f'
|
||||
'8683d237bc11e9d5581d14b4697d1f8b'
|
||||
sha256sums=(
|
||||
'9e32b7dbcf7bca8249f98824757d4868714156fe2276516504cd26f736e9f677'
|
||||
'ece2cacec41d820d697e8fb5838b39e5ea1be1ced2a4cbe93d739a05a94db33a'
|
||||
'd4976200ea20b44d0efbc8225ed510157a59b921b710a9cf353052df8f7d2175'
|
||||
'1024c6dbfc7b8993a683c28a91d156552190ae33c925b217864ea874c8135eeb'
|
||||
'f6e6c1bb8fbc6eb40947dbc9f14fcf4856de840fa970d3482900408d9aaa2f43'
|
||||
'00efeff75f8a8cf61d47763b9a86ba92c68a7201d1ec50915830802b08f466e2'
|
||||
'a472bc0321cde509d0bfe1d0887a3209ba4997673d7e5a49c31cf225546da802'
|
||||
'ff9aba8c2b5e5050f811e11331637241db2fed48c2bbf5a34c970b70d45b6179'
|
||||
'3076b42f152c447a24f119b5586ef702a994efa6f4fbb3a3a51d1122effef435'
|
||||
'4e5c70345b1bd40019c58c0f334a76d9ece5bbb3cd08e1fb1a16b614c8e2e0cb'
|
||||
'4f562411d3d431af99560789cfd69f4d6c72ca82986d4999f8ab7e6c0db7f912'
|
||||
'3b7c0644143b6498ca21cb6b892b645346092f79aa5d0bc0e56fbd6181eb2e31'
|
||||
'13ce51e827cd6c959a6cd92322e79df26e59f4177d831530239be491b8ffc9ff'
|
||||
'a1f6f551acf5d05f2173d6ac328a30044f2af2f2f15e87547e69fad5250a2653'
|
||||
'0c2413f0d1c024127063b5cbb0a403fe12555ec820190f7981db4a5a82be7b62'
|
||||
)
|
||||
|
||||
build() {
|
||||
cd ${pkgname}-${pkgver}
|
||||
msg "patch autoconf failure"
|
||||
patch -N -i ../par2cmdline-0.4-autoconf.patch || return 1
|
||||
msg "patch wildcard-fix"
|
||||
patch -N -i ../par2cmdline-0.4-wildcard-fix.patch || return 1
|
||||
msg "patch offset"
|
||||
patch -N -i ../par2cmdline-0.4-offset.patch || return 1
|
||||
msg "patch letype"
|
||||
patch -N -i ../par2cmdline-0.4-letype.patch || return 1
|
||||
msg "patch gcc4"
|
||||
patch -N -i ../par2cmdline-0.4-gcc4.patch || return 1
|
||||
msg "patch cosmetic"
|
||||
patch -N -i ../par2cmdline-0.4-cosmetic.patch || return 1
|
||||
msg "patch hardlinks"
|
||||
patch -N -i ../par2cmdline-0.4-hardlinks.patch || return 1
|
||||
for patch in ${startdir}/[0-9][0-9]*.patch; do
|
||||
msg ${patch}
|
||||
patch -Np1 -i ${patch}
|
||||
done
|
||||
msg "remove old files"
|
||||
rm -f Makefile.in \
|
||||
aclocal.m4 \
|
||||
config.guess \
|
||||
config.h.in \
|
||||
config.sub \
|
||||
configure \
|
||||
depcomp \
|
||||
install-sh \
|
||||
missing \
|
||||
mkinstalldirs
|
||||
msg "run autotools stuff"
|
||||
aclocal --force
|
||||
autoconf --force
|
||||
autoheader --force
|
||||
automake --foreign --add-missing --copy --force-missing
|
||||
msg "Configure"
|
||||
./configure --prefix=/usr
|
||||
make || return 1
|
||||
msg "Make"
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
Fix compilation with gcc-4.
|
||||
|
||||
Patch by Dirk-Jan Heijs.
|
||||
|
||||
http://bugs.gentoo.org/102391
|
||||
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=287904
|
||||
|
||||
--- par2cmdline-0.4/reedsolomon.cpp
|
||||
+++ par2cmdline-0.4/reedsolomon.cpp
|
||||
@@ -51,7 +51,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
-bool ReedSolomon<Galois8>::SetInput(const vector<bool> &present)
|
||||
+template <> bool ReedSolomon<Galois8>::SetInput(const vector<bool> &present)
|
||||
{
|
||||
inputcount = (u32)present.size();
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
-bool ReedSolomon<Galois8>::SetInput(u32 count)
|
||||
+template <> bool ReedSolomon<Galois8>::SetInput(u32 count)
|
||||
{
|
||||
inputcount = count;
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
-bool ReedSolomon<Galois8>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
|
||||
+template <> bool ReedSolomon<Galois8>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
|
||||
{
|
||||
// Look up the appropriate element in the RS matrix
|
||||
Galois8 factor = leftmatrix[outputindex * (datapresent + datamissing) + inputindex];
|
||||
@@ -189,7 +189,7 @@
|
||||
|
||||
// Set which of the source files are present and which are missing
|
||||
// and compute the base values to use for the vandermonde matrix.
|
||||
-bool ReedSolomon<Galois16>::SetInput(const vector<bool> &present)
|
||||
+template <> bool ReedSolomon<Galois16>::SetInput(const vector<bool> &present)
|
||||
{
|
||||
inputcount = (u32)present.size();
|
||||
|
||||
@@ -233,7 +233,7 @@
|
||||
|
||||
// Record that the specified number of source files are all present
|
||||
// and compute the base values to use for the vandermonde matrix.
|
||||
-bool ReedSolomon<Galois16>::SetInput(u32 count)
|
||||
+template <> bool ReedSolomon<Galois16>::SetInput(u32 count)
|
||||
{
|
||||
inputcount = count;
|
||||
|
||||
@@ -267,7 +267,7 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
-bool ReedSolomon<Galois16>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
|
||||
+template <> bool ReedSolomon<Galois16>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
|
||||
{
|
||||
// Look up the appropriate element in the RS matrix
|
|
@ -1,16 +0,0 @@
|
|||
--- par2cmdline-0.4.orig/par2creatorsourcefile.cpp 2004-04-15 14:45:23.000000000 +0100
|
||||
+++ par2cmdline-0.4/par2creatorsourcefile.cpp 2005-09-29 02:27:43.000000000 +0100
|
||||
@@ -213,11 +213,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ offset += want;
|
||||
+
|
||||
if (noiselevel > CommandLine::nlQuiet)
|
||||
{
|
||||
// Display progress
|
||||
u32 oldfraction = (u32)(1000 * offset / filesize);
|
||||
- offset += want;
|
||||
u32 newfraction = (u32)(1000 * offset / filesize);
|
||||
if (oldfraction != newfraction)
|
||||
{
|
|
@ -1,23 +0,0 @@
|
|||
--- commandline.cpp.orig 2006-04-06 21:41:27.000000000 -0700
|
||||
+++ commandline.cpp 2006-04-07 00:12:29.000000000 -0700
|
||||
@@ -550,6 +550,20 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
+ //start of shell expanded * patch. -- Michael Evans
|
||||
+ //The shell might expaned * so, if we have our name and we're creating, then filter for files...
|
||||
+ if ((parfilename.length() != 0) && (operation == opCreate))
|
||||
+ {
|
||||
+ struct stat st;
|
||||
+ if (!(stat(argv[0], &st) == 0 && S_ISREG(st.st_mode)))
|
||||
+ {
|
||||
+ cerr << "Skipping non-regular file: " << argv[0] << endl;
|
||||
+ argc--;
|
||||
+ argv++;
|
||||
+ options = false;
|
||||
+ continue;
|
||||
+ }
|
||||
+ }//end of shell expanded * patch. -- Michael Evans
|
||||
filenames = new list<string>;
|
||||
filenames->push_back(argv[0]);
|
||||
}
|
Loading…
Reference in a new issue