]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
write file name direct
authorBastian Dehn <hhaalo@arcor.de>
Sun, 28 Apr 2024 19:07:48 +0000 (21:07 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 29 Apr 2024 06:23:47 +0000 (08:23 +0200)
src/kds_s2000w_image_converter.c

index 2252f80dd00df99ab4895a410edb134489e1c3e0..2c2abe3e9ae7e206c8f6be74cdda44c5e45362ea 100644 (file)
@@ -23,16 +23,11 @@ void kds_s2000w_convert_to_pnm_with_depth(blobdata* in,
        ExceptionInfo* exception = NULL;
        Image* input_image = NULL;
        ImageInfo* image_info = NULL;
-       char* streamname = NULL;
-       int str_length = 0;
 
        exception = AcquireExceptionInfo();
        image_info = CloneImageInfo(NULL);
 
-       str_length = 10 + strlen(format);
-       streamname = malloc(sizeof(char) * str_length);
-       snprintf(streamname, str_length, "streamin.%s", format);
-       memcpy(image_info->filename, streamname, str_length);
+       sprintf(image_info->filename, "streamin.%s", format);
        debug_printf(DEBUG, image_info->filename);
        input_image = BlobToImage(image_info, in->data, in->size , exception);
 
@@ -46,8 +41,6 @@ void kds_s2000w_convert_to_pnm_with_depth(blobdata* in,
        if (input_image == NULL) {
                DestroyImageInfo(image_info);
                DestroyExceptionInfo(exception);
-               free(streamname);
-               streamname = NULL;
                return;
        }
 
@@ -65,8 +58,6 @@ void kds_s2000w_convert_to_pnm_with_depth(blobdata* in,
        DestroyImageInfo(image_info);
        DestroyImage(input_image);
        DestroyExceptionInfo(exception);
-       free(streamname);
-       streamname = NULL;
 }
 
 void kds_s2000w_convert_jpg_to_pnm_with_depth(blobdata* in, blobdata* out, int depth)