Skip to content

Commit 793dd1a

Browse files
committed
Remove -cc gcc
1 parent f70cc66 commit 793dd1a

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

io/tiff/ReadTiff.c

+20-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#define CAML_NAME_SPACE
2-
#include <signal.h>
32
#include <stdio.h>
43

54
#include <caml/alloc.h>
@@ -10,6 +9,13 @@
109

1110
#include <tiffio.h>
1211

12+
#ifdef _WIN32
13+
#include <excpt.h> // For structured exception handling (SEH)
14+
#include <setjmp.h>
15+
#include <signal.h>
16+
#include <windows.h>
17+
#endif
18+
1319
CAMLprim value read_tiff_file_to_tuple(value file) {
1420
CAMLparam1(file);
1521
CAMLlocal2(res, ba);
@@ -34,11 +40,21 @@ CAMLprim value read_tiff_file_to_tuple(value file) {
3440
NULL, dims);
3541

3642
uint32_t *buffer = (uint32_t *)Caml_ba_data_val(ba);
37-
if (!(TIFFReadRGBAImageOriented(image, width, height, buffer,
38-
ORIENTATION_TOPLEFT, 0))) {
43+
44+
#ifdef _WIN32
45+
__try {
46+
#endif
47+
if (!(TIFFReadRGBAImageOriented(image, width, height, buffer,
48+
ORIENTATION_TOPLEFT, 0))) {
49+
TIFFClose(image);
50+
caml_failwith("reading input file failed");
51+
}
52+
#ifdef _WIN32
53+
} __except (EXCEPTION_EXECUTE_HANDLER) {
3954
TIFFClose(image);
40-
caml_failwith("reading input file failed");
55+
caml_failwith("reading input file failed due to an exception");
4156
}
57+
#endif
4258

4359
TIFFClose(image);
4460

0 commit comments

Comments
 (0)