summaryrefslogtreecommitdiff
path: root/include/hexdump.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/hexdump.h')
-rw-r--r--include/hexdump.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/hexdump.h b/include/hexdump.h
index 381e1a68..e8f4fe1a 100644
--- a/include/hexdump.h
+++ b/include/hexdump.h
@@ -71,7 +71,7 @@ prepare_text(const void *data, size_t size, char *buf, unsigned int position)
else
buf[offset++] = '.';
}
- buf[offset++] = size > 0 ? '|' : 'X';
+ buf[offset++] = '|';
buf[offset] = '\0';
}
@@ -89,6 +89,11 @@ vhexdumpf(const char *file, int line, const char *func, const CHAR16 *const fmt,
if (verbose == 0)
return;
+ if (!data || !size) {
+ dprint(L"hexdump of a NULL pointer!\n");
+ return;
+ }
+
while (offset < size) {
char hexbuf[49];
char txtbuf[19];
@@ -137,12 +142,19 @@ hexdumpat(const char *file, int line, const char *func, const void *data, unsign
hexdumpf(file, line, func, L"", data, size, at);
}
+#if defined(SHIM_UNIT_TEST)
+#define LogHexDump(data, ...)
+#define dhexdump(data, ...)
+#define dhexdumpat(data, ...)
+#define dhexdumpf(fmt, ...)
+#else
#define LogHexdump(data, sz) LogHexdump_(__FILE__, __LINE__, __func__, data, sz)
#define dhexdump(data, sz) hexdump(__FILE__, __LINE__, __func__, data, sz)
#define dhexdumpat(data, sz, at) \
hexdumpat(__FILE__, __LINE__ - 1, __func__, data, sz, at)
#define dhexdumpf(fmt, data, sz, at, ...) \
hexdumpf(__FILE__, __LINE__ - 1, __func__, fmt, data, sz, at, ##__VA_ARGS__)
+#endif
#endif /* STATIC_HEXDUMP_H */
// vim:fenc=utf-8:tw=75:noet