mirror of
https://github.com/Adamcake/Bolt.git
synced 2026-05-24 09:04:28 -04:00
window_launcher: make PQINT less error-prone
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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) \
|
||||
|
||||
Reference in New Issue
Block a user