File: 0007-Fix-compilation-with-OCaml-5.2.0.patch

package info (click to toggle)
cairo-ocaml 1%3A1.2.0-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 576 kB
  • sloc: ml: 2,086; ansic: 1,656; makefile: 189; sh: 153
file content (90 lines) | stat: -rw-r--r-- 2,849 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
From: Stephane Glondu <steph@glondu.net>
Date: Tue, 6 Aug 2024 13:33:52 +0200
Subject: Fix compilation with OCaml 5.2.0

---
 src/cairo_png.ml      | 2 +-
 src/ml_cairo.c        | 2 +-
 src/ml_cairo_ft.c     | 8 ++++----
 src/ml_cairo_status.c | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/cairo_png.ml b/src/cairo_png.ml
index c4a7024..bb6b368 100644
--- a/src/cairo_png.ml
+++ b/src/cairo_png.ml
@@ -13,7 +13,7 @@ let image_surface_create_from_channel ic =
   image_surface_create_from_stream_unsafe
     (fun s n ->
       for i = 0 to n - 1 do
-	String.unsafe_set s i (input_char ic)
+	Bytes.unsafe_set s i (input_char ic)
       done)
 
 let image_surface_create_from_file fname =
diff --git a/src/ml_cairo.c b/src/ml_cairo.c
index 7f50a1d..5ac6d82 100644
--- a/src/ml_cairo.c
+++ b/src/ml_cairo.c
@@ -540,7 +540,7 @@ ml_cairo_write_func (void *closure, const unsigned char *data, unsigned int leng
 {
   value s, res, *c = closure;
   s = caml_alloc_string (length);
-  memcpy (String_val (s), data, length);
+  memcpy (Bytes_val (s), data, length);
   res = caml_callback_exn (Field (*c, 0), s);
   if (Is_exception_result (res))
     {
diff --git a/src/ml_cairo_ft.c b/src/ml_cairo_ft.c
index 4bc1607..308310f 100644
--- a/src/ml_cairo_ft.c
+++ b/src/ml_cairo_ft.c
@@ -31,7 +31,7 @@ ml_raise_FT_Error (FT_Error err)
 }
 
 static value
-Val_ptr (void *p)
+ml_FT_Val_ptr (void *p)
 {
   value v = caml_alloc_small (1, Abstract_tag);
   Field (v, 0) = Val_bp (p);
@@ -45,7 +45,7 @@ ml_FT_Init_FreeType (value unit)
 {
   FT_Library lib;
   ml_raise_FT_Error (FT_Init_FreeType (&lib));
-  return Val_ptr (lib);
+  return ml_FT_Val_ptr (lib);
 }
 
 CAMLprim value
@@ -65,7 +65,7 @@ ml_FT_New_Face (value lib, value o_index, value path)
   ml_raise_FT_Error (FT_New_Face (FT_Library_val (lib),
 				  String_val (path),
 				  index, &face));
-  return Val_ptr (face);
+  return ml_FT_Val_ptr (face);
 }
 
 CAMLprim value
@@ -114,7 +114,7 @@ ml_FcNameUnparse (value patt)
 /* cairo Fontconfig/Freetype font backend */
 wML_1 (cairo_ft_font_face_create_for_pattern, FcPattern_val, Val_cairo_font_face_t)
 wML_2 (cairo_ft_font_face_create_for_ft_face, FT_Face_val, Int_val, Val_cairo_font_face_t)
-wML_1 (cairo_ft_scaled_font_lock_face, cairo_scaled_font_t_val, Val_ptr)
+wML_1 (cairo_ft_scaled_font_lock_face, cairo_scaled_font_t_val, ml_FT_Val_ptr)
 wML_1 (cairo_ft_scaled_font_unlock_face, cairo_scaled_font_t_val, Unit)
 
 #else
diff --git a/src/ml_cairo_status.c b/src/ml_cairo_status.c
index 1863ed5..4939d59 100644
--- a/src/ml_cairo_status.c
+++ b/src/ml_cairo_status.c
@@ -20,7 +20,7 @@ wML_1 (cairo_status_to_string, Int_val, caml_copy_string)
 void
 ml_cairo_treat_status (cairo_status_t status)
 {
-  static value *cairo_exn;
+  static const value *cairo_exn;
 
   assert (status != CAIRO_STATUS_SUCCESS);