mirror of
https://gitee.com/openharmony/print_print_fwk
synced 2024-11-23 08:59:47 +00:00
commit
a3861dc88f
@ -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 =
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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)) {
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user