From: Bastian Dehn Date: Sat, 8 Feb 2025 19:01:28 +0000 (+0100) Subject: change type check with stdint X-Git-Tag: v1.0.33^2~1^2~4 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=04797b10547549d6372c3014a34b400a01a37901;p=sane-kds-s2000w-net.git change type check with stdint --- diff --git a/src/kds_s2000w_image_type_check.c b/src/kds_s2000w_image_type_check.c index ed5957d..f405ca6 100644 --- a/src/kds_s2000w_image_type_check.c +++ b/src/kds_s2000w_image_type_check.c @@ -2,7 +2,7 @@ #include "kds_s2000w_debug.h" #include "kds_s2000w_image_type_check.h" -int kds_s2000w_image_type_check_is_tiff(blobdata* image) +uint8_t kds_s2000w_image_type_check_is_tiff(blobdata* image) { kds_s2000w_debug_printf(ALL, "kds_s2000w_image_type_check_is_tiff"); @@ -11,7 +11,7 @@ int kds_s2000w_image_type_check_is_tiff(blobdata* image) char* image_data = (char*) image->data; - int result = image_data[0] == (char)0x49; + uint8_t result = image_data[0] == (char)0x49; result = result && image_data[1] == (char)0x49; result = result && image_data[2] == (char)0x2A; result = result && image_data[3] == (char)0x00; @@ -25,7 +25,7 @@ int kds_s2000w_image_type_check_is_tiff(blobdata* image) return result && image_data[3] == (char)0x2A; } -int kds_s2000w_image_type_check_is_pnm(blobdata* image) +uint8_t kds_s2000w_image_type_check_is_pnm(blobdata* image) { kds_s2000w_debug_printf(ALL, "kds_s2000w_image_type_check_is_pnm"); @@ -39,7 +39,7 @@ int kds_s2000w_image_type_check_is_pnm(blobdata* image) return strncmp(image_data, "P4", 2) == 0; } -int kds_s2000w_image_type_check_is_jpeg(blobdata* image) +uint8_t kds_s2000w_image_type_check_is_jpeg(blobdata* image) { kds_s2000w_debug_printf(ALL, "kds_s2000w_image_type_check_is_jpeg"); @@ -48,6 +48,6 @@ int kds_s2000w_image_type_check_is_jpeg(blobdata* image) char* image_data = (char*) image->data; - int result = image_data[0] == (char)0xff; + uint8_t result = image_data[0] == (char)0xff; return result && image_data[1] == (char)0xd8; } \ No newline at end of file diff --git a/src/kds_s2000w_image_type_check.h b/src/kds_s2000w_image_type_check.h index 9de38ae..d82665f 100644 --- a/src/kds_s2000w_image_type_check.h +++ b/src/kds_s2000w_image_type_check.h @@ -1,9 +1,10 @@ #ifndef KDS_S2000W_IMAGE_TYPE_CHECK_H #define KDS_S2000W_IMAGE_TYPE_CHECK_H +#include #include "kds_s2000w_image_converter.h" -int kds_s2000w_image_type_check_is_tiff(blobdata* image); -int kds_s2000w_image_type_check_is_pnm(blobdata* image); -int kds_s2000w_image_type_check_is_jpeg(blobdata* image); +uint8_t kds_s2000w_image_type_check_is_tiff(blobdata* image); +uint8_t kds_s2000w_image_type_check_is_pnm(blobdata* image); +uint8_t kds_s2000w_image_type_check_is_jpeg(blobdata* image); #endif \ No newline at end of file