From 3deb5826792c80c450b4ab99c3c8a850cfeba16d Mon Sep 17 00:00:00 2001 From: fangyunzhong Date: Sat, 15 Jun 2024 13:57:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AC=E7=A0=81bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fangyunzhong --- src/compression_parser.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/compression_parser.cpp b/src/compression_parser.cpp index d6c39b3..04cf04e 100644 --- a/src/compression_parser.cpp +++ b/src/compression_parser.cpp @@ -34,7 +34,7 @@ constexpr int OPT_SIZE_ONE = 1; constexpr int OPT_SIZE_TWO = 2; const map ERRORCODEMAP = { { TranscodeError::SUCCESS, "SUCCESS" }, - { TranscodeError::INVALID_PARAMETERS, "ANIMATED_IMAGE_SKIP" }, + { TranscodeError::INVALID_PARAMETERS, "INVALID_PARAMETERS" }, { TranscodeError::IMAGE_ERROR, "IMAGE_ERROR" }, { TranscodeError::ANIMATED_IMAGE_SKIP, "ANIMATED_IMAGE_SKIP" }, { TranscodeError::MALLOC_FAILED, "MALLOC_FAILED" }, @@ -293,7 +293,7 @@ bool CompressionParser::LoadImageTranscoder() bool CompressionParser::SetTranscodeOptions(const string &optionJson) { if (!handle_) { - cerr << "Error: handle_ is nullptr." << endl; + cerr << "Warning: SetTranscodeOptions handle_ is nullptr." << endl; return false; } #ifdef __WIN32 @@ -302,12 +302,12 @@ bool CompressionParser::SetTranscodeOptions(const string &optionJson) ISetTranscodeOptions iSetTranscodeOptions = (ISetTranscodeOptions)dlsym(handle_, "SetTranscodeOptions"); #endif if (!iSetTranscodeOptions) { - cerr << "Error: Failed to get the 'SetTranscodeOptions'." << endl; + cerr << "Warning: Failed to get the 'SetTranscodeOptions'." << endl; return false; } bool ret = (*iSetTranscodeOptions)(optionJson); if (!ret) { - cerr << "Error: SetTranscodeOptions failed." << endl; + cerr << "Warning: SetTranscodeOptions failed." << endl; return false; } return true; @@ -316,7 +316,7 @@ bool CompressionParser::SetTranscodeOptions(const string &optionJson) TranscodeError CompressionParser::TranscodeImages(const string &imagePath, string &outputPath, TranscodeResult &result) { if (!handle_) { - cerr << "Error: handle_ is nullptr." << endl; + cerr << "Warning: TranscodeImages handle_ is nullptr." << endl; return TranscodeError::LOAD_COMPRESS_FAILED; } #ifdef __WIN32 @@ -325,17 +325,17 @@ TranscodeError CompressionParser::TranscodeImages(const string &imagePath, strin ITranscodeImages iTranscodeImages = (ITranscodeImages)dlsym(handle_, "Transcode"); #endif if (!iTranscodeImages) { - cerr << "Error: Failed to get the 'Transcode'." << endl; + cerr << "Warning: Failed to get the 'Transcode'." << endl; return TranscodeError::LOAD_COMPRESS_FAILED; } TranscodeError ret = (*iTranscodeImages)(imagePath, outputPath, result); if (ret != TranscodeError::SUCCESS) { auto iter = ERRORCODEMAP.find(ret); if (iter != ERRORCODEMAP.end()) { - cerr << "Error: TranscodeImages failed, error message: " << iter->second << ", file path = " << + cerr << "Warning: TranscodeImages failed, error message: " << iter->second << ", file path = " << imagePath << endl; } else { - cerr << "Error: TranscodeImages failed" << ", file path = " << imagePath << endl; + cerr << "Warning: TranscodeImages failed" << ", file path = " << imagePath << endl; } return ret; } @@ -358,6 +358,7 @@ bool CompressionParser::IsInExcludePath(const string &src, const shared_ptrexcludePath); } + string CompressionParser::GetOptionsString(const shared_ptr &compressFilter, int type) { if (compressFilter->rules.size() == 0 || compressFilter->expandRules.size() == 0) { @@ -447,7 +448,7 @@ bool CompressionParser::CheckAndTranscode(const string &src, string &dst, string if (!IsInPath(src, compressFilter)) { return false; } - if (IsInExcludePath(src, compressFilter)) { + if (!IsInExcludePath(src, compressFilter)) { if (!SetTranscodeOptions(GetOptionsString(compressFilter, OPT_TYPE_ONE))) { return false; }