diff --git a/lib/OSnap_Browser/Zip.ml b/lib/OSnap_Browser/Zip.ml index f05595c..ea09980 100644 --- a/lib/OSnap_Browser/Zip.ml +++ b/lib/OSnap_Browser/Zip.ml @@ -46,7 +46,7 @@ let read_4_bytes_int ic = let read_string ic len = let buf = Bytes.create len in really_input ic buf 0 len; - Bytes.unsafe_to_string buf + Bytes.to_string buf ;; let int64_of_uint32 n = Int64.(logand (of_int32 n) 0xFFFF_FFFFL) diff --git a/lib/OSnap_Diff/OSnap_Diff.ml b/lib/OSnap_Diff/OSnap_Diff.ml index 7f60488..516e811 100644 --- a/lib/OSnap_Diff/OSnap_Diff.ml +++ b/lib/OSnap_Diff/OSnap_Diff.ml @@ -75,22 +75,23 @@ let diff if col >= original_image_start && col < original_image_end && row < original_image.height - then Array1.unsafe_get original_image.image ((row * original_image.width) + col) + then Array1.get original_image.image ((row * original_image.width) + col) else if col > diff_mask_start && col < diff_mask_end then ( let diff_pixel = if row < diff_mask.height then - Array1.unsafe_get + Array1.get diff_mask.image ((row * diff_mask.width) + (col - diff_mask_start)) else 0x00000000l in if not (Int32.equal diff_pixel 0x00000000l) then diff_pixel - else ( + else if row < original_image.height + then ( let pixel = - Array1.unsafe_get + Array1.get original_image.image ((row * original_image.width) + (col - diff_mask_start)) |> Int32.to_int @@ -105,15 +106,13 @@ let diff let b = (mono land 0xFF) lsl 16 in let g = (mono land 0xFF) lsl 8 in let r = (mono land 0xFF) lsl 0 in - Int32.of_int (a lor b lor g lor r))) + Int32.of_int (a lor b lor g lor r)) + else 0x00000000l) else if col > new_image_start && col <= new_image_end && row < new_image.height - then - Array1.unsafe_get - new_image.image - ((row * new_image.width) + (col - new_image_start)) + then Array1.get new_image.image ((row * new_image.width) + (col - new_image_start)) else 0x00000000l in - Array1.unsafe_set complete_image offset fill_with + Array1.set complete_image offset fill_with done; free_images (); Osnap_Diff_Png.PngIo.write_png_bigarray diff --git a/lib/OSnap_Diff/png/Osnap_Diff_Png.ml b/lib/OSnap_Diff/png/Osnap_Diff_Png.ml index 3ca1e92..27c5b73 100644 --- a/lib/OSnap_Diff/png/Osnap_Diff_Png.ml +++ b/lib/OSnap_Diff/png/Osnap_Diff_Png.ml @@ -10,12 +10,12 @@ module IO = struct let readDirectPixel ~(x : int) ~(y : int) (img : t ImageIO.img) = let image = (img.image : data) in - Array1.unsafe_get image ((y * img.width) + x) + Array1.get image ((y * img.width) + x) ;; let setImgColor ~x ~y color (img : t ImageIO.img) = let image = (img.image : data) in - Array1.unsafe_set image ((y * img.width) + x) color + Array1.set image ((y * img.width) + x) color ;; let loadImage buffer : t ImageIO.img =