Bugs dans la serialisation des objets custom (PR#238)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3348 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Xavier Leroy 2000-11-30 17:13:41 +00:00
parent 3ac44c8d14
commit 22b3c296c1
3 changed files with 7 additions and 1 deletions

View File

@ -265,6 +265,7 @@ static void intern_rec(value *dest)
size = ops->deserialize((void *) (intern_dest + 2));
size = 1 + (size + sizeof(value) - 1) / sizeof(value);
v = Val_hp(intern_dest);
if (intern_obj_table != NULL) intern_obj_table[obj_counter++] = v;
*intern_dest = Make_header(size, Custom_tag, intern_color);
Custom_ops_val(v) = ops;
intern_dest += 1 + size;

View File

@ -279,7 +279,7 @@ static void int64_serialize(value v, unsigned long * wsize_32,
unsigned long * wsize_64)
{
serialize_int_8(Int64_val(v));
*wsize_64 = *wsize_64 = 8;
*wsize_32 = *wsize_64 = 8;
}
static unsigned long int64_deserialize(void * dst)

View File

@ -60,6 +60,7 @@ let test_out filename =
output_value oc (Nativeint.of_string "-123456");
output_value oc (Nativeint.shift_left (Nativeint.of_string "123456789") 32);
output_value oc (Nativeint.shift_left (Nativeint.of_string "-123456789") 32);
let i = Int64.of_string "123456789123456" in output_value oc (i,i);
close_out oc
@ -139,6 +140,10 @@ let test_in filename =
Nativeint.shift_left (Nativeint.of_string "123456789") 32);
test 36 (input_value ic =
Nativeint.shift_left (Nativeint.of_string "-123456789") 32);
let ((i, j) : int64 * int64) = input_value ic in
test 37 (i = Int64.of_string "123456789123456");
test 38 (j = Int64.of_string "123456789123456");
test 39 (i == j);
close_in ic
let test_string () =