From 6440df9196f93aa6f145a22dbc32c67e442f88c9 Mon Sep 17 00:00:00 2001 From: tb55xemi <thomas.boy@idiv.de> Date: Mon, 18 Nov 2019 13:28:28 +0100 Subject: [PATCH] try to avoid error during read in the tar file --- Demo.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Demo.cpp b/Demo.cpp index 19e8fad..644e919 100644 --- a/Demo.cpp +++ b/Demo.cpp @@ -251,6 +251,7 @@ int main(int argc, char * argv[]) int everyPic= 60*5; //std::string fileName; int frameCounter=0; + int myFileTarWriterHeaderCounter = 0; int frameCounterOld = -1; vector<string> myFileErrorList;//list for pure io error vector<string> myFileListNoContour; //list for no contours found; @@ -297,9 +298,11 @@ int main(int argc, char * argv[]) if (r != ARCHIVE_OK) { cerr<<"archive_write_header() error: "<< archive_error_string(ext)<<endl; + myFileTarWriterHeaderCounter++; + continue; //we overjump all in our for loop } - else - { + //else + //{ //we copy all data to the buffer vector vec = copyDataInBuffer(archive); if(vec.empty()) @@ -311,7 +314,7 @@ int main(int argc, char * argv[]) cerr<<"archive_write_finish_entry: error: "<< archive_error_string(ext) <<" will abort"<< endl; exit(1); } - } + //} //we read the image buffer as a jpg picture and decode it Mat img_input = imdecode(Mat(vec), 1); @@ -591,6 +594,8 @@ int main(int argc, char * argv[]) //TODO we should merge the file + cout<< "amount of libarchive read header errors :"<< myFileTarWriterHeaderCounter; + //we write the random file list to a file std::string nameOutErrorList = outputDir + "fileErrorList.yml"; cout <<"amount of file errors: "<< myFileErrorList.size()<<endl; -- GitLab