Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development/json number type #1382

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
b6ab447
[JSONRPC] Non-happy day scenarios on JSONRPC should return an error i…
pwielders Jul 7, 2023
3de0fa9
[CONFORMANCE] Use the dedicated JSONRPC error code for incorrect pars…
pwielders Jul 7, 2023
39f83e6
[JSONRPC] Also rubbish after an opaque string should be considered info.
pwielders Jul 8, 2023
a9c1ba6
[JSON] Fixes in the JSON parsing to detect issues (added bogus data) …
pwielders Jul 9, 2023
bd15e04
[WEBSOCKET] Messages coming in over websockets could be corrupted as …
pwielders Jul 9, 2023
00df30a
Merge branch 'master' into development/NonHappyDayJSONRPC
MFransen69 Jul 10, 2023
521ebb8
[JSONRPC] Add to each and every JSONRPC register the possibility to c…
pwielders Jul 10, 2023
608670a
Merge branch 'master' into development/NonHappyDayJSONRPC
pwielders Jul 10, 2023
6518f2a
[Core/JSON] : Produce an error on non-escaped control characters.
msieben Jul 13, 2023
43fae4b
[FIXES] After testing several issues fixed.
pwielders Jul 13, 2023
a1a6dd5
[JSON] Final fix... Finally :-)
pwielders Jul 13, 2023
2976049
[CLOSE] Report on JSONRPC Notification on HTTP.
pwielders Jul 14, 2023
cb7c4b0
Merge branch 'development/NonHappyDayJSONRPC' into development/Unesca…
msieben Jul 14, 2023
5ed9d2a
[Core/JSON]: METROL-784.
msieben Jul 14, 2023
b9313f1
Merge branch 'master' into development/METROL-784
pwielders Jul 16, 2023
93948b3
Merge branch 'master' into development/METROL-784
pwielders Jul 17, 2023
7b6c753
Merge branch 'master' into development/METROL-784
pwielders Jul 17, 2023
5b1b5f5
[Core] : Improve NumberType<> JSON parsing.
msieben Jul 26, 2023
59eebb2
Merge branch 'master' into development/JSONNumberType
msieben Jul 26, 2023
779d191
[Core] : Amend '5b1b5f53efd7cc41408beee05e90ead57ca9bfe8'
msieben Jul 27, 2023
49a03b7
[Core] : Amend '779d1917295cf5b59cf5011f05b839b878e49a77'
msieben Jul 28, 2023
9611cc2
[Core]: Apply SFINEA on SIGNED and UNSIGNED NumberType<>::Convert(..)
msieben Jul 28, 2023
10066ce
[Core] : Distinghuish SIGNED and UNSIGNED in AddDigitToValue()
msieben Jul 28, 2023
c29b58d
[Tests/unit/core] : Introduce new JSON NumberType<> test set
msieben Jul 28, 2023
a0480fd
[Tests/unit/core] : Enable additional tests in JSON NumberType<> test…
msieben Jul 31, 2023
57cf0aa
Merge branch 'master' into development/JSONNumberType
pwielders Jul 31, 2023
1e1c641
Merge branch 'master' into development/JSONNumberType
pwielders Jul 31, 2023
5c07913
[Tests/unit/core] : Add tests to JSON NumberType<> test set
msieben Aug 1, 2023
b048a1a
[Tests/unit/core] : Enable 'test_jsonnumbertype.cpp' in build.
msieben Aug 1, 2023
d3a8ba3
Merge branch 'master' into development/JSONNumberType
msieben Aug 4, 2023
4b3b3a4
[Core / Tests/unit/core] : Add prefix and suffix 'whitespace' parsing…
msieben Aug 7, 2023
889bb77
[Core] : Add 'FALLTHROUGH's' to suppress compiler warnings.
msieben Aug 7, 2023
374a668
[Core / Tests/unit/core] : Improve character sequence termination JSO…
msieben Aug 8, 2023
070134d
[Core] : set 'SET' for valid input for NumberType<>
msieben Aug 8, 2023
6197488
[Core / Tests/unit/core] : Cherry-pick from 'development/JSONFloatType'
msieben Aug 8, 2023
06387ab
[Tests/unit/core] : Adequately use 'AllowChange' in 'NumberType<>' te…
msieben Aug 10, 2023
3bc35a2
[Core / Tests/unit/core] : Improve JSON parsing for NumberType<>
msieben Aug 11, 2023
7657343
[Core] : Improve NumberType<>'s Serialize
msieben Aug 15, 2023
b5fc3ca
Merge branch 'master' into development/JSONNumberType
pwielders Aug 16, 2023
cb9a4ea
Merge branch 'master' into development/JSONNumberType
pwielders Aug 16, 2023
7517976
[Core] : Move 'FALLTHROUGH' to 'Portability.h
msieben Aug 16, 2023
1165107
[Core] : Make 'AddDigitToValue' a NumberType<> member
msieben Aug 16, 2023
6c13b51
[Core] : Treat warnings as errors
msieben Aug 17, 2023
7c3490a
Merge branch 'master' into development/JSONNumberType
msieben Aug 18, 2023
3cee2e3
[Warnings] Adding pedantic warnings to the cmake project file, fixing…
VeithMetro Aug 24, 2023
080e0ce
Adding a pedantic warning macro to disable these types of warnings (#…
VeithMetro Aug 25, 2023
9d83277
[Core / Tests/unit/core] : Various fixes and workarounds highlighted …
msieben Sep 4, 2023
06c3c8d
[Core] : cherry-pick 'bebfcebd4ef2ae1662809b6a6a20257b3b101215' from …
msieben Sep 4, 2023
fa56197
[Tests/unit/core] : Amend '9d832779f5ec9ebd1829d65b6cfa080ebed2564c'
msieben Sep 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ string(REGEX REPLACE "\\-\\g$" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REGEX REPLACE "-D_FORTIFY_SOURCE=[0-3]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "-D_FORTIFY_SOURCE=[0-3]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror")

# make sure others can make use of the JSON creation tools as well!!!
configure_file( "${CMAKE_SOURCE_DIR}/cmake/project.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${NAMESPACE}.cmake"
Expand Down
4 changes: 2 additions & 2 deletions Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ endif()
if(ENABLE_STRICT_COMPILER_SETTINGS)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message(FATAL_ERROR "Compiling with Clang")
set(CMAKE_STRICT_COMPILER_SETTINGS "-Weverything -Wextra -Werror=return-type -Werror=array-bounds")
set(CMAKE_STRICT_COMPILER_SETTINGS "-Weverything -Wextra -Wpedantic -Werror")
set(CMAKE_STRICT_CXX_COMPILER_SETTINGS "${CMAKE_STRICT_COMPILER_SETTINGS} -Wnon-virtual-dtor")
elseif(${CMAKE_COMPILER_IS_GNUCXX})
message(STATUS "Compiling with GCC")
set(CMAKE_STRICT_COMPILER_SETTINGS "-Wall -Wextra -Werror=return-type -Werror=array-bounds")
set(CMAKE_STRICT_COMPILER_SETTINGS "-Wall -Wextra -Wpedantic -Werror")
set(CMAKE_STRICT_CXX_COMPILER_SETTINGS "${CMAKE_STRICT_COMPILER_SETTINGS} -Wnon-virtual-dtor")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
message(STATUS "Compiling with MS Visual Studio")
Expand Down
2 changes: 1 addition & 1 deletion Source/com/Communicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ namespace RPC {
#endif
// Definitions of static members
uint8_t Communicator::_softKillCheckWaitTime = 10;
uint8_t Communicator::_hardKillCheckWaitTime = 4;;
uint8_t Communicator::_hardKillCheckWaitTime = 4;

PUSH_WARNING(DISABLE_WARNING_THIS_IN_MEMBER_INITIALIZER_LIST)
Communicator::Communicator(const Core::NodeId& node, const string& proxyStubPath)
Expand Down
4 changes: 2 additions & 2 deletions Source/com/ConnectorType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ Core::ProxyType<RPC::IIPCServer> DefaultInvokeServer()
};
static Core::ProxyType<Engine> engine = Core::ProxyType<Engine>::Create();
return Core::ProxyType<RPC::IIPCServer>(engine);
};
}

Core::ProxyType<RPC::IIPCServer> WorkerPoolInvokeServer()
{
return (Core::ProxyType<RPC::IIPCServer>(Core::ProxyType<RPC::InvokeServer>::Create(&Core::IWorkerPool::Instance())));
};
}

