Skip to content

Commit 037a373

Browse files
committed
Add INVALID_DYNLIB_BYTE macro
1 parent e545d98 commit 037a373

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

include/dynlibutils/module.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
# define DYNLIB_COMPILE_TIME_EXPR constexpr
3636
#endif
3737

38+
#define INVALID_DYNLIB_BYTE (~0)
39+
3840
namespace DynLibUtils {
3941

4042
struct Section_t
@@ -187,7 +189,7 @@ inline auto ParsePattern(const std::string_view svInput)
187189
if ('a' <= c && c <= 'f') return 10 + (c - 'a');
188190
if ('A' <= c && c <= 'F') return 10 + (c - 'A');
189191

190-
return 0;
192+
return INVALID_DYNLIB_BYTE;
191193
};
192194

193195
size_t n = 0;
@@ -210,7 +212,7 @@ inline auto ParsePattern(const std::string_view svInput)
210212
{
211213
auto nLeft = funcGetHexByte(svInput[n]), nRight = funcGetHexByte(svInput[n + 1]);
212214

213-
bool bIsValid = nLeft && nRight;
215+
bool bIsValid = nLeft != INVALID_DYNLIB_BYTE && nRight != INVALID_DYNLIB_BYTE;
214216

215217
assert(bIsValid && R"(Passing invalid characters. Allowed: <space> or pair: "0-9", "a-f", "A-F" or "?")");
216218
if (!bIsValid)

0 commit comments

Comments
 (0)