Fixes for safe-string.

This commit is contained in:
Richard W.M. Jones 2017-11-18 11:25:52 +00:00
parent daa40c1212
commit 40619dc754
2 changed files with 22 additions and 0 deletions

View File

@ -10,6 +10,9 @@ URL: http://ocamlsdl.sourceforge.net
Source0: http://downloads.sourceforge.net/ocamlsdl/ocamlsdl-%{version}.tar.gz
Source1: ocamlsdl-0.7.2-htmlref.tar.gz
# Fix for safe-string in OCaml 4.06.
Patch1: ocamlsdl-0.9.1-safe-string.patch
BuildRequires: ocaml-lablgl-devel
BuildRequires: SDL_ttf-devel, SDL_mixer-devel, SDL_image-devel
BuildRequires: ocaml
@ -34,6 +37,7 @@ applications using ocamlSDL
%prep
%setup -q -n ocamlsdl-%{version} -a 1
%autopatch -p1
%build

View File

@ -0,0 +1,18 @@
--- ocamlsdl-0.9.1.old/src/sdlmouse.ml 2011-04-10 16:33:52.000000000 +0100
+++ ocamlsdl-0.9.1/src/sdlmouse.ml 2017-11-18 11:24:01.989795950 +0000
@@ -49,12 +49,12 @@
= "ml_SDL_Cursor_data"
let string_of_bits x =
- let s = String.make 8 ' ' in
+ let s = Bytes.make 8 ' ' in
for i=0 to 7 do
if x land (1 lsl i) <> 0
- then s.[7-i] <- '@'
+ then Bytes.set s (7-i) '@'
done ;
- s
+ Bytes.to_string s
let pprint_cursor c =
let { data = data ; mask = mask } = cursor_data c in