Pol  Revision:cb584c9
fdump.cpp
Go to the documentation of this file.
1 
7 #include "fdump.h"
8 
9 namespace Pol
10 {
11 namespace Clib
12 {
13 void dump16( fmt::Writer& writer, const unsigned char* s, int len )
14 {
15  int i;
16  for ( i = 0; i < 16; i++ )
17  {
18  if ( i < len )
19  writer.Format( "{:02x} " ) << (int)s[i];
20  else
21  writer << " ";
22  if ( i == 7 )
23  writer << " ";
24  }
25  writer << " ";
26 
27  for ( i = 0; i < 16; i++ )
28  {
29  if ( i >= len || !isprint( s[i] ) )
30  writer << '.';
31  else
32  writer.Format( "{}" ) << s[i];
33 
34  if ( i == 7 )
35  writer << ' ';
36  }
37  writer << '\n';
38 }
39 
40 void fdump( fmt::Writer& writer, const void* data, int len )
41 {
42  int i;
43  const unsigned char* s = (const unsigned char*)data;
44 
45  for ( i = 0; i < len; i += 16 )
46  {
47  int nprint = len - i;
48  if ( nprint > 16 )
49  nprint = 16;
50  writer.Format( "{:04x} " ) << i;
51  dump16( writer, &s[i], nprint );
52  }
53 }
54 }
55 }
void dump16(fmt::Writer &writer, const unsigned char *s, int len)
Definition: fdump.cpp:13
void fdump(fmt::Writer &writer, const void *data, int len)
Definition: fdump.cpp:40
std::unordered_map< u64, ScriptDiffData > data
Definition: osmod.cpp:966
Definition: berror.cpp:12