]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
release build without debug prints
authorBastian Dehn <hhaalo@arcor.de>
Wed, 31 Jul 2024 18:43:07 +0000 (20:43 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Wed, 31 Jul 2024 18:43:07 +0000 (20:43 +0200)
src/CMakeLists.txt
src/kds_s2000w_client.c
src/kds_s2000w_debug.c
src/kds_s2000w_debug.h
src/kds_s2000w_handler.c
src/kds_s2000w_handler_opts.c
src/kds_s2000w_image_converter.c
src/kds_s2000w_net.c
src/kds_s2000w_option_descriptors.c

index 261e57e58b454d57ffdeed455bb94524b83720c9..0592163b4e21fed6ef32264d275b30d7874121b6 100644 (file)
@@ -85,6 +85,10 @@ TARGET_LINK_LIBRARIES("sane-kds_s2000w_net-static"
        ${ImageMagick_LIBRARIES}
        json-c)
 
+IF(CMAKE_BUILD_TYPE STREQUAL "Release")
+       add_compile_definitions("NODEBUG")
+ENDIF()
+
 INSTALL(TARGETS "sane-kds_s2000w_net" "sane-kds_s2000w_net-static"
        DESTINATION ${CMAKE_LIBRARY_PATH}/sane)
 install(FILES "kds_s2000w_net.conf"
index 4c30d7812b8de68307a34cc949920c1e9f996adf..c86ea975418aa7e591dbc6f33ea8747161656f24 100644 (file)
@@ -5,7 +5,10 @@
 #include "kds_s2000w_config.h"
 #include "kds_s2000w_heartbeat.h"
 #include "kds_s2000w_client.h"
+
+#ifndef NODEBUG
 #include "kds_s2000w_debug.h"
+#endif
 
 void _kds_s2000w_client_read_error_status(CURL* curl, response* resp)
 {
@@ -32,7 +35,9 @@ void _kds_s2000w_client_load_config()
 
 void _kds_s2000w_client_stream_to_response(FILE* stream, response* resp, size_t* size)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_client_stream_to_response");
+#endif
 
        resp->data = realloc(resp->data, sizeof(char) * *size + 1);
        fseek(stream, 0, SEEK_SET);
@@ -43,7 +48,9 @@ void _kds_s2000w_client_stream_to_response(FILE* stream, response* resp, size_t*
 
 response* kds_s2000w_client_response_init()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_client_response_init");
+#endif
 
        response* resp = NULL;
 
@@ -59,7 +66,9 @@ response* kds_s2000w_client_response_init()
 
 void kds_s2000w_client_response_free(response* response)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_client_response_free");
+#endif
        if (response == NULL)
                return;
 
@@ -73,7 +82,10 @@ void kds_s2000w_client_response_free(response* response)
 
 int kds_s2000w_client_open_session(response* response)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_client_open_session");
+#endif
+
        _kds_s2000w_client_load_config();
 
        CURL* curl = NULL;
@@ -131,7 +143,10 @@ int kds_s2000w_client_open_session(response* response)
 
 void kds_s2000w_client_close_session(int64_t sessionid)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_client_close_session");
+#endif
+
        CURL* curl = NULL;
        CURLU* url_handler = NULL;
        struct curl_slist* headers = NULL;
@@ -172,7 +187,10 @@ void kds_s2000w_client_close_session(int64_t sessionid)
 
 int kds_s2000w_client_status_session(int64_t sessionid, response* response)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_client_status_session");
+#endif
+
        join_thread();
        wait_seconds(&p_config.heartbeat);
        CURL* curl = NULL;
@@ -232,7 +250,10 @@ int kds_s2000w_client_status_session(int64_t sessionid, response* response)
 
 int kds_s2000w_client_start_scan(int64_t sessionid, response* response)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_client_start_scan");
+#endif
+
        CURL* curl = NULL;
        CURLU* url_handler = NULL;
        char* url = NULL;
@@ -292,7 +313,10 @@ int kds_s2000w_client_start_scan(int64_t sessionid, response* response)
 
 int kds_s2000w_client_stop_scan(int64_t sessionid, response* response)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_client_stop_scan");
+#endif
+
        CURL* curl = NULL;
        CURLU* url_handler = NULL;
        struct curl_slist* headers = NULL;
@@ -351,7 +375,10 @@ int kds_s2000w_client_stop_scan(int64_t sessionid, response* response)
 
 int kds_s2000w_client_get_image(int64_t sessionid, int img_number, response* response)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_client_get_image");
+#endif
+
        CURL* curl = NULL;
        CURLU* url_handler = NULL;
        struct curl_slist* headers = NULL;
@@ -411,7 +438,10 @@ int kds_s2000w_client_get_image(int64_t sessionid, int img_number, response* res
 
 int kds_s2000w_client_delete_image(int64_t sessionid, int img_number, response* response)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_client_delete_image");
+#endif
+
        CURL* curl = NULL;
        CURLU* url_handler = NULL;
        char* url = NULL;
@@ -471,7 +501,10 @@ int kds_s2000w_client_delete_image(int64_t sessionid, int img_number, response*
 
 int kds_s2000w_client_get_capabilities(response* response)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_client_get_capabilities");
+#endif
+
        CURL* curl = NULL;
        CURLU* url_handler =NULL;
        char* url = NULL;
@@ -524,7 +557,10 @@ int kds_s2000w_client_get_capabilities(response* response)
 
 int kds_s2000w_client_get_option(int64_t sessionid, response* response)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_client_get_option");
+#endif
+
        CURL* curl = NULL;
        CURLU* url_handler = NULL;
        struct curl_slist* headers = NULL;
@@ -582,7 +618,10 @@ int kds_s2000w_client_get_option(int64_t sessionid, response* response)
 
 int kds_s2000w_client_set_option(int64_t sessionid, response* response)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_client_set_option");
+#endif
+
        CURL* curl = NULL;
        CURLU* url_handler = NULL;
        char* url = NULL;
index 2535dfb0f72c806eadf5345f89796eac0418c63a..c8897fcedf23b85a5c1f23b24203bd489c7da6f7 100644 (file)
@@ -1,3 +1,4 @@
+#ifndef NODEBUG
 #include <stdio.h>
 #include <stdlib.h>
 #include "kds_s2000w_debug.h"
@@ -34,4 +35,5 @@ void debug_printf_hex(int level, const char* message, char value)
 {
        if (level <= _get_log_level())
                printf("%s: %hhx\n", message, value);
-}
\ No newline at end of file
+}
+#endif
\ No newline at end of file
index f5076127810c20c1212400c112d6a6b57e0a2698..c8377ebb72c99e629139983dcfe6b01a1ec7598f 100644 (file)
@@ -1,3 +1,4 @@
+#ifndef NODEBUG
 #ifndef KDS_S2000w_DEBUG_H
 #define KDS_S2000w_DEBUG_H
 
@@ -13,4 +14,5 @@ void debug_printf(int level, const char* message);
 void debug_printf_int(int level, const char* message, int value);
 void debug_printf_long(int level, const char* message, long value);
 void debug_printf_hex(int level, const char* message, char value);
-#endif
\ No newline at end of file
+#endif /* KDS_S2000w_DEBUG_H */
+#endif /* NODEBUG */
\ No newline at end of file
index 8ee33bd683b06675012abf65d177330217cad2d9..6733d130eb93cc1bc0604a7842733f2dd477937d 100644 (file)
@@ -6,11 +6,17 @@
 #include "kds_s2000w_handler_opts.h"
 #include "kds_s2000w_client.h"
 #include "kds_s2000w_image_converter.h"
+
+#ifndef NODEBUG
 #include "kds_s2000w_debug.h"
+#endif
 
 void _get_current_metadata(handler* h)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "get_current_metadata");
+#endif
+
        json_object* metadata = NULL;
        json_object* config = NULL;
        blobdata* scanner_image = NULL;
@@ -53,7 +59,9 @@ void _get_current_metadata(handler* h)
                kds_s2000w_convert_tiff_to_pnm(scanner_image, pnm_image);
        }
 
+#ifndef NODEBUG
        debug_printf_int(DEBUG, "size of pnm image", h->pnm_image->size);
+#endif
 
        if (h->current_metadata->depth == 1)
                h->current_metadata->bytes_per_line = h->current_metadata->channels * floor((h->current_metadata->pixels_per_line + 7) / 8);
@@ -69,7 +77,10 @@ void _get_current_metadata(handler* h)
 
 void _delete_current_image(handler* h)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "delete_current_image");
+#endif
+
        response* resp = NULL;
 
        resp = kds_s2000w_client_response_init();
@@ -84,7 +95,10 @@ void _delete_current_image(handler* h)
 
 void _download_current_image(handler* h)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "download_current_image");
+#endif
+
        response* resp = NULL;
 
        if (h->scanner_image->size > 0) {
@@ -108,7 +122,10 @@ void _download_current_image(handler* h)
 
 void _get_current_scan_status(handler* h)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "get_current_scan_status");
+#endif
+
        json_object* status_resp_obj = NULL;
        json_object* status_obj = NULL;
        json_object* status_value_obj = NULL;
@@ -122,7 +139,10 @@ void _get_current_scan_status(handler* h)
        if (resp->error_size > 0)
                fprintf(stderr, "%s\n", resp->error_status);
 
+#ifndef NODEBUG
        debug_printf(DEBUG, resp->data);
+#endif
+
        status_resp_obj = json_tokener_parse(resp->data);
        status_obj = json_object_object_get(status_resp_obj, "Status");
        status_value_obj = json_object_object_get(status_obj, "NumImagesStored");
@@ -141,7 +161,10 @@ void _get_current_scan_status(handler* h)
 
 handler* init_handler()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "init handler");
+#endif
+
        handler* h = malloc(sizeof(handler));
        h->current_scanner_config = NULL;
        h->current_scan_status = malloc(sizeof(scanstatus));
@@ -181,7 +204,10 @@ handler* init_handler()
 
 void free_handler(handler* h)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "free handler");
+#endif
+
        json_object_put(h->current_scanner_config);
        h->current_scanner_config = NULL;
        free(h->current_scan_status);
@@ -202,7 +228,10 @@ void free_handler(handler* h)
 
 void reset_handler(handler* h)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "reset handler");
+#endif
+
        free(h->pnm_image->data);
        h->pnm_image->data = NULL;
        free(h->scanner_image->data);
@@ -249,7 +278,10 @@ void kds_s2000w_handler_recreate_session(handler* h)
                value_object = NULL;
                json_object_put(sessionJson);
                sessionJson = NULL;
+
+#ifndef NODEBUG
                debug_printf_long(INFO, "SessionId", h->sessionid);
+#endif
 
                // set old config parameters
                kds_s2000w_client_response_free(resp);
@@ -271,7 +303,10 @@ void kds_s2000w_handler_recreate_session(handler* h)
 
 void kds_s2000w_handler_open(const char* devicename, void** handle)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_handler_open");
+#endif
+
        if (strcmp(devicename, "kds_s2000w_net") != 0)
                return;
 
