Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix use of camlzip in byteweight #1609

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bap-byteweight.opam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ depends: [
"dune" {>= "3.1"}
"bap-signatures" {= version}
"bap-std" {= version}
"camlzip" {>= "1.0" & < "2.0"}
"camlzip" {>= "1.12" & < "2.0"}
"core_kernel" {>= "v0.14" & < "v0.16"}
"bap-common" {= version}
"ppx_bap" {= version}
Expand Down
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
(depends
(bap-signatures (= :version))
(bap-std (= :version))
(camlzip (and (>= 1.0) (< 2.0)))
(camlzip (and (>= 1.12) (< 2.0)))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for >= 1.12 with the change I suggested.

(core_kernel (and (>= v0.14) (< v0.16)))
(bap-common (= :version))
(ppx_bap (= :version))
Expand Down
5 changes: 2 additions & 3 deletions lib/bap_byteweight/bap_byteweight_signatures.ml
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ let update_or_fail ?compiler target data payload path =
let path = make_entry ?compiler target data in
let data = Bytes.unsafe_to_string (data.save payload) in
Zip.add_entry data zip path;
List.iter entries ~f:(fun ({Zip.filename; extra; comment; mtime},data) ->
Zip.add_entry data zip filename
~extra ~comment ~mtime)
List.iter entries ~f:(fun ({Zip.filename; comment; mtime},data) ->

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you write the pattern as follows, you'll remain compatible with CamlZip < 1.12 while not triggering warning 9:

fun ({Zip.filename; comment; mtime; _},data) ->

Zip.add_entry data zip filename ~comment ~mtime)

let copy input output =
let len = 0x1000 in
Expand Down
Loading