!355 AI检视问题修改

Merge pull request !355 from 梁瑾/master
This commit is contained in:
openharmony_ci 2024-09-13 02:08:37 +00:00 committed by Gitee
commit a3861dc88f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 17 additions and 21 deletions

View File

@ -137,7 +137,7 @@ napi_value NapiPrintTask::PrintByAdapter(napi_env env, napi_callback_info info)
napi_value NapiPrintTask::ParsePrintAdapterParameter(napi_env env, size_t argc, napi_value *argv, napi_value self)
{
if (argc > NapiPrintUtils::ARGC_THREE && argc > NapiPrintUtils::ARGC_TWO) {
if (argc > NapiPrintUtils::ARGC_THREE) {
std::string printJobName = NapiPrintUtils::GetStringFromValueUtf8(env, argv[0]);
std::shared_ptr<PrintAttributes> printAttributes =

View File

@ -75,7 +75,9 @@ static constexpr const char *FUNCTION_GET_ADDED_PRINTER_INFO_BY_ID = "getAddedPr
static void SetEnumProperty(napi_env env, napi_value object, const std::string &name, uint32_t value)
{
napi_value tempValue = nullptr;
napi_create_int32(env, value, &tempValue);
if (napi_create_int32(env, value, &tempValue) != napi_ok) {
return;
}
napi_set_named_property(env, object, name.c_str(), tempValue);
}

View File

@ -45,19 +45,19 @@ static const std::string CALLER_PKG_NAME = "caller.pkgName";
PrintTask::PrintTask(const std::vector<std::string> &innerList, const sptr<IRemoteObject> &innerCallerToken_)
: taskId_("")
{
if (innerList.begin()->find("fd://") == 0) {
PRINT_HILOGD("list type: fdlist");
for (auto fdPath : innerList) {
pathType_ = FD_PATH;
uint32_t fd = PrintUtils::GetIdFromFdPath(fdPath);
fdList_.emplace_back(fd);
}
} else {
PRINT_HILOGD("list type: filelist");
fileList_.assign(innerList.begin(), innerList.end());
pathType_ = FILE_PATH_ABSOLUTED;
if (fileList_.size() > 0) {
if (fileList_.begin()->find("file://") == 0) {
if (!innerList.empty()) {
if (innerList.begin()->find("fd://") == 0) {
PRINT_HILOGD("list type: fdlist");
for (auto fdPath : innerList) {
pathType_ = FD_PATH;
uint32_t fd = PrintUtils::GetIdFromFdPath(fdPath);
fdList_.emplace_back(fd);
}
} else {
PRINT_HILOGD("list type: filelist");
fileList_.assign(innerList.begin(), innerList.end());
pathType_ = FILE_PATH_ABSOLUTED;
if (!fileList_.empty() && fileList_.begin()->find("file://") == 0) {
pathType_ = FILE_PATH;
}
}
@ -178,10 +178,6 @@ uint32_t PrintTask::CallSpooler(
}
auto asyncContext = std::make_shared<BaseContext>();
if (asyncContext == nullptr) {
PRINT_HILOGE("create asyncContext failed.");
return E_PRINT_SERVER_FAILURE;
}
asyncContext->env = env;
asyncContext->requestType = PrintRequestType::REQUEST_TYPE_START;
if (!ParseAbilityContextReq(env, argv[contextIndex], asyncContext->context, asyncContext->uiExtensionContext)) {

View File

@ -107,14 +107,12 @@ void PrintCupsAttributeTest::DoTestResponse(PreAttrTestFunc preFunc, PostRespons
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", 1, nullptr, ATTR_TEST_ALL);
ipp_t *response = ippNewResponse(request);
ippDelete(request);
request = nullptr;
if (response == nullptr) {
return;
}
preFunc(response);
postFunc(response);
ippDelete(response);
response = nullptr;
}
void PrintCupsAttributeTest::DoTest(PreAttrTestFunc preFunc, PostAttrTestFunc postFunc)