mirror of https://gitee.com/bigwinds/arangodb
remove cctype (#10501)
This commit is contained in:
parent
5321bf5c1a
commit
75b87689fa
|
@ -554,7 +554,7 @@ auth::Level auth::User::collectionAuthLevel(std::string const& dbname,
|
|||
return auth::Level::NONE; // invalid collection names
|
||||
}
|
||||
// we must have got a non-empty collection name when we get here
|
||||
TRI_ASSERT(!isdigit(cname[0]));
|
||||
TRI_ASSERT(cname[0] < '0' || cname[0] > '9');
|
||||
|
||||
bool isSystem = cname[0] == '_';
|
||||
if (isSystem) {
|
||||
|
|
|
@ -777,8 +777,9 @@ auth::Level auth::UserManager::collectionAuthLevel(std::string const& user,
|
|||
return auth::Level::NONE; // no user found
|
||||
}
|
||||
|
||||
TRI_ASSERT(!coll.empty());
|
||||
auth::Level level;
|
||||
if (isdigit(coll[0])) {
|
||||
if (coll[0] >= '0' && coll[0] <= '9') {
|
||||
std::string tmpColl = DatabaseFeature::DATABASE->translateCollectionName(dbname, coll);
|
||||
level = it->second.collectionAuthLevel(dbname, tmpColl);
|
||||
} else {
|
||||
|
|
|
@ -57,7 +57,7 @@ std::vector<VersionSort::CharOrInt> VersionSort::splitVersion(std::string const&
|
|||
};
|
||||
|
||||
for (size_t pos = 0; pos < str.length(); pos++) {
|
||||
if (isdigit(str[pos])) {
|
||||
if (str[pos] >= '0' && str[pos] <= '9') {
|
||||
if (from == std::string::npos) {
|
||||
from = pos;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "Rest/GeneralRequest.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
|
||||
using namespace arangodb;
|
||||
|
||||
|
@ -42,7 +41,9 @@ SyncerId SyncerId::fromRequest(GeneralRequest const& request) {
|
|||
if (idStr.empty()) {
|
||||
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_BAD_PARAMETER, "syncerId, if set, must not be empty");
|
||||
}
|
||||
if (!std::all_of(idStr.begin(), idStr.end(), [](char c) { return std::isdigit(c); })) {
|
||||
if (!std::all_of(idStr.begin(), idStr.end(), [](char c) {
|
||||
return c >= '0' && c <= '9';
|
||||
})) {
|
||||
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_BAD_PARAMETER, "syncerId must be an integer");
|
||||
}
|
||||
if (idStr[0] == '0') {
|
||||
|
|
|
@ -74,7 +74,7 @@ TRI_voc_cid_t CollectionNameResolver::getCollectionIdLocal(std::string const& na
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (isdigit(name[0])) {
|
||||
if (name[0] >= '0' && name[0] <= '9') {
|
||||
// name is a numeric id
|
||||
return NumberUtils::atoi_zero<TRI_voc_cid_t>(name.data(), name.data() + name.size());
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ TRI_voc_cid_t CollectionNameResolver::getCollectionIdCluster(std::string const&
|
|||
if (name.empty()) {
|
||||
return 0;
|
||||
}
|
||||
if (isdigit(name[0])) {
|
||||
if (name[0] >= '0' && name[0] <= '9') {
|
||||
// name is a numeric id
|
||||
TRI_voc_cid_t cid =
|
||||
NumberUtils::atoi_zero<TRI_voc_cid_t>(name.data(), name.data() + name.size());
|
||||
|
|
|
@ -22,14 +22,17 @@
|
|||
|
||||
#include "UrlHelper.h"
|
||||
|
||||
#include <cctype>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
using namespace arangodb;
|
||||
using namespace arangodb::url;
|
||||
|
||||
namespace {
|
||||
// used for URI-encoding
|
||||
static char const* hexValuesLower = "0123456789abcdef";
|
||||
};
|
||||
|
||||
std::ostream& Query::toStream(std::ostream& ostream) const {
|
||||
struct output {
|
||||
std::ostream& ostream;
|
||||
|
@ -181,7 +184,10 @@ std::optional<Fragment> const& Location::fragment() const noexcept {
|
|||
|
||||
// unreserved are A-Z, a-z, 0-9 and - _ . ~
|
||||
bool arangodb::url::isUnreserved(char c) {
|
||||
return std::isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~';
|
||||
return (c >= '0' && c <= '9') ||
|
||||
(c >= 'a' && c <= 'z') ||
|
||||
(c >= 'A' && c <= 'Z') ||
|
||||
c == '-' || c == '_' || c == '.' || c == '~';
|
||||
}
|
||||
|
||||
// reserved are:
|
||||
|
@ -194,19 +200,22 @@ bool arangodb::url::isReserved(char c) {
|
|||
}
|
||||
|
||||
std::string arangodb::url::uriEncode(std::string const& raw) {
|
||||
std::stringstream encoded;
|
||||
|
||||
encoded << std::hex << std::setfill('0');
|
||||
std::string encoded;
|
||||
|
||||
for (auto const c : raw) {
|
||||
if (isUnreserved(c)) {
|
||||
encoded << c;
|
||||
// append character as is
|
||||
encoded.push_back(c);
|
||||
} else {
|
||||
encoded << '%' << std::setw(2) << static_cast<unsigned>(c);
|
||||
// must hex-encode the character
|
||||
encoded.push_back('%');
|
||||
auto u = static_cast<unsigned char>(c);
|
||||
encoded.push_back(::hexValuesLower[u >> 4]);
|
||||
encoded.push_back(::hexValuesLower[u % 16]);
|
||||
}
|
||||
}
|
||||
|
||||
return encoded.str();
|
||||
return encoded;
|
||||
}
|
||||
|
||||
std::ostream& arangodb::url::operator<<(std::ostream& ostream, Location const& location) {
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
|
||||
#include "Basics/Common.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <float.h>
|
||||
#include <limits>
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "StringUtils.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <algorithm>
|
||||
|
@ -164,11 +163,17 @@ unsigned char const BASE64U_REVS[256] = {
|
|||
};
|
||||
|
||||
inline bool isBase64(unsigned char c) {
|
||||
return (isalnum(c) || (c == '+') || (c == '/'));
|
||||
return (c >= '0' && c <= '9') ||
|
||||
(c >= 'a' && c <= 'z') ||
|
||||
(c >= 'A' && c <= 'Z') ||
|
||||
c == '+' || c == '/';
|
||||
}
|
||||
|
||||
inline bool isBase64U(unsigned char c) {
|
||||
return (isalnum(c) || (c == '-') || (c == '_'));
|
||||
return (c >= '0' && c <= '9') ||
|
||||
(c >= 'a' && c <= 'z') ||
|
||||
(c >= 'A' && c <= 'Z') ||
|
||||
c == '-' || c == '_';
|
||||
}
|
||||
|
||||
unsigned char consume(char const*& s) {
|
||||
|
|
|
@ -62,7 +62,7 @@ double TRI_DoubleString(char const* str) {
|
|||
TRI_set_errno(TRI_ERROR_NO_ERROR);
|
||||
double result = strtod(str, &endptr);
|
||||
|
||||
while (isspace(*endptr)) {
|
||||
while (*endptr == ' ' || *endptr == '\t' || *endptr == '\r' || *endptr == '\n' || *endptr == '\f' || *endptr == '\v') {
|
||||
++endptr;
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ int32_t TRI_Int32String(char const* str) {
|
|||
result = strtol(str, &endptr, 10);
|
||||
#endif
|
||||
|
||||
while (isspace(*endptr)) {
|
||||
while (*endptr == ' ' || *endptr == '\t' || *endptr == '\r' || *endptr == '\n' || *endptr == '\f' || *endptr == '\v') {
|
||||
++endptr;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ uint32_t TRI_UInt32String(char const* str) {
|
|||
result = (uint32_t)strtoul(str, &endptr, 10);
|
||||
#endif
|
||||
|
||||
while (isspace(*endptr)) {
|
||||
while (*endptr == ' ' || *endptr == '\t' || *endptr == '\r' || *endptr == '\n' || *endptr == '\f' || *endptr == '\v') {
|
||||
++endptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include "GeoJson.h"
|
||||
|
||||
#include <cctype>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "Basics/win-utils.h"
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
|
@ -1335,7 +1334,7 @@ static void JS_ChMod(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
|
||||
long mode = 0;
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
if (!isdigit(modeStr[i])) {
|
||||
if (modeStr[i] < '0' || modeStr[i] > '9') {
|
||||
TRI_V8_THROW_TYPE_ERROR(
|
||||
"<mode> must be a string with up to 4 octal digits in it plus a "
|
||||
"leading zero.");
|
||||
|
|
Loading…
Reference in New Issue