From 3be23eb3fcd47bc7c7b9dce7cf10f7a536bd061c Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Mon, 13 Sep 2010 13:29:47 +0000 Subject: [PATCH] Fixed alignment issue --- apps/shell/shell-text.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/shell/shell-text.c b/apps/shell/shell-text.c index 0345fa1cc..5bcd840b5 100644 --- a/apps/shell/shell-text.c +++ b/apps/shell/shell-text.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: shell-text.c,v 1.6 2010/02/03 21:53:51 adamdunkels Exp $ + * $Id: shell-text.c,v 1.7 2010/09/13 13:29:47 adamdunkels Exp $ */ /** @@ -145,7 +145,9 @@ PROCESS_THREAD(shell_binprint_process, ev, data) bufptr = buf; ptr = (uint16_t *)input->data1; for(i = 0; i < input->len1 && i < input->len1 - 1; i += 2) { - bufptr += sprintf(bufptr, "%u ", *ptr); + uint16_t data; + memcpy(&data, ptr, sizeof(data)); + bufptr += sprintf(bufptr, "%u ", data); if(bufptr - buf >= sizeof(buf) - 6) { shell_output_str(&binprint_command, buf, ""); bufptr = buf; @@ -158,7 +160,9 @@ PROCESS_THREAD(shell_binprint_process, ev, data) ptr = (uint16_t *)input->data2; for(i = 0; i < input->len2 && i < input->len2 - 1; i += 2) { - bufptr += sprintf(bufptr, "%u ", *ptr); + uint16_t data; + memcpy(&data, ptr, sizeof(data)); + bufptr += sprintf(bufptr, "%u ", data); if(bufptr - buf >= sizeof(buf) - 6) { shell_output_str(&binprint_command, buf, ""); bufptr = buf;