diff --git a/src/cmd/package_parser.cpp b/src/cmd/package_parser.cpp index 43ebc91f9e0655497eae80736c78d38a748cdfe3..6d8ba8b4209d23fc64b8ac0ccb418b1e5df77535 100644 --- a/src/cmd/package_parser.cpp +++ b/src/cmd/package_parser.cpp @@ -364,7 +364,7 @@ uint32_t PackageParser::AddAppend(const string& argValue) { string appendPath = ResourceUtil::RealPath(argValue); if (appendPath.empty()) { - cerr << "Warning: invalid compress '" << argValue << "'" << endl; + cout << "Warning: invalid compress '" << argValue << "'" << endl; appendPath = argValue; } auto ret = find_if(append_.begin(), append_.end(), [appendPath](auto iter) {return appendPath == iter;}); @@ -573,7 +573,7 @@ uint32_t PackageParser::HandleProcess(int c, const string &argValue) { auto handler = handles_.find(c); if (handler == handles_.end()) { - cerr << "Warning: unsupport " << c << endl; + PrintError(GetError(ERR_CODE_UNKNOWN_OPTION).FormatCause(std::to_string(c).c_str())); return RESTOOL_ERROR; } return handler->second(argValue); diff --git a/src/compression_parser.cpp b/src/compression_parser.cpp index c6eff90a23920d81d95af0d603be652dfa771a1f..26504a4509e0b299cfad4e7ec692bd31c8a17750 100644 --- a/src/compression_parser.cpp +++ b/src/compression_parser.cpp @@ -160,25 +160,25 @@ bool CompressionParser::ParseCompression(const cJSON *compressionNode) bool CompressionParser::ParseContext(const cJSON *contextNode) { if (!contextNode) { - cerr << "Warning: if image transcoding is supported, the 'context' node cannot be empty."; + cout << "Warning: if image transcoding is supported, the 'context' node cannot be empty."; return false; } if (!cJSON_IsObject(contextNode)) { - cerr << "Warning: 'context' must be object."; + cout << "Warning: 'context' must be object."; return false; } cJSON *extensionPathNode = cJSON_GetObjectItem(contextNode, "extensionPath"); if (!extensionPathNode) { - cerr << "Warning: if image transcoding is supported, the 'extensionPath' node cannot be empty."; + cout << "Warning: if image transcoding is supported, the 'extensionPath' node cannot be empty."; return false; } if (!cJSON_IsString(extensionPathNode)) { - cerr << "Warning: 'extensionPath' must be string."; + cout << "Warning: 'extensionPath' must be string."; return false; } extensionPath_ = extensionPathNode->valuestring; if (extensionPath_.empty()) { - cerr << "Warning: 'extensionPath' value cannot be empty."; + cout << "Warning: 'extensionPath' value cannot be empty."; return false; } return true; @@ -249,7 +249,7 @@ string CompressionParser::ParseRules(const cJSON *rulesNode) { string res = ""; if (!rulesNode || !cJSON_IsObject(rulesNode)) { - cerr << "Warning: rules is not exist or node type is wrong" << endl; + cout << "Warning: rules is not exist or node type is wrong" << endl; return res; } for (cJSON *item = rulesNode->child; item; item = item->next) { @@ -273,7 +273,7 @@ vector CompressionParser::ParsePath(const cJSON *pathNode) return res; } if (!cJSON_IsArray(pathNode)) { - cerr << "Warning: pathnode is not array." << endl; + cout << "Warning: pathnode is not array." << endl; return res; } for (cJSON *item = pathNode->child; item; item = item->next) { @@ -337,7 +337,7 @@ bool CompressionParser::LoadImageTranscoder() bool CompressionParser::SetTranscodeOptions(const string &optionJson, const string &optionJsonExclude) { if (!handle_) { - cerr << "Warning: SetTranscodeOptions handle_ is nullptr." << endl; + cout << "Warning: SetTranscodeOptions handle_ is nullptr." << endl; return false; } #ifdef __WIN32 @@ -346,12 +346,12 @@ bool CompressionParser::SetTranscodeOptions(const string &optionJson, const stri ISetTranscodeOptions iSetTranscodeOptions = (ISetTranscodeOptions)dlsym(handle_, "SetTranscodeOptions"); #endif if (!iSetTranscodeOptions) { - cerr << "Warning: Failed to get the 'SetTranscodeOptions'." << endl; + cout << "Warning: Failed to get the 'SetTranscodeOptions'." << endl; return false; } bool ret = (*iSetTranscodeOptions)(optionJson, optionJsonExclude); if (!ret) { - cerr << "Warning: SetTranscodeOptions failed." << endl; + cout << "Warning: SetTranscodeOptions failed." << endl; return false; } return true; @@ -361,7 +361,7 @@ TranscodeError CompressionParser::TranscodeImages(const string &imagePath, const string &outputPath, TranscodeResult &result) { if (!handle_) { - cerr << "Warning: TranscodeImages handle_ is nullptr." << endl; + cout << "Warning: TranscodeImages handle_ is nullptr." << endl; return TranscodeError::LOAD_COMPRESS_FAILED; } #ifdef __WIN32 @@ -370,17 +370,17 @@ TranscodeError CompressionParser::TranscodeImages(const string &imagePath, const ITranscodeImages iTranscodeImages = (ITranscodeImages)dlsym(handle_, "Transcode"); #endif if (!iTranscodeImages) { - cerr << "Warning: Failed to get the 'Transcode'." << endl; + cout << "Warning: Failed to get the 'Transcode'." << endl; return TranscodeError::LOAD_COMPRESS_FAILED; } TranscodeError ret = (*iTranscodeImages)(imagePath, extAppend, outputPath, result); if (ret != TranscodeError::SUCCESS) { auto iter = ERRORCODEMAP.find(ret); if (iter != ERRORCODEMAP.end()) { - cerr << "Warning: TranscodeImages failed, error message: " << iter->second << ", file path = " << + cout << "Warning: TranscodeImages failed, error message: " << iter->second << ", file path = " << imagePath << endl; } else { - cerr << "Warning: TranscodeImages failed" << ", file path = " << imagePath << endl; + cout << "Warning: TranscodeImages failed" << ", file path = " << imagePath << endl; } return ret; } @@ -390,7 +390,7 @@ TranscodeError CompressionParser::TranscodeImages(const string &imagePath, const TranscodeError CompressionParser::ScaleImage(const std::string &imagePath, std::string &outputPath) { if (!handle_) { - cerr << "Warning: ScaleImage handle_ is nullptr." << endl; + cout << "Warning: ScaleImage handle_ is nullptr." << endl; return TranscodeError::LOAD_COMPRESS_FAILED; } #ifdef __WIN32 @@ -399,17 +399,17 @@ TranscodeError CompressionParser::ScaleImage(const std::string &imagePath, std:: IScaleImage iScaleImage = (IScaleImage)dlsym(handle_, "TranscodeSLR"); #endif if (!iScaleImage) { - cerr << "Warning: Failed to get the 'TranscodeSLR'." << endl; + cout << "Warning: Failed to get the 'TranscodeSLR'." << endl; return TranscodeError::LOAD_COMPRESS_FAILED; } TranscodeError ret = (*iScaleImage)(imagePath, outputPath, { 512, 512 }); if (ret != TranscodeError::SUCCESS) { auto iter = ERRORCODEMAP.find(ret); if (iter != ERRORCODEMAP.end()) { - cerr << "Warning: ScaleImage failed, error message: " << iter->second << ", file path = " << imagePath + cout << "Warning: ScaleImage failed, error message: " << iter->second << ", file path = " << imagePath << endl; } else { - cerr << "Warning: ScaleImage failed" << ", file path = " << imagePath << endl; + cout << "Warning: ScaleImage failed" << ", file path = " << imagePath << endl; } return ret; } diff --git a/src/resconfig_parser.cpp b/src/resconfig_parser.cpp index 73ed4d7ecdbdfe8ead3b87894f577d2de2f3a503..e72fa1ed8a560e0f3557681551b5130a0bd3d79c 100644 --- a/src/resconfig_parser.cpp +++ b/src/resconfig_parser.cpp @@ -47,7 +47,7 @@ uint32_t ResConfigParser::Init(const string &filePath, HandleBack callback) for (cJSON *item = root_->child; item; item = item->next) { auto handler = fileListHandles_.find(item->string); if (handler == fileListHandles_.end()) { - cerr << "Warning: unsupport " << item->string << endl; + cout << "Warning: unsupport " << item->string << endl; continue; } if (handler->second(item) != RESTOOL_SUCCESS) { diff --git a/src/resource_append.cpp b/src/resource_append.cpp index 34eb4dbf2a79eb6f619440f096474e58f7b0215a..4ecc9b21230488ad2689b45ed521010aa42c817c 100644 --- a/src/resource_append.cpp +++ b/src/resource_append.cpp @@ -267,7 +267,7 @@ bool ResourceAppend::ScanFiles(const unique_ptr &entry, bool ResourceAppend::ScanFile(const FileInfo &fileInfo, const string &outputPath) { if (ResourceAppend::IsBaseIdDefined(fileInfo)) { - cerr << "Warning: id_defined.json does not compile to generate intermediate files" << endl; + cout << "Warning: id_defined.json does not compile to generate intermediate files" << endl; FileEntry::FilePath outPath(outputPath); return ResourceUtil::CopyFileInner(fileInfo.filePath, outPath.Append(ID_DEFINED_FILE).GetPath()); } diff --git a/src/resource_check.cpp b/src/resource_check.cpp index 9312ab4f036eadcfea277af8a844af0a342b951a..97047896ef216524e528336cabd9a205ea520f37 100755 --- a/src/resource_check.cpp +++ b/src/resource_check.cpp @@ -72,7 +72,7 @@ void ResourceCheck::CheckNodeInResourceItem(const string &key, const ResourceIte return; } if (width != height) { - cout << "Warning: the png width and height not equal" << NEW_LINE_PATH << filePath << endl; + cerr << "Warning: the png width and height not equal" << NEW_LINE_PATH << filePath << endl; return; } auto result = g_keyNodeIndexs.find(key); diff --git a/src/resource_module.cpp b/src/resource_module.cpp index fef6ed983bc526450d90487c02605f7e64dadaa2..89202b27a478f1f5adbc5dbe69405b47f71f538f 100644 --- a/src/resource_module.cpp +++ b/src/resource_module.cpp @@ -101,9 +101,9 @@ uint32_t ResourceModule::MergeResourceItem(map> &a resourceItem.GetFilePath().c_str())); return RESTOOL_ERROR; } - cerr << "Warning: '"<< resourceItem.GetName() <<"' conflict, first declared."; - cerr << NEW_LINE_PATH << ret->GetFilePath() << endl; - cerr << "but declared again." << NEW_LINE_PATH << resourceItem.GetFilePath() << endl; + cout << "Warning: '"<< resourceItem.GetName() <<"' conflict, first declared."; + cout << NEW_LINE_PATH << ret->GetFilePath() << endl; + cout << "but declared again." << NEW_LINE_PATH << resourceItem.GetFilePath() << endl; } } return RESTOOL_SUCCESS; diff --git a/src/resource_pack.cpp b/src/resource_pack.cpp index 66dfb6ec31ba52e529d99664ab1d1e7595fedd68..49830c377a239ea99eb3d200f619bc78030aeb36 100644 --- a/src/resource_pack.cpp +++ b/src/resource_pack.cpp @@ -177,7 +177,7 @@ uint32_t ResourcePack::GenerateHeader() const string extension = FileEntry::FilePath(headerPath).GetExtension(); auto it = headerCreaters_.find(extension); if (it == headerCreaters_.end()) { - cerr << "Warning: don't support header file format '" << headerPath << "'" << endl; + cout << "Warning: don't support header file format '" << headerPath << "'" << endl; continue; } if (it->second(headerPath) != RESTOOL_SUCCESS) { diff --git a/src/thread_pool.cpp b/src/thread_pool.cpp index b9be1adfdb3307b6427ca6b416bb63416bdb7e02..c7e0de38c67795711493f641c7beab7d1a83fde7 100644 --- a/src/thread_pool.cpp +++ b/src/thread_pool.cpp @@ -36,7 +36,7 @@ ThreadPool &ThreadPool::GetInstance() uint32_t ThreadPool::Start(const size_t &threadCount) { if (!workerThreads_.empty()) { - cerr << "Warning: ThreadPool is already started." << endl; + cout << "Warning: ThreadPool is already started." << endl; return RESTOOL_SUCCESS; } size_t hardwareCount = std::thread::hardware_concurrency();