kopia lustrzana https://gitlab.com/sane-project/backends
The logs are sent on the output 10 indeed of the 1 (that equal at stdout)
rodzic
b60e9f742e
commit
d4df090e45
|
@ -416,7 +416,7 @@ convertFromESCLDev(ESCL_Device *cdev)
|
||||||
unix_path, cdev->https ? "s" : "", cdev->ip_address, cdev->port_nb);
|
unix_path, cdev->https ? "s" : "", cdev->ip_address, cdev->port_nb);
|
||||||
sdev->name = tmp;
|
sdev->name = tmp;
|
||||||
|
|
||||||
DBG( 1, "Escl add device : %s\n", tmp);
|
DBG( 10, "Escl add device : %s\n", tmp);
|
||||||
sdev->vendor = get_vendor(cdev->model_name);
|
sdev->vendor = get_vendor(cdev->model_name);
|
||||||
|
|
||||||
if (!sdev->vendor)
|
if (!sdev->vendor)
|
||||||
|
@ -1888,24 +1888,24 @@ escl_curl_url(CURL *handle, const ESCL_Device *device, SANE_String_Const path)
|
||||||
(device->https ? "https" : "http"), device->ip_address,
|
(device->https ? "https" : "http"), device->ip_address,
|
||||||
device->port_nb, path);
|
device->port_nb, path);
|
||||||
|
|
||||||
DBG( 1, "escl_curl_url: URL: %s\n", url );
|
DBG( 10, "escl_curl_url: URL: %s\n", url );
|
||||||
curl_easy_setopt(handle, CURLOPT_URL, url);
|
curl_easy_setopt(handle, CURLOPT_URL, url);
|
||||||
free(url);
|
free(url);
|
||||||
DBG( 1, "Before use hack\n");
|
DBG( 10, "Before use hack\n");
|
||||||
if (device->hack) {
|
if (device->hack) {
|
||||||
DBG( 1, "Use hack\n");
|
DBG( 10, "Use hack\n");
|
||||||
curl_easy_setopt(handle, CURLOPT_HTTPHEADER, device->hack);
|
curl_easy_setopt(handle, CURLOPT_HTTPHEADER, device->hack);
|
||||||
}
|
}
|
||||||
DBG( 1, "After use hack\n");
|
DBG( 10, "After use hack\n");
|
||||||
if (device->https) {
|
if (device->https) {
|
||||||
DBG( 1, "Ignoring safety certificates, use https\n");
|
DBG( 10, "Ignoring safety certificates, use https\n");
|
||||||
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0L);
|
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||||
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 0L);
|
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||||
if (device->tls > 0)
|
if (device->tls > 0)
|
||||||
curl_easy_setopt(handle, CURLOPT_SSLVERSION, device->tls);
|
curl_easy_setopt(handle, CURLOPT_SSLVERSION, device->tls);
|
||||||
}
|
}
|
||||||
if (device->unix_socket != NULL) {
|
if (device->unix_socket != NULL) {
|
||||||
DBG( 1, "Using local socket %s\n", device->unix_socket );
|
DBG( 10, "Using local socket %s\n", device->unix_socket );
|
||||||
curl_easy_setopt(handle, CURLOPT_UNIX_SOCKET_PATH,
|
curl_easy_setopt(handle, CURLOPT_UNIX_SOCKET_PATH,
|
||||||
device->unix_socket);
|
device->unix_socket);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ header_callback(void *str, size_t size, size_t nmemb, void *userp)
|
||||||
char *content = realloc(header->memory, header->size + realsize + 1);
|
char *content = realloc(header->memory, header->size + realsize + 1);
|
||||||
|
|
||||||
if (content == NULL) {
|
if (content == NULL) {
|
||||||
DBG( 1, "Not enough memory (realloc returned NULL)\n");
|
DBG( 10, "Not enough memory (realloc returned NULL)\n");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
header->memory = content;
|
header->memory = content;
|
||||||
|
@ -566,9 +566,9 @@ escl_capabilities(ESCL_Device *device, char *blacklist, SANE_Status *status)
|
||||||
curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L);
|
curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L);
|
||||||
CURLcode res = curl_easy_perform(curl_handle);
|
CURLcode res = curl_easy_perform(curl_handle);
|
||||||
if (res == CURLE_OK)
|
if (res == CURLE_OK)
|
||||||
DBG( 1, "Create NewJob : the scanner header responded : [%s]\n", header->memory);
|
DBG( 10, "Create NewJob : the scanner header responded : [%s]\n", header->memory);
|
||||||
if (res != CURLE_OK) {
|
if (res != CURLE_OK) {
|
||||||
DBG( 1, "The scanner didn't respond: %s\n", curl_easy_strerror(res));
|
DBG( 10, "The scanner didn't respond: %s\n", curl_easy_strerror(res));
|
||||||
*status = SANE_STATUS_INVAL;
|
*status = SANE_STATUS_INVAL;
|
||||||
goto clean_data;
|
goto clean_data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ escl_crop_surface(capabilities_t *scanner,
|
||||||
int real_h = 0;
|
int real_h = 0;
|
||||||
unsigned char *surface_crop = NULL;
|
unsigned char *surface_crop = NULL;
|
||||||
|
|
||||||
DBG( 1, "Escl Image Crop\n");
|
DBG( 10, "Escl Image Crop\n");
|
||||||
ratio = (double)w / (double)scanner->caps[scanner->source].width;
|
ratio = (double)w / (double)scanner->caps[scanner->source].width;
|
||||||
scanner->caps[scanner->source].width = w;
|
scanner->caps[scanner->source].width = w;
|
||||||
if (scanner->caps[scanner->source].pos_x < 0)
|
if (scanner->caps[scanner->source].pos_x < 0)
|
||||||
|
@ -62,18 +62,18 @@ escl_crop_surface(capabilities_t *scanner,
|
||||||
y_off = (int)((double)scanner->caps[scanner->source].pos_y * ratio);
|
y_off = (int)((double)scanner->caps[scanner->source].pos_y * ratio);
|
||||||
real_h = scanner->caps[scanner->source].height - y_off;
|
real_h = scanner->caps[scanner->source].height - y_off;
|
||||||
|
|
||||||
DBG( 1, "Escl Image Crop [%dx%d|%dx%d]\n", scanner->caps[scanner->source].pos_x, scanner->caps[scanner->source].pos_y,
|
DBG( 10, "Escl Image Crop [%dx%d|%dx%d]\n", scanner->caps[scanner->source].pos_x, scanner->caps[scanner->source].pos_y,
|
||||||
scanner->caps[scanner->source].width, scanner->caps[scanner->source].height);
|
scanner->caps[scanner->source].width, scanner->caps[scanner->source].height);
|
||||||
|
|
||||||
*width = real_w;
|
*width = real_w;
|
||||||
*height = real_h;
|
*height = real_h;
|
||||||
DBG( 1, "Escl Image Crop [%dx%d]\n", *width, *height);
|
DBG( 10, "Escl Image Crop [%dx%d]\n", *width, *height);
|
||||||
if (x_off > 0 || real_w < scanner->caps[scanner->source].width ||
|
if (x_off > 0 || real_w < scanner->caps[scanner->source].width ||
|
||||||
y_off > 0 || real_h < scanner->caps[scanner->source].height) {
|
y_off > 0 || real_h < scanner->caps[scanner->source].height) {
|
||||||
surface_crop = (unsigned char *)malloc (sizeof (unsigned char) * real_w
|
surface_crop = (unsigned char *)malloc (sizeof (unsigned char) * real_w
|
||||||
* real_h * bps);
|
* real_h * bps);
|
||||||
if(!surface_crop) {
|
if(!surface_crop) {
|
||||||
DBG( 1, "Escl Crop : Surface_crop Memory allocation problem\n");
|
DBG( 10, "Escl Crop : Surface_crop Memory allocation problem\n");
|
||||||
free(surface);
|
free(surface);
|
||||||
surface = NULL;
|
surface = NULL;
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
|
@ -193,21 +193,21 @@ escl_devices(SANE_Status *status)
|
||||||
|
|
||||||
*status = SANE_STATUS_GOOD;
|
*status = SANE_STATUS_GOOD;
|
||||||
if (!(simple_poll = avahi_simple_poll_new())) {
|
if (!(simple_poll = avahi_simple_poll_new())) {
|
||||||
DBG( 1, "Failed to create simple poll object.\n");
|
DBG( 10, "Failed to create simple poll object.\n");
|
||||||
*status = SANE_STATUS_INVAL;
|
*status = SANE_STATUS_INVAL;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
client = avahi_client_new(avahi_simple_poll_get(simple_poll), 0,
|
client = avahi_client_new(avahi_simple_poll_get(simple_poll), 0,
|
||||||
client_callback, NULL, &error);
|
client_callback, NULL, &error);
|
||||||
if (!client) {
|
if (!client) {
|
||||||
DBG( 1, "Failed to create client: %s\n", avahi_strerror(error));
|
DBG( 10, "Failed to create client: %s\n", avahi_strerror(error));
|
||||||
*status = SANE_STATUS_INVAL;
|
*status = SANE_STATUS_INVAL;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
if (!(sb = avahi_service_browser_new(client, AVAHI_IF_UNSPEC,
|
if (!(sb = avahi_service_browser_new(client, AVAHI_IF_UNSPEC,
|
||||||
AVAHI_PROTO_UNSPEC, "_uscan._tcp",
|
AVAHI_PROTO_UNSPEC, "_uscan._tcp",
|
||||||
NULL, 0, browse_callback, client))) {
|
NULL, 0, browse_callback, client))) {
|
||||||
DBG( 1, "Failed to create service browser: %s\n",
|
DBG( 10, "Failed to create service browser: %s\n",
|
||||||
avahi_strerror(avahi_client_errno(client)));
|
avahi_strerror(avahi_client_errno(client)));
|
||||||
*status = SANE_STATUS_INVAL;
|
*status = SANE_STATUS_INVAL;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -216,7 +216,7 @@ escl_devices(SANE_Status *status)
|
||||||
AVAHI_PROTO_UNSPEC,
|
AVAHI_PROTO_UNSPEC,
|
||||||
"_uscans._tcp", NULL, 0,
|
"_uscans._tcp", NULL, 0,
|
||||||
browse_callback, client))) {
|
browse_callback, client))) {
|
||||||
DBG( 1, "Failed to create service browser: %s\n",
|
DBG( 10, "Failed to create service browser: %s\n",
|
||||||
avahi_strerror(avahi_client_errno(client)));
|
avahi_strerror(avahi_client_errno(client)));
|
||||||
*status = SANE_STATUS_INVAL;
|
*status = SANE_STATUS_INVAL;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
|
@ -179,7 +179,7 @@ get_JPEG_data(capabilities_t *scanner, int *width, int *height, int *bps)
|
||||||
if (surface != NULL)
|
if (surface != NULL)
|
||||||
free(surface);
|
free(surface);
|
||||||
fseek(scanner->tmp, start, SEEK_SET);
|
fseek(scanner->tmp, start, SEEK_SET);
|
||||||
DBG( 1, "Escl Jpeg : Error reading jpeg\n");
|
DBG( 10, "Escl Jpeg : Error reading jpeg\n");
|
||||||
if (scanner->tmp) {
|
if (scanner->tmp) {
|
||||||
fclose(scanner->tmp);
|
fclose(scanner->tmp);
|
||||||
scanner->tmp = NULL;
|
scanner->tmp = NULL;
|
||||||
|
@ -241,7 +241,7 @@ get_JPEG_data(capabilities_t *scanner, int *width, int *height, int *bps)
|
||||||
surface = malloc(cinfo.output_width * cinfo.output_height * cinfo.output_components);
|
surface = malloc(cinfo.output_width * cinfo.output_height * cinfo.output_components);
|
||||||
if (surface == NULL) {
|
if (surface == NULL) {
|
||||||
jpeg_destroy_decompress(&cinfo);
|
jpeg_destroy_decompress(&cinfo);
|
||||||
DBG( 1, "Escl Jpeg : Memory allocation problem\n");
|
DBG( 10, "Escl Jpeg : Memory allocation problem\n");
|
||||||
if (scanner->tmp) {
|
if (scanner->tmp) {
|
||||||
fclose(scanner->tmp);
|
fclose(scanner->tmp);
|
||||||
scanner->tmp = NULL;
|
scanner->tmp = NULL;
|
||||||
|
|
|
@ -220,7 +220,7 @@ get_PDF_data(capabilities_t *scanner, int *width, int *height, int *bps)
|
||||||
// If necessary, trim the image.
|
// If necessary, trim the image.
|
||||||
surface = escl_crop_surface(scanner, surface, pix->w, pix->h, pix->n, width, height);
|
surface = escl_crop_surface(scanner, surface, pix->w, pix->h, pix->n, width, height);
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
DBG( 1, "Escl Pdf : Surface Memory allocation problem\n");
|
DBG( 10, "Escl Pdf : Surface Memory allocation problem\n");
|
||||||
status = SANE_STATUS_NO_MEM;
|
status = SANE_STATUS_NO_MEM;
|
||||||
goto drop_pix;
|
goto drop_pix;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ download_callback(void *str, size_t size, size_t nmemb, void *userp)
|
||||||
char *content = realloc(download->memory, download->size + realsize + 1);
|
char *content = realloc(download->memory, download->size + realsize + 1);
|
||||||
|
|
||||||
if (content == NULL) {
|
if (content == NULL) {
|
||||||
DBG( 1, "Not enough memory (realloc returned NULL)\n");
|
DBG( 10, "Not enough memory (realloc returned NULL)\n");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
download->memory = content;
|
download->memory = content;
|
||||||
|
@ -144,19 +144,19 @@ escl_newjob (capabilities_t *scanner, const ESCL_Device *device, SANE_Status *st
|
||||||
*status = SANE_STATUS_GOOD;
|
*status = SANE_STATUS_GOOD;
|
||||||
if (device == NULL || scanner == NULL) {
|
if (device == NULL || scanner == NULL) {
|
||||||
*status = SANE_STATUS_NO_MEM;
|
*status = SANE_STATUS_NO_MEM;
|
||||||
DBG( 1, "Create NewJob : the name or the scan are invalid.\n");
|
DBG( 10, "Create NewJob : the name or the scan are invalid.\n");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
upload = (struct downloading *)calloc(1, sizeof(struct downloading));
|
upload = (struct downloading *)calloc(1, sizeof(struct downloading));
|
||||||
if (upload == NULL) {
|
if (upload == NULL) {
|
||||||
*status = SANE_STATUS_NO_MEM;
|
*status = SANE_STATUS_NO_MEM;
|
||||||
DBG( 1, "Create NewJob : memory allocation failure\n");
|
DBG( 10, "Create NewJob : memory allocation failure\n");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
download = (struct downloading *)calloc(1, sizeof(struct downloading));
|
download = (struct downloading *)calloc(1, sizeof(struct downloading));
|
||||||
if (download == NULL) {
|
if (download == NULL) {
|
||||||
free(upload);
|
free(upload);
|
||||||
DBG( 1, "Create NewJob : memory allocation failure\n");
|
DBG( 10, "Create NewJob : memory allocation failure\n");
|
||||||
*status = SANE_STATUS_NO_MEM;
|
*status = SANE_STATUS_NO_MEM;
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ escl_newjob (capabilities_t *scanner, const ESCL_Device *device, SANE_Status *st
|
||||||
" <scan:Duplex>%s</scan:Duplex>",
|
" <scan:Duplex>%s</scan:Duplex>",
|
||||||
scanner->source == ADFDUPLEX ? "true" : "false");
|
scanner->source == ADFDUPLEX ? "true" : "false");
|
||||||
}
|
}
|
||||||
DBG( 1, "Create NewJob : %s\n", scanner->caps[scanner->source].default_format);
|
DBG( 10, "Create NewJob : %s\n", scanner->caps[scanner->source].default_format);
|
||||||
if (scanner->caps[scanner->source].pos_x > scanner->caps[scanner->source].width)
|
if (scanner->caps[scanner->source].pos_x > scanner->caps[scanner->source].width)
|
||||||
off_x = (scanner->caps[scanner->source].pos_x > scanner->caps[scanner->source].width) / 2;
|
off_x = (scanner->caps[scanner->source].pos_x > scanner->caps[scanner->source].width) / 2;
|
||||||
if (scanner->caps[scanner->source].pos_y > scanner->caps[scanner->source].height)
|
if (scanner->caps[scanner->source].pos_y > scanner->caps[scanner->source].height)
|
||||||
|
@ -278,7 +278,7 @@ escl_newjob (capabilities_t *scanner, const ESCL_Device *device, SANE_Status *st
|
||||||
upload->memory = strdup(cap_data);
|
upload->memory = strdup(cap_data);
|
||||||
upload->size = strlen(cap_data);
|
upload->size = strlen(cap_data);
|
||||||
wake_up_device:
|
wake_up_device:
|
||||||
DBG( 1, "Create NewJob : %s\n", cap_data);
|
DBG( 10, "Create NewJob : %s\n", cap_data);
|
||||||
download->memory = malloc(1);
|
download->memory = malloc(1);
|
||||||
download->size = 0;
|
download->size = 0;
|
||||||
curl_handle = curl_easy_init();
|
curl_handle = curl_easy_init();
|
||||||
|
@ -293,7 +293,7 @@ wake_up_device:
|
||||||
curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L);
|
curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L);
|
||||||
CURLcode res = curl_easy_perform(curl_handle);
|
CURLcode res = curl_easy_perform(curl_handle);
|
||||||
if (res != CURLE_OK) {
|
if (res != CURLE_OK) {
|
||||||
DBG( 1, "Create NewJob : the scanner responded incorrectly: %s\n", curl_easy_strerror(res));
|
DBG( 10, "Create NewJob : the scanner responded incorrectly: %s\n", curl_easy_strerror(res));
|
||||||
*status = SANE_STATUS_INVAL;
|
*status = SANE_STATUS_INVAL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -308,7 +308,7 @@ wake_up_device:
|
||||||
location = strrchr(tmp_location,'/');
|
location = strrchr(tmp_location,'/');
|
||||||
if (location) {
|
if (location) {
|
||||||
result = strdup(location);
|
result = strdup(location);
|
||||||
DBG( 1, "Create NewJob : %s\n", result);
|
DBG( 10, "Create NewJob : %s\n", result);
|
||||||
*temporary = '\n';
|
*temporary = '\n';
|
||||||
*location = '\0';
|
*location = '\0';
|
||||||
location = strrchr(tmp_location,'/');
|
location = strrchr(tmp_location,'/');
|
||||||
|
@ -316,7 +316,7 @@ wake_up_device:
|
||||||
if (location) {
|
if (location) {
|
||||||
location++;
|
location++;
|
||||||
scanner->scanJob = strdup(location);
|
scanner->scanJob = strdup(location);
|
||||||
DBG( 1, "Full location header [%s]\n", scanner->scanJob);
|
DBG( 10, "Full location header [%s]\n", scanner->scanJob);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
scanner->scanJob = strdup("ScanJobs");
|
scanner->scanJob = strdup("ScanJobs");
|
||||||
|
@ -324,14 +324,14 @@ wake_up_device:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
DBG( 1, "Error : Create NewJob, no location: %s\n", download->memory);
|
DBG( 10, "Error : Create NewJob, no location: %s\n", download->memory);
|
||||||
*status = SANE_STATUS_INVAL;
|
*status = SANE_STATUS_INVAL;
|
||||||
}
|
}
|
||||||
free(download->memory);
|
free(download->memory);
|
||||||
download->memory = NULL;
|
download->memory = NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DBG( 1, "Create NewJob : The creation of the failed job: %s\n", download->memory);
|
DBG( 10, "Create NewJob : The creation of the failed job: %s\n", download->memory);
|
||||||
// If "409 Conflict" appear it means that there is no paper in feeder
|
// If "409 Conflict" appear it means that there is no paper in feeder
|
||||||
if (strstr(download->memory, "409 Conflict") != NULL)
|
if (strstr(download->memory, "409 Conflict") != NULL)
|
||||||
*status = SANE_STATUS_NO_DOCS;
|
*status = SANE_STATUS_NO_DOCS;
|
||||||
|
@ -346,7 +346,7 @@ wake_up_device:
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*status = SANE_STATUS_NO_MEM;
|
*status = SANE_STATUS_NO_MEM;
|
||||||
DBG( 1, "Create NewJob : The creation of the failed job\n");
|
DBG( 10, "Create NewJob : The creation of the failed job\n");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ get_PNG_data(capabilities_t *scanner, int *width, int *height, int *bps)
|
||||||
// check for valid magic number
|
// check for valid magic number
|
||||||
if (!png_check_sig (magic, sizeof (magic)))
|
if (!png_check_sig (magic, sizeof (magic)))
|
||||||
{
|
{
|
||||||
DBG( 1, "Escl Png : PNG error is not a valid PNG image!\n");
|
DBG( 10, "Escl Png : PNG error is not a valid PNG image!\n");
|
||||||
status = SANE_STATUS_INVAL;
|
status = SANE_STATUS_INVAL;
|
||||||
goto close_file;
|
goto close_file;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ get_PNG_data(capabilities_t *scanner, int *width, int *height, int *bps)
|
||||||
(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||||
if (!png_ptr)
|
if (!png_ptr)
|
||||||
{
|
{
|
||||||
DBG( 1, "Escl Png : PNG error create a png read struct\n");
|
DBG( 10, "Escl Png : PNG error create a png read struct\n");
|
||||||
status = SANE_STATUS_INVAL;
|
status = SANE_STATUS_INVAL;
|
||||||
goto close_file;
|
goto close_file;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ get_PNG_data(capabilities_t *scanner, int *width, int *height, int *bps)
|
||||||
png_infop info_ptr = png_create_info_struct (png_ptr);
|
png_infop info_ptr = png_create_info_struct (png_ptr);
|
||||||
if (!info_ptr)
|
if (!info_ptr)
|
||||||
{
|
{
|
||||||
DBG( 1, "Escl Png : PNG error create a png info struct\n");
|
DBG( 10, "Escl Png : PNG error create a png info struct\n");
|
||||||
png_destroy_read_struct (&png_ptr, NULL, NULL);
|
png_destroy_read_struct (&png_ptr, NULL, NULL);
|
||||||
status = SANE_STATUS_INVAL;
|
status = SANE_STATUS_INVAL;
|
||||||
goto close_file;
|
goto close_file;
|
||||||
|
@ -93,7 +93,7 @@ get_PNG_data(capabilities_t *scanner, int *width, int *height, int *bps)
|
||||||
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||||
if (surface)
|
if (surface)
|
||||||
free (surface);
|
free (surface);
|
||||||
DBG( 1, "Escl Png : PNG read error.\n");
|
DBG( 10, "Escl Png : PNG read error.\n");
|
||||||
status = SANE_STATUS_INVAL;
|
status = SANE_STATUS_INVAL;
|
||||||
goto close_file;
|
goto close_file;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ get_PNG_data(capabilities_t *scanner, int *width, int *height, int *bps)
|
||||||
surface = (unsigned char *)malloc (sizeof (unsigned char) * w
|
surface = (unsigned char *)malloc (sizeof (unsigned char) * w
|
||||||
* h * components);
|
* h * components);
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
DBG( 1, "Escl Png : texels Memory allocation problem\n");
|
DBG( 10, "Escl Png : texels Memory allocation problem\n");
|
||||||
status = SANE_STATUS_NO_MEM;
|
status = SANE_STATUS_NO_MEM;
|
||||||
goto close_file;
|
goto close_file;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ get_PNG_data(capabilities_t *scanner, int *width, int *height, int *bps)
|
||||||
// setup a pointer array. Each one points at the begening of a row.
|
// setup a pointer array. Each one points at the begening of a row.
|
||||||
row_pointers = (png_bytep *)malloc (sizeof (png_bytep) * h);
|
row_pointers = (png_bytep *)malloc (sizeof (png_bytep) * h);
|
||||||
if (!row_pointers) {
|
if (!row_pointers) {
|
||||||
DBG( 1, "Escl Png : row_pointers Memory allocation problem\n");
|
DBG( 10, "Escl Png : row_pointers Memory allocation problem\n");
|
||||||
free(surface);
|
free(surface);
|
||||||
status = SANE_STATUS_NO_MEM;
|
status = SANE_STATUS_NO_MEM;
|
||||||
goto close_file;
|
goto close_file;
|
||||||
|
@ -169,7 +169,7 @@ get_PNG_data(capabilities_t *scanner, int *width, int *height, int *bps)
|
||||||
// If necessary, trim the image.
|
// If necessary, trim the image.
|
||||||
surface = escl_crop_surface(scanner, surface, w, h, components, width, height);
|
surface = escl_crop_surface(scanner, surface, w, h, components, width, height);
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
DBG( 1, "Escl Png : Surface Memory allocation problem\n");
|
DBG( 10, "Escl Png : Surface Memory allocation problem\n");
|
||||||
status = SANE_STATUS_NO_MEM;
|
status = SANE_STATUS_NO_MEM;
|
||||||
goto close_file;
|
goto close_file;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ escl_scan(capabilities_t *scanner, const ESCL_Device *device, char *scanJob, cha
|
||||||
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, scanner);
|
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, scanner);
|
||||||
CURLcode res = curl_easy_perform(curl_handle);
|
CURLcode res = curl_easy_perform(curl_handle);
|
||||||
if (res != CURLE_OK) {
|
if (res != CURLE_OK) {
|
||||||
DBG( 1, "Unable to scan: %s\n", curl_easy_strerror(res));
|
DBG( 10, "Unable to scan: %s\n", curl_easy_strerror(res));
|
||||||
scanner->real_read = 0;
|
scanner->real_read = 0;
|
||||||
fclose(scanner->tmp);
|
fclose(scanner->tmp);
|
||||||
scanner->tmp = NULL;
|
scanner->tmp = NULL;
|
||||||
|
|
|
@ -225,7 +225,7 @@ reload:
|
||||||
curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L);
|
curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L);
|
||||||
CURLcode res = curl_easy_perform(curl_handle);
|
CURLcode res = curl_easy_perform(curl_handle);
|
||||||
if (res != CURLE_OK) {
|
if (res != CURLE_OK) {
|
||||||
DBG( 1, "The scanner didn't respond: %s\n", curl_easy_strerror(res));
|
DBG( 10, "The scanner didn't respond: %s\n", curl_easy_strerror(res));
|
||||||
status = SANE_STATUS_INVAL;
|
status = SANE_STATUS_INVAL;
|
||||||
goto clean_data;
|
goto clean_data;
|
||||||
}
|
}
|
||||||
|
@ -375,7 +375,7 @@ escl_reset_all_jobs(ESCL_Device *device)
|
||||||
curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L);
|
curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L);
|
||||||
CURLcode res = curl_easy_perform(curl_handle);
|
CURLcode res = curl_easy_perform(curl_handle);
|
||||||
if (res != CURLE_OK) {
|
if (res != CURLE_OK) {
|
||||||
DBG( 1, "The scanner didn't respond: %s\n", curl_easy_strerror(res));
|
DBG( 10, "The scanner didn't respond: %s\n", curl_easy_strerror(res));
|
||||||
status = SANE_STATUS_INVAL;
|
status = SANE_STATUS_INVAL;
|
||||||
goto clean_data1;
|
goto clean_data1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ get_TIFF_data(capabilities_t *scanner, int *width, int *height, int *bps)
|
||||||
lseek(fileno(scanner->tmp), 0, SEEK_SET);
|
lseek(fileno(scanner->tmp), 0, SEEK_SET);
|
||||||
tif = TIFFFdOpen(fileno(scanner->tmp), "temp", "r");
|
tif = TIFFFdOpen(fileno(scanner->tmp), "temp", "r");
|
||||||
if (!tif) {
|
if (!tif) {
|
||||||
DBG( 1, "Escl Tiff : Can not open, or not a TIFF file.\n");
|
DBG( 10, "Escl Tiff : Can not open, or not a TIFF file.\n");
|
||||||
status = SANE_STATUS_INVAL;
|
status = SANE_STATUS_INVAL;
|
||||||
goto close_file;
|
goto close_file;
|
||||||
}
|
}
|
||||||
|
@ -76,14 +76,14 @@ get_TIFF_data(capabilities_t *scanner, int *width, int *height, int *bps)
|
||||||
surface = (unsigned char*) malloc(npixels * sizeof (uint32_t));
|
surface = (unsigned char*) malloc(npixels * sizeof (uint32_t));
|
||||||
if (surface == NULL)
|
if (surface == NULL)
|
||||||
{
|
{
|
||||||
DBG( 1, "Escl Tiff : raster Memory allocation problem.\n");
|
DBG( 10, "Escl Tiff : raster Memory allocation problem.\n");
|
||||||
status = SANE_STATUS_INVAL;
|
status = SANE_STATUS_INVAL;
|
||||||
goto close_tiff;
|
goto close_tiff;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TIFFReadRGBAImage(tif, w, h, (uint32_t *)surface, 0))
|
if (!TIFFReadRGBAImage(tif, w, h, (uint32_t *)surface, 0))
|
||||||
{
|
{
|
||||||
DBG( 1, "Escl Tiff : Problem reading image data.\n");
|
DBG( 10, "Escl Tiff : Problem reading image data.\n");
|
||||||
status = SANE_STATUS_INVAL;
|
status = SANE_STATUS_INVAL;
|
||||||
free(surface);
|
free(surface);
|
||||||
goto close_tiff;
|
goto close_tiff;
|
||||||
|
@ -94,7 +94,7 @@ get_TIFF_data(capabilities_t *scanner, int *width, int *height, int *bps)
|
||||||
// If necessary, trim the image.
|
// If necessary, trim the image.
|
||||||
surface = escl_crop_surface(scanner, surface, w, h, components, width, height);
|
surface = escl_crop_surface(scanner, surface, w, h, components, width, height);
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
DBG( 1, "Escl Tiff : Surface Memory allocation problem\n");
|
DBG( 10, "Escl Tiff : Surface Memory allocation problem\n");
|
||||||
status = SANE_STATUS_INVAL;
|
status = SANE_STATUS_INVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue