lang/mtasc: the port had been improved (+)
- Unbreak against safe strings in OCaml 4.06+ - Define LICENSE (GNU GPL version 2 or later)
This commit is contained in:
parent
2ab38bd2ae
commit
4c1e5cee8f
3 changed files with 61 additions and 0 deletions
|
@ -9,6 +9,8 @@ MASTER_SITES= LOCAL/chinsan
|
|||
MAINTAINER= saper@saper.info
|
||||
COMMENT= Motion-Twin ActionScript 2 Compiler
|
||||
|
||||
LICENSE= GPLv2+
|
||||
|
||||
BUILD_DEPENDS= ${LOCALBASE}/lib/ocaml/site-lib/extlib/IO.cmi:devel/ocaml-extlib
|
||||
|
||||
USE_OCAML= yes
|
||||
|
@ -32,6 +34,13 @@ PORTDATA= std std8
|
|||
|
||||
OPTIONS_DEFINE= DOCS EXAMPLES
|
||||
|
||||
post-patch:
|
||||
@${REINPLACE_CMD} -E 's,n(read|write) ch,n\1_string ch,' \
|
||||
${WRKSRC}/swflib/actionScript.ml \
|
||||
${WRKSRC}/swflib/as3code.ml \
|
||||
${WRKSRC}/swflib/as3parse.ml \
|
||||
${WRKSRC}/swflib/swfParser.ml
|
||||
|
||||
do-build:
|
||||
(cd ${WRKSRC}/extc && \
|
||||
${OCAMLOPT} ${WRKSRC}/extc/extc_stubs.c && \
|
||||
|
|
34
lang/mtasc/files/patch-extc_extc.ml
Normal file
34
lang/mtasc/files/patch-extc_extc.ml
Normal file
|
@ -0,0 +1,34 @@
|
|||
--- extc/extc.ml.orig 2007-02-26 13:00:51 UTC
|
||||
+++ extc/extc.ml
|
||||
@@ -34,11 +34,11 @@ type zresult = {
|
||||
}
|
||||
|
||||
external zlib_deflate_init : int -> zstream = "zlib_deflate_init"
|
||||
-external zlib_deflate : zstream -> src:string -> spos:int -> slen:int -> dst:string -> dpos:int -> dlen:int -> zflush -> zresult = "zlib_deflate_bytecode" "zlib_deflate"
|
||||
+external zlib_deflate : zstream -> src:string -> spos:int -> slen:int -> dst:bytes -> dpos:int -> dlen:int -> zflush -> zresult = "zlib_deflate_bytecode" "zlib_deflate"
|
||||
external zlib_deflate_end : zstream -> unit = "zlib_deflate_end"
|
||||
|
||||
external zlib_inflate_init : unit -> zstream = "zlib_inflate_init"
|
||||
-external zlib_inflate : zstream -> src:string -> spos:int -> slen:int -> dst:string -> dpos:int -> dlen:int -> zflush -> zresult = "zlib_inflate_bytecode" "zlib_inflate"
|
||||
+external zlib_inflate : zstream -> src:string -> spos:int -> slen:int -> dst:bytes -> dpos:int -> dlen:int -> zflush -> zresult = "zlib_inflate_bytecode" "zlib_inflate"
|
||||
external zlib_inflate_end : zstream -> unit = "zlib_inflate_end"
|
||||
|
||||
external _executable_path : string -> string = "executable_path"
|
||||
@@ -60,7 +60,7 @@ let zlib_op op z str =
|
||||
let rec loop pos len acc =
|
||||
let r = op z ~src:str ~spos:pos ~slen:len ~dst:tmp ~dpos:0 ~dlen:bufsize (if len = 0 then Z_FINISH else Z_SYNC_FLUSH) in
|
||||
total := !total + r.z_wrote;
|
||||
- let acc = String.sub tmp 0 r.z_wrote :: acc in
|
||||
+ let acc = Bytes.sub_string tmp 0 r.z_wrote :: acc in
|
||||
if r.z_finish then
|
||||
acc
|
||||
else
|
||||
@@ -74,7 +74,7 @@ let zlib_op op z str =
|
||||
String.unsafe_blit s 0 big p l;
|
||||
p
|
||||
) !total strings);
|
||||
- big
|
||||
+ Bytes.unsafe_to_string big
|
||||
|
||||
let zip str =
|
||||
let z = zlib_deflate_init 9 in
|
18
lang/mtasc/files/patch-swflib_swfZip.ml
Normal file
18
lang/mtasc/files/patch-swflib_swfZip.ml
Normal file
|
@ -0,0 +1,18 @@
|
|||
--- swflib/swfZip.ml.orig 2004-11-03 02:38:17 UTC
|
||||
+++ swflib/swfZip.ml
|
||||
@@ -24,13 +24,13 @@ let deflate o =
|
||||
let buf = Buffer.create 0 in
|
||||
let flush() =
|
||||
let data = Buffer.contents buf in
|
||||
- IO.nwrite o (Extc.zip data);
|
||||
+ IO.nwrite_string o (Extc.zip data);
|
||||
IO.flush o;
|
||||
Buffer.reset buf;
|
||||
in
|
||||
IO.create_out
|
||||
~write:(Buffer.add_char buf)
|
||||
- ~output:(fun s p l -> Buffer.add_substring buf s p l; l)
|
||||
+ ~output:(fun s p l -> Buffer.add_subbytes buf s p l; l)
|
||||
~flush
|
||||
~close:(fun () -> flush(); IO.close_out o)
|
||||
|
Loading…
Reference in a new issue