@@ -315,7 +350,9 @@ void kds_s2000w_handler_open(const char* devicename, void** handle)
                json_object_object_get_ex(h->current_scanner_config, "SessionId", &value_object);
                h->sessionid = json_object_get_int64(value_object);
                h->state = OPENED;
+#ifndef NODEBUG
                debug_printf_long(INFO, "SessionId", h->sessionid);
+#endif
                value_object = NULL;
        }
 
@@ -327,7 +364,10 @@ void kds_s2000w_handler_open(const char* devicename, void** handle)
 
 void kds_s2000w_handler_close(handler* h)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_handler_close");
+#endif
+
        json_object_put(h->current_scanner_config);
        h->current_scanner_config = NULL;
 
@@ -342,7 +382,10 @@ void kds_s2000w_handler_close(handler* h)
 
 void kds_s2000w_handler_start_scan(handler* h)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_handler_start_scan");
+#endif
+
        response* resp = NULL;
 
        resp = kds_s2000w_client_response_init();
@@ -356,7 +399,10 @@ void kds_s2000w_handler_start_scan(handler* h)
 
 void kds_s2000w_handler_stop_scan(handler* h)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_handler_stop_scan");
+#endif
+
        response* resp = NULL;
 
        resp = kds_s2000w_client_response_init();
