]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add math floor
authorBastian Dehn <hhaalo@arcor.de>
Thu, 8 Feb 2024 17:19:05 +0000 (18:19 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Thu, 8 Feb 2024 17:19:05 +0000 (18:19 +0100)
CMakeLists.txt
src/kds_s2000w_handler.c

index 4d1e30f307d38a0570e6293c3786ef997e9714d6..bad10ae56891898d5b643f25f3e6f9839dd4d7e9 100644 (file)
@@ -16,7 +16,7 @@ add_library("sane-kds_s2000w_net"
        "src/kds_s2000w_client.c"
        "src/kds_s2000w_image_converter.c")
 set_target_properties("sane-kds_s2000w_net" PROPERTIES VERSION 1)
-target_link_libraries("sane-kds_s2000w_net" json-c curl MagickCore-6.Q16)
+target_link_libraries("sane-kds_s2000w_net" json-c curl MagickCore-6.Q16 m)
 
 add_executable("convert"
        "tools/convert.c"
index 56aa3ee7d08e678ecd344626daef5db2761a7e75..9bb3869219a296d9723125ae89c5014c7e8b5643 100644 (file)
@@ -2,6 +2,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <json-c/json.h>
+#include <math.h>
 #include "kds_s2000w_handler.h"
 #include "kds_s2000w_handler_opts.h"
 #include "kds_s2000w_client.h"
@@ -94,7 +95,7 @@ void _get_current_metadata()
        printf("size of pnm image: %i\n", pnm_image.size);
 
        if (current_scan_status.mdata.depth == 1)
-               current_scan_status.mdata.bytes_per_line = channels * ((current_scan_status.mdata.pixels_per_line + 7) / 8);
+               current_scan_status.mdata.bytes_per_line = channels * floor((current_scan_status.mdata.pixels_per_line + 7) / 8);
        else
                current_scan_status.mdata.bytes_per_line = channels * current_scan_status.mdata.pixels_per_line * current_scan_status.mdata.depth / 8;