diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-07 11:21:27 +0100 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-07 11:21:27 +0100 |
| commit | 94ebd2816ed1cbf08334573175d2ed1dec18f962 (patch) | |
| tree | 5f653ea2b204414de138c81a321169a236e1144a /serialize/string.cpp | |
| parent | bdbf5534c58aa5649751d0e239f13bd22f9de158 (diff) | |
fix use after free
Diffstat (limited to 'serialize/string.cpp')
| -rw-r--r-- | serialize/string.cpp | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/serialize/string.cpp b/serialize/string.cpp deleted file mode 100644 index 0c0fa74e..00000000 --- a/serialize/string.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "string.hpp" -#include <Corrade/Containers/String.h> -#include <string_view> -#include <nlohmann/json.hpp> - -using String = Corrade::Containers::String; -using StringView = Corrade::Containers::StringView; - -namespace nlohmann { - -void adl_serializer<String>::to_json(json& j, const String& val) -{ - using nlohmann::to_json; - to_json(j, std::string_view { val.cbegin(), val.cend() }); -} - -void adl_serializer<String>::from_json(const json& j, String& val) -{ - using nlohmann::from_json; - std::string_view str; - from_json(j, str); - val = { str.cbegin(), str.size() }; -} - -void adl_serializer<StringView>::to_json(json& j, const StringView& val) -{ - using nlohmann::to_json; - to_json(j, std::string_view { val.cbegin(), val.cend() }); -} - -void adl_serializer<StringView>::from_json(const json& j, StringView& val) -{ - using nlohmann::from_json; - std::string_view str; - from_json(j, str); - val = { str.cbegin(), str.size() }; -} - -} // namespace nlohmann |