@@ -370,7 +416,9 @@ void kds_s2000w_handler_stop_scan(handler* h)
 
 void kds_s2000w_handler_get_parameters(handler* h)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_handler_get_parameters");
+#endif
 
        if (h->current_scan_status->complete_scanned
                && h->current_scan_status->available_images <= 0) {
@@ -379,16 +427,26 @@ void kds_s2000w_handler_get_parameters(handler* h)
                return;
        }
 
+#ifndef NODEBUG
        debug_printf(DEBUG, "get scanner status");
+#endif
        _get_current_scan_status(h);
 
+#ifndef NODEBUG
        debug_printf_int(DEBUG, "available images", h->current_scan_status->available_images);
+#endif
        if (h->current_scan_status->available_images > 0) {
+#ifndef NODEBUG
                debug_printf_int(DEBUG, "download image", h->current_scan_status->current_image_number);
+#endif
                _download_current_image(h);
+#ifndef NODEBUG
                debug_printf_int(DEBUG, "get metadata for image", h->current_scan_status->current_image_number);
+#endif
                _get_current_metadata(h);
+#ifndef NODEBUG
                debug_printf_int(DEBUG, "delete image", h->current_scan_status->current_image_number);
+#endif
                _delete_current_image(h);
                h->current_scan_status->current_image_number++;
        }
index 15d7b2c1c4801c4eab6d61b540ab5955207286fb..264fe9121fe69402d9113f2d0a1593072cf7713c 100644 (file)
@@ -3,7 +3,10 @@
 #include "kds_s2000w_handler.h"
 #include "kds_s2000w_client.h"
 #include "kds_s2000w_handler_opts.h"
+
+#ifndef NODEBUG
 #include "kds_s2000w_debug.h"
+#endif
 
 #define AUTOSTART_ALWAYS_ON 1
 #define COUNT_CUSTOM_OPTIONS 0
