[Libreoffice-commits] online.git: loolwsd/configure.ac loolwsd/LoadTest.cpp loolwsd/LOOLWSD.cpp loolwsd/test

Miklos Vajna vmiklos at collabora.co.uk
Wed Oct 28 09:56:03 UTC 2015


 loolwsd/LOOLWSD.cpp         |  142 ++++++++++++++++++++++----------------------
 loolwsd/LoadTest.cpp        |   78 ++++++++++++------------
 loolwsd/configure.ac        |    2 
 loolwsd/test/httpwstest.cpp |    6 -
 4 files changed, 114 insertions(+), 114 deletions(-)

New commits:
commit 0fe05e6d919a49b8491f211426a7af161311e51c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Oct 28 10:55:03 2015 +0100

    loolwsd: -Werror=shadow

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 3e30e62..ffea9ea 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -615,103 +615,103 @@ void LOOLWSD::uninitialize()
     ServerApplication::uninitialize();
 }
 
-void LOOLWSD::defineOptions(OptionSet& options)
+void LOOLWSD::defineOptions(OptionSet& optionSet)
 {
-    ServerApplication::defineOptions(options);
+    ServerApplication::defineOptions(optionSet);
 
-    options.addOption(Option("help", "", "Display help information on command line arguments.")
-                      .required(false)
-                      .repeatable(false));
+    optionSet.addOption(Option("help", "", "Display help information on command line arguments.")
+                        .required(false)
+                        .repeatable(false));
 
-    options.addOption(Option("port", "", "Port number to listen to (default: " + std::to_string(DEFAULT_CLIENT_PORT_NUMBER) + "),"
+    optionSet.addOption(Option("port", "", "Port number to listen to (default: " + std::to_string(DEFAULT_CLIENT_PORT_NUMBER) + "),"
                              " must not be " + std::to_string(MASTER_PORT_NUMBER) + ".")
-                      .required(false)
-                      .repeatable(false)
-                      .argument("port number"));
-
-    options.addOption(Option("cache", "", "Path to a directory where to keep the persistent tile cache (default: " + std::string(LOOLWSD_CACHEDIR) + ").")
-                      .required(false)
-                      .repeatable(false)
-                      .argument("directory"));
-
-    options.addOption(Option("systemplate", "", "Path to a template tree with shared libraries etc to be used as source for chroot jails for child processes.")
-                      .required(false)
-                      .repeatable(false)
-                      .argument("directory"));
-
-    options.addOption(Option("lotemplate", "", "Path to a LibreOffice installation tree to be copied (linked) into the jails for child processes. Should be on the same file system as systemplate.")
-                      .required(false)
-                      .repeatable(false)
-                      .argument("directory"));
-
-    options.addOption(Option("childroot", "", "Path to the directory under which the chroot jails for the child processes will be created. Should be on the same file system as systemplate and lotemplate.")
-                      .required(false)
-                      .repeatable(false)
-                      .argument("directory"));
-
-    options.addOption(Option("losubpath", "", "Relative path where the LibreOffice installation will be copied inside a jail (default: '" + loSubPath + "').")
-                      .required(false)
-                      .repeatable(false)
-                      .argument("relative path"));
-
-    options.addOption(Option("numprespawns", "", "Number of child processes to keep started in advance and waiting for new clients.")
-                      .required(false)
-                      .repeatable(false)
-                      .argument("number"));
-
-    options.addOption(Option("test", "", "Interactive testing.")
-                      .required(false)
-                      .repeatable(false));
-
-    options.addOption(Option("child", "", "For internal use only.")
-                      .required(false)
-                      .repeatable(false)
-                      .argument("child id"));
-
-    options.addOption(Option("jail", "", "For internal use only.")
-                      .required(false)
-                      .repeatable(false)
-                      .argument("directory"));
+                        .required(false)
+                        .repeatable(false)
+                        .argument("port number"));
+
+    optionSet.addOption(Option("cache", "", "Path to a directory where to keep the persistent tile cache (default: " + std::string(LOOLWSD_CACHEDIR) + ").")
+                        .required(false)
+                        .repeatable(false)
+                        .argument("directory"));
+
+    optionSet.addOption(Option("systemplate", "", "Path to a template tree with shared libraries etc to be used as source for chroot jails for child processes.")
+                        .required(false)
+                        .repeatable(false)
+                        .argument("directory"));
+
+    optionSet.addOption(Option("lotemplate", "", "Path to a LibreOffice installation tree to be copied (linked) into the jails for child processes. Should be on the same file system as systemplate.")
+                        .required(false)
+                        .repeatable(false)
+                        .argument("directory"));
+
+    optionSet.addOption(Option("childroot", "", "Path to the directory under which the chroot jails for the child processes will be created. Should be on the same file system as systemplate and lotemplate.")
+                        .required(false)
+                        .repeatable(false)
+                        .argument("directory"));
+
+    optionSet.addOption(Option("losubpath", "", "Relative path where the LibreOffice installation will be copied inside a jail (default: '" + loSubPath + "').")
+                        .required(false)
+                        .repeatable(false)
+                        .argument("relative path"));
+
+    optionSet.addOption(Option("numprespawns", "", "Number of child processes to keep started in advance and waiting for new clients.")
+                        .required(false)
+                        .repeatable(false)
+                        .argument("number"));
+
+    optionSet.addOption(Option("test", "", "Interactive testing.")
+                        .required(false)
+                        .repeatable(false));
+
+    optionSet.addOption(Option("child", "", "For internal use only.")
+                        .required(false)
+                        .repeatable(false)
+                        .argument("child id"));
+
+    optionSet.addOption(Option("jail", "", "For internal use only.")
+                        .required(false)
+                        .repeatable(false)
+                        .argument("directory"));
 
 #if ENABLE_DEBUG
-    options.addOption(Option("uid", "", "Uid to assume if running under sudo for debugging purposes.")
-                      .required(false)
-                      .repeatable(false)
-                      .argument("uid"));
+    optionSet.addOption(Option("uid", "", "Uid to assume if running under sudo for debugging purposes.")
+                        .required(false)
+                        .repeatable(false)
+                        .argument("uid"));
 #endif
 }
 
-void LOOLWSD::handleOption(const std::string& name, const std::string& value)
+void LOOLWSD::handleOption(const std::string& optionName, const std::string& value)
 {
-    ServerApplication::handleOption(name, value);
+    ServerApplication::handleOption(optionName, value);
 
-    if (name == "help")
+    if (optionName == "help")
     {
         displayHelp();
         exit(Application::EXIT_OK);
     }
-    else if (name == "port")
+    else if (optionName == "port")
         portNumber = std::stoi(value);
-    else if (name == "cache")
+    else if (optionName == "cache")
         cache = value;
-    else if (name == "systemplate")
+    else if (optionName == "systemplate")
         sysTemplate = value;
-    else if (name == "lotemplate")
+    else if (optionName == "lotemplate")
         loTemplate = value;
-    else if (name == "childroot")
+    else if (optionName == "childroot")
         childRoot = value;
-    else if (name == "losubpath")
+    else if (optionName == "losubpath")
         loSubPath = value;
-    else if (name == "numprespawns")
+    else if (optionName == "numprespawns")
         _numPreSpawnedChildren = std::stoi(value);
-    else if (name == "test")
+    else if (optionName == "test")
         LOOLWSD::doTest = true;
-    else if (name == "child")
+    else if (optionName == "child")
         _childId = std::stoull(value);
-    else if (name == "jail")
+    else if (optionName == "jail")
         jail = value;
 #if ENABLE_DEBUG
-    else if (name == "uid")
+    else if (optionName == "uid")
         uid = std::stoull(value);
 #endif
 }
diff --git a/loolwsd/LoadTest.cpp b/loolwsd/LoadTest.cpp
index a1f0442..9ef5263 100644
--- a/loolwsd/LoadTest.cpp
+++ b/loolwsd/LoadTest.cpp
@@ -303,58 +303,58 @@ std::vector<std::string> LoadTest::getDocList() const
     return _docList;
 }
 
