mirror of https://gitee.com/bigwinds/arangodb
attempt to fix clang build
This commit is contained in:
parent
d20444d183
commit
f7b819579d
|
@ -50,6 +50,8 @@ struct HexDump {
|
||||||
|
|
||||||
static std::string toHex(uint8_t value);
|
static std::string toHex(uint8_t value);
|
||||||
|
|
||||||
|
friend std::ostream& operator<<(std::ostream&, HexDump const&);
|
||||||
|
|
||||||
Slice const slice;
|
Slice const slice;
|
||||||
int valuesPerLine;
|
int valuesPerLine;
|
||||||
std::string separator;
|
std::string separator;
|
||||||
|
@ -58,8 +60,4 @@ struct HexDump {
|
||||||
} // namespace arangodb::velocypack
|
} // namespace arangodb::velocypack
|
||||||
} // namespace arangodb
|
} // namespace arangodb
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream&, arangodb::velocypack::HexDump const*);
|
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream&, arangodb::velocypack::HexDump const&);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -42,14 +42,17 @@ std::string HexDump::toHex(uint8_t value) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& stream, HexDump const* hexdump) {
|
namespace arangodb {
|
||||||
|
namespace velocypack {
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream& stream, HexDump const& hexdump) {
|
||||||
int current = 0;
|
int current = 0;
|
||||||
|
|
||||||
for (uint8_t it : hexdump->slice) {
|
for (uint8_t it : hexdump.slice) {
|
||||||
if (current != 0) {
|
if (current != 0) {
|
||||||
stream << hexdump->separator;
|
stream << hexdump.separator;
|
||||||
|
|
||||||
if (hexdump->valuesPerLine > 0 && current == hexdump->valuesPerLine) {
|
if (hexdump.valuesPerLine > 0 && current == hexdump.valuesPerLine) {
|
||||||
stream << std::endl;
|
stream << std::endl;
|
||||||
current = 0;
|
current = 0;
|
||||||
}
|
}
|
||||||
|
@ -62,6 +65,5 @@ std::ostream& operator<<(std::ostream& stream, HexDump const* hexdump) {
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& stream, HexDump const& hexdump) {
|
}
|
||||||
return operator<<(stream, &hexdump);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#include <velocypack/HexDump.h>
|
||||||
#include <velocypack/velocypack-aliases.h>
|
#include <velocypack/velocypack-aliases.h>
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
|
@ -52,6 +53,38 @@ using namespace arangodb;
|
||||||
using namespace arangodb::basics;
|
using namespace arangodb::basics;
|
||||||
using namespace arangodb::rest;
|
using namespace arangodb::rest;
|
||||||
|
|
||||||
|
inline std::size_t validateAndCount(char const* vpStart,
|
||||||
|
char const* vpEnd) {
|
||||||
|
VPackOptions validationOptions = VPackOptions::Defaults;
|
||||||
|
validationOptions.validateUtf8Strings = true;
|
||||||
|
VPackValidator validator(&validationOptions);
|
||||||
|
|
||||||
|
std::size_t numPayloads = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// check for slice start to the end of Chunk
|
||||||
|
// isSubPart allows the slice to be shorter than the checked buffer.
|
||||||
|
do {
|
||||||
|
validator.validate(vpStart, std::distance(vpStart, vpEnd),
|
||||||
|
/*isSubPart =*/true);
|
||||||
|
|
||||||
|
// get offset to next
|
||||||
|
VPackSlice tmp(vpStart);
|
||||||
|
vpStart += tmp.byteSize();
|
||||||
|
numPayloads++;
|
||||||
|
} while (vpStart != vpEnd);
|
||||||
|
return numPayloads - 1;
|
||||||
|
} catch (std::exception const& e) {
|
||||||
|
VPackSlice slice(vpStart);
|
||||||
|
VPackHexDump dump(slice);
|
||||||
|
LOG_TOPIC(DEBUG, Logger::COMMUNICATION)
|
||||||
|
<< "len: " << std::distance(vpStart, vpEnd) << " - " << dump ;
|
||||||
|
throw std::runtime_error(
|
||||||
|
std::string("error during validation of incoming VPack: ") + e.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
VppCommTask::VppCommTask(EventLoop loop, GeneralServer* server,
|
VppCommTask::VppCommTask(EventLoop loop, GeneralServer* server,
|
||||||
std::unique_ptr<Socket> socket, ConnectionInfo&& info,
|
std::unique_ptr<Socket> socket, ConnectionInfo&& info,
|
||||||
double timeout, bool skipInit)
|
double timeout, bool skipInit)
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include <velocypack/Options.h>
|
#include <velocypack/Options.h>
|
||||||
#include <velocypack/Slice.h>
|
#include <velocypack/Slice.h>
|
||||||
#include <velocypack/Validator.h>
|
#include <velocypack/Validator.h>
|
||||||
#include <velocypack/HexDump.h>
|
|
||||||
#include <velocypack/velocypack-aliases.h>
|
#include <velocypack/velocypack-aliases.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -39,37 +38,6 @@
|
||||||
|
|
||||||
namespace arangodb {
|
namespace arangodb {
|
||||||
|
|
||||||
inline std::size_t validateAndCount(char const* vpStart,
|
|
||||||
char const* vpEnd) {
|
|
||||||
VPackOptions validationOptions = VPackOptions::Defaults;
|
|
||||||
validationOptions.validateUtf8Strings = true;
|
|
||||||
VPackValidator validator(&validationOptions);
|
|
||||||
|
|
||||||
std::size_t numPayloads = 0;
|
|
||||||
|
|
||||||
try {
|
|
||||||
// check for slice start to the end of Chunk
|
|
||||||
// isSubPart allows the slice to be shorter than the checked buffer.
|
|
||||||
do {
|
|
||||||
validator.validate(vpStart, std::distance(vpStart, vpEnd),
|
|
||||||
/*isSubPart =*/true);
|
|
||||||
|
|
||||||
// get offset to next
|
|
||||||
VPackSlice tmp(vpStart);
|
|
||||||
vpStart += tmp.byteSize();
|
|
||||||
numPayloads++;
|
|
||||||
} while (vpStart != vpEnd);
|
|
||||||
return numPayloads - 1;
|
|
||||||
} catch (std::exception const& e) {
|
|
||||||
VPackSlice slice(vpStart);
|
|
||||||
VPackHexDump dump(slice);
|
|
||||||
LOG_TOPIC(DEBUG, Logger::COMMUNICATION)
|
|
||||||
<< "len: " << std::distance(vpStart, vpEnd) << " - " << dump ;
|
|
||||||
throw std::runtime_error(
|
|
||||||
std::string("error during validation of incoming VPack: ") + e.what());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::size_t appendToBuffer(basics::StringBuffer* buffer, T& value) {
|
std::size_t appendToBuffer(basics::StringBuffer* buffer, T& value) {
|
||||||
constexpr std::size_t len = sizeof(T);
|
constexpr std::size_t len = sizeof(T);
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
#include "Basics/Common.h"
|
#include "Basics/Common.h"
|
||||||
#include "Basics/Exceptions.h"
|
#include "Basics/Exceptions.h"
|
||||||
#include "Logger/Logger.h"
|
|
||||||
#include "Zip/zip.h"
|
#include "Zip/zip.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "Basics/StringUtils.h"
|
#include "Basics/StringUtils.h"
|
||||||
#include "GeneralRequest.h"
|
#include "GeneralRequest.h"
|
||||||
#include "Endpoint/Endpoint.h"
|
#include "Endpoint/Endpoint.h"
|
||||||
|
#include "Logger/Logger.h"
|
||||||
#include "Rest/CommonDefines.h"
|
#include "Rest/CommonDefines.h"
|
||||||
|
|
||||||
namespace arangodb {
|
namespace arangodb {
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#include "Basics/socket-utils.h"
|
#include "Basics/socket-utils.h"
|
||||||
|
#include "Logger/Logger.h"
|
||||||
#include "Ssl/ssl-helper.h"
|
#include "Ssl/ssl-helper.h"
|
||||||
|
|
||||||
#undef TRACE_SSL_CONNECTIONS
|
#undef TRACE_SSL_CONNECTIONS
|
||||||
|
|
Loading…
Reference in New Issue