diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-02-28 10:50:58 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-02-28 16:07:56 +0100 |
commit | b8bd1990aaa1b063ca21b78ffec629b5d5ae7697 (patch) | |
tree | 15d21403ca3712252f2927d4826be0cad5b46461 /test/Makefile.am | |
parent | 133dee2980538ded58dfe82b16b14ba80fe35a85 (diff) |
Rework LOOLProtocol::tokenize() to return a StringVector object
The bulk of this commit just changes std::vector<std::string> to
StringVector when we deal with tokens from a websocket message.
The less boring part of it is the new StringVector class, which is a
wrapper around std::vector<std::string>, and provides the same API,
except that operator[] returns a string, not a string&, and this allows
returning an empty string in case that prevents reading past the end of
the underlying array.
This means in case client code forgets to check size() before invoking
operator[], we don't crash. (See the ~3 previous commits which fixed
such crashes.)
Later the ctor could be changed to take a single underlying string to
avoid lots of tiny allocations, that's not yet done in this commit.
Change-Id: I8a6082143a8ac0b65824f574b32104d7889c184f
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89687
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'test/Makefile.am')
-rw-r--r-- | test/Makefile.am | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index e6588810c..3732c6a4e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -81,6 +81,7 @@ unittest_SOURCES = \ ../common/Session.cpp \ ../common/SigUtil.cpp \ ../common/Unit.cpp \ + ../common/StringVector.cpp \ ../net/Socket.cpp \ ../wsd/Auth.cpp \ ../wsd/TestStubs.cpp \ |