-void LoadTest::defineOptions(OptionSet& options) 
+void LoadTest::defineOptions(OptionSet& optionSet)
 {
-    Application::defineOptions(options);
-
-    options.addOption(Option("help", "", "Display help information on command line arguments.")
-                      .required(false)
-                      .repeatable(false));
-
-    options.addOption(Option("doclist", "", "file containing URIs or pathnames of documents to load, - for stdin")
-                      .required(true)
-                      .repeatable(false)
-                      .argument("file"));
-
-    options.addOption(Option("numclients", "", "number of simultaneous clients to simulate")
-                      .required(false)
-                      .repeatable(false)
-                      .argument("number"));
-
-    options.addOption(Option("numdocs", "", "number of sequential documents per client")
-                      .required(false)
-                      .repeatable(false)
-                      .argument("number"));
-
-    options.addOption(Option("duration", "", "duration in hours")
-                      .required(false)
-                      .repeatable(false)
-                      .argument("hours"));
-
-    options.addOption(Option("server", "", "URI of LOOL server")
-                      .required(false)
-                      .repeatable(false)
-                      .argument("uri"));
+    Application::defineOptions(optionSet);
+
+    optionSet.addOption(Option("help", "", "Display help information on command line arguments.")
+                        .required(false)
+                        .repeatable(false));
+
+    optionSet.addOption(Option("doclist", "", "file containing URIs or pathnames of documents to load, - for stdin")
+                        .required(true)
+                        .repeatable(false)
+                        .argument("file"));
+
+    optionSet.addOption(Option("numclients", "", "number of simultaneous clients to simulate")
+                        .required(false)
+                        .repeatable(false)
+                        .argument("number"));
+
+    optionSet.addOption(Option("numdocs", "", "number of sequential documents per client")
+                        .required(false)
+                        .repeatable(false)
+                        .argument("number"));
+
+    optionSet.addOption(Option("duration", "", "duration in hours")
+                        .required(false)
+                        .repeatable(false)
+                        .argument("hours"));
+
+    optionSet.addOption(Option("server", "", "URI of LOOL server")
+                        .required(false)
+                        .repeatable(false)
+                        .argument("uri"));
 }
 
