From 375828304805c51fc8ebbea3a681f054bea4ab3f Mon Sep 17 00:00:00 2001 From: Darren Ranalli Date: Fri, 23 Feb 2007 08:52:00 +0000 Subject: [PATCH] added indent to dump_hex --- panda/src/express/datagram.cxx | 7 +++++-- panda/src/express/datagram.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/panda/src/express/datagram.cxx b/panda/src/express/datagram.cxx index cf1d16e3d8..3b60d63606 100644 --- a/panda/src/express/datagram.cxx +++ b/panda/src/express/datagram.cxx @@ -53,12 +53,15 @@ clear() { // contents, as a sequence of hex (and ASCII) values. //////////////////////////////////////////////////////////////////// void Datagram:: -dump_hex(ostream &out) const { +dump_hex(ostream &out, unsigned int indent) const { const char *message = (const char *)get_data(); size_t num_bytes = get_length(); for (size_t line = 0; line < num_bytes; line += 16) { char hex[12]; sprintf(hex, "%04x ", ((unsigned int )line)); + for (unsigned int ind = 0; ind < indent; ind++) { + out << " "; + } out << hex; size_t p; @@ -226,6 +229,6 @@ write(ostream &out, unsigned int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""<<"Datagram:\n"; - dump_hex(out); + dump_hex(out, indent); #endif //] NDEBUG } diff --git a/panda/src/express/datagram.h b/panda/src/express/datagram.h index ad9ef5063c..d134d88702 100644 --- a/panda/src/express/datagram.h +++ b/panda/src/express/datagram.h @@ -55,7 +55,7 @@ PUBLISHED: virtual ~Datagram(); virtual void clear(); - void dump_hex(ostream &out) const; + void dump_hex(ostream &out, unsigned int indent=0) const; INLINE void add_bool(bool value); INLINE void add_int8(PN_int8 value);