diff options
author | Xiao Pan <xyz@flylightning.xyz> | 2024-12-16 18:44:05 -0800 |
---|---|---|
committer | Xiao Pan <xyz@flylightning.xyz> | 2024-12-16 18:48:49 -0800 |
commit | cf6365c0957253940b8fae7e1a606105c6a2754c (patch) | |
tree | df259da4c45432c0fc3d2d2b496d226664ca94ce /pkgbuilds/osk-sdl/fix-config-parsing-with-libstdc++.patch | |
parent | 75c587ea9c4b8bf19ef6eec11a6e0aed508f3dac (diff) |
Add osk-sdl PKGBUILD from danctnix Pine64-Arch
https://github.com/dreemurrs-embedded/Pine64-Arch
Diffstat (limited to 'pkgbuilds/osk-sdl/fix-config-parsing-with-libstdc++.patch')
-rw-r--r-- | pkgbuilds/osk-sdl/fix-config-parsing-with-libstdc++.patch | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/pkgbuilds/osk-sdl/fix-config-parsing-with-libstdc++.patch b/pkgbuilds/osk-sdl/fix-config-parsing-with-libstdc++.patch new file mode 100644 index 0000000..2e60e4f --- /dev/null +++ b/pkgbuilds/osk-sdl/fix-config-parsing-with-libstdc++.patch @@ -0,0 +1,39 @@ +--- src/config.cpp ++++ src/config.cpp +@@ -175,24 +175,26 @@ + std::istringstream iss(line); + std::string id, eq, val; + +- bool error = false; +- +- if (!(iss >> id)) { +- continue; +- } else if (id[0] == '#') { ++ iss >> id; ++ if (iss.fail()) { + continue; + } else if (id.empty()) { + continue; +- } else if (!(iss >> eq >> val >> std::ws) || eq != "=" || iss.get() != EOF) { +- error = true; ++ } else if (id[0] == '#') { ++ continue; + } + +- if (error) { ++ iss >> eq >> val; ++ // check that: ++ // 1) fail/bad bits aren't set ++ // 2) eq field is '=' ++ // 3) that there are no trailing fields, after ignoring any trailing whitespace ++ if (iss.fail() || eq.compare("=") || !(iss >> std::ws).eof()) { + SDL_LogError(SDL_LOG_CATEGORY_ERROR, "Syntax error on line %d", lineno); + return false; +- } else { +- Config::options[id] = val; + } ++ ++ Config::options[id] = val; + } + return true; + } |