From ce4f6a793d5f3c70f834b8338464d079cbecb1e4 Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Thu, 31 Mar 2016 19:19:13 +0900 Subject: [PATCH] sensord: use memcpy instead of copying values * if value_count is over 16(max value count), it makes a problem when values is copied in loop. Change-Id: I8f07fe76909fe995027a604ac18bb9cdb6fbf827 Signed-off-by: kibak.yoon --- src/client/command_channel.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/client/command_channel.cpp b/src/client/command_channel.cpp index ca6b025..da07846 100644 --- a/src/client/command_channel.cpp +++ b/src/client/command_channel.cpp @@ -589,15 +589,7 @@ bool command_channel::cmd_get_data(unsigned int type, sensor_data_t* sensor_data return false; } - sensor_data_t *base_data; - base_data = &cmd_get_data_done->base_data; - - sensor_data->timestamp = base_data->timestamp; - sensor_data->accuracy = base_data->accuracy; - sensor_data->value_count = base_data->value_count; - - memcpy(sensor_data->values, base_data->values, - sizeof(sensor_data->values[0]) * base_data->value_count); + memcpy(sensor_data, &cmd_get_data_done->base_data, sizeof(sensor_data_t)); delete[] (char *)cmd_get_data_done; delete packet; -- 2.7.4