MCPcopy Create free account
hub / github.com/ariccio/altWinDirStat / hexdump

Function hexdump

Reference code/osImageTool/debug.cpp:205–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203}
204
205std::string hexdump(const BYTE *buf, int nLength, int nDumpUnitSize /*=1*/)
206{
207 int nCharsInResult= nLength*(nDumpUnitSize==1?3:nDumpUnitSize==2?5:nDumpUnitSize==4?9:9);
208 std::string line;
209
210 line.reserve(nCharsInResult);
211
212 switch(nDumpUnitSize)
213 {
214 case 1: hexdumpbytes(line, buf, nLength); break;
215 case 2: hexdumpwords(line, (WORD*)buf, nLength); break;
216 case 4: hexdumpdwords(line, (DWORD*)buf, nLength); break;
217 }
218 return line;
219}
220std::string hexdump(DWORD dwOffset, const BYTE *buf, int nLength, int nDumpUnitSize /*=1*/, int nMaxUnitsPerLine /*=16*/)
221{
222 int nCharsInLine= 10+nMaxUnitsPerLine*(nDumpUnitSize==1?4:nDumpUnitSize==2?6:nDumpUnitSize==4?10:10);

Callers 1

ValueToStringMethod · 0.85

Calls 6

hexdumpbytesFunction · 0.85
hexdumpwordsFunction · 0.85
hexdumpdwordsFunction · 0.85
stringformatFunction · 0.85
writespacesFunction · 0.85
dumpasciiFunction · 0.85

Tested by

no test coverage detected