mirror of https://gitee.com/bigwinds/arangodb
fixed minor several compiler complaints (#5406)
This commit is contained in:
parent
30d0d840c2
commit
8e6d5df129
|
@ -499,7 +499,7 @@ std::vector<std::string> AgencyCommManager::slicePath(std::string const& p1) {
|
|||
}
|
||||
|
||||
std::string AgencyCommManager::generateStamp() {
|
||||
time_t tt = time(0);
|
||||
time_t tt = time(nullptr);
|
||||
struct tm tb;
|
||||
char buffer[21];
|
||||
|
||||
|
|
|
@ -29,14 +29,14 @@ using namespace arangodb::consensus;
|
|||
using namespace arangodb::velocypack;
|
||||
|
||||
AgentCallback::AgentCallback() :
|
||||
_agent(0), _last(0), _toLog(0), _startTime(0.0) {}
|
||||
_agent(nullptr), _last(0), _toLog(0), _startTime(0.0) {}
|
||||
|
||||
AgentCallback::AgentCallback(Agent* agent, std::string const& slaveID,
|
||||
index_t last, size_t toLog)
|
||||
: _agent(agent), _last(last), _slaveID(slaveID), _toLog(toLog),
|
||||
_startTime(TRI_microtime()) {}
|
||||
|
||||
void AgentCallback::shutdown() { _agent = 0; }
|
||||
void AgentCallback::shutdown() { _agent = nullptr; }
|
||||
|
||||
bool AgentCallback::operator()(arangodb::ClusterCommResult* res) {
|
||||
if (res->status == CL_COMM_SENT) {
|
||||
|
|
|
@ -278,7 +278,7 @@ AqlValue AqlValue::at(transaction::Methods* trx,
|
|||
}
|
||||
|
||||
/// @brief get the _key attribute from an object/document
|
||||
AqlValue AqlValue::getKeyAttribute(transaction::Methods* trx,
|
||||
AqlValue AqlValue::getKeyAttribute(transaction::Methods* /*trx*/,
|
||||
bool& mustDestroy, bool doCopy) const {
|
||||
mustDestroy = false;
|
||||
switch (type()) {
|
||||
|
@ -361,7 +361,7 @@ AqlValue AqlValue::getIdAttribute(transaction::Methods* trx,
|
|||
}
|
||||
|
||||
/// @brief get the _from attribute from an object/document
|
||||
AqlValue AqlValue::getFromAttribute(transaction::Methods* trx,
|
||||
AqlValue AqlValue::getFromAttribute(transaction::Methods* /*trx*/,
|
||||
bool& mustDestroy, bool doCopy) const {
|
||||
mustDestroy = false;
|
||||
switch (type()) {
|
||||
|
@ -400,7 +400,7 @@ AqlValue AqlValue::getFromAttribute(transaction::Methods* trx,
|
|||
}
|
||||
|
||||
/// @brief get the _to attribute from an object/document
|
||||
AqlValue AqlValue::getToAttribute(transaction::Methods* trx,
|
||||
AqlValue AqlValue::getToAttribute(transaction::Methods* /*trx*/,
|
||||
bool& mustDestroy, bool doCopy) const {
|
||||
mustDestroy = false;
|
||||
switch (type()) {
|
||||
|
|
|
@ -306,13 +306,13 @@ struct AstNode {
|
|||
|
||||
/// @brief set a flag for the node
|
||||
inline void setFlag(AstNodeFlagType flag) const {
|
||||
flags |= static_cast<decltype(flags)>(flag);
|
||||
flags |= flag;
|
||||
}
|
||||
|
||||
/// @brief set two flags for the node
|
||||
inline void setFlag(AstNodeFlagType typeFlag,
|
||||
AstNodeFlagType valueFlag) const {
|
||||
flags |= static_cast<decltype(flags)>(typeFlag | valueFlag);
|
||||
flags |= (typeFlag | valueFlag);
|
||||
}
|
||||
|
||||
/// @brief whether or not the node value is trueish
|
||||
|
@ -323,9 +323,7 @@ struct AstNode {
|
|||
|
||||
/// @brief whether or not the members of a list node are sorted
|
||||
inline bool isSorted() const {
|
||||
return ((flags &
|
||||
static_cast<decltype(flags)>(DETERMINED_SORTED | VALUE_SORTED)) ==
|
||||
static_cast<decltype(flags)>(DETERMINED_SORTED | VALUE_SORTED));
|
||||
return ((flags & (DETERMINED_SORTED | VALUE_SORTED)) == (DETERMINED_SORTED | VALUE_SORTED));
|
||||
}
|
||||
|
||||
/// @brief whether or not a value node is NULL
|
||||
|
|
|
@ -1561,7 +1561,7 @@ AqlValue Functions::FindFirst(arangodb::aql::Query* query,
|
|||
|
||||
auto locale = LanguageFeature::instance()->getLocale();
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
StringSearch search(uSearchBuf, uBuf, locale, NULL, status);
|
||||
StringSearch search(uSearchBuf, uBuf, locale, nullptr, status);
|
||||
|
||||
for(int pos = search.first(status);
|
||||
U_SUCCESS(status) && pos != USEARCH_DONE;
|
||||
|
@ -1632,7 +1632,7 @@ AqlValue Functions::FindLast(arangodb::aql::Query* query,
|
|||
|
||||
auto locale = LanguageFeature::instance()->getLocale();
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
StringSearch search(uSearchBuf, uBuf, locale, NULL, status);
|
||||
StringSearch search(uSearchBuf, uBuf, locale, nullptr, status);
|
||||
|
||||
int foundPos = -1;
|
||||
for(int pos = search.first(status);
|
||||
|
|
|
@ -264,11 +264,15 @@ struct ClusterCommResult {
|
|||
// request => response we simulate the old behaviour now and fake a request
|
||||
// containing the body of our response
|
||||
// :snake: OPST_CIRCUS
|
||||
answer_code = dynamic_cast<HttpResponse*>(response.get())->responseCode();
|
||||
auto httpResponse = dynamic_cast<HttpResponse*>(response.get());
|
||||
if (httpResponse == nullptr) {
|
||||
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "invalid response type");
|
||||
}
|
||||
answer_code = httpResponse->responseCode();
|
||||
HttpRequest* request = HttpRequest::createHttpRequest(
|
||||
ContentType::JSON,
|
||||
dynamic_cast<HttpResponse*>(response.get())->body().c_str(),
|
||||
dynamic_cast<HttpResponse*>(response.get())->body().length(), std::unordered_map<std::string,std::string>());
|
||||
httpResponse->body().c_str(),
|
||||
httpResponse->body().length(), std::unordered_map<std::string, std::string>());
|
||||
|
||||
auto const& headers = response->headers();
|
||||
auto errorCodes = headers.find(StaticStrings::ErrorCodes);
|
||||
|
|
|
@ -254,7 +254,7 @@ class ServerState {
|
|||
private:
|
||||
/// @brief atomically fetches the server role
|
||||
RoleEnum loadRole() {
|
||||
return static_cast<RoleEnum>(_role.load(std::memory_order_consume));
|
||||
return _role.load(std::memory_order_consume);
|
||||
}
|
||||
|
||||
/// @brief validate a state transition for a primary server
|
||||
|
|
|
@ -1634,7 +1634,7 @@ static void JS_AsyncRequest(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
|
||||
OperationID opId = cc->asyncRequest(
|
||||
clientTransactionID, coordTransactionID, destination, reqType, path, body,
|
||||
headerFields, 0, timeout, singleRequest, initTimeout);
|
||||
headerFields, nullptr, timeout, singleRequest, initTimeout);
|
||||
ClusterCommResult res = cc->enquire(opId);
|
||||
if (res.status == CL_COMM_BACKEND_UNAVAILABLE) {
|
||||
TRI_V8_THROW_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
|
||||
|
|
|
@ -148,7 +148,10 @@ bool AttributeWeightShortestPathFinder::Searcher::oneStep() {
|
|||
lookupPeer(v, s->weight());
|
||||
|
||||
Step* s2 = _myInfo._pq.find(v);
|
||||
s2->_done = true;
|
||||
TRI_ASSERT(s2 != nullptr);
|
||||
if (s2 != nullptr) {
|
||||
s2->_done = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ bool jsonCommitMeta(
|
|||
builder.add("commitTimeoutMsec", arangodb::velocypack::Value(meta._commitTimeoutMsec));
|
||||
|
||||
typedef arangodb::iresearch::IResearchViewMeta::CommitMeta::ConsolidationPolicy ConsolidationPolicy;
|
||||
struct ConsolidationPolicyHash { size_t operator()(ConsolidationPolicy::Type const& value) const { return size_t(value); } }; // for GCC compatibility
|
||||
struct ConsolidationPolicyHash { size_t operator()(ConsolidationPolicy::Type const& value) const noexcept { return size_t(value); } }; // for GCC compatibility
|
||||
static const std::unordered_map<ConsolidationPolicy::Type, std::string, ConsolidationPolicyHash> policies = {
|
||||
{ ConsolidationPolicy::Type::BYTES, "bytes" },
|
||||
{ ConsolidationPolicy::Type::BYTES_ACCUM, "bytes_accum" },
|
||||
|
@ -702,4 +702,4 @@ NS_END // arangodb
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- END-OF-FILE
|
||||
// -----------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -250,7 +250,7 @@ static MMFilesDatafile* CreatePhysicalDatafile(std::string const& filename,
|
|||
// try populating the mapping already
|
||||
flags |= MAP_POPULATE;
|
||||
#endif
|
||||
int res = TRI_MMFile(0, maximalSize, PROT_WRITE | PROT_READ, flags, fd,
|
||||
int res = TRI_MMFile(nullptr, maximalSize, PROT_WRITE | PROT_READ, flags, fd,
|
||||
&mmHandle, 0, &data);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
|
@ -1157,7 +1157,7 @@ int MMFilesDatafile::truncateAndSeal(uint32_t position) {
|
|||
}
|
||||
|
||||
// memory map the data
|
||||
int res = TRI_MMFile(0, maximalSize, PROT_WRITE | PROT_READ, MAP_SHARED, fd,
|
||||
int res = TRI_MMFile(nullptr, maximalSize, PROT_WRITE | PROT_READ, MAP_SHARED, fd,
|
||||
&mmHandle, 0, &data);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
|
@ -1931,7 +1931,7 @@ MMFilesDatafile* MMFilesDatafile::openHelper(std::string const& filename, bool i
|
|||
// map datafile into memory
|
||||
void* data;
|
||||
void* mmHandle;
|
||||
res = TRI_MMFile(0, size, PROT_READ, MAP_SHARED, fd, &mmHandle, 0, &data);
|
||||
res = TRI_MMFile(nullptr, size, PROT_READ, MAP_SHARED, fd, &mmHandle, 0, &data);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
TRI_set_errno(res);
|
||||
|
|
|
@ -1586,7 +1586,7 @@ int MMFilesWalRecoverState::removeEmptyLogfiles() {
|
|||
for (auto it = emptyLogfiles.begin(); it != emptyLogfiles.end(); ++it) {
|
||||
auto filename = (*it);
|
||||
|
||||
if (basics::FileUtils::remove(filename, 0)) {
|
||||
if (basics::FileUtils::remove(filename, nullptr)) {
|
||||
LOG_TOPIC(TRACE, arangodb::Logger::ENGINES)
|
||||
<< "removing empty WAL logfile '" << filename << "'";
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ class VertexEntry {
|
|||
namespace std {
|
||||
template <>
|
||||
struct hash<arangodb::pregel::PregelID> {
|
||||
std::size_t operator()(const arangodb::pregel::PregelID& k) const {
|
||||
std::size_t operator()(const arangodb::pregel::PregelID& k) const noexcept {
|
||||
using std::size_t;
|
||||
using std::hash;
|
||||
using std::string;
|
||||
|
|
|
@ -239,7 +239,7 @@ RestStatus RestBatchHandler::executeHttp() {
|
|||
httpResponse->body().appendText(StaticStrings::BatchContentType);
|
||||
|
||||
// append content-id if it is present
|
||||
if (helper.contentId != 0) {
|
||||
if (helper.contentId != nullptr) {
|
||||
httpResponse->body().appendText(
|
||||
"\r\nContent-Id: " +
|
||||
std::string(helper.contentId, helper.contentIdLength));
|
||||
|
@ -389,7 +389,7 @@ bool RestBatchHandler::extractPart(SearchHelper* helper) {
|
|||
helper->foundStart = nullptr;
|
||||
helper->foundLength = 0;
|
||||
helper->containsMore = false;
|
||||
helper->contentId = 0;
|
||||
helper->contentId = nullptr;
|
||||
helper->contentIdLength = 0;
|
||||
|
||||
char const* searchEnd = helper->message->messageEnd;
|
||||
|
|
|
@ -128,7 +128,7 @@ int ServerIdFeature::writeId() {
|
|||
TRI_ASSERT(SERVERID != 0);
|
||||
builder.add("serverId", VPackValue(std::to_string(SERVERID)));
|
||||
|
||||
time_t tt = time(0);
|
||||
time_t tt = time(nullptr);
|
||||
struct tm tb;
|
||||
TRI_gmtime(tt, &tb);
|
||||
char buffer[32];
|
||||
|
|
|
@ -144,11 +144,11 @@ class RocksDBEngine final : public StorageEngine {
|
|||
) override;
|
||||
|
||||
std::string versionFilename(TRI_voc_tick_t id) const override;
|
||||
std::string databasePath(TRI_vocbase_t const* vocbase) const override {
|
||||
std::string databasePath(TRI_vocbase_t const* /*vocbase*/) const override {
|
||||
return _basePath;
|
||||
}
|
||||
std::string collectionPath(TRI_vocbase_t const* vocbase,
|
||||
TRI_voc_cid_t id) const override {
|
||||
std::string collectionPath(TRI_vocbase_t const* /*vocbase*/,
|
||||
TRI_voc_cid_t /*id*/) const override {
|
||||
return std::string(); // no path to be returned here
|
||||
}
|
||||
|
||||
|
@ -445,4 +445,4 @@ class RocksDBEngine final : public StorageEngine {
|
|||
|
||||
} // namespace arangodb
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -504,7 +504,7 @@ void Scheduler::initializeSignalHandlers() {
|
|||
// ignore broken pipes
|
||||
action.sa_handler = SIG_IGN;
|
||||
|
||||
int res = sigaction(SIGPIPE, &action, 0);
|
||||
int res = sigaction(SIGPIPE, &action, nullptr);
|
||||
|
||||
if (res < 0) {
|
||||
LOG_TOPIC(ERR, arangodb::Logger::FIXME) << "cannot initialize signal handlers for pipe";
|
||||
|
|
|
@ -286,7 +286,7 @@ void SchedulerFeature::buildControlCHandler() {
|
|||
// least one thread.
|
||||
sigset_t all;
|
||||
sigemptyset(&all);
|
||||
pthread_sigmask(SIG_SETMASK, &all, 0);
|
||||
pthread_sigmask(SIG_SETMASK, &all, nullptr);
|
||||
|
||||
auto ioService = _scheduler->managerService();
|
||||
_exitSignals = std::make_shared<asio::signal_set>(*ioService, SIGINT,
|
||||
|
|
|
@ -103,11 +103,11 @@ class StorageEngine : public application_features::ApplicationFeature {
|
|||
|
||||
// when a new collection is created, this method is called to augment the collection
|
||||
// creation data with engine-specific information
|
||||
virtual void addParametersForNewCollection(VPackBuilder& builder, VPackSlice info) {}
|
||||
virtual void addParametersForNewCollection(VPackBuilder&, VPackSlice /*info*/) {}
|
||||
|
||||
// when a new index is created, this method is called to augment the index
|
||||
// creation data with engine-specific information
|
||||
virtual void addParametersForNewIndex(VPackBuilder& builder, VPackSlice info) {}
|
||||
virtual void addParametersForNewIndex(VPackBuilder&, VPackSlice /*info*/) {}
|
||||
|
||||
// create storage-engine specific collection
|
||||
virtual PhysicalCollection* createPhysicalCollection(LogicalCollection*, VPackSlice const&) = 0;
|
||||
|
@ -237,7 +237,7 @@ class StorageEngine : public application_features::ApplicationFeature {
|
|||
virtual bool inRecovery() { return false; }
|
||||
|
||||
/// @brief function to be run when recovery is done
|
||||
virtual void recoveryDone(TRI_vocbase_t& vocbase) {}
|
||||
virtual void recoveryDone(TRI_vocbase_t& /*vocbase*/) {}
|
||||
|
||||
//// Operations on Collections
|
||||
// asks the storage engine to create a collection as specified in the VPack
|
||||
|
|
|
@ -405,8 +405,8 @@ class Methods {
|
|||
CollectionNameResolver const* resolver() const;
|
||||
|
||||
#ifdef USE_ENTERPRISE
|
||||
virtual bool isInaccessibleCollectionId(TRI_voc_cid_t cid) { return false; }
|
||||
virtual bool isInaccessibleCollection(std::string const& cid) { return false; }
|
||||
virtual bool isInaccessibleCollectionId(TRI_voc_cid_t /*cid*/) { return false; }
|
||||
virtual bool isInaccessibleCollection(std::string const& /*cid*/) { return false; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
|
|
@ -1220,7 +1220,7 @@ V8Context* V8DealerFeature::buildContext(size_t id) {
|
|||
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate);
|
||||
|
||||
v8::Persistent<v8::Context> persistentContext;
|
||||
persistentContext.Reset(isolate, v8::Context::New(isolate, 0, global));
|
||||
persistentContext.Reset(isolate, v8::Context::New(isolate, nullptr, global));
|
||||
auto localContext = v8::Local<v8::Context>::New(isolate, persistentContext);
|
||||
|
||||
localContext->Enter();
|
||||
|
@ -1259,10 +1259,10 @@ V8Context* V8DealerFeature::buildContext(size_t id) {
|
|||
}
|
||||
TRI_InitV8UserFunctions(isolate, localContext);
|
||||
TRI_InitV8UserStructures(isolate, localContext);
|
||||
TRI_InitV8Buffer(isolate, localContext);
|
||||
TRI_InitV8Buffer(isolate);
|
||||
TRI_InitV8Utils(isolate, localContext, _startupDirectory, modules);
|
||||
TRI_InitV8DebugUtils(isolate, localContext);
|
||||
TRI_InitV8Shell(isolate, localContext);
|
||||
TRI_InitV8Shell(isolate);
|
||||
|
||||
{
|
||||
v8::HandleScope scope(isolate);
|
||||
|
|
|
@ -1014,7 +1014,7 @@ static void JS_DefineAction(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
// extract the action name
|
||||
TRI_Utf8ValueNFC utf8name(args[0]);
|
||||
|
||||
if (*utf8name == 0) {
|
||||
if (*utf8name == nullptr) {
|
||||
TRI_V8_THROW_TYPE_ERROR("<name> must be an UTF-8 string");
|
||||
}
|
||||
|
||||
|
|
|
@ -356,7 +356,7 @@ static void JS_FormatDatetime(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
int64_t datetime = TRI_ObjectToInt64(args[0]);
|
||||
v8::String::Value pattern(args[1]);
|
||||
|
||||
TimeZone* tz = 0;
|
||||
TimeZone* tz = nullptr;
|
||||
if (args.Length() > 2) {
|
||||
v8::String::Value value(args[2]);
|
||||
|
||||
|
@ -416,7 +416,7 @@ static void JS_ParseDatetime(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
v8::String::Value datetimeString(args[0]);
|
||||
v8::String::Value pattern(args[1]);
|
||||
|
||||
TimeZone* tz = 0;
|
||||
TimeZone* tz = nullptr;
|
||||
if (args.Length() > 2) {
|
||||
v8::String::Value value(args[2]);
|
||||
|
||||
|
|
|
@ -165,9 +165,9 @@ class LogicalDataSource {
|
|||
/// @brief append implementation-specific values to the data-source definition
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
virtual Result appendVelocyPack(
|
||||
velocypack::Builder& builder,
|
||||
bool detailed,
|
||||
bool forPersistence
|
||||
velocypack::Builder&,
|
||||
bool /*detailed*/,
|
||||
bool /*forPersistence*/
|
||||
) const {
|
||||
return Result(); // NOOP by default
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ struct DocumentCrudAppendTest : public BenchmarkOperation {
|
|||
return (char const*)nullptr;
|
||||
} else {
|
||||
TRI_ASSERT(false);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -577,7 +577,7 @@ struct DocumentCrudTest : public BenchmarkOperation {
|
|||
return (char const*)nullptr;
|
||||
} else {
|
||||
TRI_ASSERT(false);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -686,7 +686,7 @@ struct EdgeCrudTest : public BenchmarkOperation {
|
|||
return (char const*)nullptr;
|
||||
} else {
|
||||
TRI_ASSERT(false);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -769,7 +769,7 @@ struct SkiplistTest : public BenchmarkOperation {
|
|||
return (char const*)nullptr;
|
||||
} else {
|
||||
TRI_ASSERT(false);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -852,13 +852,13 @@ struct HashTest : public BenchmarkOperation {
|
|||
return (char const*)nullptr;
|
||||
} else {
|
||||
TRI_ASSERT(false);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct DocumentImportTest : public BenchmarkOperation {
|
||||
DocumentImportTest() : BenchmarkOperation(), _url(), _buffer(0) {
|
||||
DocumentImportTest() : BenchmarkOperation(), _url(), _buffer(nullptr) {
|
||||
_url = "/_api/import?collection=" + ARANGOBENCH->collection() +
|
||||
"&type=documents";
|
||||
|
||||
|
@ -911,7 +911,7 @@ struct DocumentImportTest : public BenchmarkOperation {
|
|||
};
|
||||
|
||||
struct DocumentCreationTest : public BenchmarkOperation {
|
||||
DocumentCreationTest() : BenchmarkOperation(), _url(), _buffer(0) {
|
||||
DocumentCreationTest() : BenchmarkOperation(), _url(), _buffer(nullptr) {
|
||||
_url = "/_api/document?collection=" + ARANGOBENCH->collection();
|
||||
|
||||
uint64_t const n = ARANGOBENCH->complexity();
|
||||
|
@ -995,8 +995,8 @@ struct CollectionCreationTest : public BenchmarkOperation {
|
|||
char* data;
|
||||
|
||||
buffer = TRI_CreateSizedStringBuffer(64);
|
||||
if (buffer == 0) {
|
||||
return 0;
|
||||
if (buffer == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
TRI_AppendStringStringBuffer(buffer, "{\"name\":\"");
|
||||
TRI_AppendStringStringBuffer(buffer, ARANGOBENCH->collection().c_str());
|
||||
|
|
|
@ -918,9 +918,9 @@ void V8ShellFeature::initGlobals() {
|
|||
// we take the last entry in _startupDirectory as global path;
|
||||
// all the other entries are only used for the modules
|
||||
|
||||
TRI_InitV8Buffer(_isolate, context);
|
||||
TRI_InitV8Buffer(_isolate);
|
||||
TRI_InitV8Utils(_isolate, context, _startupDirectory, modules);
|
||||
TRI_InitV8Shell(_isolate, context);
|
||||
TRI_InitV8Shell(_isolate);
|
||||
|
||||
// pager functions (overwrite existing SYS_OUTPUT from InitV8Utils)
|
||||
v8::Local<v8::Value> console = v8::External::New(_isolate, _console);
|
||||
|
|
|
@ -48,7 +48,7 @@ void ApplicationFeature::collectOptions(std::shared_ptr<ProgramOptions>) {}
|
|||
// load options from somewhere. this method will only be called for enabled
|
||||
// features
|
||||
void ApplicationFeature::loadOptions(std::shared_ptr<ProgramOptions>,
|
||||
char const* binaryPath) {}
|
||||
char const* /*binaryPath*/) {}
|
||||
|
||||
// validate the feature's options. this method will only be called for active
|
||||
// features, after the ApplicationServer has determined which features should be
|
||||
|
|
|
@ -388,7 +388,7 @@ void ApplicationServer::validateOptions() {
|
|||
}
|
||||
|
||||
// inform about obsolete options
|
||||
_options->walk([](Section const& section, Option const& option) {
|
||||
_options->walk([](Section const&, Option const& option) {
|
||||
if (option.obsolete) {
|
||||
LOG_TOPIC(WARN, Logger::STARTUP) << "obsolete option '" << option.displayName() << "' used in configuration. "
|
||||
<< "setting this option will not have any effect.";
|
||||
|
|
|
@ -256,13 +256,12 @@ class ApplicationServer {
|
|||
|
||||
private:
|
||||
// throws an exception that a requested feature was not found
|
||||
static void throwFeatureNotFoundException(std::string const& name);
|
||||
[[ noreturn ]] static void throwFeatureNotFoundException(std::string const& name);
|
||||
|
||||
// throws an exception that a requested feature is not enabled
|
||||
static void throwFeatureNotEnabledException(std::string const& name);
|
||||
[[ noreturn ]] static void throwFeatureNotEnabledException(std::string const& name);
|
||||
|
||||
static void disableFeatures(std::vector<std::string> const& names,
|
||||
bool force);
|
||||
static void disableFeatures(std::vector<std::string> const& names, bool force);
|
||||
|
||||
// walks over all features and runs a callback function for them
|
||||
void apply(std::function<void(ApplicationFeature*)>, bool enabledOnly);
|
||||
|
@ -354,4 +353,4 @@ class ApplicationServer {
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -86,7 +86,7 @@ void PrivilegeFeature::extractPrivileges() {
|
|||
#ifdef ARANGODB_HAVE_GETGRGID
|
||||
group* g = getgrgid(gidNumber);
|
||||
|
||||
if (g == 0) {
|
||||
if (g == nullptr) {
|
||||
LOG_TOPIC(FATAL, arangodb::Logger::FIXME) << "unknown numeric gid '" << _gid << "'";
|
||||
FATAL_ERROR_EXIT();
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ void PrivilegeFeature::extractPrivileges() {
|
|||
std::string name = _gid;
|
||||
group* g = getgrnam(name.c_str());
|
||||
|
||||
if (g != 0) {
|
||||
if (g != nullptr) {
|
||||
gidNumber = g->gr_gid;
|
||||
} else {
|
||||
LOG_TOPIC(FATAL, arangodb::Logger::FIXME) << "cannot convert groupname '" << _gid
|
||||
|
@ -123,7 +123,7 @@ void PrivilegeFeature::extractPrivileges() {
|
|||
#ifdef ARANGODB_HAVE_GETPWUID
|
||||
passwd* p = getpwuid(uidNumber);
|
||||
|
||||
if (p == 0) {
|
||||
if (p == nullptr) {
|
||||
LOG_TOPIC(FATAL, arangodb::Logger::FIXME) << "unknown numeric uid '" << _uid << "'";
|
||||
FATAL_ERROR_EXIT();
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ void PrivilegeFeature::extractPrivileges() {
|
|||
std::string name = _uid;
|
||||
passwd* p = getpwnam(name.c_str());
|
||||
|
||||
if (p != 0) {
|
||||
if (p != nullptr) {
|
||||
uidNumber = p->pw_uid;
|
||||
} else {
|
||||
LOG_TOPIC(FATAL, arangodb::Logger::FIXME) << "cannot convert username '" << _uid << "' to numeric uid";
|
||||
|
|
|
@ -153,7 +153,7 @@ void SupervisorFeature::daemonize() {
|
|||
return;
|
||||
}
|
||||
|
||||
time_t startTime = time(0);
|
||||
time_t startTime = time(nullptr);
|
||||
time_t t;
|
||||
bool done = false;
|
||||
int result = EXIT_SUCCESS;
|
||||
|
@ -232,7 +232,7 @@ void SupervisorFeature::daemonize() {
|
|||
done = true;
|
||||
horrible = false;
|
||||
} else {
|
||||
t = time(0) - startTime;
|
||||
t = time(nullptr) - startTime;
|
||||
|
||||
if (t < MIN_TIME_ALIVE_IN_SEC) {
|
||||
LOG_TOPIC(ERR, Logger::STARTUP)
|
||||
|
@ -269,7 +269,7 @@ void SupervisorFeature::daemonize() {
|
|||
|
||||
default:
|
||||
TRI_ASSERT(horrible);
|
||||
t = time(0) - startTime;
|
||||
t = time(nullptr) - startTime;
|
||||
|
||||
if (t < MIN_TIME_ALIVE_IN_SEC) {
|
||||
LOG_TOPIC(ERR, Logger::STARTUP)
|
||||
|
|
|
@ -45,8 +45,8 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
|
|||
virtual void Free(void* data, size_t) override { free(data); }
|
||||
};
|
||||
|
||||
static void gcPrologueCallback(v8::Isolate* isolate, v8::GCType type,
|
||||
v8::GCCallbackFlags flags) {
|
||||
static void gcPrologueCallback(v8::Isolate* isolate, v8::GCType /*type*/,
|
||||
v8::GCCallbackFlags /*flags*/) {
|
||||
// if (type != v8::kGCTypeMarkSweepCompact) {
|
||||
// return;
|
||||
// }
|
||||
|
|
|
@ -132,7 +132,7 @@ LONG CALLBACK unhandledExceptionHandler(EXCEPTION_POINTERS* e) {
|
|||
|
||||
ArangoGlobalContext* ArangoGlobalContext::CONTEXT = nullptr;
|
||||
|
||||
ArangoGlobalContext::ArangoGlobalContext(int argc, char* argv[],
|
||||
ArangoGlobalContext::ArangoGlobalContext(int /*argc*/, char* argv[],
|
||||
char const* InstallDirectory)
|
||||
: _binaryName(TRI_BinaryName(argv[0])),
|
||||
_binaryPath(TRI_LocateBinaryPath(argv[0])),
|
||||
|
@ -202,7 +202,7 @@ void ArangoGlobalContext::maskAllSignals() {
|
|||
#ifdef TRI_HAVE_POSIX_THREADS
|
||||
sigset_t all;
|
||||
sigfillset(&all);
|
||||
pthread_sigmask(SIG_SETMASK, &all, 0);
|
||||
pthread_sigmask(SIG_SETMASK, &all, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ void ArangoGlobalContext::unmaskStandardSignals() {
|
|||
#ifdef TRI_HAVE_POSIX_THREADS
|
||||
sigset_t all;
|
||||
sigfillset(&all);
|
||||
pthread_sigmask(SIG_UNBLOCK, &all, 0);
|
||||
pthread_sigmask(SIG_UNBLOCK, &all, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -70,15 +70,15 @@ void spit(std::string const& filename, StringBuffer const& content,
|
|||
bool sync = false);
|
||||
|
||||
// returns true if a file could be removed
|
||||
bool remove(std::string const& fileName, int* errorNumber = 0);
|
||||
bool remove(std::string const& fileName, int* errorNumber = nullptr);
|
||||
|
||||
// returns true if a file could be renamed
|
||||
bool rename(std::string const& oldName, std::string const& newName,
|
||||
int* errorNumber = 0);
|
||||
int* errorNumber = nullptr);
|
||||
|
||||
// creates a new directory
|
||||
bool createDirectory(std::string const& name, int* errorNumber = 0);
|
||||
bool createDirectory(std::string const& name, int mask, int* errorNumber = 0);
|
||||
bool createDirectory(std::string const& name, int* errorNumber = nullptr);
|
||||
bool createDirectory(std::string const& name, int mask, int* errorNumber = nullptr);
|
||||
|
||||
// copies directories / files recursive
|
||||
bool copyRecursive(std::string const& source, std::string const& target,
|
||||
|
|
|
@ -84,7 +84,7 @@ void destroy() {
|
|||
}
|
||||
|
||||
std::string createNonce() {
|
||||
uint32_t timestamp = (uint32_t)time(0);
|
||||
uint32_t timestamp = (uint32_t)time(nullptr);
|
||||
uint32_t rand1 = RandomGenerator::interval(UINT32_MAX);
|
||||
uint32_t rand2 = RandomGenerator::interval(UINT32_MAX);
|
||||
|
||||
|
@ -150,7 +150,7 @@ bool checkAndMark(uint32_t timestamp, uint64_t random) {
|
|||
}
|
||||
|
||||
// statistics, compute the log2 of the age and increment the proofs count
|
||||
uint32_t now = (uint32_t)time(0);
|
||||
uint32_t now = (uint32_t)time(nullptr);
|
||||
uint32_t age = 1;
|
||||
|
||||
if (timestamp < now) {
|
||||
|
|
|
@ -301,7 +301,7 @@ class StringBuffer {
|
|||
|
||||
char* buffer = new char[bufferSize];
|
||||
|
||||
if (buffer == 0) {
|
||||
if (buffer == nullptr) {
|
||||
(void)inflateEnd(&strm);
|
||||
|
||||
return TRI_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -396,7 +396,7 @@ class StringBuffer {
|
|||
|
||||
char* buffer = new char[bufferSize];
|
||||
|
||||
if (buffer == 0) {
|
||||
if (buffer == nullptr) {
|
||||
(void)inflateEnd(&strm);
|
||||
|
||||
return TRI_ERROR_OUT_OF_MEMORY;
|
||||
|
|
|
@ -222,8 +222,8 @@ char* duplicate(std::string const& source) {
|
|||
}
|
||||
|
||||
char* duplicate(char const* source, size_t len) {
|
||||
if (source == 0) {
|
||||
return 0;
|
||||
if (source == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
char* result = new char[len + 1];
|
||||
|
@ -235,8 +235,8 @@ char* duplicate(char const* source, size_t len) {
|
|||
}
|
||||
|
||||
char* duplicate(char const* source) {
|
||||
if (source == 0) {
|
||||
return 0;
|
||||
if (source == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
size_t len = strlen(source);
|
||||
char* result = new char[len + 1];
|
||||
|
@ -248,25 +248,25 @@ char* duplicate(char const* source) {
|
|||
}
|
||||
|
||||
void destroy(char*& source) {
|
||||
if (source != 0) {
|
||||
if (source != nullptr) {
|
||||
::memset(source, 0, ::strlen(source));
|
||||
delete[] source;
|
||||
source = 0;
|
||||
source = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void destroy(char*& source, size_t length) {
|
||||
if (source != 0) {
|
||||
if (source != nullptr) {
|
||||
::memset(source, 0, length);
|
||||
delete[] source;
|
||||
source = 0;
|
||||
source = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void erase(char*& source) {
|
||||
if (source != 0) {
|
||||
if (source != nullptr) {
|
||||
delete[] source;
|
||||
source = 0;
|
||||
source = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1611,7 +1611,7 @@ bool boolean(std::string const& str) {
|
|||
|
||||
int64_t int64(std::string const& str) {
|
||||
try {
|
||||
return std::stoll(str, 0, 10);
|
||||
return std::stoll(str, nullptr, 10);
|
||||
} catch (...) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1619,7 +1619,7 @@ int64_t int64(std::string const& str) {
|
|||
|
||||
uint64_t uint64(std::string const& str) {
|
||||
try {
|
||||
return std::stoull(str, 0, 10);
|
||||
return std::stoull(str, nullptr, 10);
|
||||
} catch (...) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1682,7 +1682,7 @@ int32_t int32(std::string const& str) {
|
|||
struct reent buffer;
|
||||
return _strtol_r(&buffer, str.c_str(), 0, 10);
|
||||
#else
|
||||
return (int32_t)strtol(str.c_str(), 0, 10);
|
||||
return (int32_t)strtol(str.c_str(), nullptr, 10);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -1708,7 +1708,7 @@ int32_t int32(char const* value, size_t size) {
|
|||
struct reent buffer;
|
||||
return _strtol_r(&buffer, value, 0, 10);
|
||||
#else
|
||||
return (int32_t)strtol(value, 0, 10);
|
||||
return (int32_t)strtol(value, nullptr, 10);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -1722,7 +1722,7 @@ uint32_t uint32(std::string const& str) {
|
|||
struct reent buffer;
|
||||
return _strtoul_r(&buffer, str.c_str(), 0, 10);
|
||||
#else
|
||||
return (uint32_t)strtoul(str.c_str(), 0, 10);
|
||||
return (uint32_t)strtoul(str.c_str(), nullptr, 10);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -1736,7 +1736,7 @@ uint32_t unhexUint32(std::string const& str) {
|
|||
struct reent buffer;
|
||||
return _strtoul_r(&buffer, str.c_str(), 0, 16);
|
||||
#else
|
||||
return (uint32_t)strtoul(str.c_str(), 0, 16);
|
||||
return (uint32_t)strtoul(str.c_str(), nullptr, 16);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -1762,7 +1762,7 @@ uint32_t uint32(char const* value, size_t size) {
|
|||
struct reent buffer;
|
||||
return _strtoul_r(&buffer, value, 0, 10);
|
||||
#else
|
||||
return (uint32_t)strtoul(value, 0, 10);
|
||||
return (uint32_t)strtoul(value, nullptr, 10);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -1788,7 +1788,7 @@ uint32_t unhexUint32(char const* value, size_t size) {
|
|||
struct reent buffer;
|
||||
return _strtoul_r(&buffer, value, 0, 16);
|
||||
#else
|
||||
return (uint32_t)strtoul(value, 0, 16);
|
||||
return (uint32_t)strtoul(value, nullptr, 16);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ class Thread {
|
|||
/// @brief optional notification call when thread gets unplanned exception
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual void crashNotification(std::exception const & ex) {return;};
|
||||
virtual void crashNotification(std::exception const&) {}
|
||||
|
||||
protected:
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -37,7 +37,7 @@ using namespace arangodb::basics;
|
|||
|
||||
static size_t const MinReserveValue = 32;
|
||||
|
||||
void VelocyPackDumper::handleUnsupportedType(VPackSlice const* slice) {
|
||||
void VelocyPackDumper::handleUnsupportedType(VPackSlice const* /*slice*/) {
|
||||
TRI_string_buffer_t* buffer = _buffer->stringBuffer();
|
||||
|
||||
if (options->unsupportedTypeBehavior == VPackOptions::NullifyUnsupportedType) {
|
||||
|
|
|
@ -27,10 +27,10 @@ static void defaultExitFunction(int, void*);
|
|||
|
||||
TRI_ExitFunction_t TRI_EXIT_FUNCTION = defaultExitFunction;
|
||||
|
||||
void defaultExitFunction(int exitCode, void* data) { _exit(exitCode); }
|
||||
void defaultExitFunction(int exitCode, void* /*data*/) { _exit(exitCode); }
|
||||
|
||||
void TRI_Application_Exit_SetExit(TRI_ExitFunction_t exitFunction) {
|
||||
if (exitFunction != NULL) {
|
||||
if (exitFunction != nullptr) {
|
||||
TRI_EXIT_FUNCTION = exitFunction;
|
||||
} else {
|
||||
TRI_EXIT_FUNCTION = defaultExitFunction;
|
||||
|
|
|
@ -2006,13 +2006,11 @@ static std::string getTempPath() {
|
|||
return system;
|
||||
}
|
||||
|
||||
static int mkDTemp(char* s, size_t bufferSize) {
|
||||
static int mkDTemp(char* s, size_t /*bufferSize*/) {
|
||||
if (mkdtemp(s) != nullptr) {
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
else {
|
||||
return errno;
|
||||
}
|
||||
return errno;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -176,7 +176,7 @@ inline typename std::enable_if<std::is_unsigned<T>::value, T>::type toNumber(
|
|||
|
||||
// convert a string into a number, version for double values
|
||||
template <>
|
||||
inline double toNumber<double>(std::string value, double base) {
|
||||
inline double toNumber<double>(std::string value, double /*base*/) {
|
||||
return std::stod(value);
|
||||
}
|
||||
|
||||
|
|
|
@ -481,7 +481,7 @@ void HttpRequest::setValues(char* buffer, char* end) {
|
|||
}
|
||||
|
||||
keyBegin = key = buffer + 1;
|
||||
valueBegin = value = 0;
|
||||
valueBegin = value = nullptr;
|
||||
|
||||
continue;
|
||||
} else if (next == PERCENT) {
|
||||
|
|
|
@ -131,7 +131,7 @@ ConnectionManager::ServerConnections::popConnection() {
|
|||
|
||||
void ConnectionManager::ServerConnections::pushConnection(
|
||||
ConnectionManager::SingleServerConnection* connection) {
|
||||
connection->_lastUsed = time(0);
|
||||
connection->_lastUsed = time(nullptr);
|
||||
|
||||
WRITE_LOCKER(writeLocker, _lock);
|
||||
_unused.emplace_back(connection);
|
||||
|
@ -160,7 +160,7 @@ void ConnectionManager::ServerConnections::removeConnection(
|
|||
|
||||
void ConnectionManager::ServerConnections::closeUnusedConnections(
|
||||
double limit) {
|
||||
time_t const t = time(0);
|
||||
time_t const t = time(nullptr);
|
||||
|
||||
std::list<ConnectionManager::SingleServerConnection*>::iterator current;
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ class ConnectionManager {
|
|||
_connection(connection),
|
||||
_endpoint(endpoint),
|
||||
_endpointSpecification(endpointSpecification),
|
||||
_lastUsed(::time(0)) {}
|
||||
_lastUsed(::time(nullptr)) {}
|
||||
|
||||
~SingleServerConnection();
|
||||
};
|
||||
|
|
|
@ -244,7 +244,7 @@ asio::ssl::context SslServerFeature::createSslContext() const {
|
|||
LOG_TOPIC(TRACE, arangodb::Logger::SSL)
|
||||
<< "trying to load CA certificates from '" << _cafile << "'";
|
||||
|
||||
int res = SSL_CTX_load_verify_locations(nativeContext, _cafile.c_str(), 0);
|
||||
int res = SSL_CTX_load_verify_locations(nativeContext, _cafile.c_str(), nullptr);
|
||||
|
||||
if (res == 0) {
|
||||
LOG_TOPIC(ERR, arangodb::Logger::SSL)
|
||||
|
|
|
@ -130,80 +130,3 @@ JSLoader::eState JSLoader::loadScript(v8::Isolate* isolate,
|
|||
|
||||
return eSuccess;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief loads all scripts
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool JSLoader::loadAllScripts(v8::Isolate* isolate,
|
||||
v8::Handle<v8::Context>& context) {
|
||||
v8::HandleScope scope(isolate);
|
||||
|
||||
if (_directory.empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<std::string> parts = getDirectoryParts();
|
||||
|
||||
bool result = true;
|
||||
|
||||
for (size_t i = 0; i < parts.size(); i++) {
|
||||
result = result &&
|
||||
TRI_ExecuteGlobalJavaScriptDirectory(isolate, parts.at(i).c_str());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief loads a named script
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool JSLoader::executeScript(v8::Isolate* isolate,
|
||||
v8::Handle<v8::Context>& context,
|
||||
std::string const& name) {
|
||||
v8::HandleScope scope(isolate);
|
||||
v8::TryCatch tryCatch;
|
||||
|
||||
findScript(name);
|
||||
|
||||
std::map<std::string, std::string>::iterator i = _scripts.find(name);
|
||||
|
||||
if (i == _scripts.end()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string content =
|
||||
"(function() { " + i->second + "/* end-of-file '" + name + "' */ })()";
|
||||
|
||||
// Enter the newly created execution environment.
|
||||
v8::Context::Scope context_scope(context);
|
||||
|
||||
TRI_ExecuteJavaScriptString(isolate, context, TRI_V8_STD_STRING(isolate, content),
|
||||
TRI_V8_STD_STRING(isolate, name), false);
|
||||
|
||||
if (!tryCatch.HasCaught()) {
|
||||
TRI_LogV8Exception(isolate, &tryCatch);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief executes all scripts
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool JSLoader::executeAllScripts(v8::Isolate* isolate,
|
||||
v8::Handle<v8::Context>& context) {
|
||||
v8::HandleScope scope(isolate);
|
||||
v8::TryCatch tryCatch;
|
||||
|
||||
if (_directory.empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ok = TRI_ExecuteLocalJavaScriptDirectory(isolate, _directory.c_str());
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
|
|
@ -65,26 +65,6 @@ class JSLoader : public ScriptLoader {
|
|||
|
||||
JSLoader::eState loadScript(v8::Isolate* isolate, v8::Handle<v8::Context>&,
|
||||
std::string const& name, VPackBuilder* builder);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief loads all scripts
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool loadAllScripts(v8::Isolate* isolate, v8::Handle<v8::Context>& context);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief executes a named script
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool executeScript(v8::Isolate* isolate, v8::Handle<v8::Context>& context,
|
||||
std::string const& name);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief executes all scripts
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool executeAllScripts(v8::Isolate* isolate,
|
||||
v8::Handle<v8::Context>& context);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ static bool SignalHandler(DWORD eventType) {
|
|||
|
||||
#else
|
||||
|
||||
static void SignalHandler(int signal) {
|
||||
static void SignalHandler(int /*signal*/) {
|
||||
// get the instance of the console
|
||||
auto instance = SINGLETON.load();
|
||||
|
||||
|
@ -106,7 +106,7 @@ class V8Completer : public Completer {
|
|||
~V8Completer() {}
|
||||
|
||||
public:
|
||||
bool isComplete(std::string const& source, size_t lineno) override final {
|
||||
bool isComplete(std::string const& source, size_t /*lineno*/) override final {
|
||||
int openParen = 0;
|
||||
int openBrackets = 0;
|
||||
int openBraces = 0;
|
||||
|
@ -395,7 +395,7 @@ V8LineEditor::V8LineEditor(v8::Isolate* isolate,
|
|||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_handler = &SignalHandler;
|
||||
|
||||
int res = sigaction(SIGINT, &sa, 0);
|
||||
int res = sigaction(SIGINT, &sa, nullptr);
|
||||
|
||||
if (res != 0) {
|
||||
LOG_TOPIC(ERR, arangodb::Logger::FIXME) << "unable to install signal handler";
|
||||
|
|
|
@ -777,7 +777,7 @@ void V8Buffer::replace(v8::Isolate* isolate, char* data, size_t length,
|
|||
free_callback_fptr callback, void* hint) {
|
||||
TRI_V8_CURRENT_GLOBALS_AND_SCOPE;
|
||||
|
||||
if (_callback != 0) {
|
||||
if (_callback != nullptr) {
|
||||
_callback(_data, _callbackHint);
|
||||
} else if (0 < _length) {
|
||||
delete[] _data;
|
||||
|
@ -791,7 +791,7 @@ void V8Buffer::replace(v8::Isolate* isolate, char* data, size_t length,
|
|||
_callback = callback;
|
||||
_callbackHint = hint;
|
||||
|
||||
if (_callback != 0) {
|
||||
if (_callback != nullptr) {
|
||||
_data = data;
|
||||
} else if (0 < _length) {
|
||||
_data = new char[_length + SAFETY_OVERHEAD];
|
||||
|
@ -1625,7 +1625,7 @@ static void MapSetIndexedBuffer(
|
|||
/// @brief initializes the buffer module
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_InitV8Buffer(v8::Isolate* isolate, v8::Handle<v8::Context> context) {
|
||||
void TRI_InitV8Buffer(v8::Isolate* isolate) {
|
||||
v8::HandleScope scope(isolate);
|
||||
|
||||
// sanity checks
|
||||
|
|
|
@ -292,4 +292,4 @@ class V8Buffer : public V8Wrapper<V8Buffer, TRI_V8_BUFFER_CID> {
|
|||
/// @brief initializes the buffer module
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_InitV8Buffer(v8::Isolate* isolate, v8::Handle<v8::Context> context);
|
||||
void TRI_InitV8Buffer(v8::Isolate* isolate);
|
||||
|
|
|
@ -239,7 +239,7 @@ static void JS_ProcessJsonFile(
|
|||
// extract the filename
|
||||
TRI_Utf8ValueNFC filename(args[0]);
|
||||
|
||||
if (*filename == 0) {
|
||||
if (*filename == nullptr) {
|
||||
TRI_V8_THROW_TYPE_ERROR("<filename> must be an UTF8 filename");
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,7 @@ static void JS_ProcessJsonFile(
|
|||
/// @brief stores the V8 shell functions inside the global variable
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_InitV8Shell(v8::Isolate* isolate, v8::Handle<v8::Context> context) {
|
||||
void TRI_InitV8Shell(v8::Isolate* isolate) {
|
||||
v8::HandleScope scope(isolate);
|
||||
|
||||
// .............................................................................
|
||||
|
|
|
@ -32,6 +32,6 @@
|
|||
/// @brief stores the V8 shell function inside the global variable
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_InitV8Shell(v8::Isolate* isolate, v8::Handle<v8::Context> context);
|
||||
void TRI_InitV8Shell(v8::Isolate* isolate);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3016,13 +3016,13 @@ static void JS_Sha512(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
std::string key = TRI_ObjectToString(isolate, args[0]);
|
||||
|
||||
// create sha512
|
||||
char* hash = 0;
|
||||
char* hash = nullptr;
|
||||
size_t hashLen;
|
||||
|
||||
SslInterface::sslSHA512(key.c_str(), key.size(), hash, hashLen);
|
||||
|
||||
// as hex
|
||||
char* hex = 0;
|
||||
char* hex = nullptr;
|
||||
size_t hexLen;
|
||||
|
||||
SslInterface::sslHEX(hash, hashLen, hex, hexLen);
|
||||
|
@ -3058,13 +3058,13 @@ static void JS_Sha384(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
std::string key = TRI_ObjectToString(isolate, args[0]);
|
||||
|
||||
// create sha384
|
||||
char* hash = 0;
|
||||
char* hash = nullptr;
|
||||
size_t hashLen;
|
||||
|
||||
SslInterface::sslSHA384(key.c_str(), key.size(), hash, hashLen);
|
||||
|
||||
// as hex
|
||||
char* hex = 0;
|
||||
char* hex = nullptr;
|
||||
size_t hexLen;
|
||||
|
||||
SslInterface::sslHEX(hash, hashLen, hex, hexLen);
|
||||
|
@ -3100,13 +3100,13 @@ static void JS_Sha256(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
std::string key = TRI_ObjectToString(isolate, args[0]);
|
||||
|
||||
// create sha256
|
||||
char* hash = 0;
|
||||
char* hash = nullptr;
|
||||
size_t hashLen;
|
||||
|
||||
SslInterface::sslSHA256(key.c_str(), key.size(), hash, hashLen);
|
||||
|
||||
// as hex
|
||||
char* hex = 0;
|
||||
char* hex = nullptr;
|
||||
size_t hexLen;
|
||||
|
||||
SslInterface::sslHEX(hash, hashLen, hex, hexLen);
|
||||
|
@ -3142,13 +3142,13 @@ static void JS_Sha224(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
std::string key = TRI_ObjectToString(isolate, args[0]);
|
||||
|
||||
// create sha224
|
||||
char* hash = 0;
|
||||
char* hash = nullptr;
|
||||
size_t hashLen;
|
||||
|
||||
SslInterface::sslSHA224(key.c_str(), key.size(), hash, hashLen);
|
||||
|
||||
// as hex
|
||||
char* hex = 0;
|
||||
char* hex = nullptr;
|
||||
size_t hexLen;
|
||||
|
||||
SslInterface::sslHEX(hash, hashLen, hex, hexLen);
|
||||
|
@ -3184,13 +3184,13 @@ static void JS_Sha1(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
std::string key = TRI_ObjectToString(isolate, args[0]);
|
||||
|
||||
// create sha1
|
||||
char* hash = 0;
|
||||
char* hash = nullptr;
|
||||
size_t hashLen;
|
||||
|
||||
SslInterface::sslSHA1(key.c_str(), key.size(), hash, hashLen);
|
||||
|
||||
// as hex
|
||||
char* hex = 0;
|
||||
char* hex = nullptr;
|
||||
size_t hexLen;
|
||||
|
||||
SslInterface::sslHEX(hash, hashLen, hex, hexLen);
|
||||
|
|
|
@ -133,7 +133,7 @@ SECTION("tst_init") {
|
|||
SECTION("tst_insert_few") {
|
||||
INIT_MULTI
|
||||
|
||||
void* r = 0;
|
||||
void* r = nullptr;
|
||||
|
||||
ELEMENT(e1, 1, 123);
|
||||
CHECK(r == a1.insert(nullptr, &e1, true, false));
|
||||
|
@ -157,7 +157,7 @@ SECTION("tst_insert_delete_many") {
|
|||
ELEMENT(e, 0, 0);
|
||||
vector<data_container_t*> v;
|
||||
|
||||
data_container_t* n = 0;
|
||||
data_container_t* n = nullptr;
|
||||
data_container_t* p;
|
||||
data_container_t* one_more;
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ SECTION("tst_init") {
|
|||
SECTION("tst_insert_few") {
|
||||
INIT_MULTI
|
||||
|
||||
void* r = 0;
|
||||
void* r = nullptr;
|
||||
|
||||
ELEMENT(e1, 1, 123);
|
||||
CHECK(r == a1.insert(nullptr, &e1, true, false));
|
||||
|
@ -157,7 +157,7 @@ SECTION("tst_insert_delete_many") {
|
|||
ELEMENT(e, 0, 0);
|
||||
vector<data_container_t*> v;
|
||||
|
||||
data_container_t* n = 0;
|
||||
data_container_t* n = nullptr;
|
||||
data_container_t* p;
|
||||
data_container_t* one_more;
|
||||
|
||||
|
|
|
@ -97,11 +97,11 @@ SECTION("tst_unique_forward") {
|
|||
arangodb::MMFilesSkiplist<void, void> skiplist(CmpElmElm, CmpKeyElm, FreeElm, true, false);
|
||||
|
||||
// check start node
|
||||
CHECK((void*) 0 == skiplist.startNode()->nextNode());
|
||||
CHECK((void*) 0 == skiplist.startNode()->prevNode());
|
||||
CHECK((void*) nullptr == skiplist.startNode()->nextNode());
|
||||
CHECK((void*) nullptr == skiplist.startNode()->prevNode());
|
||||
|
||||
// check end node
|
||||
CHECK((void*) 0 == skiplist.endNode());
|
||||
CHECK((void*) nullptr == skiplist.endNode());
|
||||
|
||||
CHECK(0 == (int) skiplist.getNrUsed());
|
||||
|
||||
|
@ -119,11 +119,11 @@ SECTION("tst_unique_forward") {
|
|||
CHECK(100 == (int) skiplist.getNrUsed());
|
||||
|
||||
// check start node
|
||||
CHECK((void*) 0 == skiplist.startNode()->prevNode());
|
||||
CHECK((void*) nullptr == skiplist.startNode()->prevNode());
|
||||
CHECK(values[0] == skiplist.startNode()->nextNode()->document());
|
||||
|
||||
// check end node
|
||||
CHECK((void*) 0 == skiplist.endNode());
|
||||
CHECK((void*) nullptr == skiplist.endNode());
|
||||
|
||||
arangodb::MMFilesSkiplistNode<void, void>* current;
|
||||
|
||||
|
@ -177,11 +177,11 @@ SECTION("tst_unique_reverse") {
|
|||
arangodb::MMFilesSkiplist<void, void> skiplist(CmpElmElm, CmpKeyElm, FreeElm, true, false);
|
||||
|
||||
// check start node
|
||||
CHECK((void*) 0 == skiplist.startNode()->nextNode());
|
||||
CHECK((void*) 0 == skiplist.startNode()->prevNode());
|
||||
CHECK((void*) nullptr == skiplist.startNode()->nextNode());
|
||||
CHECK((void*) nullptr == skiplist.startNode()->prevNode());
|
||||
|
||||
// check end node
|
||||
CHECK((void*) 0 == skiplist.endNode());
|
||||
CHECK((void*) nullptr == skiplist.endNode());
|
||||
|
||||
CHECK(0 == (int) skiplist.getNrUsed());
|
||||
|
||||
|
@ -199,11 +199,11 @@ SECTION("tst_unique_reverse") {
|
|||
CHECK(100 == (int) skiplist.getNrUsed());
|
||||
|
||||
// check start node
|
||||
CHECK((void*) 0 == skiplist.startNode()->prevNode());
|
||||
CHECK((void*) nullptr == skiplist.startNode()->prevNode());
|
||||
CHECK(values[0] == skiplist.startNode()->nextNode()->document());
|
||||
|
||||
// check end node
|
||||
CHECK((void*) 0 == skiplist.endNode());
|
||||
CHECK((void*) nullptr == skiplist.endNode());
|
||||
|
||||
arangodb::MMFilesSkiplistNode<void, void>* current;
|
||||
|
||||
|
@ -275,16 +275,16 @@ SECTION("tst_unique_lookup") {
|
|||
int value;
|
||||
|
||||
value = -1;
|
||||
CHECK((void*) 0 == skiplist.lookup(nullptr, &value));
|
||||
CHECK((void*) nullptr == skiplist.lookup(nullptr, &value));
|
||||
|
||||
value = 100;
|
||||
CHECK((void*) 0 == skiplist.lookup(nullptr, &value));
|
||||
CHECK((void*) nullptr == skiplist.lookup(nullptr, &value));
|
||||
|
||||
value = 101;
|
||||
CHECK((void*) 0 == skiplist.lookup(nullptr, &value));
|
||||
CHECK((void*) nullptr == skiplist.lookup(nullptr, &value));
|
||||
|
||||
value = 1000;
|
||||
CHECK((void*) 0 == skiplist.lookup(nullptr, &value));
|
||||
CHECK((void*) nullptr == skiplist.lookup(nullptr, &value));
|
||||
|
||||
// clean up
|
||||
for (auto i : values) {
|
||||
|
@ -335,10 +335,10 @@ SECTION("tst_unique_remove") {
|
|||
|
||||
// check start node
|
||||
CHECK(values[2] == skiplist.startNode()->nextNode()->document());
|
||||
CHECK((void*) 0 == skiplist.startNode()->prevNode());
|
||||
CHECK((void*) nullptr == skiplist.startNode()->prevNode());
|
||||
|
||||
// check end node
|
||||
CHECK((void*) 0 == skiplist.endNode());
|
||||
CHECK((void*) nullptr == skiplist.endNode());
|
||||
|
||||
CHECK(93 == (int) skiplist.getNrUsed());
|
||||
|
||||
|
@ -373,23 +373,23 @@ SECTION("tst_unique_remove") {
|
|||
|
||||
CHECK(values[97] == skiplist.lookup(nullptr, values[97])->document());
|
||||
CHECK(values[96] == skiplist.lookup(nullptr, values[97])->prevNode()->document());
|
||||
CHECK((void*) 0 == skiplist.lookup(nullptr, values[97])->nextNode());
|
||||
CHECK((void*) nullptr == skiplist.lookup(nullptr, values[97])->nextNode());
|
||||
|
||||
// lookup non-existing values
|
||||
value = 0;
|
||||
CHECK((void*) 0 == skiplist.lookup(nullptr, &value));
|
||||
CHECK((void*) nullptr == skiplist.lookup(nullptr, &value));
|
||||
value = 1;
|
||||
CHECK((void*) 0 == skiplist.lookup(nullptr, &value));
|
||||
CHECK((void*) nullptr == skiplist.lookup(nullptr, &value));
|
||||
value = 7;
|
||||
CHECK((void*) 0 == skiplist.lookup(nullptr, &value));
|
||||
CHECK((void*) nullptr == skiplist.lookup(nullptr, &value));
|
||||
value = 12;
|
||||
CHECK((void*) 0 == skiplist.lookup(nullptr, &value));
|
||||
CHECK((void*) nullptr == skiplist.lookup(nullptr, &value));
|
||||
value = 23;
|
||||
CHECK((void*) 0 == skiplist.lookup(nullptr, &value));
|
||||
CHECK((void*) nullptr == skiplist.lookup(nullptr, &value));
|
||||
value = 98;
|
||||
CHECK((void*) 0 == skiplist.lookup(nullptr, &value));
|
||||
CHECK((void*) nullptr == skiplist.lookup(nullptr, &value));
|
||||
value = 99;
|
||||
CHECK((void*) 0 == skiplist.lookup(nullptr, &value));
|
||||
CHECK((void*) nullptr == skiplist.lookup(nullptr, &value));
|
||||
|
||||
// clean up
|
||||
for (auto i : values) {
|
||||
|
@ -423,18 +423,18 @@ SECTION("tst_unique_remove_all") {
|
|||
}
|
||||
|
||||
// check start node
|
||||
CHECK((void*) 0 == skiplist.startNode()->nextNode());
|
||||
CHECK((void*) 0 == skiplist.startNode()->prevNode());
|
||||
CHECK((void*) nullptr == skiplist.startNode()->nextNode());
|
||||
CHECK((void*) nullptr == skiplist.startNode()->prevNode());
|
||||
|
||||
// check end node
|
||||
CHECK((void*) 0 == skiplist.endNode());
|
||||
CHECK((void*) nullptr == skiplist.endNode());
|
||||
|
||||
CHECK(0 == (int) skiplist.getNrUsed());
|
||||
|
||||
// lookup non-existing values
|
||||
CHECK((void*) 0 == skiplist.lookup(nullptr, values[0]));
|
||||
CHECK((void*) 0 == skiplist.lookup(nullptr, values[12]));
|
||||
CHECK((void*) 0 == skiplist.lookup(nullptr, values[99]));
|
||||
CHECK((void*) nullptr == skiplist.lookup(nullptr, values[0]));
|
||||
CHECK((void*) nullptr == skiplist.lookup(nullptr, values[12]));
|
||||
CHECK((void*) nullptr == skiplist.lookup(nullptr, values[99]));
|
||||
|
||||
// clean up
|
||||
for (auto i : values) {
|
||||
|
|
|
@ -473,7 +473,7 @@ SECTION("tst_steal") {
|
|||
|
||||
// buffer is now empty
|
||||
CHECK((0UL) == TRI_LengthStringBuffer(&sb));
|
||||
CHECK(((void*) 0) == (void*) TRI_BeginStringBuffer(&sb));
|
||||
CHECK(((void*) nullptr) == (void*) TRI_BeginStringBuffer(&sb));
|
||||
|
||||
// stolen should still point to ptr
|
||||
CHECK(((void*) stolen) == (void*) ptr);
|
||||
|
|
|
@ -167,7 +167,7 @@ SECTION("tst_remove_invalid2") {
|
|||
SECTION("tst_at_empty") {
|
||||
VECTOR_INIT
|
||||
|
||||
void* r = 0;
|
||||
void* r = nullptr;
|
||||
|
||||
CHECK(r == TRI_AtVector(&v1, 0));
|
||||
CHECK(r == TRI_AtVector(&v1, 1));
|
||||
|
@ -217,7 +217,7 @@ SECTION("tst_at_insert") {
|
|||
SECTION("tst_at_insert_remove") {
|
||||
VECTOR_INIT
|
||||
|
||||
void* r = 0;
|
||||
void* r = nullptr;
|
||||
int a = 1;
|
||||
int b = 2;
|
||||
int c = 3;
|
||||
|
|
Loading…
Reference in New Issue