Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .gitattributes
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified .travis.yml
100644 → 100755
Empty file.
Empty file modified .vimrc
100644 → 100755
Empty file.
Empty file modified AUTHORS
100644 → 100755
Empty file.
Empty file modified COPYING
100644 → 100755
Empty file.
Empty file modified ChangeLog
100644 → 100755
Empty file.
Empty file modified INSTALL
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion Makefile.am
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ par2_SOURCES = src/par2cmdline.cpp \
par2_LDADD = libpar2.a

LDADD = -lstdc++
AM_CXXFLAGS = -Wall -std=c++11 $(OPENMP_CXXFLAGS)
AM_CXXFLAGS = -Wall -Wextra -O3 -std=c++11 $(OPENMP_CXXFLAGS)

EXTRA_DIST = PORTING ROADMAP \
man/par2.1 \
Expand Down
Empty file modified NEWS
100644 → 100755
Empty file.
Empty file modified PORTING
100644 → 100755
Empty file.
Empty file modified README
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified ROADMAP
100644 → 100755
Empty file.
12 changes: 3 additions & 9 deletions config.h.in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should have been a separate commit since this update is generated

Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
/* Define to 1 if you have the `memcpy' function. */
#undef HAVE_MEMCPY

/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H

Expand Down Expand Up @@ -105,7 +102,9 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION

/* Define to 1 if you have the ANSI C header files. */
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS

/* Version number of package */
Expand All @@ -123,11 +122,6 @@
# endif
#endif

/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif

/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS

Expand Down
Empty file modified man/par2.1
100644 → 100755
Empty file.
Empty file modified par2cmdline.sln
100644 → 100755
Empty file.
Empty file modified par2cmdline.vcxproj
100644 → 100755
Empty file.
Empty file modified par2cmdline.vcxproj.filters
100644 → 100755
Empty file.
2 changes: 2 additions & 0 deletions src/commandline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,10 @@ bool CommandLine::ReadArgs(int argc, const char * const *argv)
{
case 'g':
redundancysize = redundancysize * 1024;
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must deliberatly fallthrough so the reduncancysize is multiplied more with the given modifier

case 'm':
redundancysize = redundancysize * 1024;
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must deliberatly fallthrough so the reduncancysize is multiplied more with the given modifier (same as above )

case 'k':
redundancysize = redundancysize * 1024;
break;
Expand Down
2 changes: 2 additions & 0 deletions src/descriptionpacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ string DescriptionPacket::UrlEncodeChar(char c)
// system, we don't want to change the filenames.
string DescriptionPacket::TranslateFilenameFromLocalToPar2(std::ostream &sout, std::ostream &serr, const NoiseLevel noiselevel, string local_filename)
{
(void)sout;
string par2_encoded_filename;

string::iterator p = local_filename.begin();
Expand Down Expand Up @@ -260,6 +261,7 @@ string DescriptionPacket::TranslateFilenameFromLocalToPar2(std::ostream &sout, s
// sure that anything can be done here for that.
string DescriptionPacket::TranslateFilenameFromPar2ToLocal(std::ostream &sout, std::ostream &serr, const NoiseLevel noiselevel, string par2_encoded_filename)
{
(void)sout;
string local_filename;

string::iterator p = par2_encoded_filename.begin();
Expand Down
2 changes: 1 addition & 1 deletion src/galois.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Galois
typedef valuetype ValueType;

// Basic constructors
Galois(void) {};
Galois(void) : value(0) {};
Galois(ValueType v);

// Copy and assignment
Expand Down
6 changes: 3 additions & 3 deletions src/galois_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ int test4() {
// and 2^pow != 0 for any pow

template<typename gtype, typename utype>
int test_powers(const gtype two, const gtype zero, int max_value) {
int test_powers(const gtype two, int max_value) {
gtype g = two;

int used[256*256];
Expand Down Expand Up @@ -331,11 +331,11 @@ int test_powers(const gtype two, const gtype zero, int max_value) {


int test5() {
return test_powers<Galois8, u8>(Galois8(2), Galois8(0), 256);
return test_powers<Galois8, u8>(Galois8(2), 256);
}

int test6() {
return test_powers<Galois16, u16>(Galois16(2), Galois16(0), 256*256);
return test_powers<Galois16, u16>(Galois16(2), 256*256);
}


Expand Down
1 change: 1 addition & 0 deletions src/libpar2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ bool ComputeRecoveryFileCount(std::ostream &sout,
u64 largestfilesize,
u64 blocksize)
{
(void)sout;
// Are we computing any recovery blocks
if (recoveryblockcount == 0)
{
Expand Down
2 changes: 1 addition & 1 deletion src/par2repairer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ bool Par2Repairer::PrepareVerificationHashTable(void)
if (0 != sourcefile->GetVerificationPacket())
{
// Yes. Load the verification entries into the hash table
verificationhashtable.Load(sourcefile, blocksize);
verificationhashtable.Load(sourcefile);

blockverifiable = true;
}
Expand Down
8 changes: 8 additions & 0 deletions src/reedsolomon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ u32 gcd(u32 a, u32 b)

template <> bool ReedSolomon<Galois8>::SetInput(const vector<bool> &present, std::ostream &sout, std::ostream &serr)
{
(void) sout;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate why this is added and potentially separate these changes in a separate commit?

(void) serr;
inputcount = (u32)present.size();

datapresentindex = new u32[inputcount];
Expand Down Expand Up @@ -83,6 +85,8 @@ template <> bool ReedSolomon<Galois8>::SetInput(const vector<bool> &present, std

template <> bool ReedSolomon<Galois8>::SetInput(u32 count, std::ostream &sout, std::ostream &serr)
{
(void) sout;
(void) serr;
inputcount = count;

datapresentindex = new u32[inputcount];
Expand Down Expand Up @@ -185,6 +189,8 @@ template <> bool ReedSolomon<Galois8>::InternalProcess(const Galois8 &factor, si
// and compute the base values to use for the vandermonde matrix.
template <> bool ReedSolomon<Galois16>::SetInput(const vector<bool> &present, std::ostream &sout, std::ostream &serr)
{
(void) sout;
(void) serr;
inputcount = (u32)present.size();

datapresentindex = new u32[inputcount];
Expand Down Expand Up @@ -229,6 +235,8 @@ template <> bool ReedSolomon<Galois16>::SetInput(const vector<bool> &present, st
// and compute the base values to use for the vandermonde matrix.
template <> bool ReedSolomon<Galois16>::SetInput(u32 count, std::ostream &sout, std::ostream &serr)
{
(void) sout;
(void) serr;
inputcount = count;

datapresentindex = new u32[inputcount];
Expand Down
20 changes: 12 additions & 8 deletions src/reedsolomon.h
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate here why this change is needed and potentially separate it in a commit with the explanation?

Original file line number Diff line number Diff line change
Expand Up @@ -247,21 +247,25 @@ inline bool ReedSolomon<g>::Compute(NoiseLevel noiselevel, std::ostream &sout, s
|(dpi[col]) | | |(dmi[col]) | |
\ | / \ | /
*/

// Allocate the left hand matrix

leftmatrix = new G[outcount * incount];
memset(leftmatrix, 0, outcount * incount * sizeof(G));

// Allocate the right hand matrix only if we are recovering
// Use value initialization to initialize each element in the matrix to zero (or its default state)
for (size_t i = 0; i < outcount * incount; ++i) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just remove the memset in this case and there is no need to pre-allocate anything since the next part will fill the matrix anyway, same for the rightmatrix

leftmatrix[i] = G(); // Default-construct each element (initialize to zero if G's constructor does that)
}

G *rightmatrix = 0;
// Allocate the right hand matrix only if we are recovering
G *rightmatrix = nullptr;
if (datamissing > 0)
{
rightmatrix = new G[outcount * outcount];
memset(rightmatrix, 0, outcount *outcount * sizeof(G));
rightmatrix = new G[outcount * outcount];

// Similarly, initialize the rightmatrix elements
for (size_t i = 0; i < outcount * outcount; ++i) {
rightmatrix[i] = G(); // Default-construct each element
}
}

// Fill in the two matrices:

vector<RSOutputRow>::const_iterator outputrow = outputrows.begin();
Expand Down
2 changes: 1 addition & 1 deletion src/reedsolomon_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ int test4(int NUM_IN, int *expected_bases) {
for (int i = 0; i < NUM_IN; i++) {
// read little-endian value
utype v = 0;
for (int byte_index = 0; byte_index < sizeof(utype); byte_index++) {
for (long unsigned int byte_index = 0; byte_index < sizeof(utype); byte_index++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

long unsigned int? Who would ever write this? Was this code change generated by an AI?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it was not, this change was made to reduce compiler warnings as the name of the PR suggests

Copy link
Contributor

@Coeur Coeur Jun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the C++ standard (any version). There are no long unsigned int. It should have been unsigned long int.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that byte_index is compared with a sizeof() it should be of type size_t. Unless C++ differs from C here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right Rhialto, it should be size_t.

u8 byte = data[NUM_IN+0][sizeof(utype)*i + byte_index];
v |= (((utype)byte) << (byte_index*8));
}
Expand Down
2 changes: 1 addition & 1 deletion src/verificationhashtable.cpp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of blocksize (unused I guess) should also be a separate commit with some explanation

also referring to

  • src/par2repairer.cpp
  • src/verificationhashtable.h

Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void VerificationHashTable::SetLimit(u32 limit)
}

// Load data from a verification packet
void VerificationHashTable::Load(Par2RepairerSourceFile *sourcefile, u64 blocksize)
void VerificationHashTable::Load(Par2RepairerSourceFile *sourcefile)
{
VerificationHashEntry *preventry = 0;

Expand Down
2 changes: 1 addition & 1 deletion src/verificationhashtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class VerificationHashTable
void SetLimit(u32 limit);

// Load the data from the verification packet
void Load(Par2RepairerSourceFile *sourcefile, u64 blocksize);
void Load(Par2RepairerSourceFile *sourcefile);

// Try to find a match.
// nextentry - The entry which we expect to find next. This is used
Expand Down
Empty file modified stamp-h.in
100644 → 100755
Empty file.
Empty file modified tests/100blocks.tar.gz
100644 → 100755
Empty file.
Empty file modified tests/bug44.tar.gz
100644 → 100755
Empty file.
Empty file modified tests/flatdata-par1files.tar.gz
100644 → 100755
Empty file.
Empty file modified tests/flatdata-par2files.tar.gz
100644 → 100755
Empty file.
Empty file modified tests/flatdata.tar.gz
100644 → 100755
Empty file.
Empty file modified tests/par2-0.6.8-crash.tar.gz
100644 → 100755
Empty file.
Empty file modified tests/readbeyondeof.tar.gz
100644 → 100755
Empty file.
Empty file modified tests/smallsubdirdata-par2files.tar.gz
100644 → 100755
Empty file.
Empty file modified tests/smallsubdirdata.tar.gz
100644 → 100755
Empty file.
Empty file modified tests/subdirdata-par2files-unix.tar.gz
100644 → 100755
Empty file.
Empty file modified tests/subdirdata-par2files-win.tar.gz
100644 → 100755
Empty file.
Empty file modified tests/subdirdata.tar.gz
100644 → 100755
Empty file.
Empty file modified tests/testcollision/2mb_0s.bin
100644 → 100755
Empty file.
Empty file modified tests/testcollision/2mb_0s.bin.par2
100644 → 100755
Empty file.
Empty file modified tests/testcollision/2mb_col.bin
100644 → 100755
Empty file.
Empty file modified tests/testcollision/2mb_col.bin.par2
100644 → 100755
Empty file.
Empty file modified tests/testcollision/pattern16.bin
100644 → 100755
Empty file.
Empty file modified tests/testcollision/pattern16.bin.par2
100644 → 100755
Empty file.