aboutsummaryrefslogtreecommitdiff
path: root/src/target
diff options
context:
space:
mode:
authorMarc Schink <openocd-dev@marcschink.de>2016-05-22 20:35:34 +0200
committerPaul Fertser <fercerpav@gmail.com>2016-12-08 12:34:53 +0000
commit69ff7354d9c9accf09374772310098f1f00e8ccb (patch)
tree94a7803244c884ec26965101d45e10f6c53d8477 /src/target
parent1461237073e377d315799999b8e29f1605084449 (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/target')
-rw-r--r--src/target/smp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/target/smp.c b/src/target/smp.c
index 3dc6f6d5..bdf81a0e 100644
--- a/src/target/smp.c
+++ b/src/target/smp.c
@@ -64,7 +64,8 @@ int gdb_read_smp_packet(struct connection *connection,
char hex_buffer[len * 2 + 1];
uint8_t buffer[len];
buf_set_u32(buffer, 0, len * 8, target->gdb_service->core[0]);
- int pkt_len = hexify(hex_buffer, (char *)buffer, sizeof(buffer), sizeof(hex_buffer));
+ size_t pkt_len = hexify(hex_buffer, buffer, sizeof(buffer),
+ sizeof(hex_buffer));
retval = gdb_put_packet(connection, hex_buffer, pkt_len);
}