about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2012-02-10 06:01:32 -0800
committerNiko Matsakis <niko@alum.mit.edu>2012-02-10 20:48:28 -0800
commitfdddf8f9e1d6738d42989a6d8a735dd58127e199 (patch)
tree9e324f85345957929daed40aedeaf52d0199b33d /src/libstd
parentdbcb54f4dc44957c9505958655a16e678ee4396b (diff)
downloadrust-fdddf8f9e1d6738d42989a6d8a735dd58127e199.tar.gz
rust-fdddf8f9e1d6738d42989a6d8a735dd58127e199.zip
put serializer into the build and encode full item paths
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/ebml.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs
index c4b07086acd..bee73814580 100644
--- a/src/libstd/ebml.rs
+++ b/src/libstd/ebml.rs
@@ -97,6 +97,8 @@ fn tagged_docs(d: doc, tg: uint, it: fn(doc)) {
 
 fn doc_data(d: doc) -> [u8] { ret vec::slice::<u8>(*d.data, d.start, d.end); }
 
+fn doc_str(d: doc) -> str { ret str::from_bytes(doc_data(d)); }
+
 fn be_uint_from_bytes(data: @[u8], start: uint, size: uint) -> uint {
     let sz = size;
     assert (sz <= 4u);
@@ -136,11 +138,11 @@ fn write_sized_vint(w: io::writer, n: uint, size: uint) {
     w.write(buf);
 }
 
-fn write_vint(w: io::writer, n: uint) {
-    if n < 0x7fu { write_sized_vint(w, n, 1u); ret; }
-    if n < 0x4000u { write_sized_vint(w, n, 2u); ret; }
-    if n < 0x200000u { write_sized_vint(w, n, 3u); ret; }
-    if n < 0x10000000u { write_sized_vint(w, n, 4u); ret; }
+fn write_vint(w: io::writer, n: u64) {
+    if n < 0x7f_u64 { write_sized_vint(w, n, 1u); ret; }
+    if n < 0x4000_u64 { write_sized_vint(w, n, 2u); ret; }
+    if n < 0x200000_u64 { write_sized_vint(w, n, 3u); ret; }
+    if n < 0x10000000_u64 { write_sized_vint(w, n, 4u); ret; }
     #error("vint to write too big");
     fail;
 }
@@ -177,7 +179,11 @@ impl writer_util for writer {
         end_tag(self);
     }
 
-    fn wr_uint(id: uint) {
+    fn wr_uint(id: u64) {
+        write_vint(self.writer, id);
+    }
+
+    fn wr_int(id: uint) {
         write_vint(self.writer, id);
     }