mirror of
https://github.com/openharmony/developtools_global_resource_tool.git
synced 2026-07-18 17:24:42 -04:00
还原部分warning日志级别为cout与5.0版本保持一致
Signed-off-by: liduo <liduo29@huawei.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
+18
-18
@@ -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<string> 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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -267,7 +267,7 @@ bool ResourceAppend::ScanFiles(const unique_ptr<FileEntry> &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());
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -101,9 +101,9 @@ uint32_t ResourceModule::MergeResourceItem(map<int64_t, vector<ResourceItem>> &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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+1
-1
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user