X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPackets%2FDumpFormat.cc;h=de102c78b3f2e8b0b8faf7cb4a9b251e1b02e362;hb=482523171f06cf239fd7e8c991f81711c02cf0ba;hp=2ce3b3f1b759e595d41677fd222aba6f9e461a78;hpb=1c55e269cfd07c017fe592a04d1ec86fdc7f4b37;p=senf.git diff --git a/senf/Packets/DumpFormat.cc b/senf/Packets/DumpFormat.cc index 2ce3b3f..de102c7 100644 --- a/senf/Packets/DumpFormat.cc +++ b/senf/Packets/DumpFormat.cc @@ -24,7 +24,7 @@ \brief DumpFormat non-inline non-template implementation */ #include "Packets.hh" -#include "DumpFormat.ih" +//#include "DumpFormat.ih" // Custom includes #include @@ -40,42 +40,12 @@ prefix_ std::string senf::fieldName(std::string const & s) { - std::string t (std::max(unsigned(SENF_PACKET_DUMP_COLON_COLUMN+1), s.size()+5), ' '); + std::string t (std::max(std::string::size_type(SENF_PACKET_DUMP_COLON_COLUMN+1), s.size()+5), ' '); std::copy(s.begin(), s.end(), t.begin()+2); t[t.size()-2] = ':'; return t; } -prefix_ std::string senf::detail::prettySignedNumber(long long v, unsigned bits) -{ - if (v<0) return prettyUnsignedNumber(-v,bits,-1); - else return prettyUnsignedNumber(v,bits,+1); -} - -prefix_ std::string senf::detail::prettyUnsignedNumber(unsigned long long v, unsigned bits, - int sign) -{ - int bytes ((bits+7)/8); - int digs (int(2.4*bytes)+1); - std::stringstream ss; - ss << (sign ? (sign<0 ? "-" : " ") : "") - << "0x" << std::setw(2*bytes) << std::setfill('0') << std::hex - << 1u*v - << " (" << std::setw(digs+(sign ? 1 : 0)) << std::setfill(' ') << std::dec; - if (sign) - ss << sign*static_cast(v); - else - ss << 1u*v; - ss << ") ("; - for (int i (bytes-1); i>=0; --i) { - char c ((v>>(8*i))&0xff); - ss << ((c>=32 && c<=127) ? c : '.'); - } - ss << ')'; - return ss.str(); -} - - ///////////////////////////////cc.e//////////////////////////////////////// #undef prefix_ //#include "DumpFormat.mpp"