summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--document/src/tests/documentselectparsertest.cpp23
-rw-r--r--juniper/src/test/auxTest.cpp24
-rw-r--r--searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp4
-rw-r--r--searchlib/src/apps/tests/btreestress_test.cpp14
-rw-r--r--searchlib/src/apps/tests/memoryindexstress_test.cpp4
-rw-r--r--searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp2
-rw-r--r--staging_vespalib/src/tests/sequencedtaskexecutor/foregroundtaskexecutor_test.cpp2
-rw-r--r--staging_vespalib/src/tests/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/websocket/websocket_server.cpp16
-rw-r--r--vespalib/src/vespa/vespalib/websocket/websocket_server.h9
10 files changed, 61 insertions, 39 deletions
diff --git a/document/src/tests/documentselectparsertest.cpp b/document/src/tests/documentselectparsertest.cpp
index 30b2bfbb1b4..7e8e3796aaf 100644
--- a/document/src/tests/documentselectparsertest.cpp
+++ b/document/src/tests/documentselectparsertest.cpp
@@ -37,8 +37,8 @@ protected:
~DocumentSelectParserTest();
Document::SP createDoc(
- const std::string& doctype, const std::string& id, uint32_t hint,
- double hfloat, const std::string& hstr, const std::string& cstr,
+ vespalib::stringref doctype, vespalib::stringref id, uint32_t hint,
+ double hfloat, vespalib::stringref hstr, vespalib::stringref cstr,
uint64_t hlong = 0);
DocumentUpdate::SP createUpdate(
@@ -105,8 +105,8 @@ void DocumentSelectParserTest::SetUp()
}
Document::SP DocumentSelectParserTest::createDoc(
- const std::string& doctype, const std::string& id, uint32_t hint,
- double hfloat, const std::string& hstr, const std::string& cstr,
+ vespalib::stringref doctype, vespalib::stringref id, uint32_t hint,
+ double hfloat, vespalib::stringref hstr, vespalib::stringref cstr,
uint64_t hlong)
{
const DocumentType* type = _repo->getDocumentType(doctype);
@@ -117,8 +117,8 @@ Document::SP DocumentSelectParserTest::createDoc(
doc->setValue(doc->getField("headerlongval"), LongFieldValue(hlong));
}
doc->setValue(doc->getField("hfloatval"), FloatFieldValue(hfloat));
- doc->setValue(doc->getField("hstringval"), StringFieldValue(hstr.c_str()));
- doc->setValue(doc->getField("content"), StringFieldValue(cstr.c_str()));
+ doc->setValue(doc->getField("hstringval"), StringFieldValue(hstr));
+ doc->setValue(doc->getField("content"), StringFieldValue(cstr));
return doc;
}
@@ -1232,10 +1232,19 @@ TEST_F(DocumentSelectParserTest, testDocumentIdsInRemoves)
PARSE("testdoctype1 and testdoctype1.headerval == 0", DocumentId("id:ns:testdoctype1::1"), Invalid);
}
+namespace {
+
+const char *
+bad_cast_from_u8(const char8_t *p) {
+ return reinterpret_cast<const char *>(p);
+}
+
+}
+
TEST_F(DocumentSelectParserTest, testUtf8)
{
createDocs();
- std::string utf8name(u8"H\u00e5kon");
+ vespalib::string utf8name = bad_cast_from_u8(u8"H\u00e5kon");
EXPECT_EQ(size_t(6), utf8name.size());
/// \todo TODO (was warning): UTF8 test for glob/regex support in selection language disabled. Known not to work
diff --git a/juniper/src/test/auxTest.cpp b/juniper/src/test/auxTest.cpp
index 7a0856dfabb..02697fd96ba 100644
--- a/juniper/src/test/auxTest.cpp
+++ b/juniper/src/test/auxTest.cpp
@@ -318,10 +318,18 @@ void test_dump(const char* s, unsigned int len)
}
}
+namespace {
+
+const char *
+bad_cast_from_u8(const char8_t * p) {
+ return reinterpret_cast<const char *>(p);
+}
+
+}
void AuxTest::TestUTF8(unsigned int size)
{
- const char* s = u8"\u00e5pent s\u00f8k\u00e6\u00f8\u00e5\u00e6\u00f8\u00e5\u00e6\u00f8\u00e5";
+ const char* s = bad_cast_from_u8(u8"\u00e5pent s\u00f8k\u00e6\u00f8\u00e5\u00e6\u00f8\u00e5\u00e6\u00f8\u00e5");
const unsigned char* p = (const unsigned char*)s;
int moved = 0;
@@ -378,20 +386,20 @@ void AuxTest::TestUTF8(unsigned int size)
void AuxTest::TestUTF8context()
{
- const char* iso_cont = u8"AND(m\u00b5ss,fast,s\u00f8kemotor,\u00e5relang)";
+ const char* iso_cont = bad_cast_from_u8(u8"AND(m\u00b5ss,fast,s\u00f8kemotor,\u00e5relang)");
juniper::QueryParser q(iso_cont);
juniper::QueryHandle qh(q, NULL, juniper::_Juniper->getModifier());
// some content
- std::string s(u8"Fast leverer s\u00d8kemotorer og andre nyttige ting for \u00e5 finne frem p\u00e5 ");
- s.append(u8"internett. Teknologien er basert p\u00e5 \u00c5relang");
+ std::string s(bad_cast_from_u8(u8"Fast leverer s\u00d8kemotorer og andre nyttige ting for \u00e5 finne frem p\u00e5 "));
+ s.append(bad_cast_from_u8(u8"internett. Teknologien er basert p\u00e5 \u00c5relang"));
s += UNIT_SEPARATOR;
- s.append(u8"norsk innsats og forskning i");
+ s.append(bad_cast_from_u8(u8"norsk innsats og forskning i"));
s += GROUP_SEPARATOR;
- s.append(u8"trondheimsmilj\u00f8et. M\u00b5ss med denne nye funksjonaliteten for \u00e5 vise frem");
+ s.append(bad_cast_from_u8(u8"trondheimsmilj\u00f8et. M\u00b5ss med denne nye funksjonaliteten for \u00e5 vise frem"));
s += UNIT_SEPARATOR;
- s.append(u8" beste forekomst av s\u00f8ket med s\u00f8kemotor til brukeren blir det enda bedre. ");
- s.append(u8"Hvis bare UTF8-kodingen virker som den skal for tegn som tar mer enn \u00e9n byte.");
+ s.append(bad_cast_from_u8(u8" beste forekomst av s\u00f8ket med s\u00f8kemotor til brukeren blir det enda bedre. "));
+ s.append(bad_cast_from_u8(u8"Hvis bare UTF8-kodingen virker som den skal for tegn som tar mer enn \u00e9n byte."));
juniper::Result* res = juniper::Analyse(juniper::TestConfig, &qh, s.c_str(), s.size(), 0, 0, 0);
_test(res != NULL);
diff --git a/searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp b/searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp
index 6e4fe34a3c9..23267e0628b 100644
--- a/searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp
+++ b/searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp
@@ -166,7 +166,7 @@ public:
performCycleLids(const std::vector<uint32_t> &lids)
{
_writeService.master().execute(
- makeLambdaTask([=]() { cycledLids(lids);}));
+ makeLambdaTask([this, lids]() { cycledLids(lids);}));
}
void
@@ -175,7 +175,7 @@ public:
if (lids.empty())
return;
_writeService.index().execute(
- makeLambdaTask([=]() { performCycleLids(lids);}));
+ makeLambdaTask([this, lids]() { performCycleLids(lids);}));
}
bool
diff --git a/searchlib/src/apps/tests/btreestress_test.cpp b/searchlib/src/apps/tests/btreestress_test.cpp
index 0fb356001f2..37fc6b26cc3 100644
--- a/searchlib/src/apps/tests/btreestress_test.cpp
+++ b/searchlib/src/apps/tests/btreestress_test.cpp
@@ -202,19 +202,19 @@ TEST_F("Test single threaded lower_bound reader during updates", Fixture)
{
uint32_t cnt = 1000000;
f._reportWork = true;
- f._writer.execute(makeLambdaTask([=]() { f.writeWork(cnt); }));
- f._readers.execute(makeLambdaTask([=]() { f.readWork(); }));
+ f._writer.execute(makeLambdaTask([this, cnt]() { f.writeWork(cnt); }));
+ f._readers.execute(makeLambdaTask([this]() { f.readWork(); }));
}
TEST_F("Test multithreaded lower_bound reader during updates", Fixture)
{
uint32_t cnt = 1000000;
f._reportWork = true;
- f._writer.execute(makeLambdaTask([=]() { f.writeWork(cnt); }));
- f._readers.execute(makeLambdaTask([=]() { f.readWork(); }));
- f._readers.execute(makeLambdaTask([=]() { f.readWork(); }));
- f._readers.execute(makeLambdaTask([=]() { f.readWork(); }));
- f._readers.execute(makeLambdaTask([=]() { f.readWork(); }));
+ f._writer.execute(makeLambdaTask([this, cnt]() { f.writeWork(cnt); }));
+ f._readers.execute(makeLambdaTask([this]() { f.readWork(); }));
+ f._readers.execute(makeLambdaTask([this]() { f.readWork(); }));
+ f._readers.execute(makeLambdaTask([this]() { f.readWork(); }));
+ f._readers.execute(makeLambdaTask([this]() { f.readWork(); }));
}
TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/searchlib/src/apps/tests/memoryindexstress_test.cpp b/searchlib/src/apps/tests/memoryindexstress_test.cpp
index 3f848b45cc3..e8590999bc1 100644
--- a/searchlib/src/apps/tests/memoryindexstress_test.cpp
+++ b/searchlib/src/apps/tests/memoryindexstress_test.cpp
@@ -371,9 +371,9 @@ Fixture::stressTest(uint32_t writeCnt)
LOG(info,
"starting stress test, 1 write thread, %u read threads, %u writes",
readThreads, writeCnt);
- _writer.execute(makeLambdaTask([=]() { writeWork(writeCnt); }));
+ _writer.execute(makeLambdaTask([this, writeCnt]() { writeWork(writeCnt); }));
for (uint32_t i = 0; i < readThreads; ++i) {
- _readers.execute(makeLambdaTask([=]() { readWork(); }));
+ _readers.execute(makeLambdaTask([this]() { readWork(); }));
}
}
diff --git a/searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp b/searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp
index 2bb55ac6977..c622ccae679 100644
--- a/searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp
+++ b/searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp
@@ -123,7 +123,7 @@ public:
_attr->shrinkLidSpace();
}
void clearDocs(uint32_t lidLow, uint32_t lidLimit) {
- _mvMapping->clearDocs(lidLow, lidLimit, [=](uint32_t docId) { _attr->clearDoc(docId); });
+ _mvMapping->clearDocs(lidLow, lidLimit, [this](uint32_t docId) { _attr->clearDoc(docId); });
}
size_t getTotalValueCnt() const { return _mvMapping->getTotalValueCnt(); }
diff --git a/staging_vespalib/src/tests/sequencedtaskexecutor/foregroundtaskexecutor_test.cpp b/staging_vespalib/src/tests/sequencedtaskexecutor/foregroundtaskexecutor_test.cpp
index 03ec64b771e..6df3b83f90f 100644
--- a/staging_vespalib/src/tests/sequencedtaskexecutor/foregroundtaskexecutor_test.cpp
+++ b/staging_vespalib/src/tests/sequencedtaskexecutor/foregroundtaskexecutor_test.cpp
@@ -61,7 +61,7 @@ public:
wait(int wantDone)
{
std::unique_lock<std::mutex> guard(_m);
- _cv.wait(guard, [=] { return this->_done >= wantDone; });
+ _cv.wait(guard, [this, wantDone] { return this->_done >= wantDone; });
}
};
diff --git a/staging_vespalib/src/tests/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp b/staging_vespalib/src/tests/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp
index 21674b4e2d0..d36664d3b1f 100644
--- a/staging_vespalib/src/tests/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp
+++ b/staging_vespalib/src/tests/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp
@@ -63,7 +63,7 @@ public:
wait(int wantDone)
{
std::unique_lock<std::mutex> guard(_m);
- _cv.wait(guard, [=] { return this->_done >= wantDone; });
+ _cv.wait(guard, [this, wantDone] { return this->_done >= wantDone; });
}
};
diff --git a/vespalib/src/vespa/vespalib/websocket/websocket_server.cpp b/vespalib/src/vespa/vespalib/websocket/websocket_server.cpp
index 171b7dabc1d..d3ef13e78d7 100644
--- a/vespalib/src/vespa/vespalib/websocket/websocket_server.cpp
+++ b/vespalib/src/vespa/vespalib/websocket/websocket_server.cpp
@@ -7,8 +7,7 @@
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/util/host_name.h>
-namespace vespalib {
-namespace ws {
+namespace vespalib::ws {
namespace {
@@ -116,7 +115,13 @@ void handle_upgrade(Connection &conn, Request &req) {
} // namespace vespalib::ws::<unnamed>
-WebsocketServer::StaticPage::~StaticPage() {}
+WebsocketServer::StaticPage::StaticPage(const vespalib::string & type, const vespalib::string & content_in)
+ : content_type(type),
+ content(content_in)
+{}
+WebsocketServer::StaticPage::StaticPage(const StaticPage &) = default;
+WebsocketServer::StaticPage & WebsocketServer::StaticPage::operator = (const StaticPage &) = default;
+WebsocketServer::StaticPage::~StaticPage() = default;
WebsocketServer::WebsocketServer(int port_in, StaticRepo &&repo)
: _acceptor(port_in, *this),
@@ -125,7 +130,7 @@ WebsocketServer::WebsocketServer(int port_in, StaticRepo &&repo)
{
}
-WebsocketServer::~WebsocketServer() {}
+WebsocketServer::~WebsocketServer() = default;
void
WebsocketServer::handle(std::unique_ptr<Socket> socket)
@@ -156,5 +161,4 @@ WebsocketServer::handle(std::unique_ptr<Socket> socket)
}
}
-} // namespace vespalib::ws
-} // namespace vespalib
+}
diff --git a/vespalib/src/vespa/vespalib/websocket/websocket_server.h b/vespalib/src/vespa/vespalib/websocket/websocket_server.h
index 31f657ddc1b..03b3da72134 100644
--- a/vespalib/src/vespa/vespalib/websocket/websocket_server.h
+++ b/vespalib/src/vespa/vespalib/websocket/websocket_server.h
@@ -7,12 +7,14 @@
#include <vespa/vespalib/stllike/string.h>
#include <map>
-namespace vespalib {
-namespace ws {
+namespace vespalib::ws {
class WebsocketServer : public Handler<Socket> {
public:
struct StaticPage {
+ StaticPage(const vespalib::string & type, const vespalib::string & content_in);
+ StaticPage(const StaticPage &);
+ StaticPage & operator = (const StaticPage &);
StaticPage(StaticPage &&) = default;
StaticPage & operator = (StaticPage &&) = default;
~StaticPage();
@@ -28,10 +30,9 @@ private:
public:
WebsocketServer(int port_in, StaticRepo &&repo = StaticRepo());
- ~WebsocketServer();
+ ~WebsocketServer() override;
void handle(std::unique_ptr<Socket> socket) override;
int port() { return _acceptor.port(); }
};
} // namespace vespalib::ws
-} // namespace vespalib