-void LoadTest::handleOption(const std::string& name, const std::string& value)
+void LoadTest::handleOption(const std::string& optionName, const std::string& value)
 {
-    Application::handleOption(name, value);
+    Application::handleOption(optionName, value);
 
-    if (name == "help")
+    if (optionName == "help")
     {
         displayHelp();
         exit(Application::EXIT_OK);
     }
-    else if (name == "doclist")
+    else if (optionName == "doclist")
         _docList = readDocList(value);
-    else if (name == "numclients")
+    else if (optionName == "numclients")
         _numClients = std::stoi(value);
-    else if (name == "numdocs")
+    else if (optionName == "numdocs")
         _numDocsPerClient = std::stoi(value);
-    else if (name == "duration")
+    else if (optionName == "duration")
         _duration = std::stoi(value);
-    else if (name == "url")
+    else if (optionName == "url")
         _url = value;
 }
 
diff --git a/loolwsd/configure.ac b/loolwsd/configure.ac
index 5e219d5..59c23a6 100644
--- a/loolwsd/configure.ac
+++ b/loolwsd/configure.ac
@@ -61,7 +61,7 @@ AS_IF([test "$enable_debug" = yes],
 # Test for build environment
 
 CXXFLAGS="$CXXFLAGS -std=c++11"
-CXXFLAGS="$CXXFLAGS -Wall -Wextra -Werror"
+CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wshadow -Werror"
 
 AS_IF([test -n "$with_lokit_path"],
       [CPPFLAGS="$CPPFLAGS -I${with_lokit_path}"])
diff --git a/loolwsd/test/httpwstest.cpp b/loolwsd/test/httpwstest.cpp
index c42bd87..2cb08fd 100644
--- a/loolwsd/test/httpwstest.cpp
+++ b/loolwsd/test/httpwstest.cpp
@@ -58,11 +58,11 @@ void HTTPWSTest::testPaste()
         n = socket.receiveFrame(buffer, sizeof(buffer), flags);
         if (n > 0 && (flags & Poco::Net::WebSocket::FRAME_OP_BITMASK) != Poco::Net::WebSocket::FRAME_OP_CLOSE)
         {
-            std::string response = LOOLProtocol::getFirstLine(buffer, n);
+            std::string line = LOOLProtocol::getFirstLine(buffer, n);
             std::string prefix = "textselectioncontent: ";
-            if (response.find(prefix) == 0)
+            if (line.find(prefix) == 0)
             {
-                selection = response.substr(prefix.length());
+                selection = line.substr(prefix.length());
                 break;
             }
         }


More information about the Libreoffice-commits mailing list