summaryrefslogtreecommitdiffhomepage
path: root/dev/lib
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-11-23 17:26:48 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-11-23 17:26:48 +0100
commitdf4ec096491ded6d58b9ee094d6942e3188c2d4a (patch)
treea2f60be1865adef69cdbb326080a1b2763a5ce79 /dev/lib
parent58dc03a47576601006c4870d1633bf35fc78176a (diff)
fix: lib: `visit` may now throw exceptions.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/lib')
-rw-r--r--dev/lib/core/chunk_string.hpp2
-rw-r--r--dev/lib/fix/fix.hpp51
-rw-r--r--dev/lib/logic/math.hpp4
-rw-r--r--dev/lib/memory/tracked_ptr.hpp2
-rw-r--r--dev/lib/net/modem.hpp1
-rw-r--r--dev/lib/simd/simd.hpp4
-rw-r--r--dev/lib/utility/cgi.hpp2
-rw-r--r--dev/lib/utility/embfs.hpp2
8 files changed, 31 insertions, 37 deletions
diff --git a/dev/lib/core/chunk_string.hpp b/dev/lib/core/chunk_string.hpp
index 0ecc73e..e32d030 100644
--- a/dev/lib/core/chunk_string.hpp
+++ b/dev/lib/core/chunk_string.hpp
@@ -94,7 +94,7 @@ namespace ocl
std::basic_string<char_type> str() const noexcept
{
static std::basic_string<char_type> ret;
- const auto& sz = ret.size();
+ const auto& sz = ret.size();
if (chunk_total_ > sz)
ret.clear();
diff --git a/dev/lib/fix/fix.hpp b/dev/lib/fix/fix.hpp
index 08360d5..0c6685d 100644
--- a/dev/lib/fix/fix.hpp
+++ b/dev/lib/fix/fix.hpp
@@ -151,6 +151,9 @@ namespace ocl::fix
return this->visit(in);
}
+ /// @brief Visit a FIX message and parse it into a basic_range_data object.
+ /// @param in The input FIX message as a string.
+ /// @warning This function may throw exceptions.
basic_range_data<char_type> visit(const std::basic_string<char_type>& in)
{
thread_local basic_range_data<char_type> ret{};
@@ -160,37 +163,29 @@ namespace ocl::fix
std::basic_string<char_type> in_tmp{"", in.size()};
- try
+ for (auto& ch : in)
{
- for (auto& ch : in)
+ if (ch != basic_visitor::soh)
{
- if (ch != basic_visitor::soh)
- {
- in_tmp += ch;
- continue;
- }
-
- std::basic_string<char_type> key = in_tmp.substr(0, in_tmp.find(basic_visitor::eq));
- std::basic_string<char_type> val = in_tmp.substr(in_tmp.find(basic_visitor::eq) + 1);
-
- if (ret.magic_.empty())
- {
- ret.magic_ = val;
- ret.magic_len_ = ret.magic_.size();
- }
- else
- {
- ret.body_.emplace_back(std::make_pair(key, val));
- ret.body_len_ += in_tmp.size();
- }
-
- in_tmp.clear();
+ in_tmp += ch;
+ continue;
}
- }
- catch (...)
- {
+
+ std::basic_string<char_type> key = in_tmp.substr(0, in_tmp.find(basic_visitor::eq));
+ std::basic_string<char_type> val = in_tmp.substr(in_tmp.find(basic_visitor::eq) + 1);
+
+ if (ret.magic_.empty())
+ {
+ ret.magic_ = val;
+ ret.magic_len_ = ret.magic_.size();
+ }
+ else
+ {
+ ret.body_.emplace_back(std::make_pair(key, val));
+ ret.body_len_ += in_tmp.size();
+ }
+
in_tmp.clear();
- return ret;
}
in_tmp.clear();
@@ -210,7 +205,7 @@ namespace ocl::fix
using fix_tag_type = std::uint32_t;
using range_data = basic_range_data<char>;
- using visitor = basic_visitor<char>;
+ using visitor = basic_visitor<char>;
} // namespace ocl::fix
#endif // ifndef _OCL_FIX_PARSER_HPP \ No newline at end of file
diff --git a/dev/lib/logic/math.hpp b/dev/lib/logic/math.hpp
index 52f4535..d131ef9 100644
--- a/dev/lib/logic/math.hpp
+++ b/dev/lib/logic/math.hpp
@@ -27,7 +27,7 @@ namespace ocl
static constexpr const bool value = false;
};
- constexpr inline auto not_a_number = __builtin_nanf ("");
- constexpr inline auto positive_infinity = __builtin_inff ();
+ constexpr inline auto not_a_number = __builtin_nanf("");
+ constexpr inline auto positive_infinity = __builtin_inff();
constexpr inline auto negative_infinity = -positive_infinity;
} // namespace ocl \ No newline at end of file
diff --git a/dev/lib/memory/tracked_ptr.hpp b/dev/lib/memory/tracked_ptr.hpp
index 0ea0e32..2df5db5 100644
--- a/dev/lib/memory/tracked_ptr.hpp
+++ b/dev/lib/memory/tracked_ptr.hpp
@@ -140,7 +140,7 @@ namespace ocl::memory
this->reset();
}
- tracked_ptr(const tracked_ptr&) = delete;
+ tracked_ptr(const tracked_ptr&) = delete;
tracked_ptr& operator=(const tracked_ptr&) = delete;
public:
diff --git a/dev/lib/net/modem.hpp b/dev/lib/net/modem.hpp
index fd64f72..d86234b 100644
--- a/dev/lib/net/modem.hpp
+++ b/dev/lib/net/modem.hpp
@@ -165,4 +165,3 @@ namespace ocl::net
}
};
} // namespace ocl::net
-
diff --git a/dev/lib/simd/simd.hpp b/dev/lib/simd/simd.hpp
index 239e512..f15f88a 100644
--- a/dev/lib/simd/simd.hpp
+++ b/dev/lib/simd/simd.hpp
@@ -30,11 +30,11 @@ namespace ocl::simd
};
public:
- real_type() = default;
+ real_type() = default;
virtual ~real_type() = default;
real_type& operator=(const real_type&) = delete;
- real_type(const real_type&) = delete;
+ real_type(const real_type&) = delete;
typename backend_type::register_type& call(const opcode& op, typename backend_type::register_type& lhs, typename backend_type::register_type& rhs)
{
diff --git a/dev/lib/utility/cgi.hpp b/dev/lib/utility/cgi.hpp
index fd00bbf..4cc913b 100644
--- a/dev/lib/utility/cgi.hpp
+++ b/dev/lib/utility/cgi.hpp
@@ -37,7 +37,7 @@ namespace ocl
public:
explicit basic_writer() = default;
- virtual ~basic_writer() = default;
+ virtual ~basic_writer() = default;
basic_writer& operator=(const basic_writer&) = default;
basic_writer(const basic_writer&) = default;
diff --git a/dev/lib/utility/embfs.hpp b/dev/lib/utility/embfs.hpp
index e2e5d18..8a716ce 100644
--- a/dev/lib/utility/embfs.hpp
+++ b/dev/lib/utility/embfs.hpp
@@ -37,7 +37,7 @@ namespace ocl::embfs
#endif
typedef std::int16_t sword_t;
-
+
typedef std::int32_t sdword_t;
typedef std::uint8_t utf8_char_t;