Merge pull request #25 from ucloud/bugfix_get_int8

bugfix_get_int8
This commit is contained in:
ethanDu1 2020-04-16 15:14:43 +08:00 committed by GitHub
commit 3bf227271a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 5 deletions

View File

@ -146,15 +146,14 @@ 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;
}
int LITE_get_uint32(uint32_t *value, char *src) {
return (sscanf(src, "%" SCNu32, value) == 1) ? SUCCESS_RET : FAILURE_RET;
}
@ -165,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;
}