diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-03-27 22:22:08 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-03-27 22:22:08 +0000 |
commit | 232501140c2d6fba164aa6757a816c7da569830a (patch) | |
tree | 413dac0a4cf7f679fdd7dbe57733af7591a66ba1 /icespider/testing/testRequest.cpp | |
parent | Enable some clang-tidy checks and fix up accordingly (diff) | |
download | icespider-232501140c2d6fba164aa6757a816c7da569830a.tar.bz2 icespider-232501140c2d6fba164aa6757a816c7da569830a.tar.xz icespider-232501140c2d6fba164aa6757a816c7da569830a.zip |
Add clang-tidy rules and fix all the things
Note: something in here appears to break linking in release build
Diffstat (limited to 'icespider/testing/testRequest.cpp')
-rw-r--r-- | icespider/testing/testRequest.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/icespider/testing/testRequest.cpp b/icespider/testing/testRequest.cpp index 5aa5bce..b866308 100644 --- a/icespider/testing/testRequest.cpp +++ b/icespider/testing/testRequest.cpp @@ -96,10 +96,12 @@ namespace IceSpider { void TestRequest::set(const std::string_view & key, const OptionalString & val, MapVars & vars) { - if (val) + if (val) { vars[std::string(key)] = *val; - else + } + else { vars.erase(vars.find(key)); + } } std::istream & @@ -137,12 +139,13 @@ namespace IceSpider { { if (responseHeaders.empty()) { while (true) { - char buf[BUFSIZ], n[BUFSIZ], v[BUFSIZ]; - output.getline(buf, BUFSIZ); - if (sscanf(buf, "%[^:]: %[^\r]", n, v) != 2) { + std::array<char, BUFSIZ> buf {}, n {}, v {}; + output.getline(buf.data(), BUFSIZ); + // NOLINTNEXTLINE(hicpp-vararg) + if (sscanf(buf.data(), "%[^:]: %[^\r]", n.data(), v.data()) != 2) { break; } - responseHeaders[n] = v; + responseHeaders[n.data()] = v.data(); } } return responseHeaders; |