fix(os): win run error
This commit is contained in:
parent
51721dfc47
commit
f1a788f161
|
@ -27,6 +27,9 @@ if(BUILD_ADDR2LINE)
|
||||||
os PUBLIC addr2line dl z
|
os PUBLIC addr2line dl z
|
||||||
)
|
)
|
||||||
endif ()
|
endif ()
|
||||||
|
if(CHECK_STR2INT_ERROR)
|
||||||
|
add_definitions(-DTD_CHECK_STR_TO_INT_ERROR)
|
||||||
|
endif()
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
os PUBLIC pthread
|
os PUBLIC pthread
|
||||||
)
|
)
|
||||||
|
|
|
@ -258,79 +258,99 @@ char *taosStrCaseStr(const char *str, const char *pattern) {
|
||||||
|
|
||||||
int64_t taosStr2Int64(const char *str, char** pEnd, int32_t radix) {
|
int64_t taosStr2Int64(const char *str, char** pEnd, int32_t radix) {
|
||||||
int64_t tmp = strtoll(str, pEnd, radix);
|
int64_t tmp = strtoll(str, pEnd, radix);
|
||||||
|
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
assert(errno != EINVAL);
|
assert(errno != EINVAL);
|
||||||
|
#endif
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t taosStr2UInt64(const char *str, char** pEnd, int32_t radix) {
|
uint64_t taosStr2UInt64(const char *str, char** pEnd, int32_t radix) {
|
||||||
uint64_t tmp = strtoull(str, pEnd, radix);
|
uint64_t tmp = strtoull(str, pEnd, radix);
|
||||||
|
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
assert(errno != EINVAL);
|
assert(errno != EINVAL);
|
||||||
|
#endif
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t taosStr2Int32(const char *str, char** pEnd, int32_t radix) {
|
int32_t taosStr2Int32(const char *str, char** pEnd, int32_t radix) {
|
||||||
int32_t tmp = strtol(str, pEnd, radix);
|
int32_t tmp = strtol(str, pEnd, radix);
|
||||||
|
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
assert(errno != EINVAL);
|
assert(errno != EINVAL);
|
||||||
|
#endif
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t taosStr2UInt32(const char *str, char** pEnd, int32_t radix) {
|
uint32_t taosStr2UInt32(const char *str, char** pEnd, int32_t radix) {
|
||||||
uint32_t tmp = strtol(str, pEnd, radix);
|
uint32_t tmp = strtol(str, pEnd, radix);
|
||||||
|
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
assert(errno != EINVAL);
|
assert(errno != EINVAL);
|
||||||
|
#endif
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t taosStr2Int16(const char *str, char** pEnd, int32_t radix) {
|
int16_t taosStr2Int16(const char *str, char** pEnd, int32_t radix) {
|
||||||
int32_t tmp = strtol(str, pEnd, radix);
|
int32_t tmp = strtol(str, pEnd, radix);
|
||||||
|
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
assert(errno != EINVAL);
|
assert(errno != EINVAL);
|
||||||
assert(tmp >= SHRT_MIN);
|
assert(tmp >= SHRT_MIN);
|
||||||
assert(tmp <= SHRT_MAX);
|
assert(tmp <= SHRT_MAX);
|
||||||
|
#endif
|
||||||
return (int16_t)tmp;
|
return (int16_t)tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t taosStr2UInt16(const char *str, char** pEnd, int32_t radix) {
|
uint16_t taosStr2UInt16(const char *str, char** pEnd, int32_t radix) {
|
||||||
uint32_t tmp = strtoul(str, pEnd, radix);
|
uint32_t tmp = strtoul(str, pEnd, radix);
|
||||||
|
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
assert(errno != EINVAL);
|
assert(errno != EINVAL);
|
||||||
assert(tmp <= USHRT_MAX);
|
assert(tmp <= USHRT_MAX);
|
||||||
|
#endif
|
||||||
return (uint16_t)tmp;
|
return (uint16_t)tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t taosStr2Int8(const char *str, char** pEnd, int32_t radix) {
|
int8_t taosStr2Int8(const char *str, char** pEnd, int32_t radix) {
|
||||||
int32_t tmp = strtol(str, pEnd, radix);
|
int32_t tmp = strtol(str, pEnd, radix);
|
||||||
|
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
assert(errno != EINVAL);
|
assert(errno != EINVAL);
|
||||||
assert(tmp >= SCHAR_MIN);
|
assert(tmp >= SCHAR_MIN);
|
||||||
assert(tmp <= SCHAR_MAX);
|
assert(tmp <= SCHAR_MAX);
|
||||||
|
#endif
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t taosStr2UInt8(const char *str, char** pEnd, int32_t radix) {
|
uint8_t taosStr2UInt8(const char *str, char** pEnd, int32_t radix) {
|
||||||
uint32_t tmp = strtoul(str, pEnd, radix);
|
uint32_t tmp = strtoul(str, pEnd, radix);
|
||||||
|
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
assert(errno != EINVAL);
|
assert(errno != EINVAL);
|
||||||
assert(tmp <= UCHAR_MAX);
|
assert(tmp <= UCHAR_MAX);
|
||||||
|
#endif
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
double taosStr2Double(const char *str, char** pEnd) {
|
double taosStr2Double(const char *str, char** pEnd) {
|
||||||
double tmp = strtod(str, pEnd);
|
double tmp = strtod(str, pEnd);
|
||||||
|
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
assert(errno != EINVAL);
|
assert(errno != EINVAL);
|
||||||
assert(tmp != HUGE_VAL);
|
assert(tmp != HUGE_VAL);
|
||||||
|
#endif
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
float taosStr2Float(const char *str, char** pEnd) {
|
float taosStr2Float(const char *str, char** pEnd) {
|
||||||
float tmp = strtof(str, pEnd);
|
float tmp = strtof(str, pEnd);
|
||||||
|
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||||
assert(errno != ERANGE);
|
assert(errno != ERANGE);
|
||||||
assert(errno != EINVAL);
|
assert(errno != EINVAL);
|
||||||
assert(tmp != HUGE_VALF);
|
assert(tmp != HUGE_VALF);
|
||||||
assert(tmp != NAN);
|
assert(tmp != NAN);
|
||||||
|
#endif
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
Loading…
Reference in New Issue