@@ -45,7 +48,9 @@ void _load_options(handler* h)
        h->current_scanner_config = json_tokener_parse(resp->data);
 
        if (result != 0 || resp->code != 200) {
+#ifndef NODEBUG
                debug_printf_int(ERROR, "load options response code", resp->code);
+#endif
                kds_s2000w_client_response_free(resp);
                resp = NULL;
                json_object_put(h->current_scanner_config);
@@ -75,7 +80,9 @@ void kds_s2000w_handler_get_option(handler* h, int option, void* value, int* inf
                        config = json_object_object_get(h->current_scanner_config, "Configuration");
                        int* int_value_ptr = (int*) value;
                        *int_value_ptr = json_object_object_length(config) + COUNT_CUSTOM_OPTIONS;
+#ifndef NODEBUG
                        debug_printf_int(DEBUG, "option numbers", *int_value_ptr);
+#endif
                        break;
                case 2:
                        value_object = json_object_object_get(config, "ScanSource");
@@ -314,8 +321,10 @@ void kds_s2000w_handler_set_option(handler* h, int option, void* value, int* inf
                        resp->data = realloc(resp->data, resp->size);
                        resp->data = memcpy(resp->data, json_string, resp->size);
                        kds_s2000w_client_set_option(h->sessionid, resp);
+#ifndef NODEBUG
                        if (resp->code != 200)
                                debug_printf_int(ERROR, "set options response code", resp->code);
+#endif
 
                        kds_s2000w_client_response_free(resp);
                        resp = NULL;
@@ -343,8 +352,10 @@ void kds_s2000w_handler_set_option(handler* h, int option, void* value, int* inf
        resp->data = realloc(resp->data, resp->size);
        resp->data = memcpy(resp->data, json_string, resp->size);
        kds_s2000w_client_set_option(h->sessionid, resp);
+#ifndef NODEBUG
        if (resp->code != 200)
                debug_printf_int(ERROR, "set options response code", resp->code);
+#endif
 
        kds_s2000w_client_response_free(resp);
        resp = NULL;
index 0e01a1f2746d0d104c5d6da62b141b805386ad1a..42d6cb1f33d672b5f5e2f845322655a8c8c1473b 100644 (file)
@@ -5,14 +5,19 @@
 #include <string.h>
 #include <magick/MagickCore.h>
 #include "kds_s2000w_image_converter.h"
+
+#ifndef NODEBUG
 #include "kds_s2000w_debug.h"
+#endif
 
 void kds_s2000w_convert_to_pnm_with_depth(blobdata* in,
        blobdata* out,
        int depth,
        const char* format)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_convert_to_pnm_With_depth");
+#endif
        
        ExceptionInfo* exception = NULL;
        Image* input_image = NULL;
@@ -22,7 +27,11 @@ void kds_s2000w_convert_to_pnm_with_depth(blobdata* in,
        image_info = CloneImageInfo(NULL);
 
        sprintf(image_info->filename, "streamin.%s", format);
+
+#ifndef NODEBUG
        debug_printf(DEBUG, image_info->filename);
+#endif
+
        input_image = BlobToImage(image_info, in->data, in->size , exception);
 
        if (exception->severity != UndefinedException) {
@@ -56,21 +65,30 @@ void kds_s2000w_convert_to_pnm_with_depth(blobdata* in,
 
 void kds_s2000w_convert_jpg_to_pnm_with_depth(blobdata* in, blobdata* out, int depth)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_convert_jpg_to_pnm_With_depth");
+#endif
+
        const char* extension = "jpg";
        kds_s2000w_convert_to_pnm_with_depth(in, out, depth, extension);
 }
 
 void kds_s2000w_convert_tiff_to_pnm(blobdata* in, blobdata* out)
 {
-       const char* extension = "tiff";
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_convert_tiff_to_pnm");
+#endif
+
+       const char* extension = "tiff";
        kds_s2000w_convert_to_pnm_with_depth(in, out, -1, extension);
 }
 
 void kds_s2000w_metadata_from_image(blobdata* image, image_metadata* mdata)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_metadata_from_image");
+#endif
+
        ExceptionInfo* exception = NULL;
        Image* input_image = NULL;
        ImageInfo* image_info = NULL;
index 29b5d9dc73f92c4d3d6f559d8683a3bf27f78077..04d96154693cb49d89b144efc0f978e4c0b0b80a 100644 (file)
@@ -7,11 +7,17 @@
 #include "kds_s2000w_net.h"
 #include "kds_s2000w_option_descriptors.h"
 #include "kds_s2000w_handler.h"
+
+#ifndef NODEBUG
 #include "kds_s2000w_debug.h"
+#endif
 
 int _sane_kds_s2000w_net_find_first_data_byte(imagedata* image)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "sane_kds_s2000w_net_find_first_data_byte");
+#endif
+
        char* data = image->data;
        int header_spaces = 3;
 
@@ -34,7 +40,10 @@ int _sane_kds_s2000w_net_find_first_data_byte(imagedata* image)
 
 SANE_Status _sane_kds_s2000w_net_init(SANE_Int* version_code, SANE_Auth_Callback authorize)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "sane_kds_s2000w_net_init");
+#endif
+
        *version_code = SANE_VERSION_CODE(MAJOR, MINOR, PATCH);
        kds_s2000w_option_descriptor_init_option_descriptors();
        return SANE_STATUS_GOOD;
@@ -42,13 +51,18 @@ SANE_Status _sane_kds_s2000w_net_init(SANE_Int* version_code, SANE_Auth_Callback
 
 void _sane_kds_s2000w_net_exit(void)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "sane_kds_s2000w_net_exit");
+#endif
 }
 
 SANE_Status _sane_kds_s2000w_net_get_devices(SANE_Device*** device_list,
        SANE_Bool local_only)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "sane_kds_s2000w_net_get_devices");
+#endif
+
        SANE_Device** own_device_list = NULL;
        SANE_Device* device_info = NULL;
        if (local_only)
@@ -70,7 +84,10 @@ SANE_Status _sane_kds_s2000w_net_get_devices(SANE_Device*** device_list,
 SANE_Status _sane_kds_s2000w_net_open(SANE_String_Const devicename,
        SANE_Handle* handle)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "sane_kds_s2000w_net_open");
+#endif
+
        if (strcmp(devicename, "kds_s2000w_net") != 0)
                return SANE_STATUS_INVAL;
 
@@ -87,7 +104,10 @@ SANE_Status _sane_kds_s2000w_net_open(SANE_String_Const devicename,
 
 void _sane_kds_s2000w_net_close(SANE_Handle handle)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "sane_kds_s2000w_net_close");
+#endif
+
        kds_s2000w_option_descriptor_free_option_descriptors();
        kds_s2000w_handler_close(handle);
 }
@@ -95,14 +115,20 @@ void _sane_kds_s2000w_net_close(SANE_Handle handle)
 const SANE_Option_Descriptor* _sane_kds_s2000w_net_get_option_descriptor(
        SANE_Handle handle, SANE_Int option)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "sane_kds_s2000w_net_get_option_descriptor");
