MCPcopy Create free account
hub / github.com/WallBreaker2/op / parse_ptr

Function parse_ptr

libop/capture/sources/MemoryImageSource.cpp:28–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28bool parse_ptr(const std::wstring &text, byte *&ptr) {
29 auto input = trim_ws(text);
30 if (input.empty()) {
31 return false;
32 }
33 errno = 0;
34 wchar_t *end = nullptr;
35 auto value = wcstoull(input.c_str(), &end, 0);
36 if (end == input.c_str()) {
37 return false;
38 }
39 while (*end != L'\0' && iswspace(*end)) {
40 ++end;
41 }
42 if (*end != L'\0' || errno == ERANGE || value == 0) {
43 return false;
44 }
45 ptr = reinterpret_cast<byte *>(static_cast<uintptr_t>(value));
46 return ptr != nullptr;
47}
48
49bool parse_positive_int(const std::wstring &text, int &value) {
50 auto input = trim_ws(text);

Callers 1

ParseMemoryImageSourceFunction · 0.85

Calls 2

trim_wsFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected