From ab0f01c381c16ed61b8258582869912d4c38cbb7 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Wed, 28 Jun 2017 11:57:21 +0200 Subject: Adjust code to make compilation under MSVC 2017 --- misc.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'misc.cc') diff --git a/misc.cc b/misc.cc index 24f8514..d7278da 100644 --- a/misc.cc +++ b/misc.cc @@ -39,20 +39,20 @@ namespace misc { }; #include -::std::string hexdump(const char *p, size_t size, bool print_header, +::std::string hexdump(const uint8_t *p, size_t size, bool print_header, bool print_ascii, bool print_empty) { ::std::stringstream out; char formatbuf[128]; - const char *pstart = p; + const uint8_t *pstart = p; - for (const char *pend = p + size; p < pend;) { + for (const uint8_t *pend = p + size; p < pend;) { if (print_header){ snprintf(formatbuf, 128, "%04x\t", static_cast (p - pstart)); out << formatbuf; } - const char* pp = p; - for (const char *le = p + 16; p < le; p++) { + const uint8_t* pp = p; + for (const uint8_t *le = p + 16; p < le; p++) { if (p < pend){ snprintf(formatbuf, 128, "%02x ", uint8_t(*p)); out << formatbuf; @@ -63,8 +63,8 @@ namespace misc { } if(print_ascii){ - out << "\t"; - for (const char *le = pp + 16; pp < le && pp < pend; pp++) { + out << " "; + for (const uint8_t *le = pp + 16; pp < le && pp < pend; pp++) { if (std::isgraph(*pp)) out << uint8_t(*pp); else -- cgit v1.2.1