summaryrefslogtreecommitdiff
path: root/misc.cc
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-06-28 11:57:21 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2017-06-28 11:57:21 +0200
commitab0f01c381c16ed61b8258582869912d4c38cbb7 (patch)
treeb8935e0008795fee2a487cf4512a93a1abf8e262 /misc.cc
parent8f7435e4553916e6cc431e4b5316cc5861fd9063 (diff)
downloadlibnitrokey-ab0f01c381c16ed61b8258582869912d4c38cbb7.tar.gz
libnitrokey-ab0f01c381c16ed61b8258582869912d4c38cbb7.tar.bz2
Adjust code to make compilation under MSVC 2017
Diffstat (limited to 'misc.cc')
-rw-r--r--misc.cc14
1 files changed, 7 insertions, 7 deletions
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 <cctype>
-::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<int> (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