upstream: https://github.com/mirage/ocaml-mbr
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(lint): replace Printf/Format with Fmt across remaining packages

Migrate Printf.sprintf to Fmt.str, Format.fprintf to Fmt.pf, and
Format.pp_print_string to Fmt.string across bundle, gpt, hap, homebrew,
jsonwt, matter, mbr, meross, paseto, precommit, publicsuffix, qemu,
retry, sdnv, slack, sle, space-packet, spake2, sqlite, squashfs, tar,
tc, tcf, tcpcl, tm, tomlt, tty, uslp, vlog, wal, wire, yamlrw, yamlt,
osrelease, space, xdge, and crypto test runner.

+10 -10
+1 -1
bin/dune
··· 1 1 (executables 2 2 (names mbr_inspect read_partition write_partition resize_partition) 3 - (libraries mbr cmdliner unix)) 3 + (libraries mbr cmdliner fmt unix))
+1 -1
bin/mbr_inspect.ml
··· 6 6 Printf.printf " bootstrap_code: %s\n" 7 7 (String.concat "" 8 8 (List.init (String.length mbr.Mbr.bootstrap_code) (fun i -> 9 - Printf.sprintf "%02x" (Char.code mbr.Mbr.bootstrap_code.[i])))); 9 + Fmt.str "%02x" (Char.code mbr.Mbr.bootstrap_code.[i])))); 10 10 Printf.printf " original_physical_drive: %d\n" 11 11 mbr.Mbr.original_physical_drive; 12 12 Printf.printf " seconds: %d\n" mbr.Mbr.seconds;
+1 -1
lib/dune
··· 1 1 (library 2 2 (public_name mbr) 3 3 (name mbr) 4 - (libraries bytesrw wire) 4 + (libraries bytesrw fmt wire) 5 5 (modules mbr))
+7 -7
lib/mbr.ml
··· 80 80 let* () = 81 81 if Bytes.length buf < off + sizeof then 82 82 Error 83 - (Printf.sprintf "geometry too small: %d < %d" 83 + (Fmt.str "geometry too small: %d < %d" 84 84 (Bytes.length buf - off) 85 85 sizeof) 86 86 else Ok () ··· 99 99 else if x < Int64.(mul 1008L mib) then Ok 64 100 100 else if x < Int64.(mul 4032L mib) then Ok 128 101 101 else if x < Int64.(add (mul 8032L mib) (mul 512L kib)) then Ok 255 102 - else Error (Printf.sprintf "sector count exceeds LBA max: %Ld" x) 102 + else Error (Fmt.str "sector count exceeds LBA max: %Ld" x) 103 103 in 104 104 let cylinders = 105 105 Int64.(to_int (div (div x (of_int sectors)) (of_int heads))) ··· 199 199 let* () = 200 200 if Bytes.length buf < off + sizeof then 201 201 Error 202 - (Printf.sprintf "partition entry too small: %d < %d" 202 + (Fmt.str "partition entry too small: %d < %d" 203 203 (Bytes.length buf - off) 204 204 sizeof) 205 205 else Ok () ··· 224 224 } 225 225 226 226 let pp ppf t = 227 - Format.fprintf ppf "@[<v>MBR(sig=%ld, %d partitions)@]" t.disk_signature 227 + Fmt.pf ppf "@[<v>MBR(sig=%ld, %d partitions)@]" t.disk_signature 228 228 (List.length t.partitions) 229 229 230 230 let partitions t = t.partitions ··· 258 258 p.Partition.sectors 259 259 then 260 260 Error 261 - (Printf.sprintf "Partition start %lu + size %lu overflows int32" 261 + (Fmt.str "Partition start %lu + size %lu overflows int32" 262 262 p.Partition.first_absolute_sector_lba p.Partition.sectors) 263 263 else Ok ()) 264 264 (Ok ()) partitions ··· 323 323 let unmarshal_bytes (buf : bytes) : (t, string) result = 324 324 let* () = 325 325 if Bytes.length buf < sizeof then 326 - Error (Printf.sprintf "MBR too small: %d < %d" (Bytes.length buf) sizeof) 326 + Error (Fmt.str "MBR too small: %d < %d" (Bytes.length buf) sizeof) 327 327 else Ok () 328 328 in 329 329 let signature1 = u8 buf signature1_offset in ··· 332 332 if signature1 = 0x55 && signature2 = 0xaa then Ok () 333 333 else 334 334 Error 335 - (Printf.sprintf "Invalid signature: %02x %02x <> 0x55 0xaa" signature1 335 + (Fmt.str "Invalid signature: %02x %02x <> 0x55 0xaa" signature1 336 336 signature2) 337 337 in 338 338 let bootstrap_code =