sysparam_get_bool: memcpy the binary values out.
This commit is contained in:
parent
b6fc58b743
commit
55958b8bc3
1 changed files with 6 additions and 2 deletions
|
@ -801,9 +801,13 @@ sysparam_status_t sysparam_get_bool(const char *key, bool *result) {
|
||||||
do {
|
do {
|
||||||
if (binary) {
|
if (binary) {
|
||||||
if (data_len == 1) { // int8 value
|
if (data_len == 1) { // int8 value
|
||||||
*result = (int8_t)(*buf) ? true : false;
|
uint8_t value;
|
||||||
|
memcpy(&value, buf, sizeof(value));
|
||||||
|
*result = value ? true : false;
|
||||||
} else if (data_len == 4) { // int32 value
|
} else if (data_len == 4) { // int32 value
|
||||||
*result = (int32_t)(*buf) ? true : false;
|
uint32_t value;
|
||||||
|
memcpy(&value, buf, sizeof(value));
|
||||||
|
*result = value ? true : false;
|
||||||
} else {
|
} else {
|
||||||
status = SYSPARAM_PARSEFAILED;
|
status = SYSPARAM_PARSEFAILED;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue