common/Common.hpp | 12 - common/FileUtil.cpp | 2 common/IoUtil.cpp | 12 - common/Message.hpp | 8 - common/MessageQueue.cpp | 22 +-- common/MessageQueue.hpp | 6 common/Png.hpp | 2 common/Protocol.cpp | 6 common/Protocol.hpp | 16 +- common/Session.cpp | 2 common/SigUtil.cpp | 4 common/Util.cpp | 10 - common/Util.hpp | 12 - kit/ChildSession.cpp | 34 ++-- kit/ChildSession.hpp | 4 kit/ForKit.cpp | 10 - kit/Kit.cpp | 92 ++++++------- kit/KitHelper.hpp | 6 net/WebSocketHandler.hpp | 8 - test/TileCacheTests.cpp | 124 ++++++++--------- test/UnitFuzz.cpp | 4 test/UnitPrefork.cpp | 2 test/countloolkits.hpp | 10 - test/helpers.hpp | 10 - test/httpcrashtest.cpp | 20 +- test/httpwserror.cpp | 20 +- test/httpwstest.cpp | 270 +++++++++++++++++++-------------------- test/integration-http-server.cpp | 2 tools/Replay.hpp | 24 +-- tools/Stress.cpp | 30 ++-- tools/map.cpp | 8 - wsd/Admin.cpp | 14 +- wsd/AdminModel.cpp | 8 - wsd/ClientSession.cpp | 24 +-- wsd/ClientSession.hpp | 2 wsd/DocumentBroker.cpp | 62 ++++---- wsd/FileServer.cpp | 16 +- wsd/LOOLWSD.cpp | 96 ++++++------- wsd/LOOLWSD.hpp | 2 wsd/SenderQueue.hpp | 6 wsd/Storage.cpp | 28 ++-- wsd/TileCache.cpp | 14 +- wsd/TileDesc.hpp | 12 - wsd/TraceFile.hpp | 10 - wsd/UserMessages.hpp | 4 45 files changed, 545 insertions(+), 545 deletions(-)
New commits: commit 1dde430bcf9b9cd6febd18547c3d3992d76cef61 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Feb 7 10:17:59 2018 +0100 wsd: spell out non-trivial autos to improve readability Change-Id: I0e1f169fc39e5c722704e1cae487147d929f7350 diff --git a/wsd/Admin.cpp b/wsd/Admin.cpp index 2c4dbc72..74b7542f 100644 --- a/wsd/Admin.cpp +++ b/wsd/Admin.cpp @@ -73,7 +73,7 @@ void AdminSocketHandler::handleMessage(bool /* fin */, WSOpCode /* code */, std::string jwtToken; LOOLProtocol::getTokenString(tokens[1], "jwt", jwtToken); const auto& config = Application::instance().config(); - const auto sslKeyPath = config.getString("ssl.key_file_path", ""); + const std::string sslKeyPath = config.getString("ssl.key_file_path", ""); LOG_INF("Verifying JWT token: " << jwtToken); JWTAuth authAgent(sslKeyPath, "admin", "admin", "admin"); @@ -158,7 +158,7 @@ void AdminSocketHandler::handleMessage(bool /* fin */, WSOpCode /* code */, { try { - const auto pid = std::stoi(tokens[1]); + const int pid = std::stoi(tokens[1]); LOG_INF("Admin request to kill PID: " << pid); SigUtil::killChild(pid); } @@ -291,10 +291,10 @@ bool AdminSocketHandler::handleInitialRequest( const std::weak_ptr<StreamSocket> &socketWeak, const Poco::Net::HTTPRequest& request) { - auto socket = socketWeak.lock(); + std::shared_ptr<StreamSocket> socket = socketWeak.lock(); // Different session id pool for admin sessions (?) - const auto sessionId = Util::decodeId(LOOLWSD::GenSessionId()); + const size_t sessionId = Util::decodeId(LOOLWSD::GenSessionId()); const std::string& requestURI = request.getURI(); StringTokenizer pathTokens(requestURI, "/", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM); @@ -349,7 +349,7 @@ Admin::Admin() : LOG_TRC("Total available memory: " << _totalAvailMemKb << " KB (memproportion: " << memLimit << "%)."); - const auto totalMem = getTotalMemoryUsage(); + const size_t totalMem = getTotalMemoryUsage(); LOG_TRC("Total memory used: " << totalMem << " KB."); _model.addMemStats(totalMem); } @@ -378,7 +378,7 @@ void Admin::pollingThread() if (cpuWait <= MinStatsIntervalMs / 2) // Close enough { const size_t currentJiffies = getTotalCpuUsage(); - auto cpuPercent = 100 * 1000 * currentJiffies / (sysconf (_SC_CLK_TCK) * _cpuStatsTaskIntervalMs); + size_t cpuPercent = 100 * 1000 * currentJiffies / (sysconf (_SC_CLK_TCK) * _cpuStatsTaskIntervalMs); _model.addCpuStats(cpuPercent); lastCPU = now; @@ -389,7 +389,7 @@ void Admin::pollingThread() std::chrono::duration_cast<std::chrono::milliseconds>(now - lastMem).count(); if (memWait <= MinStatsIntervalMs / 2) // Close enough { - const auto totalMem = getTotalMemoryUsage(); + const size_t totalMem = getTotalMemoryUsage(); if (totalMem != _lastTotalMemory) { LOG_TRC("Total memory used: " << totalMem << " KB."); diff --git a/wsd/AdminModel.cpp b/wsd/AdminModel.cpp index 337cc83a..6a9065fd 100644 --- a/wsd/AdminModel.cpp +++ b/wsd/AdminModel.cpp @@ -105,7 +105,7 @@ const std::string Document::getHistory() const void Document::takeSnapshot() { - auto p = getSnapshot(); + std::pair<std::time_t, std::string> p = getSnapshot(); auto insPoint = _snapshots.upper_bound(p.first); _snapshots.insert(insPoint, p); } @@ -128,7 +128,7 @@ bool Subscriber::notify(const std::string& message) { // If there is no socket, then return false to // signify we're disconnected. - auto webSocket = _ws.lock(); + std::shared_ptr<WebSocketHandler> webSocket = _ws.lock(); if (webSocket) { if (_subscriptions.find(LOOLProtocol::getFirstToken(message)) == _subscriptions.end()) @@ -265,7 +265,7 @@ unsigned AdminModel::getKitsMemoryUsage() { if (!it.second.isExpired()) { - const auto bytes = it.second.getMemoryDirty(); + const int bytes = it.second.getMemoryDirty(); if (bytes > 0) { totalMem += bytes; @@ -292,7 +292,7 @@ size_t AdminModel::getKitsJiffies() { if (!it.second.isExpired()) { - const auto pid = it.second.getPid(); + const int pid = it.second.getPid(); if (pid > 0) { unsigned newJ = Util::getCpuUsage(pid); diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp index f644ae2c..8d727247 100644 --- a/wsd/ClientSession.cpp +++ b/wsd/ClientSession.cpp @@ -68,7 +68,7 @@ bool ClientSession::_handleInput(const char *buffer, int length) const std::string firstLine = getFirstLine(buffer, length); const std::vector<std::string> tokens = LOOLProtocol::tokenize(firstLine.data(), firstLine.size()); - auto docBroker = getDocumentBroker(); + std::shared_ptr<DocumentBroker> docBroker = getDocumentBroker(); if (!docBroker) { LOG_ERR("No DocBroker found. Terminating session " << getName()); @@ -91,7 +91,7 @@ bool ClientSession::_handleInput(const char *buffer, int length) return false; } - const auto versionTuple = ParseVersion(tokens[1]); + const std::tuple<int, int, std::string> versionTuple = ParseVersion(tokens[1]); if (std::get<0>(versionTuple) != ProtocolMajorVersionNumber || std::get<1>(versionTuple) != ProtocolMinorVersionNumber) { @@ -408,7 +408,7 @@ bool ClientSession::sendTile(const char * /*buffer*/, int /*length*/, const std: { try { - auto tileDesc = TileDesc::parse(tokens); + TileDesc tileDesc = TileDesc::parse(tokens); docBroker->handleTileRequest(tileDesc, shared_from_this()); } catch (const std::exception& exc) @@ -425,7 +425,7 @@ bool ClientSession::sendCombinedTiles(const char* /*buffer*/, int /*length*/, co { try { - auto tileCombined = TileCombined::parse(tokens); + TileCombined tileCombined = TileCombined::parse(tokens); docBroker->handleTileCombinedRequest(tileCombined, shared_from_this()); } catch (const std::exception& exc) @@ -552,7 +552,7 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt LOG_TRC(getName() << ": handling kit-to-client [" << payload->abbr() << "]."); const std::string& firstLine = payload->firstLine(); - const auto docBroker = _docBroker.lock(); + const std::shared_ptr<DocumentBroker> docBroker = _docBroker.lock(); if (!docBroker) { LOG_ERR("No DocBroker to handle kit-to-client message: " << firstLine); @@ -566,12 +566,12 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt { const std::string stringMsg(buffer, length); LOG_INF(getName() << ": Command: " << stringMsg); - const auto index = stringMsg.find_first_of('{'); + const size_t index = stringMsg.find_first_of('{'); if (index != std::string::npos) { const std::string stringJSON = stringMsg.substr(index); Poco::JSON::Parser parser; - const auto parsedJSON = parser.parse(stringJSON); + const Poco::Dynamic::Var parsedJSON = parser.parse(stringJSON); const auto& object = parsedJSON.extract<Poco::JSON::Object::Ptr>(); if (object->get("commandName").toString() == ".uno:Save") { @@ -579,7 +579,7 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt std::string result; if (object->has("result")) { - const auto parsedResultJSON = object->get("result"); + const Poco::Dynamic::Var parsedResultJSON = object->get("result"); const auto& resultObj = parsedResultJSON.extract<Poco::JSON::Object::Ptr>(); if (resultObj->get("type").toString() == "string") result = resultObj->get("value").toString(); @@ -747,12 +747,12 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt else if (tokens[0] == "commandvalues:") { const std::string stringMsg(buffer, length); - const auto index = stringMsg.find_first_of('{'); + const size_t index = stringMsg.find_first_of('{'); if (index != std::string::npos) { const std::string stringJSON = stringMsg.substr(index); Poco::JSON::Parser parser; - const auto result = parser.parse(stringJSON); + const Poco::Dynamic::Var result = parser.parse(stringJSON); const auto& object = result.extract<Poco::JSON::Object::Ptr>(); const std::string commandName = object->has("commandName") ? object->get("commandName").toString() : ""; if (commandName == ".uno:CharFontName" || @@ -862,10 +862,10 @@ void ClientSession::onDisconnect() { LOG_INF(getName() << " Disconnected, current number of connections: " << LOOLWSD::NumConnections); - const auto docBroker = getDocumentBroker(); + const std::shared_ptr<DocumentBroker> docBroker = getDocumentBroker(); LOG_CHECK_RET(docBroker && "Null DocumentBroker instance", ); docBroker->assertCorrectThread(); - const auto docKey = docBroker->getDocKey(); + const std::string docKey = docBroker->getDocKey(); try { diff --git a/wsd/ClientSession.hpp b/wsd/ClientSession.hpp index abadb86d..2366ca78 100644 --- a/wsd/ClientSession.hpp +++ b/wsd/ClientSession.hpp @@ -73,7 +73,7 @@ public: void enqueueSendMessage(const std::shared_ptr<Message>& data) { - const auto docBroker = _docBroker.lock(); + const std::shared_ptr<DocumentBroker> docBroker = _docBroker.lock(); // If in the correct thread - no need for wakeups. if (docBroker) docBroker->assertCorrectThread(); diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index a985fe36..bf21b7ae 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -74,7 +74,7 @@ Poco::URI DocumentBroker::sanitizeURI(const std::string& uri) // The URI of the document should be url-encoded. std::string decodedUri; Poco::URI::decode(uri, decodedUri); - auto uriPublic = Poco::URI(decodedUri); + Poco::URI uriPublic(decodedUri); if (uriPublic.isRelative() || uriPublic.getScheme() == "file") { @@ -429,7 +429,7 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s // We need to map it to a jailed path and copy the file there. // user/doc/jailId - const auto jailPath = Poco::Path(JAILED_DOCUMENT_ROOT, jailId); + const Poco::Path jailPath(JAILED_DOCUMENT_ROOT, jailId); std::string jailRoot = getJailRoot(); LOG_INF("jailPath: " << jailPath.toString() << ", jailRoot: " << jailRoot); @@ -555,7 +555,7 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s session->setWatermarkText(watermarkText); // Basic file information was stored by the above getWOPIFileInfo() or getLocalFileInfo() calls - const auto fileInfo = _storage->getFileInfo(); + const StorageBase::FileInfo fileInfo = _storage->getFileInfo(); if (!fileInfo.isValid()) { LOG_ERR("Invalid fileinfo for URI [" << session->getPublicUri().toString() << "]."); @@ -593,7 +593,7 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s // Let's load the document now, if not loaded. if (!_storage->isLoaded()) { - auto localPath = _storage->loadStorageFileToLocal(session->getAuthorization()); + std::string localPath = _storage->loadStorageFileToLocal(session->getAuthorization()); // Check if we have a prefilter "plugin" for this document format for (const auto& plugin : LOOLWSD::PluginConfigurations) @@ -755,10 +755,10 @@ bool DocumentBroker::saveToStorageInternal(const std::string& sessionId, } const Authorization auth = it->second->getAuthorization(); - const auto uri = isSaveAs? saveAsPath: it->second->getPublicUri().toString(); + const std::string uri = isSaveAs? saveAsPath: it->second->getPublicUri().toString(); // If the file timestamp hasn't changed, skip saving. - const auto newFileModifiedTime = Poco::File(_storage->getRootFilePath()).getLastModified(); + const Poco::Timestamp newFileModifiedTime = Poco::File(_storage->getRootFilePath()).getLastModified(); if (!isSaveAs && newFileModifiedTime == _lastFileModifiedTime) { // Nothing to do. @@ -903,14 +903,14 @@ bool DocumentBroker::autoSave(const bool force) } else if (_isModified) { - const auto now = std::chrono::steady_clock::now(); - const auto inactivityTimeMs = std::chrono::duration_cast<std::chrono::milliseconds>(now - _lastActivityTime).count(); - const auto timeSinceLastSaveMs = std::chrono::duration_cast<std::chrono::milliseconds>(now - _lastSaveTime).count(); + const std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now(); + const std::chrono::milliseconds::rep inactivityTimeMs = std::chrono::duration_cast<std::chrono::milliseconds>(now - _lastActivityTime).count(); + const std::chrono::milliseconds::rep timeSinceLastSaveMs = std::chrono::duration_cast<std::chrono::milliseconds>(now - _lastSaveTime).count(); LOG_TRC("Time since last save of docKey [" << _docKey << "] is " << timeSinceLastSaveMs << "ms and most recent activity was " << inactivityTimeMs << "ms ago."); - static const auto idleSaveDurationMs = LOOLWSD::getConfigValue<int>("per_document.idlesave_duration_secs", 30) * 1000; - static const auto autoSaveDurationMs = LOOLWSD::getConfigValue<int>("per_document.autosave_duration_secs", 300) * 1000; + static const int idleSaveDurationMs = LOOLWSD::getConfigValue<int>("per_document.idlesave_duration_secs", 30) * 1000; + static const int autoSaveDurationMs = LOOLWSD::getConfigValue<int>("per_document.autosave_duration_secs", 300) * 1000; // Either we've been idle long enough, or it's auto-save time. if (inactivityTimeMs >= idleSaveDurationMs || timeSinceLastSaveMs >= autoSaveDurationMs) @@ -967,7 +967,7 @@ bool DocumentBroker::sendUnoSave(const std::string& sessionId, bool dontTerminat assert(_storage); _storage->setIsAutosave(isAutosave || UnitWSD::get().isAutosave()); - const auto saveArgs = oss.str(); + const std::string saveArgs = oss.str(); LOG_TRC(".uno:Save arguments: " << saveArgs); const auto command = "uno .uno:Save " + saveArgs; forwardToChild(sessionId, command); @@ -1030,7 +1030,7 @@ size_t DocumentBroker::addSessionInternal(const std::shared_ptr<ClientSession>& throw; } - const auto id = session->getId(); + const std::string id = session->getId(); // Request a new session from the child kit. const std::string aMessage = "session " + id + ' ' + _docKey + ' ' + _docId; @@ -1043,7 +1043,7 @@ size_t DocumentBroker::addSessionInternal(const std::shared_ptr<ClientSession>& _sessions.emplace(session->getId(), session); session->setAttached(); - const auto count = _sessions.size(); + const size_t count = _sessions.size(); LOG_TRC("Added " << (session->isReadOnly() ? "readonly" : "non-readonly") << " session [" << id << "] to docKey [" << _docKey << "] to have " << count << " sessions."); @@ -1097,14 +1097,14 @@ size_t DocumentBroker::removeSessionInternal(const std::string& id) { LOOLWSD::dumpEndSessionTrace(getJailId(), id, _uriOrig); - const auto readonly = (it->second ? it->second->isReadOnly() : false); + const bool readonly = (it->second ? it->second->isReadOnly() : false); // Remove. The caller must have a reference to the session // in question, lest we destroy from underneith them. _sessions.erase(it); - const auto count = _sessions.size(); + const size_t count = _sessions.size(); - auto logger = Log::trace(); + Log::StreamLogger logger = Log::trace(); if (logger.enabled()) { logger << "Removed " << (readonly ? "readonly" : "non-readonly") @@ -1227,7 +1227,7 @@ void DocumentBroker::handleTileRequest(TileDesc& tile, std::unique_lock<std::mutex> lock(_mutex); tile.setVersion(++_tileVersion); - const auto tileMsg = tile.serialize(); + const std::string tileMsg = tile.serialize(); LOG_TRC("Tile request for " << tileMsg); std::unique_ptr<std::fstream> cachedTile = _tileCache->lookupTile(tile); @@ -1246,7 +1246,7 @@ void DocumentBroker::handleTileRequest(TileDesc& tile, assert(cachedTile->is_open()); cachedTile->seekg(0, std::ios_base::end); - const auto pos = output.size(); + const size_t pos = output.size(); std::streamsize size = cachedTile->tellg(); output.resize(pos + size); cachedTile->seekg(0, std::ios_base::beg); @@ -1305,7 +1305,7 @@ void DocumentBroker::handleTileCombinedRequest(TileCombined& tileCombined, assert(cachedTile->is_open()); cachedTile->seekg(0, std::ios_base::end); - const auto pos = output.size(); + const size_t pos = output.size(); std::streamsize size = cachedTile->tellg(); output.resize(pos + size); cachedTile->seekg(0, std::ios_base::beg); @@ -1326,10 +1326,10 @@ void DocumentBroker::handleTileCombinedRequest(TileCombined& tileCombined, if (!tiles.empty()) { - auto newTileCombined = TileCombined::create(tiles); + TileCombined newTileCombined = TileCombined::create(tiles); // Forward to child to render. - const auto req = newTileCombined.serialize("tilecombine"); + const std::string req = newTileCombined.serialize("tilecombine"); LOG_DBG("Sending residual tilecombine: " << req); _childProcess->sendTextFrame(req); } @@ -1339,7 +1339,7 @@ void DocumentBroker::cancelTileRequests(const std::shared_ptr<ClientSession>& se { std::unique_lock<std::mutex> lock(_mutex); - const auto canceltiles = tileCache().cancelTiles(session); + const std::string canceltiles = tileCache().cancelTiles(session); if (!canceltiles.empty()) { LOG_DBG("Forwarding canceltiles request: " << canceltiles); @@ -1354,12 +1354,12 @@ void DocumentBroker::handleTileResponse(const std::vector<char>& payload) try { - const auto length = payload.size(); + const size_t length = payload.size(); if (firstLine.size() < static_cast<std::string::size_type>(length) - 1) { - const auto tile = TileDesc::parse(firstLine); - const auto buffer = payload.data(); - const auto offset = firstLine.size() + 1; + const TileDesc tile = TileDesc::parse(firstLine); + const char* buffer = payload.data(); + const size_t offset = firstLine.size() + 1; std::unique_lock<std::mutex> lock(_mutex); @@ -1384,12 +1384,12 @@ void DocumentBroker::handleTileCombinedResponse(const std::vector<char>& payload try { - const auto length = payload.size(); + const size_t length = payload.size(); if (firstLine.size() < static_cast<std::string::size_type>(length) - 1) { - const auto tileCombined = TileCombined::parse(firstLine); - const auto buffer = payload.data(); - auto offset = firstLine.size() + 1; + const TileCombined tileCombined = TileCombined::parse(firstLine); + const char* buffer = payload.data(); + size_t offset = firstLine.size() + 1; std::unique_lock<std::mutex> lock(_mutex); diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp index baa5931b..9ceb86ba 100644 --- a/wsd/FileServer.cpp +++ b/wsd/FileServer.cpp @@ -114,7 +114,7 @@ bool FileServerRequestHandler::isAdminLoggedIn(const HTTPRequest& request, HTTPResponse &response) { const auto& config = Application::instance().config(); - const auto sslKeyPath = config.getString("ssl.key_file_path", ""); + const std::string sslKeyPath = config.getString("ssl.key_file_path", ""); NameValueCollection cookies; request.getCookies(cookies); @@ -318,7 +318,7 @@ void FileServerRequestHandler::handleRequest(const HTTPRequest& request, Poco::M { // Useful to not serve from memory sometimes especially during loleaflet development // Avoids having to restart loolwsd everytime you make a change in loleaflet - const auto filePath = Poco::Path(LOOLWSD::FileServerRoot, relPath).absolute().toString(); + const std::string filePath = Poco::Path(LOOLWSD::FileServerRoot, relPath).absolute().toString(); HttpHelper::sendFile(socket, filePath, mimeType, response, noCache); return; } @@ -423,7 +423,7 @@ void FileServerRequestHandler::readDirToHash(const std::string &basePath, const strm.opaque = Z_NULL; deflateInit2(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 31, 8, Z_DEFAULT_STRATEGY); - auto buf = std::unique_ptr<char[]>(new char[fileStat.st_size]); + std::unique_ptr<char[]> buf(new char[fileStat.st_size]); std::string compressedFile; compressedFile.reserve(fileStat.st_size); std::string uncompressedFile; @@ -500,7 +500,7 @@ std::string FileServerRequestHandler::getRequestPathname(const HTTPRequest& requ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco::MemoryInputStream& message, const std::shared_ptr<StreamSocket>& socket) { const auto host = ((LOOLWSD::isSSLEnabled() || LOOLWSD::isSSLTermination()) ? "wss://" : "ws://") + (LOOLWSD::ServerName.empty() ? request.getHost() : LOOLWSD::ServerName); - const auto params = Poco::URI(request.getURI()).getQueryParameters(); + const Poco::URI::QueryParameters params = Poco::URI(request.getURI()).getQueryParameters(); // Is this a file we read at startup - if not; its not for serving. const std::string relPath = getRequestPathname(request); @@ -548,11 +548,11 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco:: Poco::replaceInPlace(preprocess, std::string("%VERSION%"), std::string(LOOLWSD_VERSION_HASH)); const auto& config = Application::instance().config(); - const auto loleafletLogging = config.getString("loleaflet_logging", "false"); + const std::string loleafletLogging = config.getString("loleaflet_logging", "false"); Poco::replaceInPlace(preprocess, std::string("%LOLEAFLET_LOGGING%"), loleafletLogging); - const auto outOfFocusTimeoutSecs= config.getString("per_view.out_of_focus_timeout_secs", "60"); + const std::string outOfFocusTimeoutSecs= config.getString("per_view.out_of_focus_timeout_secs", "60"); Poco::replaceInPlace(preprocess, std::string("%OUT_OF_FOCUS_TIMEOUT_SECS%"), outOfFocusTimeoutSecs); - const auto idleTimeoutSecs= config.getString("per_view.idle_timeout_secs", "900"); + const std::string idleTimeoutSecs= config.getString("per_view.idle_timeout_secs", "900"); Poco::replaceInPlace(preprocess, std::string("%IDLE_TIMEOUT_SECS%"), idleTimeoutSecs); const std::string mimeType = "text/html"; @@ -633,7 +633,7 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco:: bool keysPinned = false; while (config.has(pinPath)) { - const auto pin = config.getString(pinPath, ""); + const std::string pin = config.getString(pinPath, ""); if (!pin.empty()) { hpkpOss << "pin-sha256=\"" << pin << "\"; "; diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index 6b6696d8..9c598725 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -238,10 +238,10 @@ void cleanupDocBrokers() { Util::assertIsLocked(DocBrokersMutex); - const auto count = DocBrokers.size(); + const size_t count = DocBrokers.size(); for (auto it = DocBrokers.begin(); it != DocBrokers.end(); ) { - auto docBroker = it->second; + std::shared_ptr<DocumentBroker> docBroker = it->second; // Remove only when not alive. if (!docBroker->isAlive()) @@ -256,7 +256,7 @@ void cleanupDocBrokers() if (count != DocBrokers.size()) { - auto logger = Log::trace(); + Log::StreamLogger logger = Log::trace(); if (logger.enabled()) { logger << "Have " << DocBrokers.size() << " DocBrokers after cleanup.\n"; @@ -338,7 +338,7 @@ static int rebalanceChildren(int balance) const bool rebalance = cleanupChildren(); const auto duration = (std::chrono::steady_clock::now() - LastForkRequestTime); - const auto durationMs = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count(); + const std::chrono::milliseconds::rep durationMs = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count(); if (OutstandingForks != 0 && durationMs >= CHILD_TIMEOUT_MS) { // Children taking too long to spawn. @@ -348,7 +348,7 @@ static int rebalanceChildren(int balance) OutstandingForks = 0; } - const auto available = NewChildren.size(); + const size_t available = NewChildren.size(); balance -= available; balance -= OutstandingForks; @@ -383,7 +383,7 @@ static size_t addNewChild(const std::shared_ptr<ChildProcess>& child) ++OutstandingForks; NewChildren.emplace_back(child); - const auto count = NewChildren.size(); + const size_t count = NewChildren.size(); LOG_INF("Have " << count << " spare " << (count == 1 ? "child" : "children") << " after adding [" << child->getPid() << "]."); lock.unlock(); @@ -421,9 +421,9 @@ std::shared_ptr<ChildProcess> getNewChild_Blocks() // there are some on the way already. And if the system is slow already, that wouldn't help. if (NewChildrenCV.wait_for(lock, timeout, []() { return !NewChildren.empty(); })) { - auto child = NewChildren.back(); + std::shared_ptr<ChildProcess> child = NewChildren.back(); NewChildren.pop_back(); - const auto available = NewChildren.size(); + const size_t available = NewChildren.size(); // Validate before returning. if (child && child->isAlive()) @@ -721,7 +721,7 @@ void LOOLWSD::initialize(Application& self) // Set the log-level after complete initialization to force maximum details at startup. LogLevel = getConfigValue<std::string>(conf, "logging.level", "trace"); setenv("LOOL_LOGLEVEL", LogLevel.c_str(), true); - const auto withColor = getConfigValue<bool>(conf, "logging.color", true) && isatty(fileno(stderr)); + const bool withColor = getConfigValue<bool>(conf, "logging.color", true) && isatty(fileno(stderr)); if (withColor) { setenv("LOOL_LOGCOLOR", "1", true); @@ -732,10 +732,10 @@ void LOOLWSD::initialize(Application& self) for (size_t i = 0; ; ++i) { const std::string confPath = "logging.file.property[" + std::to_string(i) + "]"; - const auto confName = config().getString(confPath + "[@name]", ""); + const std::string confName = config().getString(confPath + "[@name]", ""); if (!confName.empty()) { - const auto value = config().getString(confPath, ""); + const std::string value = config().getString(confPath, ""); logProperties.emplace(confName, value); } else if (!config().has(confPath)) @@ -897,7 +897,7 @@ void LOOLWSD::initialize(Application& self) for (size_t i = 0; ; ++i) { const std::string confPath = "trace.filter.message[" + std::to_string(i) + "]"; - const auto regex = config().getString(confPath, ""); + const std::string regex = config().getString(confPath, ""); if (!regex.empty()) { filters.push_back(regex); @@ -942,16 +942,16 @@ void LOOLWSD::initializeSSL() if (!LOOLWSD::isSSLEnabled()) return; - const auto ssl_cert_file_path = getPathFromConfig("ssl.cert_file_path"); + const std::string ssl_cert_file_path = getPathFromConfig("ssl.cert_file_path"); LOG_INF("SSL Cert file: " << ssl_cert_file_path); - const auto ssl_key_file_path = getPathFromConfig("ssl.key_file_path"); + const std::string ssl_key_file_path = getPathFromConfig("ssl.key_file_path"); LOG_INF("SSL Key file: " << ssl_key_file_path); - const auto ssl_ca_file_path = getPathFromConfig("ssl.ca_file_path"); + const std::string ssl_ca_file_path = getPathFromConfig("ssl.ca_file_path"); LOG_INF("SSL CA file: " << ssl_ca_file_path); - const auto ssl_cipher_list = config().getString("ssl.cipher_list", ""); + const std::string ssl_cipher_list = config().getString("ssl.cipher_list", ""); LOG_INF("SSL Cipher list: " << ssl_cipher_list); #if ENABLE_SSL @@ -1519,8 +1519,8 @@ public: ~PrisonerRequestDispatcher() { // Notify the broker that we're done. - auto child = _childProcess.lock(); - auto docBroker = child ? child->getDocumentBroker() : nullptr; + std::shared_ptr<ChildProcess> child = _childProcess.lock(); + std::shared_ptr<DocumentBroker> docBroker = child ? child->getDocumentBroker() : nullptr; if (docBroker) { // FIXME: No need to notify if asked to stop. @@ -1538,18 +1538,18 @@ private: void onDisconnect() override { - auto socket = _socket.lock(); + std::shared_ptr<StreamSocket> socket = _socket.lock(); if (socket) LOG_TRC("#" << socket->getFD() << " Prisoner connection disconnected."); else LOG_WRN("Prisoner connection disconnected but without valid socket."); // Notify the broker that we're done. - auto child = _childProcess.lock(); - auto docBroker = child ? child->getDocumentBroker() : nullptr; + std::shared_ptr<ChildProcess> child = _childProcess.lock(); + std::shared_ptr<DocumentBroker> docBroker = child ? child->getDocumentBroker() : nullptr; if (docBroker) { - auto lock = docBroker->getLock(); + std::unique_lock<std::mutex> lock = docBroker->getLock(); docBroker->assertCorrectThread(); docBroker->stop("docisdisconnected"); } @@ -1569,7 +1569,7 @@ private: return; } - auto socket = _socket.lock(); + std::shared_ptr<StreamSocket> socket = _socket.lock(); std::vector<char>& in = socket->_inBuffer; // Find the end of the header, if any. @@ -1591,7 +1591,7 @@ private: { request.read(message); - auto logger = Log::info(); + Log::StreamLogger logger = Log::info(); if (logger.enabled()) { logger << "#" << socket->getFD() << ": Prisoner HTTP Request: " @@ -1615,7 +1615,7 @@ private: } // New Child is spawned. - const auto params = Poco::URI(request.getURI()).getQueryParameters(); + const Poco::URI::QueryParameters params = Poco::URI(request.getURI()).getQueryParameters(); Poco::Process::PID pid = -1; std::string jailId; for (const auto& param : params) @@ -1677,14 +1677,14 @@ private: return; const std::string abbr = getAbbreviatedMessage(data); - auto socket = _socket.lock(); + std::shared_ptr<StreamSocket> socket = _socket.lock(); if (socket) LOG_TRC("#" << socket->getFD() << " Prisoner message [" << abbr << "]."); else LOG_WRN("Message handler called but without valid socket."); - auto child = _childProcess.lock(); - auto docBroker = child ? child->getDocumentBroker() : nullptr; + std::shared_ptr<ChildProcess> child = _childProcess.lock(); + std::shared_ptr<DocumentBroker> docBroker = child ? child->getDocumentBroker() : nullptr; if (docBroker) docBroker->handleInput(data); else @@ -1729,7 +1729,7 @@ private: /// Called after successful socket reads. void handleIncomingMessage(SocketDisposition &disposition) override { - auto socket = _socket.lock(); + std::shared_ptr<StreamSocket> socket = _socket.lock(); std::vector<char>& in = socket->_inBuffer; LOG_TRC("#" << socket->getFD() << " handling incoming " << in.size() << " bytes."); @@ -1752,7 +1752,7 @@ private: { request.read(message); - auto logger = Log::info(); + Log::StreamLogger logger = Log::info(); if (logger.enabled()) { logger << "#" << socket->getFD() << ": Client HTTP Request: " @@ -1893,7 +1893,7 @@ private: void handleFileServerRequest(const Poco::Net::HTTPRequest& request, Poco::MemoryInputStream& message) { - auto socket = _socket.lock(); + std::shared_ptr<StreamSocket> socket = _socket.lock(); FileServerRequestHandler::handleRequest(request, message, socket); socket->shutdown(); } @@ -1917,7 +1917,7 @@ private: oss << responseString; } - auto socket = _socket.lock(); + std::shared_ptr<StreamSocket> socket = _socket.lock(); socket->send(oss.str()); socket->shutdown(); LOG_INF("Sent / response successfully."); @@ -1933,7 +1933,7 @@ private: faviconPath = LOOLWSD::FileServerRoot + "/favicon.ico"; } - auto socket = _socket.lock(); + std::shared_ptr<StreamSocket> socket = _socket.lock(); Poco::Net::HTTPResponse response; HttpHelper::sendFile(socket, faviconPath, mimeType, response); socket->shutdown(); @@ -1958,7 +1958,7 @@ private: << "\r\n" << xml; - auto socket = _socket.lock(); + std::shared_ptr<StreamSocket> socket = _socket.lock(); socket->send(oss.str()); socket->shutdown(); LOG_INF("Sent discovery.xml successfully."); @@ -1996,7 +1996,7 @@ private: LOG_INF("Post request: [" << request.getURI() << "]"); Poco::Net::HTTPResponse response; - auto socket = _socket.lock(); + std::shared_ptr<StreamSocket> socket = _socket.lock(); StringTokenizer tokens(request.getURI(), "/?"); if (tokens.count() > 2 && tokens[2] == "convert-to") @@ -2018,8 +2018,8 @@ private: { LOG_INF("Conversion request for URI [" << fromPath << "]."); - auto uriPublic = DocumentBroker::sanitizeURI(fromPath); - const auto docKey = DocumentBroker::getDocKey(uriPublic); + Poco::URI uriPublic = DocumentBroker::sanitizeURI(fromPath); + const std::string docKey = DocumentBroker::getDocKey(uriPublic); // This lock could become a bottleneck. // In that case, we can use a pool and index by publicPath. @@ -2037,7 +2037,7 @@ private: // Load the document. // TODO: Move to DocumentBroker. const bool isReadOnly = true; - auto clientSession = createNewClientSession(nullptr, _id, uriPublic, docBroker, isReadOnly); + std::shared_ptr<ClientSession> clientSession = createNewClientSession(nullptr, _id, uriPublic, docBroker, isReadOnly); if (clientSession) { disposition.setMove([docBroker, clientSession, format] @@ -2113,7 +2113,7 @@ private: std::unique_lock<std::mutex> docBrokersLock(DocBrokersMutex); std::string decodedUri; URI::decode(tokens[2], decodedUri); - const auto docKey = DocumentBroker::getDocKey(DocumentBroker::sanitizeURI(decodedUri)); + const std::string docKey = DocumentBroker::getDocKey(DocumentBroker::sanitizeURI(decodedUri)); auto docBrokerIt = DocBrokers.find(docKey); // Maybe just free the client from sending childid in form ? @@ -2146,7 +2146,7 @@ private: // 1. Validate the dockey std::string decodedUri; URI::decode(tokens[2], decodedUri); - const auto docKey = DocumentBroker::getDocKey(DocumentBroker::sanitizeURI(decodedUri)); + const std::string docKey = DocumentBroker::getDocKey(DocumentBroker::sanitizeURI(decodedUri)); std::unique_lock<std::mutex> docBrokersLock(DocBrokersMutex); auto docBrokerIt = DocBrokers.find(docKey); if (docBrokerIt == DocBrokers.end()) @@ -2211,7 +2211,7 @@ private: void handleClientWsUpgrade(const Poco::Net::HTTPRequest& request, const std::string& url, SocketDisposition &disposition) { - auto socket = _socket.lock(); + std::shared_ptr<StreamSocket> socket = _socket.lock(); if (!socket) { LOG_WRN("No socket to handle client WS upgrade for request: " << request.getURI() << ", url: " << url); @@ -2240,8 +2240,8 @@ private: LOG_TRC("Sending to Client [" << status << "]."); ws.sendMessage(status); - const auto uriPublic = DocumentBroker::sanitizeURI(url); - const auto docKey = DocumentBroker::getDocKey(uriPublic); + const Poco::URI uriPublic = DocumentBroker::sanitizeURI(url); + const std::string docKey = DocumentBroker::getDocKey(uriPublic); LOG_INF("Sanitized URI [" << url << "] to [" << uriPublic.toString() << "] and mapped to docKey [" << docKey << "] for session [" << _id << "]."); @@ -2259,10 +2259,10 @@ private: LOG_INF("URL [" << url << "] is " << (isReadOnly ? "readonly" : "writable") << "."); // Request a kit process for this doc. - auto docBroker = findOrCreateDocBroker(ws, url, docKey, _id, uriPublic); + std::shared_ptr<DocumentBroker> docBroker = findOrCreateDocBroker(ws, url, docKey, _id, uriPublic); if (docBroker) { - auto clientSession = createNewClientSession(&ws, _id, uriPublic, docBroker, isReadOnly); + std::shared_ptr<ClientSession> clientSession = createNewClientSession(&ws, _id, uriPublic, docBroker, isReadOnly); if (clientSession) { // Transfer the client socket to the DocumentBroker when we get back to the poll: @@ -2717,12 +2717,12 @@ int LOOLWSD::innerMain() } else { - const auto timeoutMs = CHILD_TIMEOUT_MS * (LOOLWSD::NoCapsForKit ? 150 : 50); + const long timeoutMs = CHILD_TIMEOUT_MS * (LOOLWSD::NoCapsForKit ? 150 : 50); const auto timeout = std::chrono::milliseconds(timeoutMs); LOG_TRC("Waiting for a new child for a max of " << timeoutMs << " ms."); if (!NewChildrenCV.wait_for(lock, timeout, []() { return !NewChildren.empty(); })) { - const auto msg = "Failed to fork child processes."; + const char* msg = "Failed to fork child processes."; LOG_FTL(msg); std::cerr << "FATAL: " << msg << std::endl; throw std::runtime_error(msg); @@ -2765,7 +2765,7 @@ int LOOLWSD::innerMain() // Wake the prisoner poll to spawn some children, if necessary. PrisonerPoll.wakeup(); - const auto timeSinceStartMs = std::chrono::duration_cast<std::chrono::milliseconds>( + const std::chrono::milliseconds::rep timeSinceStartMs = std::chrono::duration_cast<std::chrono::milliseconds>( std::chrono::steady_clock::now() - startStamp).count(); // Unit test timeout diff --git a/wsd/LOOLWSD.hpp b/wsd/LOOLWSD.hpp index 9e388a6c..c1f603f5 100644 --- a/wsd/LOOLWSD.hpp +++ b/wsd/LOOLWSD.hpp @@ -210,7 +210,7 @@ private: /// Converts relative paths to absolute. std::string getPathFromConfig(const std::string& property) const { - auto path = config().getString(property); + std::string path = config().getString(property); if (path.empty() && config().hasProperty(property + "[@default]")) { // Use the default value if empty and a default provided. diff --git a/wsd/SenderQueue.hpp b/wsd/SenderQueue.hpp index 98059e49..fc3464b3 100644 --- a/wsd/SenderQueue.hpp +++ b/wsd/SenderQueue.hpp @@ -127,9 +127,9 @@ private: // if any, and use most recent (incoming). const std::string newMsg = item->jsonString(); Poco::JSON::Parser newParser; - const auto newResult = newParser.parse(newMsg); + const Poco::Dynamic::Var newResult = newParser.parse(newMsg); const auto& newJson = newResult.extract<Poco::JSON::Object::Ptr>(); - const auto viewId = newJson->get("viewId").toString(); + const std::string viewId = newJson->get("viewId").toString(); const auto& pos = std::find_if(_queue.begin(), _queue.end(), [command, viewId](const queue_item_t& cur) { @@ -137,7 +137,7 @@ private: { const std::string msg = cur->jsonString(); Poco::JSON::Parser parser; - const auto result = parser.parse(msg); + const Poco::Dynamic::Var result = parser.parse(msg); const auto& json = result.extract<Poco::JSON::Object::Ptr>(); return viewId == json->get("viewId").toString(); } diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp index 1227c7fe..5698d24c 100644 --- a/wsd/Storage.cpp +++ b/wsd/Storage.cpp @@ -54,7 +54,7 @@ Util::RegexListMatcher StorageBase::WopiHosts; std::string StorageBase::getLocalRootPath() const { - auto localPath = _jailPath; + std::string localPath = _jailPath; if (localPath[0] == '/') { // Remove the leading / @@ -62,7 +62,7 @@ std::string StorageBase::getLocalRootPath() const } // /chroot/jailId/user/doc/childId - const auto rootPath = Poco::Path(_localStorePath, localPath); + const Poco::Path rootPath = Poco::Path(_localStorePath, localPath); Poco::File(rootPath).createDirectories(); return rootPath.toString(); @@ -86,7 +86,7 @@ void StorageBase::initialize() for (size_t i = 0; ; ++i) { const std::string path = "storage.wopi.host[" + std::to_string(i) + "]"; - const auto host = app.config().getString(path, ""); + const std::string host = app.config().getString(path, ""); if (!host.empty()) { if (app.config().getBool(path + "[@allow]", false)) @@ -233,13 +233,13 @@ std::atomic<unsigned> LocalStorage::LastLocalStorageId; std::unique_ptr<LocalStorage::LocalFileInfo> LocalStorage::getLocalFileInfo() { - const auto path = Poco::Path(_uri.getPath()); + const Poco::Path path = Poco::Path(_uri.getPath()); LOG_DBG("Getting info for local uri [" << _uri.toString() << "], path [" << path.toString() << "]."); const auto& filename = path.getFileName(); - const auto file = Poco::File(path); - const auto lastModified = file.getLastModified(); - const auto size = file.getSize(); + const Poco::File file = Poco::File(path); + const Poco::Timestamp lastModified = file.getLastModified(); + const size_t size = file.getSize(); _fileInfo = FileInfo({filename, "localhost", lastModified, size}); @@ -250,13 +250,13 @@ std::unique_ptr<LocalStorage::LocalFileInfo> LocalStorage::getLocalFileInfo() std::string LocalStorage::loadStorageFileToLocal(const Authorization& /*auth*/) { // /chroot/jailId/user/doc/childId/file.ext - const auto filename = Poco::Path(_uri.getPath()).getFileName(); + const std::string filename = Poco::Path(_uri.getPath()).getFileName(); _jailedFilePath = Poco::Path(getLocalRootPath(), filename).toString(); LOG_INF("Public URI [" << _uri.getPath() << "] jailed to [" << _jailedFilePath << "]."); // Despite the talk about URIs it seems that _uri is actually just a pathname here - const auto publicFilePath = _uri.getPath(); + const std::string publicFilePath = _uri.getPath(); if (!FileUtil::checkDiskSpace(_jailedFilePath)) { @@ -426,12 +426,12 @@ void getWOPIValue(const Poco::JSON::Object::Ptr &object, const std::string& key, bool parseJSON(const std::string& json, Poco::JSON::Object::Ptr& object) { bool success = false; - const auto index = json.find_first_of('{'); + const size_t index = json.find_first_of('{'); if (index != std::string::npos) { const std::string stringJSON = json.substr(index); Poco::JSON::Parser parser; - const auto result = parser.parse(stringJSON); + const Poco::Dynamic::Var result = parser.parse(stringJSON); object = result.extract<Poco::JSON::Object::Ptr>(); success = true; } @@ -503,7 +503,7 @@ std::unique_ptr<WopiStorage::WOPIFileInfo> WopiStorage::getWOPIFileInfo(const Au std::istream& rs = psession->receiveResponse(response); callDuration = (std::chrono::steady_clock::now() - startTime); - auto logger = Log::trace(); + Log::StreamLogger logger = Log::trace(); if (logger.enabled()) { logger << "WOPI::CheckFileInfo header for URI [" << uriObject.toString() << "]:\n"; @@ -614,7 +614,7 @@ std::string WopiStorage::loadStorageFileToLocal(const Authorization& auth) const std::chrono::duration<double> diff = (std::chrono::steady_clock::now() - startTime); _wopiLoadDuration += diff; - auto logger = Log::trace(); + Log::StreamLogger logger = Log::trace(); if (logger.enabled()) { logger << "WOPI::GetFile header for URI [" << uriObject.toString() << "]:\n"; @@ -664,7 +664,7 @@ StorageBase::SaveResult WopiStorage::saveLocalFileToStorage(const Authorization& const bool isSaveAs = !saveAsPath.empty() && !saveAsFilename.empty(); const std::string filePath(isSaveAs? saveAsPath: _jailedFilePath); - const auto size = getFileSize(filePath); + const size_t size = getFileSize(filePath); Poco::URI uriObject(_uri); uriObject.setPath(isSaveAs? uriObject.getPath(): uriObject.getPath() + "/contents"); diff --git a/wsd/TileCache.cpp b/wsd/TileCache.cpp index e92bb380..95ed5089 100644 --- a/wsd/TileCache.cpp +++ b/wsd/TileCache.cpp @@ -154,7 +154,7 @@ void TileCache::saveTileAndNotify(const TileDesc& tile, const char *data, const std::shared_ptr<TileBeingRendered> tileBeingRendered = findTileBeingRendered(tile); // Save to disk. - const auto cachedName = (tileBeingRendered ? tileBeingRendered->getCacheName() + const std::string cachedName = (tileBeingRendered ? tileBeingRendered->getCacheName() : cacheFileName(tile)); // Ignore if we can't save the tile, things will work anyway, but slower. @@ -168,7 +168,7 @@ void TileCache::saveTileAndNotify(const TileDesc& tile, const char *data, const // Notify subscribers, if any. if (tileBeingRendered) { - const auto subscriberCount = tileBeingRendered->_subscribers.size(); + const size_t subscriberCount = tileBeingRendered->_subscribers.size(); if (subscriberCount > 0) { std::string response = tile.serialize("tile:"); @@ -182,7 +182,7 @@ void TileCache::saveTileAndNotify(const TileDesc& tile, const char *data, const payload->append(data, size); auto& firstSubscriber = tileBeingRendered->_subscribers[0]; - auto firstSession = firstSubscriber.lock(); + std::shared_ptr<ClientSession> firstSession = firstSubscriber.lock(); if (firstSession) firstSession->enqueueSendMessage(payload); @@ -201,7 +201,7 @@ void TileCache::saveTileAndNotify(const TileDesc& tile, const char *data, const for (size_t i = 1; i < subscriberCount; ++i) { auto& subscriber = tileBeingRendered->_subscribers[i]; - auto session = subscriber.lock(); + std::shared_ptr<ClientSession> session = subscriber.lock(); if (session) { session->enqueueSendMessage(payload); @@ -443,7 +443,7 @@ void TileCache::subscribeToTileRendering(const TileDesc& tile, const std::shared { std::ostringstream oss; oss << '(' << tile.getPart() << ',' << tile.getTilePosX() << ',' << tile.getTilePosY() << ')'; - const auto name = oss.str(); + const std::string name = oss.str(); assertCorrectThread(); @@ -494,7 +494,7 @@ std::string TileCache::cancelTiles(const std::shared_ptr<ClientSession> &subscri assertCorrectThread(); - const auto sub = subscriber.get(); + const ClientSession* sub = subscriber.get(); std::ostringstream oss; @@ -529,7 +529,7 @@ std::string TileCache::cancelTiles(const std::shared_ptr<ClientSession> &subscri ++it; } - const auto canceltiles = oss.str(); + const std::string canceltiles = oss.str(); return canceltiles.empty() ? canceltiles : "canceltiles " + canceltiles; } diff --git a/wsd/TileDesc.hpp b/wsd/TileDesc.hpp index 7e738f64..fa945df1 100644 --- a/wsd/TileDesc.hpp +++ b/wsd/TileDesc.hpp @@ -208,11 +208,11 @@ public: const bool broadcast = (LOOLProtocol::getTokenString(tokens, "broadcast", s) && s == "yes"); - auto result = TileDesc(pairs["part"], pairs["width"], pairs["height"], - pairs["tileposx"], pairs["tileposy"], - pairs["tilewidth"], pairs["tileheight"], - pairs["ver"], - pairs["imgsize"], pairs["id"], broadcast); + TileDesc result(pairs["part"], pairs["width"], pairs["height"], + pairs["tileposx"], pairs["tileposy"], + pairs["tilewidth"], pairs["tileheight"], + pairs["ver"], + pairs["imgsize"], pairs["id"], broadcast); result.setOldWireId(oldWireId); result.setWireId(wireId); @@ -276,7 +276,7 @@ private: Poco::StringTokenizer oldWireIdTokens(oldWireIds, ",", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM); Poco::StringTokenizer wireIdTokens(wireIds, ",", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM); - const auto numberOfPositions = positionXtokens.count(); + const size_t numberOfPositions = positionXtokens.count(); // check that the comma-separated strings have the same number of elements if (numberOfPositions != positionYtokens.count() || diff --git a/wsd/TraceFile.hpp b/wsd/TraceFile.hpp index d19c0103..958a73cf 100644 --- a/wsd/TraceFile.hpp +++ b/wsd/TraceFile.hpp @@ -103,7 +103,7 @@ public: { std::string decodedUri; Poco::URI::decode(uri, decodedUri); - const auto url = Poco::URI(decodedUri).getPath(); + const std::string url = Poco::URI(decodedUri).getPath(); const auto it = _urlToSnapshot.find(url); if (it != _urlToSnapshot.end()) { @@ -139,7 +139,7 @@ public: std::string snapshot = uri; - const auto url = Poco::URI(uri).getPath(); + const std::string url = Poco::URI(uri).getPath(); const auto it = _urlToSnapshot.find(url); if (it != _urlToSnapshot.end()) { @@ -177,7 +177,7 @@ public: // Remap the URL to the snapshot. if (LOOLProtocol::matchPrefix("load", data)) { - auto tokens = LOOLProtocol::tokenize(data); + std::vector<std::string> tokens = LOOLProtocol::tokenize(data); if (tokens.size() >= 2) { std::string url; @@ -185,7 +185,7 @@ public: { std::string decodedUrl; Poco::URI::decode(url, decodedUrl); - auto uriPublic = Poco::URI(decodedUrl); + Poco::URI uriPublic = Poco::URI(decodedUrl); if (uriPublic.isRelative() || uriPublic.getScheme() == "file") { uriPublic.normalize(); @@ -266,7 +266,7 @@ private: static std::string processPath(const std::string& path) { - const auto pos = path.find('%'); + const size_t pos = path.find('%'); if (pos == std::string::npos) { return path; diff --git a/wsd/UserMessages.hpp b/wsd/UserMessages.hpp index 9dad0d36..3efbdf8d 100644 --- a/wsd/UserMessages.hpp +++ b/wsd/UserMessages.hpp @@ -12,8 +12,8 @@ #ifndef INCLUDED_USERMESSAGES_HPP #define INCLUDED_USERMESSAGES_HPP -constexpr auto SERVICE_UNAVAILABLE_INTERNAL_ERROR = "error: cmd=socket kind=serviceunavailable"; -constexpr auto PAYLOAD_UNAVAILABLE_LIMIT_REACHED = "error: cmd=socket kind=limitreached params=%u,%u"; +constexpr const char* SERVICE_UNAVAILABLE_INTERNAL_ERROR = "error: cmd=socket kind=serviceunavailable"; +constexpr const char* PAYLOAD_UNAVAILABLE_LIMIT_REACHED = "error: cmd=socket kind=limitreached params=%u,%u"; #endif commit 9733e0f7ff59941b84ba115cde3af43cec9f83cc Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Feb 7 10:17:52 2018 +0100 tools: spell out non-trivial autos to improve readability Change-Id: I8b462c5e6ae96fb8daf2abd1ed3756a796cdd434 diff --git a/tools/Replay.hpp b/tools/Replay.hpp index 585a0ce8..d9d95b6a 100644 --- a/tools/Replay.hpp +++ b/tools/Replay.hpp @@ -38,7 +38,7 @@ public: Poco::URI::encode(documentURL, ":/?", encodedUri); Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, "/lool/" + encodedUri + "/ws"); Poco::Net::HTTPResponse response; - auto ws = helpers::connectLOKit(uri, request, response, sessionId + ' '); + std::shared_ptr<LOOLWebSocket> ws = helpers::connectLOKit(uri, request, response, sessionId + ' '); std::cout << "Connected to " << serverURI << ".\n"; return std::shared_ptr<Connection>(new Connection(documentURL, sessionId, ws)); } @@ -133,24 +133,24 @@ protected: { TraceFileReader traceFile(_uri); - auto epochFile(traceFile.getEpochStart()); - auto epochCurrent(std::chrono::steady_clock::now()); + Poco::Int64 epochFile(traceFile.getEpochStart()); + auto epochCurrent = std::chrono::steady_clock::now(); - const auto replayDuration = (traceFile.getEpochEnd() - epochFile); + const Poco::Int64 replayDuration = (traceFile.getEpochEnd() - epochFile); std::cout << "Replaying file [" << _uri << "] of " << replayDuration / 1000000. << " second length." << std::endl; for (;;) { - const auto rec = traceFile.getNextRecord(); + const TraceFileRecord rec = traceFile.getNextRecord(); if (rec.Dir == TraceFileRecord::Direction::Invalid) { // End of trace file. break; } - const auto deltaCurrent = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now() - epochCurrent).count(); - const auto deltaFile = rec.TimestampNs - epochFile; - const auto delay = (_ignoreTiming ? 0 : deltaFile - deltaCurrent); + const std::chrono::microseconds::rep deltaCurrent = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now() - epochCurrent).count(); + const unsigned deltaFile = rec.TimestampNs - epochFile; + const unsigned delay = (_ignoreTiming ? 0 : deltaFile - deltaCurrent); if (delay > 0) { if (delay > 1e6) @@ -171,7 +171,7 @@ protected: if (rec.Payload.find(NewSession) == 0) { - const auto uriOrig = rec.Payload.substr(NewSession.size()); + const std::string uriOrig = rec.Payload.substr(NewSession.size()); std::string uri; Poco::URI::decode(uriOrig, uri); auto it = _sessions.find(uri); @@ -184,7 +184,7 @@ protected: } else { - auto connection = Connection::create(_serverUri, uri, rec.SessionId); + std::shared_ptr<Connection> connection = Connection::create(_serverUri, uri, rec.SessionId); if (connection) { it->second.emplace(rec.SessionId, connection); @@ -195,7 +195,7 @@ protected: { std::cout << "New Document: " << uri << "\n"; _childToDoc.emplace(rec.Pid, uri); - auto connection = Connection::create(_serverUri, uri, rec.SessionId); + std::shared_ptr<Connection> connection = Connection::create(_serverUri, uri, rec.SessionId); if (connection) { _sessions[uri].emplace(rec.SessionId, connection); @@ -204,7 +204,7 @@ protected: } else if (rec.Payload.find(EndSession) == 0) { - const auto uriOrig = rec.Payload.substr(EndSession.size()); + const std::string uriOrig = rec.Payload.substr(EndSession.size()); std::string uri; Poco::URI::decode(uriOrig, uri); auto it = _sessions.find(uri); diff --git a/tools/Stress.cpp b/tools/Stress.cpp index 6cd8d3dc..a29277ed 100644 --- a/tools/Stress.cpp +++ b/tools/Stress.cpp @@ -61,7 +61,7 @@ long percentile(std::vector<long>& v, const double percentile) { std::sort(v.begin(), v.end()); - const auto N = v.size(); + const size_t N = v.size(); const double n = (N - 1) * percentile / 100.0 + 1; if (n <= 1) { @@ -80,8 +80,8 @@ long percentile(std::vector<long>& v, const double percentile) std::mutex Connection::Mutex; //static constexpr auto FIRST_ROW_TILES = "tilecombine part=0 width=256 height=256 tileposx=0,3840,7680 tileposy=0,0,0 tilewidth=3840 tileheight=3840"; -static constexpr auto FIRST_PAGE_TILES = "tilecombine part=0 width=256 height=256 tileposx=0,3840,7680,11520,0,3840,7680,11520,0,3840,7680,11520,0,3840,7680,11520 tileposy=0,0,0,0,3840,3840,3840,3840,7680,7680,7680,7680,11520,11520,11520,11520 tilewidth=3840 tileheight=3840"; -static constexpr auto FIRST_PAGE_TILE_COUNT = 16; +static constexpr const char* FIRST_PAGE_TILES = "tilecombine part=0 width=256 height=256 tileposx=0,3840,7680,11520,0,3840,7680,11520,0,3840,7680,11520,0,3840,7680,11520 tileposy=0,0,0,0,3840,3840,3840,3840,7680,7680,7680,7680,11520,11520,11520,11520 tilewidth=3840 tileheight=3840"; +static constexpr int FIRST_PAGE_TILE_COUNT = 16; /// Main thread class to replay a trace file. class Worker: public Replay @@ -131,7 +131,7 @@ private: const bool success = !con->recv("invalidatetiles:").empty(); const auto now = std::chrono::steady_clock::now(); - const auto deltaModify = std::chrono::duration_cast<std::chrono::microseconds>(now - startModify).count(); + const std::chrono::microseconds::rep deltaModify = std::chrono::duration_cast<std::chrono::microseconds>(now - startModify).count(); _latencyStats.push_back(deltaModify); return success; @@ -143,7 +143,7 @@ private: const auto start = std::chrono::steady_clock::now(); - const auto expectedTilesCount = FIRST_PAGE_TILE_COUNT; + const int expectedTilesCount = FIRST_PAGE_TILE_COUNT; con->send(FIRST_PAGE_TILES); for (int i = 0; i < expectedTilesCount; ++i) { @@ -154,7 +154,7 @@ private: } const auto now = std::chrono::steady_clock::now(); - const auto delta = std::chrono::duration_cast<std::chrono::microseconds>(now - start).count(); + const std::chrono::microseconds::rep delta = std::chrono::duration_cast<std::chrono::microseconds>(now - start).count(); _renderingStats.push_back(delta / expectedTilesCount); return true; @@ -164,7 +164,7 @@ private: { const auto start = std::chrono::steady_clock::now(); - const auto expectedTilesCount = FIRST_PAGE_TILE_COUNT; + const int expectedTilesCount = FIRST_PAGE_TILE_COUNT; con->send(FIRST_PAGE_TILES); for (int i = 0; i < expectedTilesCount; ++i) { @@ -175,7 +175,7 @@ private: } const auto now = std::chrono::steady_clock::now(); - const auto delta = std::chrono::duration_cast<std::chrono::microseconds>(now - start).count(); + const std::chrono::microseconds::rep delta = std::chrono::duration_cast<std::chrono::microseconds>(now - start).count(); _cacheStats.push_back(delta / expectedTilesCount); return true; @@ -190,8 +190,8 @@ private: _renderingStats.reserve(Stress::Iterations * 4); static std::atomic<unsigned> SessionId; - const auto sessionId = ++SessionId; - auto connection = Connection::create(_serverUri, _uri, std::to_string(sessionId)); + const size_t sessionId = ++SessionId; + std::shared_ptr<Connection> connection = Connection::create(_serverUri, _uri, std::to_string(sessionId)); connection->load(); @@ -315,13 +315,13 @@ int Stress::main(const std::vector<std::string>& args) for (const auto& worker : workers) { - const auto latencyStat = worker->getLatencyStats(); + const std::vector<long> latencyStat = worker->getLatencyStats(); latencyStats.insert(latencyStats.end(), latencyStat.begin(), latencyStat.end()); - const auto renderingStat = worker->getRenderingStats(); + const std::vector<long> renderingStat = worker->getRenderingStats(); renderingStats.insert(renderingStats.end(), renderingStat.begin(), renderingStat.end()); - const auto cachedStat = worker->getCacheStats(); + const std::vector<long> cachedStat = worker->getCacheStats(); cachedStats.insert(cachedStats.end(), cachedStat.begin(), cachedStat.end()); } @@ -336,12 +336,12 @@ int Stress::main(const std::vector<std::string>& args) const auto renderingTime = std::accumulate(renderingStats.begin(), renderingStats.end(), 0L); const double renderedPixels = 256 * 256 * renderingStats.size(); - const auto pixelsPerSecRendered = renderedPixels / renderingTime; + const double pixelsPerSecRendered = renderedPixels / renderingTime; std::cerr << "Rendering power: " << pixelsPerSecRendered << " MPixels/sec." << std::endl; const auto cacheTime = std::accumulate(cachedStats.begin(), cachedStats.end(), 0L); const double cachePixels = 256 * 256 * cachedStats.size(); - const auto pixelsPerSecCached = cachePixels / cacheTime; + const double pixelsPerSecCached = cachePixels / cacheTime; std::cerr << "Cache power: " << pixelsPerSecCached << " MPixels/sec." << std::endl; } } diff --git a/tools/map.cpp b/tools/map.cpp index f3773501..56906bf8 100644 --- a/tools/map.cpp +++ b/tools/map.cpp @@ -307,7 +307,7 @@ static void dumpPages(unsigned proc_id, unsigned parent_id, const char *type, co size_t cnt = 0; addr_t sameButUnshared = 0; addr_t bytesTouched = 0; - for (auto page : pages) + for (addr_t page : pages) { std::vector<char> pageData, parentData; pageData.resize(0x1000); @@ -420,7 +420,7 @@ static void dump_unshared(unsigned proc_id, unsigned parent_id, std::vector<char> bitmap; std::vector<addr_t> vunshared; addr_t numShared = 0, numOwn = 0; - for (auto p : vaddrs) + for (addr_t p : vaddrs) { if (lseek(fd, (p / 0x1000 * 8), SEEK_SET) < 0) error(EXIT_FAILURE, errno, "Failed to seek in pagemap"); @@ -458,13 +458,13 @@ static void dump_unshared(unsigned proc_id, unsigned parent_id, dumpPages(proc_id, parent_id, type, vunshared, space); std::unordered_set<addr_t> unShared; - for (auto addr : vunshared) + for (addr_t addr : vunshared) unShared.insert(addr); if (DumpStrings) { printf("String dump:\n"); - for (auto addr : space._addrToStr) + for (const auto& addr : space._addrToStr) { if (DumpAll || unShared.find((addr.first & ~0x1fff)) != unShared.end()) commit 4bcfdbb5b3025655c9b729a1ae486583859a1771 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Feb 7 10:17:42 2018 +0100 test: spell out non-trivial autos to improve readability Change-Id: Ie3b4b961c50ab61ef63380c4724a0f00e8f960d2 diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp index 82ee85fe..2c22da3a 100644 --- a/test/TileCacheTests.cpp +++ b/test/TileCacheTests.cpp @@ -174,18 +174,18 @@ void TileCacheTests::testSimple() TileDesc tile(part, width, height, tilePosX, tilePosY, tileWidth, tileHeight, -1, 0, -1, false); // No Cache - auto file = tc.lookupTile(tile); + std::unique_ptr<std::fstream> file = tc.lookupTile(tile); CPPUNIT_ASSERT_MESSAGE("found tile when none was expected", !file); // Cache Tile - const auto size = 1024; - const auto data = genRandomData(size); + const int size = 1024; + const std::vector<char> data = genRandomData(size); tc.saveTileAndNotify(tile, data.data(), size); // Find Tile file = tc.lookupTile(tile); CPPUNIT_ASSERT_MESSAGE("tile not found when expected", file && file->is_open()); - const auto tileData = readDataFromFile(file); + const std::vector<char> tileData = readDataFromFile(file); CPPUNIT_ASSERT_MESSAGE("cached tile corrupted", data == tileData); // Invalidate Tiles @@ -198,18 +198,18 @@ void TileCacheTests::testSimple() void TileCacheTests::testSimpleCombine() { - const auto testname = "simpleCombine "; + const char* testname = "simpleCombine "; std::string documentPath, documentURL; getDocumentPathAndURL("hello.odt", documentPath, documentURL, testname); // First. - auto socket1 = loadDocAndGetSocket(_uri, documentURL, "simpleCombine-1 "); + std::shared_ptr<LOOLWebSocket> socket1 = loadDocAndGetSocket(_uri, documentURL, "simpleCombine-1 "); sendTextFrame(socket1, "tilecombine part=0 width=256 height=256 tileposx=0,3840 tileposy=0,0 tilewidth=3840 tileheight=3840"); - auto tile1a = getResponseMessage(socket1, "tile:"); + std::vector<char> tile1a = getResponseMessage(socket1, "tile:"); CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile1a.empty()); - auto tile1b = getResponseMessage(socket1, "tile:"); + std::vector<char> tile1b = getResponseMessage(socket1, "tile:"); CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile1b.empty()); sendTextFrame(socket1, "tilecombine part=0 width=256 height=256 tileposx=0,3840 tileposy=0,0 tilewidth=3840 tileheight=3840"); @@ -220,27 +220,27 @@ void TileCacheTests::testSimpleCombine() // Second. std::cerr << "Connecting second client." << std::endl; - auto socket2 = loadDocAndGetSocket(_uri, documentURL, "simpleCombine-2 ", true); + std::shared_ptr<LOOLWebSocket> socket2 = loadDocAndGetSocket(_uri, documentURL, "simpleCombine-2 ", true); sendTextFrame(socket2, "tilecombine part=0 width=256 height=256 tileposx=0,3840 tileposy=0,0 tilewidth=3840 tileheight=3840"); - auto tile2a = getResponseMessage(socket2, "tile:"); + std::vector<char> tile2a = getResponseMessage(socket2, "tile:"); CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile2a.empty()); - auto tile2b = getResponseMessage(socket2, "tile:"); + std::vector<char> tile2b = getResponseMessage(socket2, "tile:"); CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile2b.empty()); } void TileCacheTests::testPerformance() { - auto socket = loadDocAndGetSocket("hello.odt", _uri, "performance "); + std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket("hello.odt", _uri, "performance "); Poco::Timestamp timestamp; - for (auto x = 0; x < 5; ++x) + for (int x = 0; x < 5; ++x) { sendTextFrame(socket, "tilecombine part=0 width=256 height=256 tileposx=0,3840,7680,11520,0,3840,7680,11520 tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 tileheight=3840"); - for (auto i = 0; i < 8; ++i) + for (int i = 0; i < 8; ++i) { - auto tile = getResponseMessage(socket, "tile:", "tile-performance "); + std::vector<char> tile = getResponseMessage(socket, "tile:", "tile-performance "); CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile.empty()); } } @@ -255,7 +255,7 @@ void TileCacheTests::testPerformance() void TileCacheTests::testCancelTiles() { - const auto testName = "cancelTiles "; + const char* testName = "cancelTiles "; // The tile response can race past the canceltiles, // so be forgiving to avoid spurious failures. @@ -267,7 +267,7 @@ void TileCacheTests::testCancelTiles() // Wait to clear previous sessions. countLoolKitProcesses(InitialLoolKitCount); - auto socket = loadDocAndGetSocket("setclientpart.ods", _uri, testName); + std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket("setclientpart.ods", _uri, testName); // Request a huge tile, and cancel immediately. sendTextFrame(socket, "tilecombine part=0 width=2560 height=2560 tileposx=0 tileposy=0 tilewidth=38400 tileheight=38400"); @@ -306,8 +306,8 @@ void TileCacheTests::testCancelTilesMultiView() countLoolKitProcesses(InitialLoolKitCount); // Request a huge tile, and cancel immediately. - auto socket1 = loadDocAndGetSocket(_uri, documentURL, "cancelTilesMultiView-1 "); - auto socket2 = loadDocAndGetSocket(_uri, documentURL, "cancelTilesMultiView-2 ", true); + std::shared_ptr<LOOLWebSocket> socket1 = loadDocAndGetSocket(_uri, documentURL, "cancelTilesMultiView-1 "); + std::shared_ptr<LOOLWebSocket> socket2 = loadDocAndGetSocket(_uri, documentURL, "cancelTilesMultiView-2 ", true); sendTextFrame(socket1, "tilecombine part=0 width=256 height=256 tileposx=0,3840,7680,11520,0,3840,7680,11520 tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 tileheight=3840", "cancelTilesMultiView-1 "); sendTextFrame(socket2, "tilecombine part=0 width=256 height=256 tileposx=0,3840,7680,0 tileposy=0,0,0,22520 tilewidth=3840 tileheight=3840", "cancelTilesMultiView-2 "); @@ -325,7 +325,7 @@ void TileCacheTests::testCancelTilesMultiView() continue; } - for (auto i = 0; i < 4; ++i) + for (int i = 0; i < 4; ++i) { getTileMessage(*socket2, "cancelTilesMultiView-2 "); } @@ -367,15 +367,15 @@ void TileCacheTests::testDisconnectMultiView() countLoolKitProcesses(InitialLoolKitCount); // Request a huge tile, and cancel immediately. - auto socket1 = loadDocAndGetSocket(_uri, documentURL, "disconnectMultiView-1 "); - auto socket2 = loadDocAndGetSocket(_uri, documentURL, "disconnectMultiView-2 ", true); + std::shared_ptr<LOOLWebSocket> socket1 = loadDocAndGetSocket(_uri, documentURL, "disconnectMultiView-1 "); + std::shared_ptr<LOOLWebSocket> socket2 = loadDocAndGetSocket(_uri, documentURL, "disconnectMultiView-2 ", true); sendTextFrame(socket1, "tilecombine part=0 width=256 height=256 tileposx=0,3840,7680,11520,0,3840,7680,11520 tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 tileheight=3840", "cancelTilesMultiView-1 "); sendTextFrame(socket2, "tilecombine part=0 width=256 height=256 tileposx=0,3840,7680,0 tileposy=0,0,0,22520 tilewidth=3840 tileheight=3840", "cancelTilesMultiView-2 "); socket1->shutdown(); - for (auto i = 0; i < 4; ++i) + for (int i = 0; i < 4; ++i) { getTileMessage(*socket2, "disconnectMultiView-2 "); } @@ -391,23 +391,23 @@ void TileCacheTests::testUnresponsiveClient() getDocumentPathAndURL("hello.odt", documentPath, documentURL, "unresponsiveClient "); std::cerr << "Connecting first client." << std::endl; - auto socket1 = loadDocAndGetSocket(_uri, documentURL, "unresponsiveClient-1 "); + std::shared_ptr<LOOLWebSocket> socket1 = loadDocAndGetSocket(_uri, documentURL, "unresponsiveClient-1 "); std::cerr << "Connecting second client." << std::endl; - auto socket2 = loadDocAndGetSocket(_uri, documentURL, "unresponsiveClient-2 "); + std::shared_ptr<LOOLWebSocket> socket2 = loadDocAndGetSocket(_uri, documentURL, "unresponsiveClient-2 "); // Pathologically request tiles and fail to read (say slow connection). // Meanwhile, verify that others can get all tiles fine. // TODO: Track memory consumption to verify we don't buffer too much. std::ostringstream oss; - for (auto i = 0; i < 1000; ++i) + for (int i = 0; i < 1000; ++i) { oss << Util::encodeId(Util::rng::getNext(), 6); } - const auto documentContents = oss.str(); - for (auto x = 0; x < 8; ++x) + const std::string documentContents = oss.str(); + for (int x = 0; x < 8; ++x) { // Invalidate to force re-rendering. sendTextFrame(socket2, "uno .uno:SelectAll"); @@ -421,9 +421,9 @@ void TileCacheTests::testUnresponsiveClient() // Verify that we get all 8 tiles. sendTextFrame(socket2, "tilecombine part=0 width=256 height=256 tileposx=0,3840,7680,11520,0,3840,7680,11520 tileposy=0,0,0,0,3840,3840,3840,3840 tilewidth=3840 tileheight=3840"); - for (auto i = 0; i < 8; ++i) + for (int i = 0; i < 8; ++i) { - auto tile = getResponseMessage(socket2, "tile:", "client2 "); + std::vector<char> tile = getResponseMessage(socket2, "tile:", "client2 "); CPPUNIT_ASSERT_MESSAGE("Did not receive tile #" + std::to_string(i+1) + " of 8: message as expected", !tile.empty()); } } @@ -434,7 +434,7 @@ void TileCacheTests::testImpressTiles() try { const std::string testName = "impressTiles "; - auto socket = loadDocAndGetSocket("setclientpart.odp", _uri, testName); + std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket("setclientpart.odp", _uri, testName); sendTextFrame(socket, "tile part=0 width=180 height=135 tileposx=0 tileposy=0 tilewidth=15875 tileheight=11906 id=0", testName); getTileMessage(*socket, testName); @@ -450,7 +450,7 @@ void TileCacheTests::testClientPartImpress() try { const std::string testName = "clientPartImpress "; - auto socket = loadDocAndGetSocket("setclientpart.odp", _uri, testName); + std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket("setclientpart.odp", _uri, testName); checkTiles(socket, "presentation", testName); @@ -467,7 +467,7 @@ void TileCacheTests::testClientPartCalc() try { const std::string testName = "clientPartCalc "; - auto socket = loadDocAndGetSocket("setclientpart.ods", _uri, testName); + std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket("setclientpart.ods", _uri, testName); checkTiles(socket, "spreadsheet", testName); @@ -481,9 +481,9 @@ void TileCacheTests::testClientPartCalc() void TileCacheTests::testTilesRenderedJustOnce() { - const auto testname = "tilesRenderdJustOnce "; + const char* testname = "tilesRenderdJustOnce "; - auto socket = loadDocAndGetSocket("with_comment.odt", _uri, testname); + std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket("with_comment.odt", _uri, testname); assertResponseString(socket, "statechanged: .uno:AcceptTrackedChange=", testname); @@ -551,13 +551,13 @@ void TileCacheTests::testTilesRenderedJustOnceMultiClient() getDocumentPathAndURL("with_comment.odt", documentPath, documentURL, testname); std::cerr << "Connecting first client." << std::endl; - auto socket = loadDocAndGetSocket(_uri, documentURL, testname1); + std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket(_uri, documentURL, testname1); std::cerr << "Connecting second client." << std::endl; - auto socket2 = loadDocAndGetSocket(_uri, documentURL, testname2); + std::shared_ptr<LOOLWebSocket> socket2 = loadDocAndGetSocket(_uri, documentURL, testname2); std::cerr << "Connecting third client." << std::endl; - auto socket3 = loadDocAndGetSocket(_uri, documentURL, testname3); + std::shared_ptr<LOOLWebSocket> socket3 = loadDocAndGetSocket(_uri, documentURL, testname3); std::cerr << "Connecting fourth client." << std::endl; - auto socket4 = loadDocAndGetSocket(_uri, documentURL, "tilesRenderdJustOnce-4 "); + std::shared_ptr<LOOLWebSocket> socket4 = loadDocAndGetSocket(_uri, documentURL, "tilesRenderdJustOnce-4 "); for (int i = 0; i < 10; ++i) { @@ -641,9 +641,9 @@ void TileCacheTests::testSimultaneousTilesRenderedJustOnce() getDocumentPathAndURL("hello.odt", documentPath, documentURL, "simultaneousTilesrenderedJustOnce "); std::cerr << "Connecting first client." << std::endl; - auto socket1 = loadDocAndGetSocket(_uri, documentURL, "simultaneousTilesRenderdJustOnce-1 "); + std::shared_ptr<LOOLWebSocket> socket1 = loadDocAndGetSocket(_uri, documentURL, "simultaneousTilesRenderdJustOnce-1 "); std::cerr << "Connecting second client." << std::endl; - auto socket2 = loadDocAndGetSocket(_uri, documentURL, "simultaneousTilesRenderdJustOnce-2 "); + std::shared_ptr<LOOLWebSocket> socket2 = loadDocAndGetSocket(_uri, documentURL, "simultaneousTilesRenderdJustOnce-2 "); // Wait for the invalidatetile events to pass, otherwise they // remove our tile subscription. @@ -673,8 +673,8 @@ void TileCacheTests::testLoad12ods() { try { - const auto testName = "load12ods "; - auto socket = loadDocAndGetSocket("load12.ods", _uri, testName); + const char* testName = "load12ods "; + std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket("load12.ods", _uri, testName); int docSheet = -1; int docSheets = 0; @@ -702,7 +702,7 @@ void TileCacheTests::checkBlackTile(std::stringstream& tile) png_uint_32 width = 0; png_uint_32 rowBytes = 0; - auto rows = Png::decodePNG(tile, height, width, rowBytes); + std::vector<png_bytep> rows = Png::decodePNG(tile, height, width, rowBytes); png_uint_32 black = 0; for (png_uint_32 itRow = 0; itRow < height; ++itRow) @@ -734,10 +734,10 @@ void TileCacheTests::checkBlackTiles(std::shared_ptr<LOOLWebSocket>& socket, con // render correctly and there are no black tiles. // Current cap of table size ends at 257280 twips (for load12.ods), // otherwise 2035200 should be rendered successfully. - const auto req = "tile part=0 width=256 height=256 tileposx=0 tileposy=253440 tilewidth=3840 tileheight=3840"; + const char* req = "tile part=0 width=256 height=256 tileposx=0 tileposy=253440 tilewidth=3840 tileheight=3840"; sendTextFrame(socket, req); - const auto tile = getResponseMessage(socket, "tile:", name); + const std::vector<char> tile = getResponseMessage(socket, "tile:", name); const std::string firstLine = LOOLProtocol::getFirstLine(tile); #if 0 @@ -753,12 +753,12 @@ void TileCacheTests::checkBlackTiles(std::shared_ptr<LOOLWebSocket>& socket, con void TileCacheTests::testTileInvalidateWriter() { - const auto testname = "tileInvalidateWriter "; + const char* testname = "tileInvalidateWriter "; std::string documentPath, documentURL; getDocumentPathAndURL("empty.odt", documentPath, documentURL, testname); Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL); - auto socket = loadDocAndGetSocket(_uri, documentURL, testname); + std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket(_uri, documentURL, testname); std::string text = "Test. Now go 3 \"Enters\":\n\n\nNow after the enters, goes this text"; for (char ch : text) @@ -789,13 +789,13 @@ void TileCacheTests::testTileInvalidateWriter() void TileCacheTests::testTileInvalidateWriterPage() { - const auto testname = "tileInvalidateWriterPage "; + const char* testname = "tileInvalidateWriterPage "; std::string documentPath, documentURL; getDocumentPathAndURL("empty.odt", documentPath, documentURL, testname); Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL); - auto socket = loadDocAndGetSocket(_uri, documentURL, testname); + std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket(_uri, documentURL, testname); sendChar(socket, '\n', skCtrl, testname); // Send Ctrl+Enter (page break). assertResponseString(socket, "invalidatetiles:", testname); @@ -812,22 +812,22 @@ void TileCacheTests::testTileInvalidateWriterPage() // This isn't yet used void TileCacheTests::testWriterAnyKey() { - const auto testname = "writerAnyKey "; + const char* testname = "writerAnyKey "; std::string documentPath, documentURL; getDocumentPathAndURL("empty.odt", documentPath, documentURL, testname); Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL); - auto socket = loadDocAndGetSocket(_uri, documentURL, testname); + std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket(_uri, documentURL, testname); // Now test "usual" keycodes (TODO: whole 32-bit range) for (int i=0; i<0x1000; ++i) { std::stringstream ss("Keycode "); ss << i; - auto s = ss.str(); + std::string s = ss.str(); std::stringstream fn("saveas url="); fn << documentURL << i << ".odt format= options="; - auto f = fn.str(); + std::string f = fn.str(); const int istart = 474; sendText(socket, "\n"+s+"\n"); @@ -897,7 +897,7 @@ void TileCacheTests::testWriterAnyKey() void TileCacheTests::testTileInvalidateCalc() { const std::string testname = "tileInvalidateCalc "; - auto socket = loadDocAndGetSocket("empty.ods", _uri, testname); + std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket("empty.ods", _uri, testname); std::string text = "Test. Now go 3 \"Enters\": Now after the enters, goes this text"; for (char ch : text) @@ -931,13 +931,13 @@ void TileCacheTests::testTileInvalidatePartCalc() std::string documentPath, documentURL; getDocumentPathAndURL(filename, documentPath, documentURL, testname); - auto socket1 = loadDocAndGetSocket(_uri, documentURL, testname1); + std::shared_ptr<LOOLWebSocket> socket1 = loadDocAndGetSocket(_uri, documentURL, testname1); sendTextFrame(socket1, "setclientpart part=2", testname1); assertResponseString(socket1, "setpart:", testname1); sendTextFrame(socket1, "mouse type=buttondown x=1500 y=1500 count=1 buttons=1 modifier=0", testname1); - auto socket2 = loadDocAndGetSocket(_uri, documentURL, testname2); + std::shared_ptr<LOOLWebSocket> socket2 = loadDocAndGetSocket(_uri, documentURL, testname2); sendTextFrame(socket2, "setclientpart part=5", testname2); assertResponseString(socket2, "setpart:", testname2); sendTextFrame(socket2, "mouse type=buttondown x=1500 y=1500 count=1 buttons=1 modifier=0", testname2); @@ -969,13 +969,13 @@ void TileCacheTests::testTileInvalidatePartImpress() std::string documentPath, documentURL; getDocumentPathAndURL(filename, documentPath, documentURL, testname); - auto socket1 = loadDocAndGetSocket(_uri, documentURL, testname1); + std::shared_ptr<LOOLWebSocket> socket1 = loadDocAndGetSocket(_uri, documentURL, testname1); sendTextFrame(socket1, "setclientpart part=2", testname1); assertResponseString(socket1, "setpart:", testname1); sendTextFrame(socket1, "mouse type=buttondown x=1500 y=1500 count=1 buttons=1 modifier=0", testname1); - auto socket2 = loadDocAndGetSocket(_uri, documentURL, testname2); + std::shared_ptr<LOOLWebSocket> socket2 = loadDocAndGetSocket(_uri, documentURL, testname2); sendTextFrame(socket2, "setclientpart part=5", testname2); assertResponseString(socket2, "setpart:", testname2); sendTextFrame(socket2, "mouse type=buttondown x=1500 y=1500 count=1 buttons=1 modifier=0", testname2); @@ -1024,7 +1024,7 @@ void TileCacheTests::checkTiles(std::shared_ptr<LOOLWebSocket>& socket, const st CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(6), tokens.count()); // Expected format is something like 'type= parts= current= width= height='. - const auto text = tokens[0].substr(type.size()); + const std::string text = tokens[0].substr(type.size()); totalParts = std::stoi(tokens[1].substr(parts.size())); currentPart = std::stoi(tokens[2].substr(current.size())); docWidth = std::stoi(tokens[3].substr(width.size())); @@ -1048,12 +1048,12 @@ void TileCacheTests::checkTiles(std::shared_ptr<LOOLWebSocket>& socket, const st std::vector<int> vParts = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; std::random_shuffle(vParts.begin(), vParts.end()); int requests = 0; - for (auto it : vParts) + for (int it : vParts) { if (currentPart != it) { // change part - const auto text = Poco::format("setclientpart part=%d", it); + const std::string text = Poco::format("setclientpart part=%d", it); sendTextFrame(socket, text, name); // Wait for the change to take effect otherwise we get invalidatetile // which removes our next tile request subscription (expecting us to diff --git a/test/UnitFuzz.cpp b/test/UnitFuzz.cpp index 7d09819f..e36f78dd 100644 --- a/test/UnitFuzz.cpp +++ b/test/UnitFuzz.cpp @@ -76,7 +76,7 @@ public: if (_dist(_mt) < 875) return false; - auto fuzzed = new std::vector<char>(); + std::unique_ptr<std::vector<char>> fuzzed(new std::vector<char>()); fuzzed->assign(buffer, buffer+length); int resize = _dist(_mt); @@ -114,7 +114,7 @@ public: c |= 0x80; } - replace.reset(fuzzed); + replace.reset(fuzzed.release()); return true; } diff --git a/test/UnitPrefork.cpp b/test/UnitPrefork.cpp index a87c63b3..827e1c06 100644 --- a/test/UnitPrefork.cpp +++ b/test/UnitPrefork.cpp @@ -42,7 +42,7 @@ public: { Poco::Timestamp::TimeDiff elapsed = _startTime.elapsed(); - const auto totalTime = (1000. * elapsed)/Poco::Timestamp::resolution(); + const double totalTime = (1000. * elapsed)/Poco::Timestamp::resolution(); LOG_INF("Launched " << _childSockets << " in " << totalTime); std::cerr << "Launch time total " << totalTime << " ms" << std::endl; std::cerr << "Launch time average " << (totalTime / _childSockets) << " ms" << std::endl; diff --git a/test/countloolkits.hpp b/test/countloolkits.hpp index 830246e3..4b157b9a 100644 --- a/test/countloolkits.hpp +++ b/test/countloolkits.hpp @@ -29,11 +29,11 @@ static int countLoolKitProcesses(const int expected) // This does not need to depend on any constant from Common.hpp. // The shorter the better (the quicker the test runs). - const auto sleepMs = 50; + const int sleepMs = 50; // This has to cause waiting for at least COMMAND_TIMEOUT_MS. Add one second for safety. const size_t repeat = ((COMMAND_TIMEOUT_MS + 1000) / sleepMs); - auto count = getLoolKitProcessCount(); + int count = getLoolKitProcessCount(); for (size_t i = 0; i < repeat; ++i) { std::cerr << count << ' '; @@ -45,7 +45,7 @@ static int countLoolKitProcesses(const int expected) // Give polls in the lool processes time to time out etc std::this_thread::sleep_for(std::chrono::milliseconds(sleepMs)); - const auto newCount = getLoolKitProcessCount(); + const int newCount = getLoolKitProcessCount(); if (count != newCount) { // Allow more time until the number settles. @@ -84,11 +84,11 @@ static void testCountHowManyLoolkits() static void testNoExtraLoolKitsLeft() { - const auto countNow = countLoolKitProcesses(InitialLoolKitCount); + const int countNow = countLoolKitProcesses(InitialLoolKitCount); CPPUNIT_ASSERT_EQUAL(InitialLoolKitCount, countNow); const auto duration = (std::chrono::steady_clock::now() - TestStartTime); - const auto durationMs = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count(); + const std::chrono::milliseconds::rep durationMs = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count(); std::cout << " (" << durationMs << " ms)"; } diff --git a/test/helpers.hpp b/test/helpers.hpp index 220ffd30..68038a8d 100644 --- a/test/helpers.hpp +++ b/test/helpers.hpp @@ -47,7 +47,7 @@ std::vector<char> genRandomData(const size_t size) { std::vector<char> v(size); v.resize(size); - auto data = v.data(); + char* data = v.data(); for (size_t i = 0; i < size; ++i) { data[i] = static_cast<char>(Util::rng::getNext()); @@ -335,7 +335,7 @@ connectLOKit(const Poco::URI& uri, { std::unique_ptr<Poco::Net::HTTPClientSession> session(createSession(uri)); auto ws = std::make_shared<LOOLWebSocket>(*session, request, response); - const auto expected_response = "statusindicator: ready"; + const char* expected_response = "statusindicator: ready"; if (getResponseString(ws, expected_response, name) == expected_response) { return ws; @@ -364,7 +364,7 @@ std::shared_ptr<LOOLWebSocket> loadDocAndGetSocket(const Poco::URI& uri, const s // Load a document and get its status. Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL); Poco::Net::HTTPResponse response; - auto socket = connectLOKit(uri, request, response, name); + std::shared_ptr<LOOLWebSocket> socket = connectLOKit(uri, request, response, name); sendTextFrame(socket, "load url=" + documentURL, name); CPPUNIT_ASSERT_MESSAGE("cannot load the document " + documentURL, isDocumentLoaded(*socket, name, isView)); @@ -462,7 +462,7 @@ std::vector<char> getTileMessage(LOOLWebSocket& ws, const std::string& name = "" inline std::vector<char> assertTileMessage(LOOLWebSocket& ws, const std::string& name = "") { - const auto response = getTileMessage(ws, name); + const std::vector<char> response = getTileMessage(ws, name); const std::string firstLine = LOOLProtocol::getFirstLine(response); Poco::StringTokenizer tileTokens(firstLine, " ", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM); @@ -552,7 +552,7 @@ inline std::vector<char> getTileAndSave(std::shared_ptr<LOOLWebSocket>& socket, std::cerr << testname << "Requesting: " << req << std::endl; sendTextFrame(socket, req, testname); - const auto tile = getResponseMessage(socket, "tile:", testname); + const std::vector<char> tile = getResponseMessage(socket, "tile:", testname); std::cerr << testname << " Tile PNG size: " << tile.size() << std::endl; const std::string firstLine = LOOLProtocol::getFirstLine(tile); diff --git a/test/httpcrashtest.cpp b/test/httpcrashtest.cpp index 9c7d5ab3..38c2961d 100644 --- a/test/httpcrashtest.cpp +++ b/test/httpcrashtest.cpp @@ -105,7 +105,7 @@ public: void HTTPCrashTest::testBarren() { // Kill all kit processes and try loading a document. - const auto testname = "barren "; + const char* testname = "barren "; try { killLoKitProcesses(); @@ -114,7 +114,7 @@ void HTTPCrashTest::testBarren() std::cerr << "Loading after kill." << std::endl; // Load a document and get its status. - auto socket = loadDocAndGetSocket("hello.odt", _uri, testname); + std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket("hello.odt", _uri, testname); sendTextFrame(socket, "status", testname); assertResponseString(socket, "status:", testname); @@ -127,10 +127,10 @@ void HTTPCrashTest::testBarren() void HTTPCrashTest::testCrashKit() { - const auto testname = "crashKit "; + const char* testname = "crashKit "; try { - auto socket = loadDocAndGetSocket("empty.odt", _uri, testname); + std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket("empty.odt", _uri, testname); std::cerr << "Killing loolkit instances." << std::endl; @@ -145,7 +145,7 @@ void HTTPCrashTest::testCrashKit() getResponseMessage(socket, "", testname, 1000); std::string message; - const auto statusCode = getErrorCode(socket, message, testname); + const int statusCode = getErrorCode(socket, message, testname); CPPUNIT_ASSERT_EQUAL(static_cast<int>(Poco::Net::WebSocket::WS_ENDPOINT_GOING_AWAY), statusCode); // respond close frame @@ -176,10 +176,10 @@ void HTTPCrashTest::testCrashKit() void HTTPCrashTest::testRecoverAfterKitCrash() { - const auto testname = "recoverAfterKitCrash "; + const char* testname = "recoverAfterKitCrash "; try { - auto socket = loadDocAndGetSocket("empty.odt", _uri, testname); + std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket("empty.odt", _uri, testname); std::cerr << "Killing loolkit instances." << std::endl; @@ -189,7 +189,7 @@ void HTTPCrashTest::testRecoverAfterKitCrash() // We expect the client connection to close. std::cerr << "Reconnect after kill." << std::endl; - auto socket2 = loadDocAndGetSocket("empty.odt", _uri, testname); + std::shared_ptr<LOOLWebSocket> socket2 = loadDocAndGetSocket("empty.odt", _uri, testname); sendTextFrame(socket2, "status", testname); assertResponseString(socket2, "status:", testname); } @@ -201,10 +201,10 @@ void HTTPCrashTest::testRecoverAfterKitCrash() void HTTPCrashTest::testCrashForkit() { - const auto testname = "crashForkit "; + const char* testname = "crashForkit "; try { - auto socket = loadDocAndGetSocket("empty.odt", _uri, testname); + std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket("empty.odt", _uri, testname); std::cerr << "Killing forkit." << std::endl; killForkitProcess(); diff --git a/test/httpwserror.cpp b/test/httpwserror.cpp index ded7f032..6ba40d01 100644 --- a/test/httpwserror.cpp +++ b/test/httpwserror.cpp @@ -86,14 +86,14 @@ public: void HTTPWSError::testBadDocLoadFail() { // Load corrupted document and validate error. - const auto testname = "docLoadFail "; + const char* testname = "docLoadFail "; try { std::string documentPath, documentURL; getDocumentPathAndURL("corrupted.odt", documentPath, documentURL, testname); Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL); - auto socket = connectLOKit(_uri, request, _response); + std::shared_ptr<LOOLWebSocket> socket = connectLOKit(_uri, request, _response); // Send a load request with incorrect password sendTextFrame(socket, "load url=" + documentURL); @@ -118,7 +118,7 @@ void HTTPWSError::testBadDocLoadFail() void HTTPWSError::testMaxDocuments() { static_assert(MAX_DOCUMENTS >= 2, "MAX_DOCUMENTS must be at least 2"); - const auto testname = "maxDocuments "; + const char* testname = "maxDocuments "; if (MAX_DOCUMENTS > 20) { @@ -155,7 +155,7 @@ void HTTPWSError::testMaxDocuments() assertResponseString(socket, "error:", testname); std::string message; - const auto statusCode = getErrorCode(socket, message, testname); + const int statusCode = getErrorCode(socket, message, testname); CPPUNIT_ASSERT_EQUAL(static_cast<int>(Poco::Net::WebSocket::WS_POLICY_VIOLATION), statusCode); socket->shutdown(); @@ -169,7 +169,7 @@ void HTTPWSError::testMaxDocuments() void HTTPWSError::testMaxConnections() { static_assert(MAX_CONNECTIONS >= 3, "MAX_CONNECTIONS must be at least 3"); - const auto testname = "maxConnections "; + const char* testname = "maxConnections "; if (MAX_CONNECTIONS > 40) { @@ -188,7 +188,7 @@ void HTTPWSError::testMaxConnections() getDocumentPathAndURL("empty.odt", docPath, docURL, testname); Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, docURL); - auto socket = loadDocAndGetSocket(_uri, docURL, testname); + std::shared_ptr<LOOLWebSocket> socket = loadDocAndGetSocket(_uri, docURL, testname); std::cerr << "Opened connection #1 of " << MAX_CONNECTIONS << std::endl; std::vector<std::shared_ptr<LOOLWebSocket>> views; @@ -210,7 +210,7 @@ void HTTPWSError::testMaxConnections() sendTextFrame(socketN, "load url=" + docURL, testname); std::string message; - const auto statusCode = getErrorCode(socketN, message, testname); + const int statusCode = getErrorCode(socketN, message, testname); CPPUNIT_ASSERT_EQUAL(static_cast<int>(Poco::Net::WebSocket::WS_POLICY_VIOLATION), statusCode); socketN->shutdown(); @@ -224,7 +224,7 @@ void HTTPWSError::testMaxConnections() void HTTPWSError::testMaxViews() { static_assert(MAX_CONNECTIONS >= 3, "MAX_CONNECTIONS must be at least 3"); - const auto testname = "maxViews "; + const char* testname = "maxViews "; if (MAX_CONNECTIONS > 40) { @@ -243,7 +243,7 @@ void HTTPWSError::testMaxViews() getDocumentPathAndURL("empty.odt", docPath, docURL, testname); Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, docURL); ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits