Fix -Wmissing-field-initializers
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
EXAMPLE_FILES := HelloWorld ServerName EchoServer BroadcastingEchoServer UpgradeSync UpgradeAsync
|
||||
THREADED_EXAMPLE_FILES := HelloWorldThreaded EchoServerThreaded
|
||||
override CXXFLAGS += -lpthread -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -std=c++17 -Isrc -IuSockets/src
|
||||
override CXXFLAGS += -lpthread -Wextra -Wno-unused-parameter -std=c++17 -Isrc -IuSockets/src
|
||||
override LDFLAGS += uSockets/*.o -lz
|
||||
|
||||
DESTDIR ?=
|
||||
|
||||
+3
-1
@@ -61,6 +61,8 @@ private:
|
||||
std::vector<std::unique_ptr<Node>> children;
|
||||
std::vector<uint32_t> handlers;
|
||||
bool isHighPriority;
|
||||
|
||||
Node(std::string name) : name(name) {}
|
||||
} root = {"rootNode"};
|
||||
|
||||
/* Advance from parent to child, adding child if necessary */
|
||||
@@ -72,7 +74,7 @@ private:
|
||||
}
|
||||
|
||||
/* Insert sorted, but keep order if parent is root (we sort methods by priority elsewhere) */
|
||||
std::unique_ptr<Node> newNode(new Node({child}));
|
||||
std::unique_ptr<Node> newNode(new Node(child));
|
||||
newNode->isHighPriority = isHighPriority;
|
||||
return parent->children.emplace(std::upper_bound(parent->children.begin(), parent->children.end(), newNode, [parent, this](auto &a, auto &b) {
|
||||
|
||||
|
||||
@@ -160,14 +160,14 @@ struct CloseFrame {
|
||||
|
||||
static inline CloseFrame parseClosePayload(char *src, size_t length) {
|
||||
/* If we get no code or message, default to reporting 1005 no status code present */
|
||||
CloseFrame cf = {1005};
|
||||
CloseFrame cf = {1005, nullptr, 0};
|
||||
if (length >= 2) {
|
||||
memcpy(&cf.code, src, 2);
|
||||
cf = {cond_byte_swap<uint16_t>(cf.code), src + 2, length - 2};
|
||||
if (cf.code < 1000 || cf.code > 4999 || (cf.code > 1011 && cf.code < 4000) ||
|
||||
(cf.code >= 1004 && cf.code <= 1006) || !isValidUtf8((unsigned char *) cf.message, cf.length)) {
|
||||
/* Even though we got a WebSocket close frame, it in itself is abnormal */
|
||||
return {1006};
|
||||
return {1006, nullptr, 0};
|
||||
}
|
||||
}
|
||||
return cf;
|
||||
|
||||
Reference in New Issue
Block a user