diff options
author | Marc Schink <openocd-dev@marcschink.de> | 2016-05-22 20:35:34 +0200 |
---|---|---|
committer | Paul Fertser <fercerpav@gmail.com> | 2016-12-08 12:34:53 +0000 |
commit | 69ff7354d9c9accf09374772310098f1f00e8ccb (patch) | |
tree | 94a7803244c884ec26965101d45e10f6c53d8477 /src/helper/binarybuffer.h | |
parent | 1461237073e377d315799999b8e29f1605084449 (diff) |
helper: Code cleanup for hexify()
Simplify hexify() and do not longer use 0 as special case for the
parameter 'count' to determine the string length of the binary input.
Instead, use strlen() outside of the function if needed.
Additionally, fix the return value and return the length of the
converted string. The old function always returned 2 * count.
Also, use more appropriate data types for the function parameters and
add a small documentation.
Change-Id: I133a8ab786b8f7c1296afcaf9c0a0b43881e5112
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/3793
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Diffstat (limited to 'src/helper/binarybuffer.h')
-rw-r--r-- | src/helper/binarybuffer.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/helper/binarybuffer.h b/src/helper/binarybuffer.h index b035779a..f1da8c4a 100644 --- a/src/helper/binarybuffer.h +++ b/src/helper/binarybuffer.h @@ -235,7 +235,7 @@ void bit_copy_discard(struct bit_copy_queue *q); /* functions to convert to/from hex encoded buffer * used in ti-icdi driver and gdb server */ size_t unhexify(uint8_t *bin, const char *hex, size_t count); -int hexify(char *hex, const char *bin, int count, int out_maxlen); +size_t hexify(char *hex, const uint8_t *bin, size_t count, size_t out_maxlen); void buffer_shr(void *_buf, unsigned buf_len, unsigned count); #endif /* OPENOCD_HELPER_BINARYBUFFER_H */ |