diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2024-03-03 09:55:03 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2024-03-03 09:55:03 +0100 |
commit | 23c348d62ab9f0a902189c70921310a5f856852c (patch) | |
tree | 08c40dc8b180b31f504945e8da3e3ea3950e4145 /backend/escl | |
parent | 2938695ca4c9bca7834817465662e31570f6d32f (diff) | |
parent | 44916ca6d75e0b5f258a098a50d659f31c6625fd (diff) |
Update upstream source from tag 'upstream/1.3.0'
Update to upstream version '1.3.0'
with Debian dir ab14a3d39c8a7f8e08536efd939bb78110db77f3
Diffstat (limited to 'backend/escl')
-rw-r--r-- | backend/escl/escl.c | 14 | ||||
-rw-r--r-- | backend/escl/escl.h | 2 | ||||
-rw-r--r-- | backend/escl/escl_capabilities.c | 11 | ||||
-rw-r--r-- | backend/escl/escl_jpeg.c | 14 | ||||
-rw-r--r-- | backend/escl/escl_newjob.c | 22 |
5 files changed, 42 insertions, 21 deletions
diff --git a/backend/escl/escl.c b/backend/escl/escl.c index cbbdb60..77b753f 100644 --- a/backend/escl/escl.c +++ b/backend/escl/escl.c @@ -621,16 +621,20 @@ sane_get_devices(const SANE_Device ***device_list, SANE_Bool local_only) ESCL_Device *dev = NULL; static const SANE_Device **devlist = 0; SANE_Status status; + SANE_Status status2; if (device_list == NULL) return (SANE_STATUS_INVAL); - status = sanei_configure_attach(ESCL_CONFIG_FILE, NULL, + status2 = sanei_configure_attach(ESCL_CONFIG_FILE, NULL, attach_one_config, NULL); - if (status != SANE_STATUS_GOOD) - return (status); escl_devices(&status); - if (status != SANE_STATUS_GOOD) - return (status); + if (status != SANE_STATUS_GOOD && status2 != SANE_STATUS_GOOD) + { + if (status2 != SANE_STATUS_GOOD) + return (status2); + if (status != SANE_STATUS_GOOD) + return (status); + } if (devlist) free(devlist); devlist = (const SANE_Device **) calloc (num_devices + 1, sizeof (devlist[0])); diff --git a/backend/escl/escl.h b/backend/escl/escl.h index f99bff9..b59a3ff 100644 --- a/backend/escl/escl.h +++ b/backend/escl/escl.h @@ -92,7 +92,7 @@ typedef struct { typedef struct ESCL_Device { struct ESCL_Device *next; - double version; + char *version; char *model_name; int port_nb; char *ip_address; diff --git a/backend/escl/escl_capabilities.c b/backend/escl/escl_capabilities.c index efbd547..950efaa 100644 --- a/backend/escl/escl_capabilities.c +++ b/backend/escl/escl_capabilities.c @@ -72,7 +72,7 @@ convert_elements(SANE_String_Const str) return (SANE_VALUE_SCAN_MODE_GRAY); else if (strcmp(str, "RGB24") == 0) return (SANE_VALUE_SCAN_MODE_COLOR); -#if(defined HAVE_POPPLER_GLIB) +#if HAVE_POPPLER_GLIB else if (strcmp(str, "BlackAndWhite1") == 0) return (SANE_VALUE_SCAN_MODE_LINEART); #endif @@ -202,7 +202,11 @@ find_valor_of_array_variables(xmlNode *node, capabilities_t *scanner, int type) const char *name = (const char *)node->name; if (strcmp(name, "ColorMode") == 0) { const char *color = (SANE_String_Const)xmlNodeGetContent(node); +#if HAVE_POPPLER_GLIB if (type == PLATEN || strcmp(color, "BlackAndWhite1")) +#else + if (strcmp(color, "BlackAndWhite1")) +#endif scanner->caps[type].ColorModes = char_to_array(scanner->caps[type].ColorModes, &scanner->caps[type].ColorModesSize, (SANE_String_Const)xmlNodeGetContent(node), 1); } else if (strcmp(name, "ContentType") == 0) @@ -237,7 +241,7 @@ find_valor_of_array_variables(xmlNode *node, capabilities_t *scanner, int type) scanner->caps[type].have_tiff = i; } #endif -#if(defined HAVE_POPPLER_GLIB) +#if HAVE_POPPLER_GLIB else if(type == PLATEN && !strcmp(scanner->caps[type].DocumentFormats[i], "application/pdf")) { have_pdf = SANE_TRUE; @@ -432,7 +436,7 @@ print_xml_c(xmlNode *node, ESCL_Device *device, capabilities_t *scanner, int typ } if (!strcmp((const char *)node->name, "Version")&& node->ns && node->ns->prefix){ if (!strcmp((const char*)node->ns->prefix, "pwg")) - device->version = atof ((const char *)xmlNodeGetContent(node)); + device->version = strdup((const char *)xmlNodeGetContent(node)); } if (!strcmp((const char *)node->name, "MakeAndModel")){ device->model_name = strdup((const char *)xmlNodeGetContent(node)); @@ -588,7 +592,6 @@ escl_capabilities(ESCL_Device *device, char *blacklist, SANE_Status *status) strstr(header->memory, "Server: HP_Compact_Server")) device->hack = curl_slist_append(NULL, "Host: localhost"); - device->version = 0.0; scanner->source = 0; scanner->Sources = (SANE_String_Const *)malloc(sizeof(SANE_String_Const) * 4); for (i = 0; i < 4; i++) diff --git a/backend/escl/escl_jpeg.c b/backend/escl/escl_jpeg.c index 1dd3ec9..62c20c0 100644 --- a/backend/escl/escl_jpeg.c +++ b/backend/escl/escl_jpeg.c @@ -232,7 +232,13 @@ get_JPEG_data(capabilities_t *scanner, int *width, int *height, int *bps) y_off, w, h); - surface = malloc(w * h * cinfo.output_components); + jpeg_start_decompress(&cinfo); + if (x_off > 0 || w < cinfo.output_width) + jpeg_crop_scanline(&cinfo, &x_off, &w); + lineSize = w * cinfo.output_components; + if (y_off > 0) + jpeg_skip_scanlines(&cinfo, y_off); + surface = malloc(cinfo.output_width * cinfo.output_height * cinfo.output_components); if (surface == NULL) { jpeg_destroy_decompress(&cinfo); DBG( 1, "Escl Jpeg : Memory allocation problem\n"); @@ -242,12 +248,6 @@ get_JPEG_data(capabilities_t *scanner, int *width, int *height, int *bps) } return (SANE_STATUS_NO_MEM); } - jpeg_start_decompress(&cinfo); - if (x_off > 0 || w < cinfo.output_width) - jpeg_crop_scanline(&cinfo, &x_off, &w); - lineSize = w * cinfo.output_components; - if (y_off > 0) - jpeg_skip_scanlines(&cinfo, y_off); pos = 0; while (cinfo.output_scanline < (unsigned int)rh) { rowptr[0] = (JSAMPROW)surface + (lineSize * pos); // ..cinfo.output_scanline); diff --git a/backend/escl/escl_newjob.c b/backend/escl/escl_newjob.c index e1b326f..cb48bd1 100644 --- a/backend/escl/escl_newjob.c +++ b/backend/escl/escl_newjob.c @@ -46,7 +46,7 @@ struct downloading static const char settings[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" \ "<scan:ScanSettings xmlns:pwg=\"http://www.pwg.org/schemas/2010/12/sm\" xmlns:scan=\"http://schemas.hp.com/imaging/escl/2011/05/03\">" \ - " <pwg:Version>%.2f</pwg:Version>" \ + " <pwg:Version>%s</pwg:Version>" \ " <pwg:ScanRegions>" \ " <pwg:ScanRegion>" \ " <pwg:ContentRegionUnits>escl:ThreeHundredthsOfInches</pwg:ContentRegionUnits>" \ @@ -184,10 +184,24 @@ escl_newjob (capabilities_t *scanner, const ESCL_Device *device, SANE_Status *st } } else { - scanner->caps[scanner->source].default_format = - strdup(scanner->caps[scanner->source].DocumentFormats[have_pdf]); + if (have_pdf != -1) { + scanner->caps[scanner->source].default_format = + strdup(scanner->caps[scanner->source].DocumentFormats[have_pdf]); + } + else if (have_tiff != -1) { + scanner->caps[scanner->source].default_format = + strdup(scanner->caps[scanner->source].DocumentFormats[have_tiff]); + } + else if (have_png != -1) { + scanner->caps[scanner->source].default_format = + strdup(scanner->caps[scanner->source].DocumentFormats[have_png]); + } + else if (have_jpeg != -1) { + scanner->caps[scanner->source].default_format = + strdup(scanner->caps[scanner->source].DocumentFormats[have_jpeg]); + } } - if (device->version <= 2.0) + if (atof ((const char *)device->version) <= 2.0) { // For eSCL 2.0 and older clients snprintf(f_ext_tmp, sizeof(f_ext_tmp), |