From 2546b57063aa434f3861c9cdcd83eea30755d291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=99=BA=E5=8B=87?= Date: Sat, 2 Nov 2024 11:37:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8D=E8=A7=84=E8=8C=83?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张智勇 --- services/print_service/src/print_cups_client.cpp | 8 ++++++++ services/print_service/src/print_system_data.cpp | 2 -- services/print_service/src/print_usb_manager.cpp | 1 - 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/services/print_service/src/print_cups_client.cpp b/services/print_service/src/print_cups_client.cpp index 52ff327..3c8d244 100644 --- a/services/print_service/src/print_cups_client.cpp +++ b/services/print_service/src/print_cups_client.cpp @@ -1676,8 +1676,16 @@ bool PrintCupsClient::IsPrinterExist(const char *printerUri, const char *printer dest = printAbility_->GetNamedDest(CUPS_HTTP_DEFAULT, printerName, NULL); if (dest != NULL) { const char *deviceUri = cupsGetOption("device-uri", dest->num_options, dest->options); + if (deviceUri == nullptr) { + PRINT_HILOGD("deviceUri is null"); + return false; + } PRINT_HILOGD("deviceUri=%{private}s", deviceUri); const char *makeModel = cupsGetOption("printer-make-and-model", dest->num_options, dest->options); + if (makeModel == nullptr) { + PRINT_HILOGD("makeModel is null"); + return false; + } PRINT_HILOGD("makeModel=%{private}s", makeModel); int printerState = cupsGetIntegerOption("printer-state", dest->num_options, dest->options); PRINT_HILOGD("printerState=%{private}d", printerState); diff --git a/services/print_service/src/print_system_data.cpp b/services/print_service/src/print_system_data.cpp index f7e4fe7..40c7345 100644 --- a/services/print_service/src/print_system_data.cpp +++ b/services/print_service/src/print_system_data.cpp @@ -347,8 +347,6 @@ void PrintSystemData::ConvertPrinterCapabilityToJson(PrinterCapability &printerC ConvertPrintMarginToJson(printerCapability, capsJson); } - ConvertPageSizeToJson(printerCapability, capsJson); - if (printerCapability.HasResolution()) { ConvertPrintResolutionToJson(printerCapability, capsJson); } diff --git a/services/print_service/src/print_usb_manager.cpp b/services/print_service/src/print_usb_manager.cpp index ab7c8d6..c9e5abc 100644 --- a/services/print_service/src/print_usb_manager.cpp +++ b/services/print_service/src/print_usb_manager.cpp @@ -110,7 +110,6 @@ void PrintUsbManager::RefreshUsbPrinterDevice() std::string PrintUsbManager::GetProductName(UsbDevice &usbDevice) { - PRINT_HILOGI("getProductName dev.GetName() = %{public}s.", usbDevice.GetName().c_str()); USBDevicePipe usbDevicePipe; int32_t openDeviceRet = UEC_OK; if (isUsbEnable) {