]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
rename handle scanner image
authorBastian Dehn <hhaalo@arcor.de>
Wed, 1 May 2024 16:03:51 +0000 (18:03 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Wed, 1 May 2024 16:03:51 +0000 (18:03 +0200)
src/kds_s2000w_handler.c
src/kds_s2000w_handler.h
src/kds_s2000w_net.c

index 9451b983ae12417423cb909f28d4155696fd104c..555eb121b1893c71e03ab2c367d6055f7eebf44a 100644 (file)
@@ -13,7 +13,7 @@ void _get_current_metadata(handler* h)
        debug_printf(ALL, "get_current_metadata");
        json_object* metadata = NULL;
        json_object* config = NULL;
-       blobdata* jpg_image = NULL;
+       blobdata* scanner_image = NULL;
        blobdata* pnm_image = NULL;
        image_metadata* mdata = NULL;
 
@@ -38,19 +38,19 @@ void _get_current_metadata(handler* h)
        if (h->current_metadata->format == 1)
                h->current_metadata->channels = 3;
 
-       jpg_image = (blobdata*) h->jpg_image;
+       scanner_image = (blobdata*) h->scanner_image;
        pnm_image = (blobdata*) h->pnm_image;
 
-       kds_s2000w_metadata_from_image(jpg_image, mdata);
+       kds_s2000w_metadata_from_image(scanner_image, mdata);
        h->current_metadata->depth = mdata->depth;
        h->current_metadata->pixels_per_line = mdata->width;
        h->current_metadata->lines = mdata->height;
 
        if (h->current_metadata->depth > 8) {
                h->current_metadata->depth = 8;
-               kds_s2000w_convert_jpg_to_pnm_with_depth(jpg_image, pnm_image, h->current_metadata->depth);
+               kds_s2000w_convert_jpg_to_pnm_with_depth(scanner_image, pnm_image, h->current_metadata->depth);
        } else {
-               kds_s2000w_convert_tiff_to_pnm(jpg_image, pnm_image);
+               kds_s2000w_convert_tiff_to_pnm(scanner_image, pnm_image);
        }
 
        debug_printf_int(DEBUG, "size of pnm image", h->pnm_image->size);
@@ -88,10 +88,10 @@ void _download_current_image(handler* h)
        debug_printf(ALL, "download_current_image");
        response* resp = NULL;
 
-       if (h->jpg_image->size > 0) {
-               free(h->jpg_image->data);
-               h->jpg_image->data = NULL;
-               h->jpg_image->size = 0;
+       if (h->scanner_image->size > 0) {
+               free(h->scanner_image->data);
+               h->scanner_image->data = NULL;
+               h->scanner_image->size = 0;
        }
 
        resp = kds_s2000w_client_response_init();
@@ -99,9 +99,9 @@ void _download_current_image(handler* h)
        if (resp->error_size > 0)
                fprintf(stderr, "%s\n", resp->error_status);
 
-       h->jpg_image->size = resp->size;
-       h->jpg_image->data = malloc(sizeof(char) * resp->size);
-       memcpy(h->jpg_image->data, resp->data, resp->size);
+       h->scanner_image->size = resp->size;
+       h->scanner_image->data = malloc(sizeof(char) * resp->size);
+       memcpy(h->scanner_image->data, resp->data, resp->size);
        kds_s2000w_client_response_free(resp);
        resp = NULL;
        h->current_scan_status->downloaded_images++;
@@ -148,7 +148,7 @@ handler* init_handler()
        h->current_scan_status = malloc(sizeof(scanstatus));
        h->current_metadata = malloc(sizeof(metadata));
        h->read_info = malloc(sizeof(readinfo));
-       h->jpg_image = malloc(sizeof(imagedata));
+       h->scanner_image = malloc(sizeof(imagedata));
        h->pnm_image = malloc(sizeof(imagedata));
 
        h->sessionid = 0;
@@ -173,8 +173,8 @@ handler* init_handler()
        h->read_info->read_size = 0;
        h->read_info->readed_bytes_per_line = 0;
        h->read_info->readed_lines = 0;
-       h->jpg_image->size = 0;
-       h->jpg_image->data = NULL;
+       h->scanner_image->size = 0;
+       h->scanner_image->data = NULL;
        h->pnm_image->size = 0;
        h->pnm_image->data = NULL;
 
@@ -192,10 +192,10 @@ void free_handler(handler* h)
        h->current_metadata = NULL;
        free(h->read_info);
        h->read_info = NULL;
-       free(h->jpg_image->data);
-       h->jpg_image->data = NULL;
-       free(h->jpg_image);
-       h->jpg_image = NULL;
+       free(h->scanner_image->data);
+       h->scanner_image->data = NULL;
+       free(h->scanner_image);
+       h->scanner_image = NULL;
        free(h->pnm_image);
        h->pnm_image = NULL;
        free(h);
@@ -207,8 +207,8 @@ void reset_handler(handler* h)
        debug_printf(ALL, "reset handler");
        free(h->pnm_image->data);
        h->pnm_image->data = NULL;
-       free(h->jpg_image->data);
-       h->jpg_image->data = NULL;
+       free(h->scanner_image->data);
+       h->scanner_image->data = NULL;
 
        h->state = NOTCONNECTED;
        h->current_scan_status->load_options = 0;
@@ -284,8 +284,8 @@ void kds_s2000w_handler_open(const char* devicename, void** handle)
        h = init_handler();
        *handle = h;
 
-       h->jpg_image->size = 0;
-       h->jpg_image->data = NULL;
+       h->scanner_image->size = 0;
+       h->scanner_image->data = NULL;
        h->pnm_image->size = 0;
        h->pnm_image->data = NULL;
 
index f2ae97ae070eda2713fa229de2aba0cccf082026..997a3a81b0cf35884381309b47fab31eaf3a4886 100644 (file)
@@ -54,7 +54,7 @@ typedef struct {
        scanstatus* current_scan_status;
        metadata* current_metadata;
        readinfo* read_info;
-       imagedata* jpg_image;
+       imagedata* scanner_image;
        imagedata* pnm_image;
 } handler;
 
index fa9563589cc740b4757fea325100da8ec345371e..a2e5acca8f060291905359f8b57b0f1ee62686ec 100644 (file)
@@ -180,7 +180,7 @@ SANE_Status _sane_kds_s2000w_net_start(SANE_Handle handle)
                        break;
        }
 
-       if (h->current_metadata->valid == 0 || h->jpg_image->size == 0) {
+       if (h->current_metadata->valid == 0 || h->scanner_image->size == 0) {
                kds_s2000w_handler_recreate_session(h);
                return SANE_STATUS_NO_DOCS;
        }
@@ -223,9 +223,9 @@ SANE_Status _sane_kds_s2000w_net_read(SANE_Handle handle, SANE_Byte* data,
        if (h->read_info->read_size >= h->pnm_image->size) {
                *length = 0;
                h->current_metadata->is_last = 1;
-               h->jpg_image->size = 0;
-               free(h->jpg_image->data);
-               h->jpg_image->data = NULL;
+               h->scanner_image->size = 0;
+               free(h->scanner_image->data);
+               h->scanner_image->data = NULL;
                h->pnm_image->size = 0;
 
                return SANE_STATUS_EOF;