X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2Fhexdump.ct;h=76b95e66cad84785c0972deb63c69b839ffba595;hb=81ffa1c459b96dd44472bcef37e1e373934ee138;hp=40aa12d2f6d6c9372a30fd0734ff60de129b702f;hpb=3f9475f73d6c84083101c4bdb04800e46b7738c5;p=senf.git diff --git a/Utils/hexdump.ct b/Utils/hexdump.ct index 40aa12d..76b95e6 100644 --- a/Utils/hexdump.ct +++ b/Utils/hexdump.ct @@ -26,6 +26,7 @@ //#include "hexdump.ih" // Custom includes +#include #include //#include "hexdump.mpp" @@ -33,8 +34,10 @@ ///////////////////////////////cc.p//////////////////////////////////////// template -prefix_ void senf::hexdump(Iterator i, Iterator const & i_end, std::ostream& stream, unsigned block_size=16) +prefix_ void senf::hexdump(Iterator i, Iterator i_end, std::ostream & stream, + unsigned block_size) { + boost::io::ios_all_saver ias (stream); unsigned offset (0); std::string ascii; for (; i != i_end; ++i, ++offset) { @@ -44,14 +47,14 @@ prefix_ void senf::hexdump(Iterator i, Iterator const & i_end, std::ostream& str ascii = ""; } stream << " " - << std::hex << std::setw(4) << std::setfill('0') - << offset << ' '; + << std::hex << std::setw(4) << std::setfill('0') + << offset << ' '; } else if ((offset % block_size) == block_size/2) { stream << " "; ascii += ' '; } stream << ' ' << std::hex << std::setw(2) << std::setfill('0') - << unsigned(*i); + << unsigned(*i); ascii += (*i >= ' ' && *i < 126) ? *i : '.'; } if (!ascii.empty()) { @@ -62,7 +65,6 @@ prefix_ void senf::hexdump(Iterator i, Iterator const & i_end, std::ostream& str } stream << " " << ascii << "\n"; } - stream << std::dec; } ///////////////////////////////cc.e////////////////////////////////////////