aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/util/debug.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/util/debug.rs')
-rw-r--r--src/components/util/debug.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/components/util/debug.rs b/src/components/util/debug.rs
index 67a1d7d5f21..5c9aa700d5b 100644
--- a/src/components/util/debug.rs
+++ b/src/components/util/debug.rs
@@ -2,30 +2,32 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-use std::io;
+use std::rt::io;
+use std::rt::io::Writer;
use std::vec::raw::buf_as_slice;
use std::cast::transmute;
use std::mem::size_of;
fn hexdump_slice(buf: &[u8]) {
- let stderr = io::stderr();
- stderr.write_str(" ");
+ let mut stderr = io::stderr();
+ stderr.write(bytes!(" "));
for (i, &v) in buf.iter().enumerate() {
- stderr.write_str(fmt!("%02X ", v as uint));
+ let output = format!("{:02X} ", v as uint);
+ stderr.write(output.as_bytes());
match i % 16 {
- 15 => stderr.write_str("\n "),
- 7 => stderr.write_str(" "),
+ 15 => stderr.write(bytes!("\n ")),
+ 7 => stderr.write(bytes!(" ")),
_ => ()
}
stderr.flush();
}
- stderr.write_char('\n');
+ stderr.write(bytes!("\n"));
}
pub fn hexdump<T>(obj: &T) {
unsafe {
let buf: *u8 = transmute(obj);
- debug!("dumping at %p", buf);
+ debug!("dumping at {:p}", buf);
buf_as_slice(buf, size_of::<T>(), hexdump_slice);
}
}