$NetBSD: patch-src_jpegread.c,v 1.3 2021/12/26 05:28:23 dholland Exp $ Use const. Update for OCaml immutable strings. --- src/jpegread.c.orig 2011-06-22 18:04:32.000000000 +0000 +++ src/jpegread.c @@ -23,6 +23,12 @@ #include #include +/* + * For future-proofing: currently in the ocaml FFI you use + * alloc_string for Bytes.t but that could change... + */ +#define alloc_bytes alloc_string + #include "oversized.h" #include @@ -76,7 +82,7 @@ read_JPEG_file (value name) CAMLparam1(name); CAMLlocal1(res); - char *filename; + const char *filename; /* This struct contains the JPEG decompression parameters and pointers to * working space (which is allocated as needed by the JPEG library). */ @@ -198,9 +204,9 @@ read_JPEG_file (value name) CAMLlocalN(r,3); r[0] = Val_int(cinfo.output_width); r[1] = Val_int(cinfo.output_height); - r[2] = alloc_string ( row_stride * cinfo.output_height ); + r[2] = alloc_bytes ( row_stride * cinfo.output_height ); for(i=0; i 1 int scanline_bytes = cinfop->output_width * 3; // no padding (size 3 is fixed? ) @@ -417,7 +423,7 @@ value read_jpeg_scanlines( value jpegh, jpeg_read_scanlines( cinfop, row, 1 ); row[0] += scanline_bytes; } - CAMLreturn0; + CAMLreturn(Val_unit); } value close_jpeg_file_for_read( jpegh )