Revision 64e2408d
Added by David Sorber almost 8 years ago
| software/photo_compress_archiver/PhotoCompressArchiver.cc | ||
|---|---|---|
|
#define WRKR_OUT_ERR(msg) { \
|
||
|
std::lock_guard<std::mutex> lock(m_output_mutex); \
|
||
|
std::cerr << "T[" << std::setw(2) << tid << "] " << BOLD << RED \
|
||
|
<< "ERROR: " << msg << std::endl; \
|
||
|
<< "ERROR: " << ENDC << msg << std::endl; \
|
||
|
}
|
||
|
|
||
|
// Helper functions
|
||
|
std::string _format_num_bytes(uint64_t num_bytes)
|
||
|
{
|
||
|
const uint64_t tera = (1024 * 1024 * 1024L);
|
||
|
const uint64_t tera = (1024 * 1024 * 1024 * 1024L);
|
||
|
const uint64_t giga = (1024 * 1024 * 1024L);
|
||
|
const uint64_t mega = (1024 * 1024L);
|
||
|
const uint64_t kilo = 1024L;
|
||
| ... | ... | |
|
// Print out message if any errors were found
|
||
|
if (m_errors.size() > 0)
|
||
|
{
|
||
|
std::cout << BOLD << RED << "NOTE: errors were encountered processing "
|
||
|
<< "the following " << m_errors.size() << " files:\n" << ENDC
|
||
|
<< std::endl;
|
||
|
std::cout << BOLD << RED << "\n\nNOTE: errors were encountered "
|
||
|
<< "processing the following " << m_errors.size()
|
||
|
<< " files:\n" << ENDC << std::endl;
|
||
|
|
||
|
WorkUnit* work_unit = nullptr;
|
||
|
for (uint32_t idx = 0; idx < m_errors.size(); ++idx)
|
||
| ... | ... | |
|
}
|
||
|
else
|
||
|
{
|
||
|
WRKR_OUT_ERR("the input file does not appear to be a valid "
|
||
|
WRKR_OUT_ERR("the input file \"" << work_unit->m_path
|
||
|
<< "\" does not appear to be a valid "
|
||
|
"packjpg (.pjg) file even though its filename "
|
||
|
"suggests it is!\n")
|
||
|
m_errors.push_back(work_unit);
|
||
| ... | ... | |
|
}
|
||
|
else
|
||
|
{
|
||
|
WRKR_OUT_ERR("the input file does not appear to be a valid "
|
||
|
WRKR_OUT_ERR("the input file \"" << work_unit->m_path
|
||
|
<< "\" does not appear to be a valid "
|
||
|
"JPEG (.jpg) file even though its filename "
|
||
|
"suggests it is!\n")
|
||
|
m_errors.push_back(work_unit);
|
||
| ... | ... | |
|
&out_size, message);
|
||
|
if (!rc)
|
||
|
{
|
||
|
WRKR_OUT_ERR("An error occurred during the compression"
|
||
|
<< "/decompression operation: " << message << "\n")
|
||
|
WRKR_OUT_ERR("An error occurred during the "
|
||
|
<< (m_decompress ? "decompression" : "compression")
|
||
|
<< " operation on " << work_unit->m_path
|
||
|
<< ": " << message << "\n")
|
||
|
m_errors.push_back(work_unit);
|
||
|
continue;
|
||
|
}
|
||
Fix minor formatting bug and improve error message handling.