8000 attempt to fix clang build · georgekaf/arangodb@f7b8195 · GitHub
[go: up one dir, main page]

Skip to content

Commit f7b8195

Browse files
committed
attempt to fix clang build
1 parent d20444d commit f7b8195

File tree

7 files changed

+45
-43
lines changed

7 files changed

+45
-43
lines changed

3rdParty/velocypack/include/velocypack/HexDump.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ struct HexDump {
5050

5151
static std::string toHex(uint8_t value);
5252

53+
friend std::ostream& operator<<(std::ostream&, HexDump const&);
54+
5355
Slice const slice;
5456
int valuesPerLine;
5557
std::string separator;
@@ -58,8 +60,4 @@ struct HexDump {
5860
} // namespace arangodb::velocypack
5961
} // namespace arangodb
6062

61-
std::ostream& operator<<(std::ostream&, arangodb::velocypack::HexDump const*);
62-
63-
std::ostream& operator<<(std::ostream&, arangodb::velocypack::HexDump const&);
64-
6563
#endif

3rdParty/velocypack/src/HexDump.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,17 @@ std::string HexDump::toHex(uint8_t value) {
4242
return result;
4343
}
4444

45-
std::ostream& operator<<(std::ostream& stream, HexDump const* hexdump) {
45+
namespace arangodb {
46+
namespace velocypack {
47+
48+
std::ostream& operator<<(std::ostream& stream, HexDump const& hexdump) {
4649
int current = 0;
4750

48-
for (uint8_t it : hexdump->slice) {
51+
for (uint8_t it : hexdump.slice) {
4952
if (current != 0) {
50-
stream << hexdump->separator;
53+
stream << hexdump.separator;
5154

52-
if (hexdump->valuesPerLine > 0 && current == hexdump->valuesPerLine) {
55+
if (hexdump.valuesPerLine > 0 && current == hexdump.valuesPerLine) {
5356
stream << std::endl;
5457
current = 0;
5558
}
@@ -62,6 +65,5 @@ std::ostream& operator<<(std::ostream& stream, HexDump const* hexdump) {
6265
return stream;
6366
}
6467

65-
std::ostream& operator<<(std::ostream& stream, HexDump const& hexdump) {
66-
return operator<<(stream, &hexdump);
68+
}
6769
}

arangod/GeneralServer/VppCommTask.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <limits>
2828
#include <stdexcept>
2929

30+
#include <velocypack/HexDump.h>
3031
#include <velocypack/velocypack-aliases.h>
3132

3233
#include <boost/optional.hpp>
@@ -52,6 +53,38 @@ using namespace arangodb;
5253
using namespace arangodb::basics;
5354
using namespace arangodb::rest;
5455

56+
inline std::size_t validateAndCount(char const* vpStart,
57+
char const* vpEnd) {
58+
VPackOptions validationOptions = VPackOptions::Defaults;
59+
validationOptions.validateUtf8Strings = true;
60+
VPackValidator validator(&validationOptions);
61+
62+
std::size_t numPayloads = 0;
63+
64+
try {
65+
// check for slice start to the end of Chunk
66+
// isSubPart allows the slice to be shorter than the checked buffer.
67+
do {
68+
validator.validate(vpStart, std::distance(vpStart, vpEnd),
69+
/*isSubPart =*/true);
70+
71+
// get offset to next
72+
VPackSlice tmp(vpStart);
73+
vpStart += tmp.byteSize();
74+
numPayloads++;
75+
} while (vpStart != vpEnd);
76+
return numPayloads - 1;
77+
} catch (std::exception const& e) {
78+
VPackSlice slice(vpStart);
79+
VPackHexDump dump(slice);
80+
LOG_TOPIC(DEBUG, Logger::COMMUNICATION)
81+
<< "len: " << std::distance(vpStart, vpEnd) << " - " << dump ;
82+
throw std::runtime_error(
83+
std::string("error during validation of incoming VPack: ") + e.what());
84+
}
85+
}
86+
87+
5588
VppCommTask::VppCommTask(EventLoop loop, GeneralServer* server,
5689
std::unique_ptr<Socket> socket, ConnectionInfo&& info,
5790
double timeout, bool skipInit)

arangod/GeneralServer/VppNetwork.h

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,45 +31,13 @@
3131
#include <velocypack/Options.h>
3232
#include <velocypack/Slice.h>
3333
#include <velocypack/Validator.h>
34-
#include <velocypack/HexDump.h>
3534
#include <velocypack/velocypack-aliases.h>
3635

3736
#include <memory>
3837
#include <stdexcept>
3938

4039
namespace arangodb {
4140

42-
inline std::size_t validateAndCount(char const* vpStart,
43-
char const* vpEnd) {
44-
VPackOptions validationOptions = VPackOptions::Defaults;
45-
validationOptions.validateUtf8Strings = true;
46-
VPackValidator validator(&validationOptions);
47-
48-
std::size_t numPayloads = 0;
49-
50-
try {
51-
// check for slice start to the end of Chunk
52-
// isSubPart allows the slice to be shorter than the checked buffer.
53-
do {
54-
validator.validate(vpStart, std::distance(vpStart, vpEnd),
55-
/*isSubPart =*/true);
56-
57-
// get offset to next
58-
VPackSlice tmp(vpStart);
59-
vpStart += tmp.byteSize();
60-
numPayloads++;
61-
} while (vpStart != vpEnd);
62-
return numPayloads - 1;
63-
} catch (std::exception const& e) {
64-
VPackSlice slice(vpStart);
65-
VPackHexDump dump(slice);
66-
LOG_TOPIC(DEBUG, Logger::COMMUNICATION)
67-
<< "len: " << std::distance(vpStart, vpEnd) << " - " << dump ;
68-
throw std::runtime_error(
69-
std::string("error during validation of incoming VPack: ") + e.what());
70-
}
71-
}
72-
7341
template <typename T>
7442
std::size_t appendToBuffer(basics::StringBuffer* buffer, T& value) {
7543
constexpr std::size_t len = sizeof(T);

lib/Basics/StringBuffer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
#include "Basics/Common.h"
2828
#include "Basics/Exceptions.h"
29-
#include "Logger/Logger.h"
3029
#include "Zip/zip.h"
3130

3231
#include <sstream>

lib/Rest/GeneralResponse.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "Basics/StringUtils.h"
3232
#include "GeneralRequest.h"
3333
#include "Endpoint/Endpoint.h"
34+
#include "Logger/Logger.h"
3435
#include "Rest/CommonDefines.h"
3536

3637
namespace arangodb {

lib/SimpleHttpClient/SslClientConnection.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include <openssl/ssl.h>
3636
#include <openssl/err.h>
3737
#include "Basics/socket-utils.h"
38+
#include "Logger/Logger.h"
3839
#include "Ssl/ssl-helper.h"
3940

4041
#undef TRACE_SSL_CONNECTIONS

0 commit comments

Comments
 (0)
0