+#endif
+
        return kds_s2000w_option_get_descriptor(option);
 }
 
 SANE_Status _sane_kds_s2000w_net_control_option(SANE_Handle handle,
        SANE_Int option, SANE_Action action, void* value, SANE_Int* info)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "sane_kds_s2000w_net_control_option");
+#endif
+
        handler* h = (handler*) handle;
        if (action == SANE_ACTION_GET_VALUE)
                kds_s2000w_handler_get_option(h, option, value, info);
@@ -115,7 +141,10 @@ SANE_Status _sane_kds_s2000w_net_control_option(SANE_Handle handle,
 
 void _sane_kds_s2000w_net_cancel(SANE_Handle handle)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "sane_kds_s2000w_net_cancel");
+#endif
+
        handler* h = (handler*) handle;
        h->read_info->cancel = 1;
        kds_s2000w_handler_stop_scan(h);
@@ -125,7 +154,10 @@ void _sane_kds_s2000w_net_cancel(SANE_Handle handle)
 SANE_Status _sane_kds_s2000w_net_get_parameters(SANE_Handle handle,
        SANE_Parameters* params)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "sane_kds_s2000w_net_get_parameters");
+#endif
+
        handler* h = (handler*) handle;
 
        if (h->read_info->cancel) {
@@ -144,19 +176,24 @@ SANE_Status _sane_kds_s2000w_net_get_parameters(SANE_Handle handle,
        h->read_info->readed_bytes_per_line = 0;
        h->read_info->readed_lines = 0;
 
+#ifndef NODEBUG
        debug_printf_int(DEBUG, "format", params->format);
        debug_printf_int(DEBUG, "last frame", params->last_frame);
        debug_printf_int(DEBUG, "bytes per line", params->bytes_per_line);
        debug_printf_int(DEBUG, "pixels per line", params->pixels_per_line);
        debug_printf_int(DEBUG, "lines", params->lines);
        debug_printf_int(DEBUG, "depth", params->depth);
+#endif
 
        return SANE_STATUS_GOOD;
 }
 
 SANE_Status _sane_kds_s2000w_net_start(SANE_Handle handle)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "sane_kds_s2000w_net_start");