ConnectorController::ConnectorController() : _controller(nullptr) {
}
Expand Down
487 changes: 304 additions & 183 deletions Source/core/JSON.h

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions Source/core/Portability.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@
#endif
#endif

#ifdef __WINDOWS__
#pragma system_header
#else
#pragma GCC system_header
#endif

#ifdef __WINDOWS__
#define DO_PRAGMA(x) __pragma(x)
Expand Down Expand Up @@ -180,6 +184,7 @@
#define DISABLE_WARNING_UNUSED_RESULT
#define DISABLE_WARNING_TYPE_LIMITS
#define DISABLE_WARNING_STRING_OPERATION_OVERREAD
#define DISABLE_WARNING_PEDANTIC

#else
#define DISABLE_WARNING_CONDITIONAL_EXPRESSION_IS_CONSTANT
Expand All @@ -205,6 +210,7 @@
#define DISABLE_WARNING_NON_VIRTUAL_DESTRUCTOR PUSH_WARNING_ARG_("-Wnon-virtual-dtor")
#define DISABLE_WARNING_TYPE_LIMITS PUSH_WARNING_ARG_("-Wtype-limits")
#define DISABLE_WARNING_STRING_OPERATION_OVERREAD PUSH_WARNING_ARG_("-Wstringop-overread")
#define DISABLE_WARNING_PEDANTIC PUSH_WARNING_ARG_("-Wpedantic")
#endif
#endif

