window_launcher: make PQINT less error-prone

This commit is contained in:
Adam
2024-09-01 19:33:04 +01:00
parent 4e3330e239
commit d5e006dbad
2 changed files with 6 additions and 4 deletions

View File

@@ -355,7 +355,7 @@ CefRefPtr<CefResourceRequestHandler> Browser::Launcher::GetResourceRequestHandle
bool has_main = false;
uint64_t client;
bool has_client = false;
bool client_valid = true;
bool client_valid = false;
this->ParseQuery(query, [&](const std::string_view& key, const std::string_view& val) {
PQCHECK(id)
PQCHECK(path)
@@ -386,10 +386,10 @@ CefRefPtr<CefResourceRequestHandler> Browser::Launcher::GetResourceRequestHandle
#if defined(BOLT_PLUGINS)
uint64_t client;
bool has_client = false;
bool client_valid = true;
bool client_valid = false;
uint64_t uid;
bool has_uid = false;
bool uid_valid = true;
bool uid_valid = false;
this->ParseQuery(query, [&](const std::string_view& key, const std::string_view& val) {
PQINT(client)
PQINT(uid)

View File

@@ -98,14 +98,16 @@ if (key == #KEY) { \
#define PQINT(KEY) \
if (key == #KEY) { \
has_##KEY = true; \
KEY##_valid = true; \
KEY = 0; \
for (auto it = val.begin(); it != val.end(); it += 1) { \
if (*it < '0' || *it > '9') { \
KEY##_valid = false; \
break; \
return; \
} \
KEY = (KEY * 10) + (*it - '0'); \
} \
return; \
}
#define PQBOOL(KEY) \