提交 cd674d8e 编写于 作者: H Haojun Liao

[td-13039] fix bug.

上级 3119efc7
...@@ -161,7 +161,7 @@ int32_t tjsonGetBigIntValue(const SJson* pJson, const char* pName, int64_t* pVal ...@@ -161,7 +161,7 @@ int32_t tjsonGetBigIntValue(const SJson* pJson, const char* pName, int64_t* pVal
} }
char* pEnd = NULL; char* pEnd = NULL;
*pVal = strtol(p, &pEnd, 10); *pVal = strtol(p, &pEnd, 10);
return (NULL == pEnd ? TSDB_CODE_SUCCESS : TSDB_CODE_FAILED); return (errno == EINVAL || errno == ERANGE)? TSDB_CODE_FAILED:TSDB_CODE_SUCCESS;
} }
int32_t tjsonGetIntValue(const SJson* pJson, const char* pName, int32_t* pVal) { int32_t tjsonGetIntValue(const SJson* pJson, const char* pName, int32_t* pVal) {
...@@ -192,7 +192,7 @@ int32_t tjsonGetUBigIntValue(const SJson* pJson, const char* pName, uint64_t* pV ...@@ -192,7 +192,7 @@ int32_t tjsonGetUBigIntValue(const SJson* pJson, const char* pName, uint64_t* pV
} }
char* pEnd = NULL; char* pEnd = NULL;
*pVal = strtoul(p, &pEnd, 10); *pVal = strtoul(p, &pEnd, 10);
return (NULL == pEnd ? TSDB_CODE_SUCCESS : TSDB_CODE_FAILED); return (errno == ERANGE||errno == EINVAL)? TSDB_CODE_FAILED:TSDB_CODE_SUCCESS;
} }
int32_t tjsonGetUTinyIntValue(const SJson* pJson, const char* pName, uint8_t* pVal) { int32_t tjsonGetUTinyIntValue(const SJson* pJson, const char* pName, uint8_t* pVal) {
...@@ -204,7 +204,7 @@ int32_t tjsonGetUTinyIntValue(const SJson* pJson, const char* pName, uint8_t* pV ...@@ -204,7 +204,7 @@ int32_t tjsonGetUTinyIntValue(const SJson* pJson, const char* pName, uint8_t* pV
int32_t tjsonGetBoolValue(const SJson* pJson, const char* pName, bool* pVal) { int32_t tjsonGetBoolValue(const SJson* pJson, const char* pName, bool* pVal) {
const SJson* pObject = tjsonGetObjectItem(pJson, pName); const SJson* pObject = tjsonGetObjectItem(pJson, pName);
if (cJSON_IsBool(pObject)) { if (!cJSON_IsBool(pObject)) {
return TSDB_CODE_FAILED; return TSDB_CODE_FAILED;
} }
*pVal = cJSON_IsTrue(pObject) ? true : false; *pVal = cJSON_IsTrue(pObject) ? true : false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册