Expand Down Expand Up @@ -957,6 +963,16 @@ namespace std {
#endif
#endif

#ifndef __has_cpp_attribute
# define __has_cpp_attribute(x) 0
#endif

#if __has_cpp_attribute(fallthrough)
# define FALLTHROUGH [[fallthrough]];
#else
# define FALLTHROUGH do{} while(0);
#endif

#define THUNDER_VERSION 4

#endif // __PORTABILITY_H
14 changes: 7 additions & 7 deletions Source/messaging/LoggingCategories.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ namespace WPEFramework {
namespace Logging {

// ...but logging controls have to be visible outside of the Messaging lib
DEFINE_LOGGING_CATEGORY(Startup);
DEFINE_LOGGING_CATEGORY(Shutdown);
DEFINE_LOGGING_CATEGORY(Notification);
DEFINE_LOGGING_CATEGORY(Error);
DEFINE_LOGGING_CATEGORY(ParsingError);
DEFINE_LOGGING_CATEGORY(Fatal);
DEFINE_LOGGING_CATEGORY(Crash);
DEFINE_LOGGING_CATEGORY(Startup)
DEFINE_LOGGING_CATEGORY(Shutdown)
DEFINE_LOGGING_CATEGORY(Notification)
DEFINE_LOGGING_CATEGORY(Error)
DEFINE_LOGGING_CATEGORY(ParsingError)
DEFINE_LOGGING_CATEGORY(Fatal)
DEFINE_LOGGING_CATEGORY(Crash)

} // namespace Logging
}
12 changes: 6 additions & 6 deletions Source/messaging/TraceCategories.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ namespace Trace {
template <typename... Args>
inline string Format(Args&&... args) { return (Core::Format(std::forward<Args>(args)...)); }

DEFINE_MESSAGING_CATEGORY(Messaging::BaseCategoryType<Core::Messaging::Metadata::type::TRACING>, Text);
DEFINE_MESSAGING_CATEGORY(Messaging::BaseCategoryType<Core::Messaging::Metadata::type::TRACING>, Initialisation);
DEFINE_MESSAGING_CATEGORY(Messaging::BaseCategoryType<Core::Messaging::Metadata::type::TRACING>, Information);
DEFINE_MESSAGING_CATEGORY(Messaging::BaseCategoryType<Core::Messaging::Metadata::type::TRACING>, Warning);
DEFINE_MESSAGING_CATEGORY(Messaging::BaseCategoryType<Core::Messaging::Metadata::type::TRACING>, Error);
DEFINE_MESSAGING_CATEGORY(Messaging::BaseCategoryType<Core::Messaging::Metadata::type::TRACING>, Fatal);
DEFINE_MESSAGING_CATEGORY(Messaging::BaseCategoryType<Core::Messaging::Metadata::type::TRACING>, Text)
DEFINE_MESSAGING_CATEGORY(Messaging::BaseCategoryType<Core::Messaging::Metadata::type::TRACING>, Initialisation)
DEFINE_MESSAGING_CATEGORY(Messaging::BaseCategoryType<Core::Messaging::Metadata::type::TRACING>, Information)
DEFINE_MESSAGING_CATEGORY(Messaging::BaseCategoryType<Core::Messaging::Metadata::type::TRACING>, Warning)
DEFINE_MESSAGING_CATEGORY(Messaging::BaseCategoryType<Core::Messaging::Metadata::type::TRACING>, Error)
DEFINE_MESSAGING_CATEGORY(Messaging::BaseCategoryType<Core::Messaging::Metadata::type::TRACING>, Fatal)

class EXTERNAL Constructor {
private:
Expand Down
2 changes: 1 addition & 1 deletion Source/plugins/Shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,6 @@ ENUM_CONVERSION_BEGIN(Plugin::Config::RootConfig::ModeType)
{ Plugin::Config::RootConfig::ModeType::CONTAINER, _TXT("Container") },
{ Plugin::Config::RootConfig::ModeType::DISTRIBUTED, _TXT("Distributed") },

ENUM_CONVERSION_END(Plugin::Config::RootConfig::ModeType);
ENUM_CONVERSION_END(Plugin::Config::RootConfig::ModeType)

} // namespace
4 changes: 2 additions & 2 deletions Source/plugins/Shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

namespace WPEFramework {

ENUM_CONVERSION_HANDLER(PluginHost::IShell::reason);
ENUM_CONVERSION_HANDLER(PluginHost::IShell::state);
ENUM_CONVERSION_HANDLER(PluginHost::IShell::reason)
ENUM_CONVERSION_HANDLER(PluginHost::IShell::state)

}
4 changes: 2 additions & 2 deletions Source/plugins/StateControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ ENUM_CONVERSION_BEGIN(PluginHost::IStateControl::state)
{ PluginHost::IStateControl::SUSPENDED, _TXT("SUSPENDED") },
{ PluginHost::IStateControl::RESUMED, _TXT("RESUMED") },

ENUM_CONVERSION_END(PluginHost::IStateControl::state);
ENUM_CONVERSION_END(PluginHost::IStateControl::state)

ENUM_CONVERSION_BEGIN(PluginHost::IStateControl::command)

{ PluginHost::IStateControl::SUSPEND, _TXT("Suspend") },
{ PluginHost::IStateControl::RESUME, _TXT("Resume") },

ENUM_CONVERSION_END(PluginHost::IStateControl::command);
ENUM_CONVERSION_END(PluginHost::IStateControl::command)

namespace PluginHost
{
Expand Down
4 changes: 2 additions & 2 deletions Source/plugins/StateControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

namespace WPEFramework {

ENUM_CONVERSION_HANDLER(PluginHost::IStateControl::command);
ENUM_CONVERSION_HANDLER(PluginHost::IStateControl::state);
ENUM_CONVERSION_HANDLER(PluginHost::IStateControl::command)
ENUM_CONVERSION_HANDLER(PluginHost::IStateControl::state)

}
2 changes: 1 addition & 1 deletion Source/plugins/SubSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@

namespace WPEFramework {

ENUM_CONVERSION_HANDLER(PluginHost::ISubSystem::subsystem);
ENUM_CONVERSION_HANDLER(PluginHost::ISubSystem::subsystem)

}
6 changes: 4 additions & 2 deletions Tests/unit/IPTestAdministrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <string.h>
#include <core/core.h>

MODULE_NAME_DECLARATION(BUILD_REFERENCE);
MODULE_NAME_DECLARATION(BUILD_REFERENCE)

#ifdef WITH_CODE_COVERAGE
extern "C" void __gcov_flush();
Expand Down Expand Up @@ -113,7 +113,9 @@ bool IPTestAdministrator::Sync(const std::string & str)
fprintf(stderr, "Warning: sync string is too long: \"%s\"\n", str.c_str());
}

strncpy(m_sharedData->m_message, str.c_str(), m_messageBufferSize);
// Avoid unintended truncation
strncpy(m_sharedData->m_message, str.c_str(), m_messageBufferSize - 1);
m_sharedData->m_message[m_messageBufferSize - 1] = '\0';

// Get hold of mutex of "waiting for second" cond var.
TimedLock(&m_sharedData->m_waitingForSecondCondMutex, str);
Expand Down
29 changes: 15 additions & 14 deletions Tests/unit/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,24 @@ set(TEST_RUNNER_NAME "WPEFramework_test_core")


add_executable(${TEST_RUNNER_NAME}
../IPTestAdministrator.cpp
test_cyclicbuffer.cpp
#../IPTestAdministrator.cpp
#test_cyclicbuffer.cpp
#test_databuffer.cpp
test_dataelement.cpp
#test_dataelement.cpp
test_dataelementfile.cpp
#test_doorbell.cpp
test_enumerate.cpp
test_event.cpp
test_hex2strserialization.cpp
test_filesystem.cpp
#test_filesystem.cpp
test_frametype.cpp
#test_hash.cpp
#test_ipc.cpp
#test_ipcclient.cpp
test_iso639.cpp
test_iterator.cpp
#test_jsonparser.cpp
test_jsonnumbertype.cpp
test_keyvalue.cpp
test_library.cpp
test_lockablecontainer.cpp
Expand All @@ -56,14 +57,14 @@ add_executable(${TEST_RUNNER_NAME}
test_rectangle.cpp
#test_rpc.cpp
test_semaphore.cpp
test_sharedbuffer.cpp
test_singleton.cpp
test_socketstreamjson.cpp
test_socketstreamtext.cpp
#test_sharedbuffer.cpp
#test_singleton.cpp
#test_socketstreamjson.cpp
#test_socketstreamtext.cpp
test_statetrigger.cpp
test_stopwatch.cpp
test_synchronize.cpp
test_synchronous.cpp
#test_synchronous.cpp
test_systeminfo.cpp
test_textfragment.cpp
test_textreader.cpp
Expand All @@ -73,12 +74,12 @@ add_executable(${TEST_RUNNER_NAME}
#test_timer.cpp
test_tristate.cpp
#test_valuerecorder.cpp
test_weblinkjson.cpp
test_weblinktext.cpp
test_websocketjson.cpp
test_websockettext.cpp
#test_weblinkjson.cpp
#test_weblinktext.cpp
#test_websocketjson.cpp
#test_websockettext.cpp
#test_workerpool.cpp
test_xgetopt.cpp
#test_xgetopt.cpp
#test_message_dispatcher.cpp
)

Expand Down
2 changes: 1 addition & 1 deletion Tests/unit/core/test_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ TEST(test_event, unlock_event)
object.Stop();
}

TEST(DISABLE_test_event, set_event)
TEST(DISABLED_test_event, set_event)
{
Event event(false,true);
std::thread::id parentTid;
Expand Down
Loading