Skip to content
Merged
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
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dnl repair tool). See http://parchive.sourceforge.net for details of PAR 2.0.
dnl
dnl Copyright (c) 2003-2015 Peter Brian Clements
dnl Copyright (c) 2011-2012 Marcel Partap
dnl Copyright (c) 2012-2015 Ike Devolder
dnl Copyright (c) 2012-2026 Ike Devolder
dnl Copyright (c) 2019 Michael D. Nahas
dnl
dnl par2cmdline is free software; you can redistribute it and/or modify
Expand Down
8 changes: 4 additions & 4 deletions src/commandline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void CommandLine::banner(void)
{
std::cout << "Copyright (C) 2003-2015 Peter Brian Clements." << std::endl
<< "Copyright (C) 2011-2012 Marcel Partap." << std::endl
<< "Copyright (C) 2012-2017 Ike Devolder." << std::endl
<< "Copyright (C) 2012-2026 Ike Devolder." << std::endl
<< "Copyright (C) 2014-2017 Jussi Kansanen." << std::endl
<< "Copyright (C) 2019 Michael Nahas." << std::endl
<< std::endl
Expand Down Expand Up @@ -137,7 +137,7 @@ void CommandLine::usage(void)
" -f<n> : First Recovery-Block-Number (default 0)\n"
" -u : Uniform recovery file sizes (default is variable)\n"
" -l : Limit size of recovery files (don't use both -u and -l)\n"
" -n<n> : Number of recovery files (std::max 31) (don't use both -n and -l)\n"
" -n<n> : Number of recovery files (max 31) (don't use both -n and -l)\n"
" -R : Recurse into subdirectories\n"
" (Be aware of wildcard shell expansion)\n"
"\n";
Expand Down Expand Up @@ -1097,7 +1097,7 @@ bool CommandLine::CheckValuesAndSetDefaults() {
if (parfilename.length() > 5 && 0 == stricmp(parfilename.substr(parfilename.length()-5, 5).c_str(), ".par2"))
{
// Yes it does.
std::cerr << "You must specify a std::list of files when creating." << std::endl;
std::cerr << "You must specify a list of files when creating." << std::endl;
return false;
}
else
Expand All @@ -1117,7 +1117,7 @@ bool CommandLine::CheckValuesAndSetDefaults() {
{
// The file does not exist or it is empty.

std::cerr << "You must specify a std::list of files when creating." << std::endl;
std::cerr << "You must specify a list of files when creating." << std::endl;
return false;
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/descriptionpacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ bool DescriptionPacket::Load(DiskFile *diskfile, u64 offset, PACKET_HEADER &head


// Returns the URL-style encoding of a character:
// "%HH" where H is a std::hex-digit.
// "%HH" where H is a hex-digit.
std::string DescriptionPacket::UrlEncodeChar(char c)
{
std::string result("%");
Expand Down Expand Up @@ -185,7 +185,7 @@ std::string DescriptionPacket::TranslateFilenameFromLocalToPar2(std::ostream &so
}

#ifdef _WIN32
// std::replace Windows-slash with HTML-slash
// replace Windows-slash with HTML-slash
if (ch == '\\') {
ch = '/';
}
Expand Down Expand Up @@ -254,7 +254,7 @@ std::string DescriptionPacket::TranslateFilenameFromLocalToPar2(std::ostream &so
// to write an absolute path, directories named "..", etc.
//
// This implementation changes any illegal char into the URL-style
// encoding of %HH where H is a std::hex-digit.
// encoding of %HH where H is a hex-digit.
//
// NOTE: Windows limits path names to 255 characters. I'm not
// sure that anything can be done here for that.
Expand Down Expand Up @@ -295,7 +295,7 @@ std::string DescriptionPacket::TranslateFilenameFromPar2ToLocal(std::ostream &so
}
#endif

// std::replace unix / to windows \ or windows \ to unix /
// replace unix / to windows \ or windows \ to unix /
#ifdef _WIN32
if (ch == '/')
{
Expand Down Expand Up @@ -323,7 +323,7 @@ std::string DescriptionPacket::TranslateFilenameFromPar2ToLocal(std::ostream &so
if (noiselevel >= nlQuiet)
{
serr << "INFO: Found illegal character '" << ch << "' in filename. Changed it to \"" << UrlEncodeChar(ch) << "\"" << std::endl;
// convert problem characters to std::hex
// convert problem characters to hex
local_filename += UrlEncodeChar(ch);
}
}
Expand Down
18 changes: 9 additions & 9 deletions src/diskfile_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ int test2() {
std::cout << "FileSize failed" << std::endl;
return 1;
}
const size_t buffer_len = strlen(input1_contents)+1; // for end-of-std::string
const size_t buffer_len = strlen(input1_contents)+1; // for end-of-string
u8 *buffer = new u8[buffer_len];
// put end-of-std::string in buffer.
// put end-of-string in buffer.
buffer[buffer_len-1] = '\0';

if (!diskfile.Read(0, buffer, buffer_len - 1)) {
Expand Down Expand Up @@ -354,9 +354,9 @@ int test2() {

/* // confirm write with read

const size_t buffer_len = strlen(input2_contents)+1; // for end-of-std::string
const size_t buffer_len = strlen(input2_contents)+1; // for end-of-string
u8 *buffer = new u8[buffer_len];
// put end-of-std::string in buffer.
// put end-of-string in buffer.
buffer[buffer_len-1] = '\0';
if (!diskfile.Read(0, buffer, buffer_len - 1)) {
std::cout << "Read whole file returned false 1" << std::endl;
Expand Down Expand Up @@ -478,7 +478,7 @@ int test2() {
return 1;
}

// add one more char, for end-of-std::string
// add one more char, for end-of-string
u8 *buffer = new u8[buffer_len + 1];
buffer[buffer_len] = '\0';

Expand Down Expand Up @@ -648,9 +648,9 @@ int test6() {
return 1;
}

const size_t buffer_len = strlen(input1_contents)+1; // for end-of-std::string
const size_t buffer_len = strlen(input1_contents)+1; // for end-of-string
u8 *buffer = new u8[buffer_len];
// put end-of-std::string in buffer.
// put end-of-string in buffer.
buffer[buffer_len-1] = '\0';

if (!diskfile.Read(0, buffer, buffer_len - 1, 2)) {
Expand Down Expand Up @@ -703,9 +703,9 @@ int test6() {
return 1;
}

const size_t buffer_len = strlen(input2_contents)+1; // for end-of-std::string
const size_t buffer_len = strlen(input2_contents)+1; // for end-of-string
u8 *buffer = new u8[buffer_len];
// put end-of-std::string in buffer.
// put end-of-string in buffer.
buffer[buffer_len-1] = '\0';


Expand Down
2 changes: 1 addition & 1 deletion src/md5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static char THIS_FILE[]=__FILE__;
#endif
#endif

// Convert hash values to std::hex
// Convert hash values to hex

std::ostream& operator<<(std::ostream &result, const MD5Hash &h)
{
Expand Down
4 changes: 2 additions & 2 deletions src/md5_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ int test1() {
}


// "MD5 of a null std::string is d41d8cd98f00b204e9800998ecf8427e"
// "MD5 of a null std::string is d4 1d 8c d9 8f 00 b2 04 e9 80 09 98 ec f8 42 7e"
// "MD5 of a null string is d41d8cd98f00b204e9800998ecf8427e"
// "MD5 of a null string is d4 1d 8c d9 8f 00 b2 04 e9 80 09 98 ec f8 42 7e"
// according to https://news.ycombinator.com/item?id=5653698
int test2() {

Expand Down
32 changes: 16 additions & 16 deletions src/par1repairer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,33 +359,33 @@ bool Par1Repairer::LoadRecoveryFile(std::string filename)
fileheader.filelistsize == 0)
break;

// Verify that the file std::list and data offsets are ok
// Verify that the file list and data offsets are ok
if ((fileheader.filelistoffset + fileheader.filelistsize > filesize)
||
(fileheader.datasize && (fileheader.dataoffset < sizeof(fileheader) || fileheader.dataoffset + fileheader.datasize > filesize))
||
(fileheader.datasize && ((fileheader.filelistoffset <= fileheader.dataoffset && fileheader.dataoffset < fileheader.filelistoffset+fileheader.filelistsize) || (fileheader.dataoffset <= fileheader.filelistoffset && fileheader.filelistoffset < fileheader.dataoffset + fileheader.datasize))))
break;

// Check the size of the file std::list
// Check the size of the file list
if (fileheader.filelistsize > 200000)
break;

// If we already have a copy of the file std::list, make sure this one has the same size
// If we already have a copy of the file list, make sure this one has the same size
if (filelist != 0 && filelistsize != fileheader.filelistsize)
break;

// Allocate a buffer to hold a copy of the file std::list
// Allocate a buffer to hold a copy of the file list
unsigned char *temp = new unsigned char[(size_t)fileheader.filelistsize];

// Read the file std::list into the buffer
// Read the file list into the buffer
if (!diskfile->Read(fileheader.filelistoffset, temp, (size_t)fileheader.filelistsize))
{
delete [] temp;
break;
}

// If we already have a copy of the file std::list, make sure this copy is identical
// If we already have a copy of the file list, make sure this copy is identical
if (filelist != 0)
{
bool match = (0 == memcmp(filelist, temp, filelistsize));
Expand All @@ -396,7 +396,7 @@ bool Par1Repairer::LoadRecoveryFile(std::string filename)
}
else
{
// Prepare to scan the file std::list
// Prepare to scan the file list
unsigned char *current = temp;
size_t remaining = (size_t)fileheader.filelistsize;
unsigned int fileindex = 0;
Expand Down Expand Up @@ -427,7 +427,7 @@ bool Par1Repairer::LoadRecoveryFile(std::string filename)
// Copy whole of file entry
memcpy((void*)fileentry, (void*)current, (size_t)(u64)fileentry->entrysize);

// Create source file and add it to the appropriate std::list
// Create source file and add it to the appropriate list
Par1RepairerSourceFile *sourcefile = new Par1RepairerSourceFile(sout, serr, noiselevel, fileentry, searchpath);
if (fileentry->status & INPARITYVOLUME)
{
Expand Down Expand Up @@ -493,7 +493,7 @@ bool Par1Repairer::LoadRecoveryFile(std::string filename)
datablock->SetLength(blocksize);
datablock->SetLocation(diskfile, fileheader.dataoffset);

// Store it in the std::map
// Store it in the map
recoveryblocks.insert(std::pair<u32, DataBlock*>(volumenumber, datablock));

havevolume = true;
Expand Down Expand Up @@ -1155,7 +1155,7 @@ bool Par1Repairer::CreateTargetFiles(void)

sourcefile->SetTargetBlock(targetfile);

// Add the file to the std::list of those that will need to be verified
// Add the file to the list of those that will need to be verified
// once the repair has completed.
verifylist.push_back(sourcefile);
}
Expand Down Expand Up @@ -1202,7 +1202,7 @@ bool Par1Repairer::ComputeRSmatrix(void)
// Record that the block was found
*pres = true;

// Add the block to the std::list of those which will be read
// Add the block to the list of those which will be read
// as input (and which might also need to be copied).
*inputblock = sourceblock;
++inputblock;
Expand All @@ -1212,7 +1212,7 @@ bool Par1Repairer::ComputeRSmatrix(void)
// Record that the block was missing
*pres = false;

// Add the block to the std::list of those to be written
// Add the block to the list of those to be written
*outputblock = targetblock;
++outputblock;
}
Expand All @@ -1230,7 +1230,7 @@ bool Par1Repairer::ComputeRSmatrix(void)
// Start iterating through the available recovery packets
std::map<u32, DataBlock*>::iterator recoveryiterator = recoveryblocks.begin();

// Continue to fill the remaining std::list of data blocks to be read
// Continue to fill the remaining list of data blocks to be read
while (inputblock != inputblocks.end())
{
// Get the next available recovery block
Expand All @@ -1242,7 +1242,7 @@ bool Par1Repairer::ComputeRSmatrix(void)
{
return false;
}
// Add the recovery block to the std::list of blocks that will be read
// Add the recovery block to the list of blocks that will be read
*inputblock = recoveryblock;

// Record that the corresponding exponent value is the next one
Expand Down Expand Up @@ -1377,7 +1377,7 @@ bool Par1Repairer::VerifyTargetFiles(void)
// Verify the target files in alphabetical order
// std::sort(verifylist.begin(), verifylist.end(), SortSourceFilesByFileName);

// Iterate through each file in the verification std::list
// Iterate through each file in the verification list
for (std::list<Par1RepairerSourceFile*>::iterator sf = verifylist.begin();
sf != verifylist.end();
++sf)
Expand Down Expand Up @@ -1418,7 +1418,7 @@ bool Par1Repairer::DeleteIncompleteTargetFiles(void)
{
std::list<Par1RepairerSourceFile*>::iterator sf = verifylist.begin();

// Iterate through each file in the verification std::list
// Iterate through each file in the verification list
while (sf != verifylist.end())
{
Par1RepairerSourceFile *sourcefile = *sf;
Expand Down
6 changes: 3 additions & 3 deletions src/par2creator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ bool Par2Creator::OpenSourceFiles(const std::vector<std::string> &extrafiles, st
}

// Record the file verification and file description packets
// in the critical packet std::list.
// in the critical packet list.
#pragma omp critical
{
sourcefile->RecordCriticalPackets(criticalpackets);
Expand All @@ -421,10 +421,10 @@ bool Par2Creator::OpenSourceFiles(const std::vector<std::string> &extrafiles, st
// Create the main packet and determine the setid to use with all packets
bool Par2Creator::CreateMainPacket(void)
{
// Construct the main packet from the std::list of source files and the block size.
// Construct the main packet from the list of source files and the block size.
mainpacket = new MainPacket;

// Add the main packet to the std::list of critical packets.
// Add the main packet to the list of critical packets.
criticalpackets.push_back(mainpacket);

// Create the packet (sourcefiles will get sorted into FileId order).
Expand Down
2 changes: 1 addition & 1 deletion src/par2creatorsourcefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ void Par2CreatorSourceFile::Close(void)
void Par2CreatorSourceFile::RecordCriticalPackets(std::list<CriticalPacket*> &criticalpackets)
{
// Add the file description packet and file verification packet to
// the critical packet std::list.
// the critical packet list.
criticalpackets.push_back(descriptionpacket);
criticalpackets.push_back(verificationpacket);
}
Expand Down
1 change: 0 additions & 1 deletion src/par2creatorsourcefile.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class Par2CreatorSourceFile
~Par2CreatorSourceFile(void);

// Open the source file and compute the Hashes and CRCs.
//bool Open(NoiseLevel noiselevel, const std::string &extrafile, u64 blocksize, bool deferhashcomputation, std::string basepath);
#ifdef _OPENMP
bool Open(NoiseLevel noiselevel, std::ostream &sout, std::ostream &serr, const std::string &extrafile, u64 blocksize, bool deferhashcomputation, std::string basepath, u64 totalsize, u64 &totalprogress);
#else
Expand Down
Loading