diff --git a/configure.ac b/configure.ac index 12cdf63d..4278e6df 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/src/commandline.cpp b/src/commandline.cpp index 6665f5ac..d9b3b5c5 100644 --- a/src/commandline.cpp +++ b/src/commandline.cpp @@ -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 @@ -137,7 +137,7 @@ void CommandLine::usage(void) " -f : 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 : Number of recovery files (std::max 31) (don't use both -n and -l)\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"; @@ -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 @@ -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; } } diff --git a/src/descriptionpacket.cpp b/src/descriptionpacket.cpp index 90577ccd..439e339f 100644 --- a/src/descriptionpacket.cpp +++ b/src/descriptionpacket.cpp @@ -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("%"); @@ -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 = '/'; } @@ -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. @@ -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 == '/') { @@ -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); } } diff --git a/src/diskfile_test.cpp b/src/diskfile_test.cpp index 72b158ff..709e33a6 100644 --- a/src/diskfile_test.cpp +++ b/src/diskfile_test.cpp @@ -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)) { @@ -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; @@ -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'; @@ -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)) { @@ -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'; diff --git a/src/md5.cpp b/src/md5.cpp index 9680f82d..a6cf57fc 100644 --- a/src/md5.cpp +++ b/src/md5.cpp @@ -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) { diff --git a/src/md5_test.cpp b/src/md5_test.cpp index 3840be33..f36b25f4 100644 --- a/src/md5_test.cpp +++ b/src/md5_test.cpp @@ -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() { diff --git a/src/par1repairer.cpp b/src/par1repairer.cpp index 0b2057e6..b44253cd 100644 --- a/src/par1repairer.cpp +++ b/src/par1repairer.cpp @@ -359,7 +359,7 @@ 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)) @@ -367,25 +367,25 @@ bool Par1Repairer::LoadRecoveryFile(std::string filename) (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)); @@ -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; @@ -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) { @@ -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(volumenumber, datablock)); havevolume = true; @@ -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); } @@ -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; @@ -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; } @@ -1230,7 +1230,7 @@ bool Par1Repairer::ComputeRSmatrix(void) // Start iterating through the available recovery packets std::map::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 @@ -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 @@ -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::iterator sf = verifylist.begin(); sf != verifylist.end(); ++sf) @@ -1418,7 +1418,7 @@ bool Par1Repairer::DeleteIncompleteTargetFiles(void) { std::list::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; diff --git a/src/par2creator.cpp b/src/par2creator.cpp index 0ceb3f6b..1224ad46 100644 --- a/src/par2creator.cpp +++ b/src/par2creator.cpp @@ -397,7 +397,7 @@ bool Par2Creator::OpenSourceFiles(const std::vector &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); @@ -421,10 +421,10 @@ bool Par2Creator::OpenSourceFiles(const std::vector &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). diff --git a/src/par2creatorsourcefile.cpp b/src/par2creatorsourcefile.cpp index ade1678b..ee7bfe07 100644 --- a/src/par2creatorsourcefile.cpp +++ b/src/par2creatorsourcefile.cpp @@ -283,7 +283,7 @@ void Par2CreatorSourceFile::Close(void) void Par2CreatorSourceFile::RecordCriticalPackets(std::list &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); } diff --git a/src/par2creatorsourcefile.h b/src/par2creatorsourcefile.h index 714a9d9d..539680b8 100644 --- a/src/par2creatorsourcefile.h +++ b/src/par2creatorsourcefile.h @@ -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 diff --git a/src/par2repairer.cpp b/src/par2repairer.cpp index 2d9eae96..8ea07e06 100644 --- a/src/par2repairer.cpp +++ b/src/par2repairer.cpp @@ -587,7 +587,7 @@ bool Par2Repairer::LoadRecoveryPacket(DiskFile *diskfile, u64 offset, PACKET_HEA // What is the exponent value of this recovery packet u32 exponent = packet->Exponent(); - // Try to insert the new packet into the recovery packet std::map + // Try to insert the new packet into the recovery packet map std::pair::const_iterator, bool> location = recoverypacketmap.insert(std::pair(exponent, packet)); // Did the insert fail @@ -616,7 +616,7 @@ bool Par2Repairer::LoadDescriptionPacket(DiskFile *diskfile, u64 offset, PACKET_ // What is the fileid const MD5Hash &fileid = packet->FileId(); - // Look up the fileid in the source file std::map for an existing source file entry + // Look up the fileid in the source file map for an existing source file entry std::map::iterator sfmi = sourcefilemap.find(fileid); Par2RepairerSourceFile *sourcefile = (sfmi == sourcefilemap.end()) ? 0 :sfmi->second; @@ -642,7 +642,7 @@ bool Par2Repairer::LoadDescriptionPacket(DiskFile *diskfile, u64 offset, PACKET_ // Create a new source file for the packet sourcefile = new Par2RepairerSourceFile(packet, NULL); - // Record the source file in the source file std::map + // Record the source file in the source file map sourcefilemap.insert(std::pair(fileid, sourcefile)); return true; @@ -664,7 +664,7 @@ bool Par2Repairer::LoadVerificationPacket(DiskFile *diskfile, u64 offset, PACKET // What is the fileid const MD5Hash &fileid = packet->FileId(); - // Look up the fileid in the source file std::map for an existing source file entry + // Look up the fileid in the source file map for an existing source file entry std::map::iterator sfmi = sourcefilemap.find(fileid); Par2RepairerSourceFile *sourcefile = (sfmi == sourcefilemap.end()) ? 0 :sfmi->second; @@ -691,7 +691,7 @@ bool Par2Repairer::LoadVerificationPacket(DiskFile *diskfile, u64 offset, PACKET // Create a new source file for the packet sourcefile = new Par2RepairerSourceFile(NULL, packet); - // Record the source file in the source file std::map + // Record the source file in the source file map sourcefilemap.insert(std::pair(fileid, sourcefile)); return true; @@ -982,7 +982,7 @@ bool Par2Repairer::CreateSourceFileList(void) { const MD5Hash &fileid = mainpacket->FileId(filenumber); - // Look up the fileid in the source file std::map + // Look up the fileid in the source file map std::map::iterator sfmi = sourcefilemap.find(fileid); Par2RepairerSourceFile *sourcefile = (sfmi == sourcefilemap.end()) ? 0 :sfmi->second; @@ -1166,7 +1166,7 @@ bool Par2Repairer::VerifySourceFiles(const std::string& basepath, std::vector sortedfiles; @@ -1234,7 +1234,7 @@ bool Par2Repairer::VerifySourceFiles(const std::string& basepath, std::vector::iterator rp = recoverypacketmap.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 packet @@ -2425,7 +2425,7 @@ bool Par2Repairer::ComputeRSmatrix(void) //if (!recoveryblock->Open()) // 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 @@ -2673,7 +2673,7 @@ bool Par2Repairer::VerifyTargetFiles(const std::string &basepath) } #endif - // Iterate through each file in the verification std::list + // Iterate through each file in the verification list #pragma omp parallel for schedule(dynamic) num_threads(Par2Repairer::GetFileThreads()) for (int i=0; i< static_cast(verifylist.size()); ++i) { @@ -2721,7 +2721,7 @@ bool Par2Repairer::DeleteIncompleteTargetFiles(void) { std::vector::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()) { Par2RepairerSourceFile *sourcefile = *sf; diff --git a/src/utf8.cpp b/src/utf8.cpp index cd1ba485..48d542e4 100644 --- a/src/utf8.cpp +++ b/src/utf8.cpp @@ -58,7 +58,7 @@ namespace utf8 } catch (const std::exception& e) { - std::cerr << "Failed to convert UTF-8 to wide std::string: " << e.what() << std::endl; + std::cerr << "Failed to convert UTF-8 to wide string: " << e.what() << std::endl; return L""; } } @@ -74,7 +74,7 @@ namespace utf8 } catch (const std::exception& e) { - std::cerr << "Failed to convert wide to UTF-8 std::string: " << e.what() << std::endl; + std::cerr << "Failed to convert wide to UTF-8 string: " << e.what() << std::endl; return ""; } } diff --git a/src/utf8_test.cpp b/src/utf8_test.cpp index 762df37d..48491003 100644 --- a/src/utf8_test.cpp +++ b/src/utf8_test.cpp @@ -73,11 +73,11 @@ int test3() int test4() { - std::string specialCharsString = "This std::string has: !@#$%^&*()_+=-`~[]{}:;'<>,.?/"; - std::wstring expectedWide = L"This std::string has: !@#$%^&*()_+=-`~[]{}:;'<>,.?/"; + std::string specialCharsString = "This string has: !@#$%^&*()_+=-`~[]{}:;'<>,.?/"; + std::wstring expectedWide = L"This string has: !@#$%^&*()_+=-`~[]{}:;'<>,.?/"; std::wstring actualWide = Utf8ToWide(specialCharsString); - std::string expectedUtf8 = "This std::string has: !@#$%^&*()_+=-`~[]{}:;'<>,.?/"; + std::string expectedUtf8 = "This string has: !@#$%^&*()_+=-`~[]{}:;'<>,.?/"; std::string actualUtf8 = WideToUtf8(expectedWide); if (actualWide == expectedWide && actualUtf8 == expectedUtf8)