!234 修正warning日志级别

Merge pull request !234 from liduo/log_level
This commit is contained in:
openharmony_ci
2025-04-25 08:18:13 +00:00
committed by Gitee
11 changed files with 40 additions and 40 deletions
+2 -2
View File
@@ -364,7 +364,7 @@ uint32_t PackageParser::AddAppend(const string& argValue)
{
string appendPath = ResourceUtil::RealPath(argValue);
if (appendPath.empty()) {
cout << "Warning: invalid compress '" << argValue << "'" << endl;
cerr << "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()) {
cout << "Warning: unsupport " << c << endl;
cerr << "Warning: unsupport " << c << endl;
return RESTOOL_ERROR;
}
return handler->second(argValue);
+24 -24
View File
@@ -125,8 +125,8 @@ uint32_t CompressionParser::Init()
bool CompressionParser::ParseCompression(const cJSON *compressionNode)
{
if (!compressionNode) {
cout << "Warning: get 'compression' node is empty, the compiled images are not transcoded.";
cout << NEW_LINE_PATH << filePath_ << endl;
cerr << "Warning: get 'compression' node is empty, the compiled images are not transcoded.";
cerr << NEW_LINE_PATH << filePath_ << endl;
return true;
}
if (!cJSON_IsObject(compressionNode)) {
@@ -135,8 +135,8 @@ bool CompressionParser::ParseCompression(const cJSON *compressionNode)
}
cJSON *mediaNode = cJSON_GetObjectItem(compressionNode, "media");
if (!mediaNode) {
cout << "Warning: get 'media' node is empty, the compiled images are not transcoded.";
cout << NEW_LINE_PATH << filePath_ << endl;
cerr << "Warning: get 'media' node is empty, the compiled images are not transcoded.";
cerr << NEW_LINE_PATH << filePath_ << endl;
return true;
}
if (!cJSON_IsObject(mediaNode)) {
@@ -145,8 +145,8 @@ bool CompressionParser::ParseCompression(const cJSON *compressionNode)
}
cJSON *enableNode = cJSON_GetObjectItem(mediaNode, "enable");
if (!enableNode) {
cout << "Warning: get 'enable' node is empty, the compiled images are not transcoded.";
cout << NEW_LINE_PATH << filePath_ << endl;
cerr << "Warning: get 'enable' node is empty, the compiled images are not transcoded.";
cerr << NEW_LINE_PATH << filePath_ << endl;
return true;
}
if (!cJSON_IsBool(enableNode)) {
@@ -160,25 +160,25 @@ bool CompressionParser::ParseCompression(const cJSON *compressionNode)
bool CompressionParser::ParseContext(const cJSON *contextNode)
{
if (!contextNode) {
cout << "Warning: if image transcoding is supported, the 'context' node cannot be empty.";
cerr << "Warning: if image transcoding is supported, the 'context' node cannot be empty.";
return false;
}
if (!cJSON_IsObject(contextNode)) {
cout << "Warning: 'context' must be object.";
cerr << "Warning: 'context' must be object.";
return false;
}
cJSON *extensionPathNode = cJSON_GetObjectItem(contextNode, "extensionPath");
if (!extensionPathNode) {
cout << "Warning: if image transcoding is supported, the 'extensionPath' node cannot be empty.";
cerr << "Warning: if image transcoding is supported, the 'extensionPath' node cannot be empty.";
return false;
}
if (!cJSON_IsString(extensionPathNode)) {
cout << "Warning: 'extensionPath' must be string.";
cerr << "Warning: 'extensionPath' must be string.";
return false;
}
extensionPath_ = extensionPathNode->valuestring;
if (extensionPath_.empty()) {
cout << "Warning: 'extensionPath' value cannot be empty.";
cerr << "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)) {
cout << "Warning: rules is not exist or node type is wrong" << endl;
cerr << "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)) {
cout << "Warning: pathnode is not array." << endl;
cerr << "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_) {
cout << "Warning: SetTranscodeOptions handle_ is nullptr." << endl;
cerr << "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) {
cout << "Warning: Failed to get the 'SetTranscodeOptions'." << endl;
cerr << "Warning: Failed to get the 'SetTranscodeOptions'." << endl;
return false;
}
bool ret = (*iSetTranscodeOptions)(optionJson, optionJsonExclude);
if (!ret) {
cout << "Warning: SetTranscodeOptions failed." << endl;
cerr << "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_) {
cout << "Warning: TranscodeImages handle_ is nullptr." << endl;
cerr << "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) {
cout << "Warning: Failed to get the 'Transcode'." << endl;
cerr << "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()) {
cout << "Warning: TranscodeImages failed, error message: " << iter->second << ", file path = " <<
cerr << "Warning: TranscodeImages failed, error message: " << iter->second << ", file path = " <<
imagePath << endl;
} else {
cout << "Warning: TranscodeImages failed" << ", file path = " << imagePath << endl;
cerr << "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_) {
cout << "Warning: ScaleImage handle_ is nullptr." << endl;
cerr << "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) {
cout << "Warning: Failed to get the 'TranscodeSLR'." << endl;
cerr << "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()) {
cout << "Warning: ScaleImage failed, error message: " << iter->second << ", file path = " << imagePath
cerr << "Warning: ScaleImage failed, error message: " << iter->second << ", file path = " << imagePath
<< endl;
} else {
cout << "Warning: ScaleImage failed" << ", file path = " << imagePath << endl;
cerr << "Warning: ScaleImage failed" << ", file path = " << imagePath << endl;
}
return ret;
}
+2 -2
View File
@@ -135,7 +135,7 @@ bool ConfigParser::SetAppIcon(string &icon, int64_t id)
{
cJSON *appNode = cJSON_GetObjectItem(root_, "app");
if (!appNode || !cJSON_IsObject(appNode)) {
cout << "Warning: 'app' not object" << endl;
cerr << "Warning: 'app' not object" << endl;
return false;
}
cJSON_AddStringToObject(appNode, "icon", icon.c_str());
@@ -147,7 +147,7 @@ bool ConfigParser::SetAppLabel(string &label, int64_t id)
{
cJSON *appNode = cJSON_GetObjectItem(root_, "app");
if (!appNode || !cJSON_IsObject(appNode)) {
cout << "Warning: 'app' not object" << endl;
cerr << "Warning: 'app' not object" << endl;
return false;
}
cJSON_AddStringToObject(appNode, "label", label.c_str());
+1 -1
View File
@@ -50,7 +50,7 @@ bool FileEntry::Init()
{
string filePath = filePath_.GetPath();
if (!Exist(filePath)) {
cout << "Warning: file not exist: " << filePath << endl;
cerr << "Warning: file not exist: " << filePath << endl;
return false;
}
+2 -2
View File
@@ -104,8 +104,8 @@ uint32_t IdDefinedParser::Init(const string &filePath, bool isSystem)
return RESTOOL_ERROR;
}
if (cJSON_GetArraySize(recordNode) == 0) {
cout << "Warning: 'record' node is empty, please check the JSON file.";
cout << NEW_LINE_PATH << filePath << endl;
cerr << "Warning: 'record' node is empty, please check the JSON file.";
cerr << NEW_LINE_PATH << filePath << endl;
return RESTOOL_SUCCESS;
}
int64_t startSysId = 0;
+1 -1
View File
@@ -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()) {
cout << "Warning: unsupport " << item->string << endl;
cerr << "Warning: unsupport " << item->string << endl;
continue;
}
if (handler->second(item) != RESTOOL_SUCCESS) {
+1 -1
View File
@@ -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)) {
cout << "Warning: id_defined.json does not compile to generate intermediate files" << endl;
cerr << "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());
}
+3 -3
View File
@@ -101,9 +101,9 @@ uint32_t ResourceModule::MergeResourceItem(map<int64_t, vector<ResourceItem>> &a
resourceItem.GetFilePath().c_str()));
return RESTOOL_ERROR;
}
cout << "Warning: '"<< resourceItem.GetName() <<"' conflict, first declared.";
cout << NEW_LINE_PATH << ret->GetFilePath() << endl;
cout << "but declared again." << NEW_LINE_PATH << resourceItem.GetFilePath() << endl;
cerr << "Warning: '"<< resourceItem.GetName() <<"' conflict, first declared.";
cerr << NEW_LINE_PATH << ret->GetFilePath() << endl;
cerr << "but declared again." << NEW_LINE_PATH << resourceItem.GetFilePath() << endl;
}
}
return RESTOOL_SUCCESS;
+1 -1
View File
@@ -177,7 +177,7 @@ uint32_t ResourcePack::GenerateHeader() const
string extension = FileEntry::FilePath(headerPath).GetExtension();
auto it = headerCreaters_.find(extension);
if (it == headerCreaters_.end()) {
cout << "Warning: don't support header file format '" << headerPath << "'" << endl;
cerr << "Warning: don't support header file format '" << headerPath << "'" << endl;
continue;
}
if (it->second(headerPath) != RESTOOL_SUCCESS) {
+2 -2
View File
@@ -503,8 +503,8 @@ bool ResourceUtil::IsValidName(const string &name)
void ResourceUtil::PrintWarningMsg(vector<pair<ResType, string>> &noBaseResource)
{
for (const auto &item : noBaseResource) {
cout << "Warning: the " << ResourceUtil::ResTypeToString(item.first);
cout << " of '" << item.second << "' does not have a base resource." << endl;
cerr << "Warning: the " << ResourceUtil::ResTypeToString(item.first);
cerr << " of '" << item.second << "' does not have a base resource." << endl;
}
}
+1 -1
View File
@@ -36,7 +36,7 @@ ThreadPool &ThreadPool::GetInstance()
uint32_t ThreadPool::Start(const size_t &threadCount)
{
if (!workerThreads_.empty()) {
cout << "Warning: ThreadPool is already started." << endl;
cerr << "Warning: ThreadPool is already started." << endl;
return RESTOOL_SUCCESS;
}
size_t hardwareCount = std::thread::hardware_concurrency();