diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2017-10-03 18:09:49 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2017-10-03 18:09:49 +0200 |
commit | 7f7cfeb45b579204e0bc94bea37e2c810d2e5ec9 (patch) | |
tree | 4058c41e2460fad253ec0290a56166e46a28bc78 /misc.cc | |
parent | 8f7435e4553916e6cc431e4b5316cc5861fd9063 (diff) | |
parent | 7d0d03428f90d3f65452eb7035bb715efec87ac8 (diff) | |
download | libnitrokey-7f7cfeb45b579204e0bc94bea37e2c810d2e5ec9.tar.gz libnitrokey-7f7cfeb45b579204e0bc94bea37e2c810d2e5ec9.tar.bz2 |
Merge branch 'OSX_merge_cleaned'
This merge:
- fixes issues with invalid mutex
- moves tests to Python 3
- allows to compile the code natively under Visual Studio with CMake
- allows to compile under QtCreator under MS Windows
- fixes some issues with test suite
- allows to run tests under Windows
- allows to compile using QMake (and easy adding to Qt projects)
- decreases delays between sending commands thus increasing 2x
communication speed
Diffstat (limited to 'misc.cc')
-rw-r--r-- | misc.cc | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -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 |