Fixed alignment issue

This commit is contained in:
adamdunkels 2010-09-13 13:29:47 +00:00
parent f1769a3622
commit 3be23eb3fc

View file

@ -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;