+#endif
+
        handler* h = (handler*) handle;
 
        if (h->read_info->cancel) {
@@ -205,7 +242,10 @@ SANE_Status _sane_kds_s2000w_net_start(SANE_Handle handle)
 SANE_Status _sane_kds_s2000w_net_read(SANE_Handle handle, SANE_Byte* data,
        SANE_Int max_length, SANE_Int* length)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "sane_kds_s2000w_net_read");
+#endif
+
        handler* h = (handler*) handle;
 
        // cancel
@@ -246,12 +286,18 @@ SANE_Status _sane_kds_s2000w_net_read(SANE_Handle handle, SANE_Byte* data,
 SANE_Status _sane_kds_s2000w_net_set_io_mode(SANE_Handle handle,
        SANE_Bool non_blocking)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "sane_kds_s2000w_net_set_io_mode");
+#endif
+
        return SANE_STATUS_UNSUPPORTED;
 }
 
 SANE_Status _sane_kds_s2000w_net_get_select_fd(SANE_Handle handle, SANE_Int* fd)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "sane_kds_s2000w_net_get_select_fd");
+#endif
+
        return SANE_STATUS_UNSUPPORTED;
 }
\ No newline at end of file
index 678592b2987c08addc07fdcf1dac602d374fcbc0..6cf2f2f85cc37f5c1a663ecff73e4f5c7ab4b5ef 100644 (file)
@@ -1,7 +1,10 @@
 #include <stdlib.h>
 #include <sane/saneopts.h>
 #include "kds_s2000w_option_descriptors.h"
+
+#ifndef NODEBUG
 #include "kds_s2000w_debug.h"
+#endif
 
 SANE_Option_Descriptor* descriptor_array = NULL;
 
