Fix signed/unsigned bug, likely cause of windows crash.

This commit is contained in:
Graydon Hoare 2012-08-03 13:18:46 -07:00
parent 2c06e7aac9
commit 241085a073

View File

@ -955,7 +955,7 @@ fn encode_index<T>(ebml_w: ebml::writer, buckets: ~[@~[entry<T>]],
ebml_w.start_tag(tag_index_buckets_bucket);
for vec::each(*bucket) |elt| {
ebml_w.start_tag(tag_index_buckets_bucket_elt);
assert elt.pos < (u32::max_value as uint);
assert elt.pos < 0xffff_ffff;
writer.write_be_u32(elt.pos as u32);
write_fn(writer, elt.val);
ebml_w.end_tag();
@ -965,7 +965,7 @@ fn encode_index<T>(ebml_w: ebml::writer, buckets: ~[@~[entry<T>]],
ebml_w.end_tag();
ebml_w.start_tag(tag_index_table);
for bucket_locs.each |pos| {
assert pos < (u32::max_value as uint);
assert pos < 0xffff_ffff;
writer.write_be_u32(pos as u32);
}
ebml_w.end_tag();
@ -975,7 +975,7 @@ fn encode_index<T>(ebml_w: ebml::writer, buckets: ~[@~[entry<T>]],
fn write_str(writer: io::writer, &&s: ~str) { writer.write_str(s); }
fn write_int(writer: io::writer, &&n: int) {
assert n < (u32::max_value as int);
assert n < 0x7fff_ffff;
writer.write_be_u32(n as u32);
}