Fixes for 32 bit
[virt-df.git] / lib / diskimage_ntfs.ml
index d0f2f49..50ae581 100644 (file)
@@ -112,6 +112,7 @@ and probe_superblock dev =
 
       let blocksize = Int63.of_int blocksize in
       let number_of_sectors = Int63.of_int64 number_of_sectors in
+      let bytes_per_sector = Int63.of_int bytes_per_sector in
 
       (* The blocksize of the filesystem is likely to be quite different
        * from that of the underlying device, so create an overlay device
@@ -530,7 +531,7 @@ and iter_blocks { ntfs_blocksize = blocksize; ntfs_dev = dev }
            let vcnsize = ref vcnsize in
            while !vcnsize > ~^0 && !data_size > ~^0 do
              let size = min blocksize !data_size in
-             let data = String.make size '\000' in
+             let data = String.make (Int63.to_int size) '\000' in
              f None !vcn data;
              vcn := !vcn +^ ~^1;
              vcnsize := !vcnsize -^ ~^1;
@@ -572,7 +573,7 @@ and read_file { ntfs_blocksize = blocksize; ntfs_dev = dev }
       let data =
        match lcn with
        | Some lcn -> dev#read (lcn *^ blocksize +^ vcnoffset) size
-       | None -> String.make size '\000' (* sparse hole *) in
+       | None -> String.make (Int63.to_int size) '\000' (* sparse hole *) in
       data
 
 (* This is easy: just look at the bitmap. *)
@@ -590,7 +591,7 @@ and offset_is_free fs offset =
     let byteoffset = lcn >^> 3 and bitoffset = lcn &^ ~^7 in
     let byte = read_file ntfs file byteoffset ~^1 in
     let byte = Char.code byte.[0] in
-    let bit = byte >^> (~^0x80 >^> (Int63.to_int bitoffset)) in
+    let bit = Int63.of_int byte >^> (0x80 lsr Int63.to_int bitoffset) in
 
     bit <> ~^0
   with