From 771e7a4b761661359ce3bb89b2c5ce049e71e601 Mon Sep 17 00:00:00 2001 From: "ethan.du" Date: Thu, 16 Apr 2020 15:08:36 +0800 Subject: [PATCH] bug fix get int8 --- src/utils/json_token.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/json_token.c b/src/utils/json_token.c index 7a08cb1..d2ffab4 100644 --- a/src/utils/json_token.c +++ b/src/utils/json_token.c @@ -146,11 +146,11 @@ int LITE_get_int16(int16_t *value, char *src) { */ int LITE_get_int8(int8_t *value, char *src) { int16_t temp = 0; - if(1 != sscanf(src, "%" SCNi16, temp)) + if(1 != sscanf(src, "%" SCNi16, &temp)) { return FAILURE_RET; } - value = (int8_t)temp; + *value = (int8_t)temp; return SUCCESS_RET; } @@ -164,11 +164,11 @@ int LITE_get_uint16(uint16_t *value, char *src) { int LITE_get_uint8(uint8_t *value, char *src) { uint16_t temp = 0; - if(1 != sscanf(src, "%" SCNu16, temp)) + if(1 != sscanf(src, "%" SCNu16, &temp)) { return FAILURE_RET; } - value = (uint8_t)temp; + *value = (uint8_t)temp; return SUCCESS_RET; }