@@ -27,7 +30,9 @@ SANE_String_Const* constraint_scan_source = NULL;
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_standard_group()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_standard_group");
+#endif
 
        SANE_Option_Descriptor descriptor = {
                SANE_NAME_STANDARD,
@@ -45,7 +50,10 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_standard_group()
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_geometry_group()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_scan_area_group");
+#endif
+
        SANE_Option_Descriptor descriptor = {
                SANE_NAME_GEOMETRY,
                SANE_TITLE_GEOMETRY,
@@ -62,7 +70,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_geometry_group()
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_num_options()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_num_options");
+#endif
 
        SANE_Option_Descriptor descriptor = {
                SANE_NAME_NUM_OPTIONS,
@@ -80,7 +90,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_num_options()
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_dpi()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_dpi");
+#endif
 
        SANE_Option_Descriptor descriptor = {
                SANE_NAME_SCAN_RESOLUTION,
@@ -99,7 +111,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_dpi()
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_scanside()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_scanside");
+#endif
 
        constraint_scanside = malloc(sizeof(SANE_String_Const*) * 3);
        constraint_scanside[0] = "Simplex";
@@ -123,7 +137,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_scanside()
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_mode()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_color_mode");
+#endif
 
        constraint_colormode = malloc(sizeof(SANE_String_Const*) * 4);
        constraint_colormode[0] = "Color";
@@ -148,7 +164,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_mode()
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_skip_blank_pages()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_skip_blank_pages");
+#endif
 
        SANE_Option_Descriptor descriptor = {
                "skip-blank-pages",
@@ -166,7 +184,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_skip_blank_pages()
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_drop()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_color_drop");
+#endif
 
        constraint_colordrop = malloc(sizeof(SANE_String_Const*) * 9);
        constraint_colordrop[0] = "None";
@@ -196,7 +216,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_drop()
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_drop_out_aggressiveness()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_color_drop_out_aggressiveness");
+#endif
 
        SANE_Option_Descriptor descriptor = {
                "colordropoutaggressiveness",
@@ -215,7 +237,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_drop_out_aggressivene
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_auto_brightness_mode()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_color_auto_brightness_mode");
+#endif
 
        constraint_color_auto_brightnessmode = malloc(sizeof(SANE_String_Const*) * 3);
        constraint_color_auto_brightnessmode[0] = "None";
@@ -239,7 +263,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_auto_brightness_mode(
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_balance_mode()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_color_balance_mode");
+#endif
 
        constraint_color_balance_mode = malloc(sizeof(SANE_String_Const*) * 5);
        constraint_color_balance_mode[0] = "None";
@@ -265,7 +291,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_balance_mode()
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_balancea_agressiveness()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_color_balancea_agressiveness");
+#endif
 
        SANE_Option_Descriptor descriptor = {
                "colorbalanceaggressiveness",
@@ -284,7 +312,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_balancea_agressivenes
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_balance_red()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_color_balance_red");
+#endif
 
        SANE_Option_Descriptor descriptor = {
                "colorbalancered",
@@ -303,7 +333,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_balance_red()
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_balance_green()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_color_balance_green");
+#endif
 
        SANE_Option_Descriptor descriptor = {
                "colorbalancegreen",
@@ -322,7 +354,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_balance_green()
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_balance_blue()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_color_balance_blue");
+#endif
 
        SANE_Option_Descriptor descriptor = {
                "colorbalanceblue",
@@ -341,7 +375,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_balance_blue()
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_foreground_boldness_mode()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_foreground_boldness_mode");
+#endif
 
        constraint_foreground_boldness_mode = malloc(sizeof(SANE_String_Const*) * 4);
        constraint_foreground_boldness_mode[0] = "None";
@@ -366,7 +402,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_foreground_boldness_mode()
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_foreground_boldness_aggressiveness()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_foreground_boldness_aggressiveness");
+#endif
 
        SANE_Option_Descriptor descriptor = {
                "foreground-boldness-aggressiveness",
@@ -385,7 +423,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_foreground_boldness_aggress
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_background_smoothing_mode()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_background_smoothing_mode");
+#endif
 
        constraint_background_smoothing_mode = malloc(sizeof(SANE_String_Const*) * 4);
        constraint_background_smoothing_mode[0] = "None";
@@ -410,7 +450,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_background_smoothing_mode()
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_background_smoothing_aggressiveness()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_background_smoothing_aggressiveness");
+#endif
 
        SANE_Option_Descriptor descriptor = {
                "background-smoothing-aggressiveness",
@@ -429,7 +471,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_background_smoothing_aggres
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_binarization_contrast()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_binarization_contrast");
+#endif
 
        SANE_Option_Descriptor descriptor = {
                SANE_NAME_CONTRAST,
@@ -448,7 +492,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_binarization_contrast()
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_scan_source()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_scan_source");
+#endif
 
        constraint_scan_source = malloc(sizeof(SANE_String_Const*) * 4);
        constraint_scan_source[0] = "DocumentFeeder";
@@ -473,7 +519,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_scan_source()
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_config_reset()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_config_reset");
+#endif
 
        SANE_Option_Descriptor descriptor = {
                "config-reset",
@@ -491,7 +539,9 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_config_reset()
 
 void kds_s2000w_option_descriptor_init_option_descriptors()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_init_option_descriptors");
+#endif
 
        descriptor_array = malloc(sizeof(SANE_Option_Descriptor) * MAX_OPTION_COUNT);
        descriptor_array[0] = _kds_s2000w_option_descriptor_num_options();
@@ -520,7 +570,10 @@ void kds_s2000w_option_descriptor_init_option_descriptors()
 
 void kds_s2000w_option_descriptor_free_option_descriptors()
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_descriptor_free_option_descriptors");
+#endif
+
        free(constraint_scanside);
        constraint_scanside = NULL;
        free(constraint_colormode);
@@ -547,7 +600,10 @@ void kds_s2000w_option_descriptor_free_option_descriptors()
 
 SANE_Option_Descriptor* kds_s2000w_option_get_descriptor(int option)
 {
+#ifndef NODEBUG
        debug_printf(ALL, "kds_s2000w_option_get_descriptor");
+#endif
+
        if (option >= MAX_OPTION_COUNT)
                return NULL;