fix ompile warnings

This commit is contained in:
Bartosz Wieczorek 2025-10-06 18:12:28 +02:00
parent a20a58a495
commit f3be74cfda
4 changed files with 16 additions and 79 deletions

View File

@ -122,16 +122,15 @@ endif()
FetchContent_Declare( FetchContent_Declare(
libwebsockets libwebsockets
URL https://github.com/warmcat/libwebsockets/archive/refs/tags/v4.3.3.zip URL https://github.com/warmcat/libwebsockets/archive/refs/tags/v4.3.6.zip
URL_HASH MD5=96ad80a3283825a9af6a2d9d1acbd132 URL_HASH MD5=1b57fde90182c8fea21a9f96df0b53eb
) )
FetchContent_MakeAvailable(libwebsockets) FetchContent_MakeAvailable(libwebsockets)
FetchContent_Declare( FetchContent_Declare(
RapidJSON RapidJSON
URL https://github.com/Tencent/rapidjson/archive/refs/tags/v1.1.0.zip URL https://github.com/jcelerier/rapidjson/archive/refs/tags/v1.2.1.zip
URL_HASH MD5=ceb1cf16e693a3170c173dc040a9d2bd URL_HASH MD5=54d53169cbd2c290076677627779636d
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_LIST_DIR}/patches/rapidjson.patch
) )
if(NOT RapidJSON_POPULATED) if(NOT RapidJSON_POPULATED)

View File

@ -77,17 +77,17 @@ class StaticString : public details::StaticStringBase {
return N - 1; return N - 1;
} }
StaticString< N > & operator+=(const char * rhs) { // StaticString< N > & operator+=(const char * rhs) {
auto remaining = capacity() - _size; // auto remaining = capacity() - _size;
auto rhs_len = std::strlen(rhs); // auto rhs_len = std::strlen(rhs);
auto copy_len = std::min(rhs_len, remaining); // auto copy_len = std::min(rhs_len, remaining);
std::strncpy(data() + _size, rhs, copy_len); // std::strncpy(data() + _size, rhs, copy_len);
_size += copy_len; // _size += copy_len;
data()[_size] = '\0'; // null // data()[_size] = '\0'; // null
return *this; // return *this;
} // }
template < std::size_t M > template < std::size_t M >
friend class StaticString; friend class StaticString;

View File

@ -127,7 +127,9 @@ class WebSocket {
} }
bool attachToTransactionConfirmationChannel(std::string_view transaction_id) { bool attachToTransactionConfirmationChannel(std::string_view transaction_id) {
StaticString< 128 > subscribe_message{}; memory::MonotonicStackResource<128> mr;
std::pmr::string subscribe_message{&mr};
subscribe_message.reserve(128);
unsigned char buf[128 + LWS_PRE] = {}; unsigned char buf[128 + LWS_PRE] = {};
subscribe_message += R"msg(42["subscribe",{"channel":"transactionConfirmation.)msg"; subscribe_message += R"msg(42["subscribe",{"channel":"transactionConfirmation.)msg";

View File

@ -1,64 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ceda71b..0128f99 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,6 +9,7 @@ endif()
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules)
+cmake_policy(SET CMP0048 NEW)
PROJECT(RapidJSON CXX)
set(LIB_MAJOR_VERSION "1")
diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h
index e3e20dfb..592c5678 100644
--- a/include/rapidjson/document.h
+++ b/include/rapidjson/document.h
@@ -97,17 +97,20 @@ struct GenericMember {
\see GenericMember, GenericValue::MemberIterator, GenericValue::ConstMemberIterator
*/
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
template <bool Const, typename Encoding, typename Allocator>
class GenericMemberIterator
: public std::iterator<std::random_access_iterator_tag
, typename internal::MaybeAddConst<Const,GenericMember<Encoding,Allocator> >::Type> {
-
+
friend class GenericValue<Encoding,Allocator>;
template <bool, typename, typename> friend class GenericMemberIterator;
typedef GenericMember<Encoding,Allocator> PlainType;
typedef typename internal::MaybeAddConst<Const,PlainType>::Type ValueType;
typedef std::iterator<std::random_access_iterator_tag,ValueType> BaseType;
+#pragma GCC diagnostic pop
public:
//! Iterator type itself
@@ -1936,7 +1939,10 @@ private:
if (count) {
GenericValue* e = static_cast<GenericValue*>(allocator.Malloc(count * sizeof(GenericValue)));
SetElementsPointer(e);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wclass-memaccess"
std::memcpy(e, values, count * sizeof(GenericValue));
+#pragma GCC diagnostic pop
}
else
SetElementsPointer(0);
@@ -1949,7 +1955,10 @@ private:
if (count) {
Member* m = static_cast<Member*>(allocator.Malloc(count * sizeof(Member)));
SetMembersPointer(m);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wclass-memaccess"
std::memcpy(m, members, count * sizeof(Member));
+#pragma GCC diagnostic pop
}
else
SetMembersPointer(0);
diff --git a/package.json b/package.json
index 843463d7..cc6087a5 100644
Binary files a/package.json and b/package.json differ