mirror of https://gitee.com/bigwinds/arangodb
fix crashes
This commit is contained in:
parent
7f860153ba
commit
f7e34b2d7c
|
@ -117,9 +117,9 @@ inline T atoi_negative(char const* p, char const* e, bool& valid) noexcept {
|
||||||
constexpr T cutoff = (std::numeric_limits<T>::min)() / 10;
|
constexpr T cutoff = (std::numeric_limits<T>::min)() / 10;
|
||||||
constexpr char cutlim = -((std::numeric_limits<T>::min)() % 10);
|
constexpr char cutlim = -((std::numeric_limits<T>::min)() % 10);
|
||||||
T result = 0;
|
T result = 0;
|
||||||
char c = *p;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
char c = *p;
|
||||||
// we expect only '0' to '9'. everything else is unexpected
|
// we expect only '0' to '9'. everything else is unexpected
|
||||||
if (TRI_UNLIKELY(c < '0' || c > '9')) {
|
if (TRI_UNLIKELY(c < '0' || c > '9')) {
|
||||||
valid = false;
|
valid = false;
|
||||||
|
@ -135,8 +135,7 @@ inline T atoi_negative(char const* p, char const* e, bool& valid) noexcept {
|
||||||
result *= 10;
|
result *= 10;
|
||||||
result -= c;
|
result -= c;
|
||||||
++p;
|
++p;
|
||||||
c = *p;
|
} while (++p < e);
|
||||||
} while (p < e);
|
|
||||||
|
|
||||||
valid = true;
|
valid = true;
|
||||||
return result;
|
return result;
|
||||||
|
@ -161,9 +160,10 @@ inline T atoi_positive(char const* p, char const* e, bool& valid) noexcept {
|
||||||
constexpr T cutoff = (std::numeric_limits<T>::max)() / 10;
|
constexpr T cutoff = (std::numeric_limits<T>::max)() / 10;
|
||||||
constexpr char cutlim = (std::numeric_limits<T>::max)() % 10;
|
constexpr char cutlim = (std::numeric_limits<T>::max)() % 10;
|
||||||
T result = 0;
|
T result = 0;
|
||||||
char c = *p;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
char c = *p;
|
||||||
|
|
||||||
// we expect only '0' to '9'. everything else is unexpected
|
// we expect only '0' to '9'. everything else is unexpected
|
||||||
if (TRI_UNLIKELY(c < '0' || c > '9')) {
|
if (TRI_UNLIKELY(c < '0' || c > '9')) {
|
||||||
valid = false;
|
valid = false;
|
||||||
|
@ -178,9 +178,7 @@ inline T atoi_positive(char const* p, char const* e, bool& valid) noexcept {
|
||||||
}
|
}
|
||||||
result *= 10;
|
result *= 10;
|
||||||
result += c;
|
result += c;
|
||||||
++p;
|
} while (++p < e);
|
||||||
c = *p;
|
|
||||||
} while (p < e);
|
|
||||||
|
|
||||||
valid = true;
|
valid = true;
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -75,9 +75,8 @@ TEST_CASE("LoggerTest", "[loggertest]") {
|
||||||
content = FileUtils::slurp(logfile2);
|
content = FileUtils::slurp(logfile2);
|
||||||
CHECK(content.find("some error message") == std::string::npos);
|
CHECK(content.find("some error message") == std::string::npos);
|
||||||
CHECK(content.find("some warning message") != std::string::npos);
|
CHECK(content.find("some warning message") != std::string::npos);
|
||||||
}
|
|
||||||
|
LogAppenderFile::clear();
|
||||||
SECTION("test_fdds_after_reopen") {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("test_fds_after_reopen") {
|
SECTION("test_fds_after_reopen") {
|
||||||
|
@ -122,10 +121,10 @@ TEST_CASE("LoggerTest", "[loggertest]") {
|
||||||
CHECK(content.find("some error message") == std::string::npos);
|
CHECK(content.find("some error message") == std::string::npos);
|
||||||
CHECK(content.find("some warning message") == std::string::npos);
|
CHECK(content.find("some warning message") == std::string::npos);
|
||||||
CHECK(content.find("some other warning message") != std::string::npos);
|
CHECK(content.find("some other warning message") != std::string::npos);
|
||||||
|
|
||||||
|
LogAppenderFile::clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
LogAppenderFile::clear();
|
|
||||||
|
|
||||||
// restore old state
|
// restore old state
|
||||||
LogAppenderFile::setFds(backup);
|
LogAppenderFile::setFds(backup);
|
||||||
LogAppenderFile::reopenAll();
|
LogAppenderFile::reopenAll();
|
||||||
|
|
Loading…
Reference in New Issue