[Libreoffice-commits] online.git: common/FileUtil.cpp common/Log.cpp common/Png.hpp common/SigUtil.cpp common/SigUtil.hpp common/Unit.cpp common/Util.cpp common/Util.hpp configure.ac gtk/Makefile.am kit/ChildSession.cpp kit/Kit.cpp kit/Kit.hpp net/FakeSocket.hpp net/ServerSocket.hpp net/Socket.cpp net/Socket.hpp net/WebSocketHandler.hpp test/fakesockettest.cpp wsd/Auth.hpp wsd/ClientSession.cpp wsd/DocumentBroker.cpp wsd/DocumentBroker.hpp wsd/LOOLWSD.cpp wsd/LOOLWSD.hpp wsd/Storage.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Feb 12 11:21:41 UTC 2019


 common/FileUtil.cpp      |    4 +-
 common/Log.cpp           |    2 -
 common/Png.hpp           |    2 -
 common/SigUtil.cpp       |    2 -
 common/SigUtil.hpp       |    4 +-
 common/Unit.cpp          |    2 -
 common/Util.cpp          |    4 +-
 common/Util.hpp          |    6 +--
 configure.ac             |    2 -
 gtk/Makefile.am          |    2 -
 kit/ChildSession.cpp     |   12 +++---
 kit/Kit.cpp              |   40 ++++++++++-----------
 kit/Kit.hpp              |    4 +-
 net/FakeSocket.hpp       |    2 -
 net/ServerSocket.hpp     |    6 +--
 net/Socket.cpp           |   16 ++++----
 net/Socket.hpp           |   30 ++++++++--------
 net/WebSocketHandler.hpp |   22 ++++++------
 test/fakesockettest.cpp  |    5 +-
 wsd/Auth.hpp             |    4 +-
 wsd/ClientSession.cpp    |    4 +-
 wsd/DocumentBroker.cpp   |   30 ++++++++--------
 wsd/DocumentBroker.hpp   |    4 +-
 wsd/LOOLWSD.cpp          |   86 +++++++++++++++++++++++------------------------
 wsd/LOOLWSD.hpp          |    4 +-
 wsd/Storage.cpp          |   14 +++----
 26 files changed, 157 insertions(+), 156 deletions(-)

New commits:
commit f76b36193df424e9718bb25c589c6efd476774cc
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Tue Feb 12 12:16:40 2019 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Tue Feb 12 12:20:11 2019 +0100

    android: #if(n)def MOBILEAPP -> #if (!)MOBILEAPP for better reliability.
    
    Change-Id: I5f9c9420b6c83601db1c8fdba4ae5a10b17b2107

diff --git a/common/FileUtil.cpp b/common/FileUtil.cpp
index 46f1dde85..cae406a77 100644
--- a/common/FileUtil.cpp
+++ b/common/FileUtil.cpp
@@ -195,7 +195,7 @@ namespace
 
 namespace FileUtil
 {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     void registerFileSystemForDiskSpaceChecks(const std::string& path)
     {
         const std::string::size_type lastSlash = path.rfind('/');
@@ -245,7 +245,7 @@ namespace FileUtil
     {
         assert(!path.empty());
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         bool hookResult;
         if (UnitBase::get().filterCheckDiskSpace(path, hookResult))
             return hookResult;
diff --git a/common/Log.cpp b/common/Log.cpp
index 617e26eca..b892c5b4b 100644
--- a/common/Log.cpp
+++ b/common/Log.cpp
@@ -142,7 +142,7 @@ namespace Log
         Source.setName(name);
         std::ostringstream oss;
         oss << Source.getName();
-#ifndef MOBILEAPP // Just one process in a mobile app, the pid is uninteresting.
+#if !MOBILEAPP // Just one process in a mobile app, the pid is uninteresting.
         oss << '-'
             << std::setw(5) << std::setfill('0') << Poco::Process::id();
 #endif
diff --git a/common/Png.hpp b/common/Png.hpp
index 84861fc48..330204306 100644
--- a/common/Png.hpp
+++ b/common/Png.hpp
@@ -130,7 +130,7 @@ bool encodeSubBufferToPNG(unsigned char* pixmap, size_t startX, size_t startY,
         return false;
     }
 
-#ifdef MOBILEAPP
+#if MOBILEAPP
     png_set_compression_level(png_ptr, Z_BEST_SPEED);
 #endif
 
diff --git a/common/SigUtil.cpp b/common/SigUtil.cpp
index fea7ca16f..56f29349f 100644
--- a/common/SigUtil.cpp
+++ b/common/SigUtil.cpp
@@ -41,7 +41,7 @@
 std::atomic<bool> TerminationFlag(false);
 std::atomic<bool> DumpGlobalState(false);
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 std::atomic<bool> ShutdownRequestFlag(false);
 
 std::mutex SigHandlerTrap;
diff --git a/common/SigUtil.hpp b/common/SigUtil.hpp
index 1bffbde47..7c247ad0d 100644
--- a/common/SigUtil.hpp
+++ b/common/SigUtil.hpp
@@ -13,7 +13,7 @@
 #include <atomic>
 #include <mutex>
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 /// Flag to commence clean shutdown
 extern std::atomic<bool> ShutdownRequestFlag;
 #else
@@ -26,7 +26,7 @@ extern std::atomic<bool> TerminationFlag;
 /// Flag to dump internal state
 extern std::atomic<bool> DumpGlobalState;
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
 /// Mutex to trap signal handler, if any,
 /// and prevent _Exit while collecting backtrace.
diff --git a/common/Unit.cpp b/common/Unit.cpp
index 7eba4fc2a..820f465ff 100644
--- a/common/Unit.cpp
+++ b/common/Unit.cpp
@@ -30,7 +30,7 @@ static Poco::Thread TimeoutThread("unit timeout");
 
 UnitBase *UnitBase::linkAndCreateUnit(UnitType type, const std::string &unitLibPath)
 {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     void *dlHandle = dlopen(unitLibPath.c_str(), RTLD_GLOBAL|RTLD_NOW);
     if (!dlHandle)
     {
diff --git a/common/Util.cpp b/common/Util.cpp
index 7c9c2f24e..0ca96021a 100644
--- a/common/Util.cpp
+++ b/common/Util.cpp
@@ -146,7 +146,7 @@ namespace Util
         return newTmp;
     }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     int getProcessThreadCount()
     {
         DIR *fdDir = opendir("/proc/self/task");
@@ -294,7 +294,7 @@ namespace Util
         return std::getenv("DISPLAY") != nullptr;
     }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
     static const char *startsWith(const char *line, const char *tag)
     {
diff --git a/common/Util.hpp b/common/Util.hpp
index 07af2a6a4..ab4ba2176 100644
--- a/common/Util.hpp
+++ b/common/Util.hpp
@@ -54,7 +54,7 @@ namespace Util
     /// Create randomized temporary directory
     std::string createRandomTmpDir();
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     /// Get number of threads in this process or -1 on error
     int getProcessThreadCount();
 
@@ -73,7 +73,7 @@ namespace Util
 
     bool windowingAvailable();
 
-#if !defined(BUILDING_TESTS) && !defined(KIT_IN_PROCESS) && !defined(MOBILEAPP)
+#if !defined(BUILDING_TESTS) && !defined(KIT_IN_PROCESS) && !MOBILEAPP
 
     /// Send a message to all clients.
     void alertAllUsers(const std::string& msg);
@@ -117,7 +117,7 @@ namespace Util
 #endif
     }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     /// Print given number of bytes in human-understandable form (KB,MB, etc.)
     std::string getHumanizedBytes(unsigned long nBytes);
 
diff --git a/configure.ac b/configure.ac
index d0d330212..ad187b6fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -461,7 +461,7 @@ AS_IF([test "$ENABLE_GTKAPP" = true],
 AM_CONDITIONAL([ENABLE_DEBUG], [test "$ENABLE_DEBUG" = "true"])
 
 mobile_app=
-MOBILEAPP=
+MOBILEAPP=0
 AC_MSG_CHECKING([Is this a mobile app])
 if test "$enable_gtkapp" = "yes" -o "$enable_iosapp" = "yes" -o "$enable_androidapp"; then
      AC_MSG_RESULT([Yes])
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 6d767bbc0..1a6241ca6 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -3,7 +3,7 @@ bin_PROGRAMS = mobile
 include_paths = -I${top_srcdir}/common -I${top_srcdir}/net -I${top_srcdir}/kit -I${top_srcdir}/wsd -I${top_srcdir}
 
 warning_flags = -Wall -Werror -Wno-parentheses -Wno-sign-compare -Wno-unused-variable -Wno-stringop-overflow
-define_flags = -DMOBILEAPP
+define_flags = -DMOBILEAPP=1
 
 AM_CPPFLAGS = -pthread \
               -DLOOLWSD_DATADIR='"@LOOLWSD_DATADIR@"' \
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index 583e83b72..818093f60 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -25,7 +25,7 @@
 #include <Poco/URI.h>
 #include <Poco/BinaryReader.h>
 #include <Poco/Base64Decoder.h>
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 #include <Poco/Net/HTTPResponse.h>
 #include <Poco/Net/HTTPSClientSession.h>
 #include <Poco/Net/SSLManager.h>
@@ -369,7 +369,7 @@ bool ChildSession::_handleInput(const char *buffer, int length)
         {
             askSignatureStatus(buffer, length, tokens);
         }
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         else if (tokens[0] == "uploadsigneddocument")
         {
             return uploadSignedDocument(buffer, length, tokens);
@@ -392,7 +392,7 @@ bool ChildSession::_handleInput(const char *buffer, int length)
     return true;
 }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
 // add to common / tools
 size_t getFileSize(const std::string& filename)
@@ -948,7 +948,7 @@ bool ChildSession::insertFile(const char* /*buffer*/, int /*length*/, const std:
 {
     std::string name, type;
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     if (tokens.size() != 3 ||
         !getTokenString(tokens[1], "name", name) ||
         !getTokenString(tokens[2], "type", type))
@@ -972,7 +972,7 @@ bool ChildSession::insertFile(const char* /*buffer*/, int /*length*/, const std:
     {
         std::string url;
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         if (type == "graphic")
             url = "file://" + std::string(JAILED_DOCUMENT_ROOT) + "insertfile/" + name;
         else if (type == "graphicurl")
@@ -1402,7 +1402,7 @@ bool ChildSession::signDocumentContent(const char* buffer, int length, const std
     return bResult;
 }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
 bool ChildSession::exportSignAndUploadDocument(const char* buffer, int length, const std::vector<std::string>& /*tokens*/)
 {
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index a91514ed4..6cea2e0c4 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -68,7 +68,7 @@
 #include <Util.hpp>
 #include "Delta.hpp"
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 #include <common/SigUtil.hpp>
 #include <common/Seccomp.hpp>
 #endif
@@ -78,7 +78,7 @@
 #include <wsd/LOOLWSD.hpp>
 #endif
 
-#ifdef MOBILEAPP
+#if MOBILEAPP
 #include "LOOLWSD.hpp"
 #endif
 
@@ -124,7 +124,7 @@ static std::string ObfuscatedFileId;
 #  define ADD_DEBUG_RENDERID(s) (s)
 #endif
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
 static LokHookFunction2* initFunction = nullptr;
 
@@ -781,7 +781,7 @@ private:
     std::vector<unsigned char> _pixmap;
 };
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 static FILE* ProcSMapsFile = nullptr;
 #endif
 
@@ -934,7 +934,7 @@ public:
             }
 
             num_sessions = _sessions.size();
-#ifndef MOBILEAPP
+#if !MOBILEAPP
             if (num_sessions == 0)
             {
                 LOG_FTL("Document [" << anonymizeUrl(_url) << "] has no more views, exiting bluntly.");
@@ -1433,7 +1433,7 @@ private:
         if (viewCount == 1)
         {
             std::unique_lock<std::mutex> lock(_mutex);
-#ifndef MOBILEAPP
+#if !MOBILEAPP
             if (_sessions.empty())
             {
                 LOG_INF("Document [" << anonymizeUrl(_url) << "] has no more views, exiting bluntly.");
@@ -1881,7 +1881,7 @@ private:
         Util::setThreadName("lokit_" + _docId);
 
         LOG_DBG("Thread started.");
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         // Update memory stats and editor every 5 seconds.
         const int memStatsPeriodMs = 5000;
         auto lastMemStatsTime = std::chrono::steady_clock::now();
@@ -1894,7 +1894,7 @@ private:
                 const TileQueue::Payload input = _tileQueue->get(POLL_TIMEOUT_MS * 2);
                 if (input.empty())
                 {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
                     auto duration = (std::chrono::steady_clock::now() - lastMemStatsTime);
                     std::chrono::milliseconds::rep durationMs = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count();
                     if (durationMs > memStatsPeriodMs)
@@ -2124,7 +2124,7 @@ protected:
     {
         std::string message(data.data(), data.size());
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         if (UnitKit::get().filterKitMessage(this, message))
             return;
 #endif
@@ -2198,7 +2198,7 @@ protected:
         }
         else if (tokens.size() == 3 && tokens[0] == "setconfig")
         {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
             // Currently onlly rlimit entries are supported.
             if (!Rlimit::handleSetrlimitCommand(tokens))
             {
@@ -2214,7 +2214,7 @@ protected:
 
     void onDisconnect() override
     {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         LOG_WRN("Kit connection lost without exit arriving from wsd. Setting TerminationFlag");
         TerminationFlag = true;
 #endif
@@ -2229,7 +2229,7 @@ void documentViewCallback(const int type, const char* payload, void* data)
 #ifndef BUILDING_TESTS
 
 void lokit_main(
-#ifndef MOBILEAPP
+#if !MOBILEAPP
                 const std::string& childRoot,
                 const std::string& jailId,
                 const std::string& sysTemplate,
@@ -2245,7 +2245,7 @@ void lokit_main(
 #endif
                 )
 {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
 #ifndef FUZZER
     SigUtil::setFatalSignals();
@@ -2303,7 +2303,7 @@ void lokit_main(
 
     try
     {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         jailPath = Path::forDirectory(childRoot + "/" + jailId);
         LOG_INF("Jail path: " << jailPath.toString());
         File(jailPath).createDirectories();
@@ -2524,7 +2524,7 @@ void lokit_main(
         SocketPoll mainKit("kit");
         mainKit.runOnClientThread(); // We will do the polling on this thread.
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         mainKit.insertNewWebSocketSync(uri, std::make_shared<KitWebSocketHandler>("child_ws_" + pid, loKit, jailId, mainKit));
 #else
         mainKit.insertNewWebSocketSync(docBrokerSocket, std::make_shared<KitWebSocketHandler>("child_ws_" + pid, loKit, jailId, mainKit));
@@ -2532,7 +2532,7 @@ void lokit_main(
 
         LOG_INF("New kit client websocket inserted.");
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         if (bTraceStartup && LogLevel != "trace")
         {
             LOG_INF("Kit initialization complete: setting log-level to [" << LogLevel << "] as configured.");
@@ -2544,7 +2544,7 @@ void lokit_main(
         {
             mainKit.poll(SocketPoll::DefaultPollTimeoutMs);
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
             if (document && document->purgeSessions() == 0)
             {
                 LOG_INF("Last session discarded. Setting TerminationFlag");
@@ -2555,7 +2555,7 @@ void lokit_main(
 
         LOG_INF("Kit poll terminated.");
 
-#ifdef MOBILEAPP
+#if MOBILEAPP
         SocketPoll::wakeupWorld();
 #endif
 
@@ -2571,7 +2571,7 @@ void lokit_main(
         LOG_ERR("Exception: " << exc.what());
     }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
     // Trap the signal handler, if invoked,
     // to prevent exiting.
@@ -2593,7 +2593,7 @@ std::string anonymizeUrl(const std::string& url)
 #endif
 }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
 /// Initializes LibreOfficeKit for cross-fork re-use.
 bool globalPreinit(const std::string &loTemplate)
diff --git a/kit/Kit.hpp b/kit/Kit.hpp
index efd768f14..58dfd9e55 100644
--- a/kit/Kit.hpp
+++ b/kit/Kit.hpp
@@ -14,7 +14,7 @@
 
 #include <common/Util.hpp>
 
-#ifdef MOBILEAPP
+#if MOBILEAPP
 
 #include "ClientSession.hpp"
 #include "DocumentBroker.hpp"
@@ -23,7 +23,7 @@
 #endif
 
 void lokit_main(
-#ifndef MOBILEAPP
+#if !MOBILEAPP
                 const std::string& childRoot,
                 const std::string& jailId,
                 const std::string& sysTemplate,
diff --git a/net/FakeSocket.hpp b/net/FakeSocket.hpp
index 11470f6da..8ad1d48f1 100644
--- a/net/FakeSocket.hpp
+++ b/net/FakeSocket.hpp
@@ -10,7 +10,7 @@
 #ifndef INCLUDED_FAKESOCKET_H
 #define INCLUDED_FAKESOCKET_H
 
-#ifdef MOBILEAPP
+#if MOBILEAPP
 
 #include <string>
 
diff --git a/net/ServerSocket.hpp b/net/ServerSocket.hpp
index 7606e86ce..eb0bb46ca 100644
--- a/net/ServerSocket.hpp
+++ b/net/ServerSocket.hpp
@@ -47,7 +47,7 @@ public:
     /// Returns true on success only.
     bool listen(const int backlog = 64)
     {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         const int rc = ::listen(getFD(), backlog);
 #else
         const int rc = fakeSocketListen(getFD());
@@ -64,7 +64,7 @@ public:
     {
         // Accept a connection (if any) and set it to non-blocking.
         // There still need the client's address to filter request from POST(call from REST) here.
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         struct sockaddr_in6 clientInfo;
         socklen_t addrlen = sizeof(clientInfo);
         const int rc = ::accept4(getFD(), (struct sockaddr *)&clientInfo, &addrlen, SOCK_NONBLOCK);
@@ -77,7 +77,7 @@ public:
             // Create a socket object using the factory.
             if (rc != -1)
             {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
                 char addrstr[INET6_ADDRSTRLEN];
 
                 const void *inAddr;
diff --git a/net/Socket.cpp b/net/Socket.cpp
index 2d35f6b02..8d2cd3533 100644
--- a/net/Socket.cpp
+++ b/net/Socket.cpp
@@ -28,7 +28,7 @@
 
 #include <SigUtil.hpp>
 #include "ServerSocket.hpp"
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 #include "SslSocket.hpp"
 #endif
 #include "WebSocketHandler.hpp"
@@ -39,7 +39,7 @@ std::atomic<bool> Socket::InhibitThreadChecks(false);
 
 int Socket::createSocket(Socket::Type type)
 {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     int domain = type == Type::IPv4 ? AF_INET : AF_INET6;
     return socket(domain, SOCK_STREAM | SOCK_NONBLOCK, 0);
 #else
@@ -71,7 +71,7 @@ SocketPoll::SocketPoll(const std::string& threadName)
 {
     // Create the wakeup fd.
     if (
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         ::pipe2(_wakeup, O_CLOEXEC | O_NONBLOCK) == -1
 #else
         fakeSocketPipe2(_wakeup) == -1
@@ -99,7 +99,7 @@ SocketPoll::~SocketPoll()
             getWakeupsArray().erase(it);
     }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     ::close(_wakeup[0]);
     ::close(_wakeup[1]);
 #else
@@ -190,14 +190,14 @@ void SocketPoll::wakeupWorld()
 }
 
 void SocketPoll::insertNewWebSocketSync(
-#ifndef MOBILEAPP
+#if !MOBILEAPP
                                         const Poco::URI &uri,
 #else
                                         int peerSocket,
 #endif
                                         const std::shared_ptr<SocketHandlerInterface>& websocketHandler)
 {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     LOG_INF("Connecting to " << uri.getHost() << " : " << uri.getPort() << " : " << uri.getPath());
 
     // FIXME: put this in a ClientSocket class ?
@@ -380,7 +380,7 @@ void SocketPoll::dumpState(std::ostream& os)
 /// Returns true on success only.
 bool ServerSocket::bind(Type type, int port)
 {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     // Enable address reuse to avoid stalling after
     // recycling, when previous socket is TIME_WAIT.
     //TODO: Might be worth refactoring out.
@@ -430,7 +430,7 @@ bool ServerSocket::bind(Type type, int port)
 #endif
 }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
 bool StreamSocket::parseHeader(const char *clientName,
                                Poco::MemoryInputStream &message,
diff --git a/net/Socket.hpp b/net/Socket.hpp
index 531f5358a..e27dc6df0 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -116,7 +116,7 @@ public:
         LOG_TRC("#" << getFD() << " Socket dtor.");
 
         // Doesn't block on sockets; no error handling needed.
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         ::close(_fd);
 #else
         fakeSocketClose(_fd);
@@ -144,7 +144,7 @@ public:
     virtual void shutdown()
     {
         LOG_TRC("#" << _fd << ": socket shutdown RDWR.");
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         ::shutdown(_fd, SHUT_RDWR);
 #else
         fakeSocketShutdown(_fd);
@@ -165,14 +165,14 @@ public:
     /// manage latency issues around packet aggregation
     void setNoDelay()
     {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         const int val = 1;
         ::setsockopt(_fd, IPPROTO_TCP, TCP_NODELAY,
                      (char *) &val, sizeof(val));
 #endif
     }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     /// Sets the kernel socket send buffer in size bytes.
     /// Note: TCP will allocate twice this size for admin purposes,
     /// so a subsequent call to getSendBufferSize will return
@@ -218,14 +218,14 @@ public:
     /// Gets our fast cache of the socket buffer size
     int getSendBufferSize() const
     {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         return _sendBufferSize;
 #else
         return INT_MAX; // We want to always send a single record in one go
 #endif
     }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     /// Sets the receive buffer size in bytes.
     /// Note: TCP will allocate twice this size for admin purposes,
     /// so a subsequent call to getReceieveBufferSize will return
@@ -318,7 +318,7 @@ protected:
         _owner = std::this_thread::get_id();
         LOG_DBG("#" << _fd << " Thread affinity set to " << Log::to_string(_owner) << ".");
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 #if ENABLE_DEBUG
         if (std::getenv("LOOL_ZERO_BUFFER_SIZE"))
         {
@@ -401,7 +401,7 @@ public:
     {
         LOG_DBG("Stopping " << _name << ".");
         _stop = true;
-#ifdef MOBILEAPP
+#if MOBILEAPP
         {
             // We don't want to risk some callbacks in _newCallbacks being invoked when we start
             // running a thread for this SocketPoll again.
@@ -485,7 +485,7 @@ public:
         int rc;
         do
         {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
             rc = ::poll(&_pollFds[0], size + 1, std::max(timeoutMaxMs,0));
 #else
             LOG_TRC("SocketPoll Poll");
@@ -504,7 +504,7 @@ public:
                 std::lock_guard<std::mutex> lock(_mutex);
 
                 // Clear the data.
-#ifndef MOBILEAPP
+#if !MOBILEAPP
                 int dump = ::read(_wakeup[0], &dump, sizeof(dump));
 #else
                 LOG_TRC("Wakeup pipe read");
@@ -588,7 +588,7 @@ public:
         // wakeup the main-loop.
         int rc;
         do {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
             rc = ::write(fd, "w", 1);
 #else
 #if 0
@@ -645,7 +645,7 @@ public:
     /// Inserts a new websocket to be polled.
     /// NOTE: The DNS lookup is synchronous.
     void insertNewWebSocketSync(
-#ifndef MOBILEAPP
+#if !MOBILEAPP
                                 const Poco::URI &uri,
 #else
                                 int peerSocket,
@@ -864,7 +864,7 @@ public:
     {
         assertCorrectThread();
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         // SSL decodes blocks of 16Kb, so for efficiency we use the same.
         char buf[16 * 1024];
         ssize_t len;
@@ -1081,7 +1081,7 @@ protected:
     virtual int readData(char* buf, int len)
     {
         assertCorrectThread();
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         return ::read(getFD(), buf, len);
 #else
         return fakeSocketRead(getFD(), buf, len);
@@ -1092,7 +1092,7 @@ protected:
     virtual int writeData(const char* buf, const int len)
     {
         assertCorrectThread();
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         return ::write(getFD(), buf, len);
 #else
         struct pollfd p;
diff --git a/net/WebSocketHandler.hpp b/net/WebSocketHandler.hpp
index a037cb6b5..88350df1e 100644
--- a/net/WebSocketHandler.hpp
+++ b/net/WebSocketHandler.hpp
@@ -113,7 +113,7 @@ public:
                 static_cast<unsigned>(statusCode) << ", message: " << statusMessage);
         _shuttingDown = true;
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         const size_t len = statusMessage.size();
         std::vector<char> buf(2 + len);
         buf[0] = ((((int)statusCode) >> 8) & 0xff);
@@ -136,7 +136,7 @@ public:
         if (len == 0)
             return false; // avoid logging.
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         if (len < 2) // partial read
         {
             LOG_TRC("#" << socket->getFD() << ": Still incomplete WebSocket message, have " << len << " bytes");
@@ -215,7 +215,7 @@ public:
 
         socket->getInBuffer().erase(socket->getInBuffer().begin(), socket->getInBuffer().begin() + headerLen + payloadLen);
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
         // FIXME: fin, aggregating payloads into _wsPayload etc.
         LOG_TRC("#" << socket->getFD() << ": Incoming WebSocket message code " << static_cast<unsigned>(code) <<
@@ -270,7 +270,7 @@ public:
 
 #endif
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         if (doClose)
         {
             if (!_shuttingDown)
@@ -312,7 +312,7 @@ public:
 
         std::shared_ptr<StreamSocket> socket = _socket.lock();
 
-#ifdef MOBILEAPP
+#if MOBILEAPP
         // No separate "upgrade" is going on
         if (socket != nullptr && !socket->isWebSocket())
             socket->setWebSocket();
@@ -322,7 +322,7 @@ public:
         {
             LOG_ERR("No socket associated with WebSocketHandler " << this);
         }
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         else if (_isClient && !socket->isWebSocket())
             handleClientUpgrade();
 #endif
@@ -345,7 +345,7 @@ public:
         return POLLIN;
     }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     /// Send a ping message
     void sendPingOrPong(std::chrono::steady_clock::time_point now,
                         const char* data, const size_t len,
@@ -388,7 +388,7 @@ public:
     /// Do we need to handle a timeout ?
     void checkTimeout(std::chrono::steady_clock::time_point now) override
     {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         if (_isClient)
             return;
 
@@ -445,7 +445,7 @@ private:
         socket->assertCorrectThread();
         std::vector<char>& out = socket->getOutBuffer();
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         const size_t oldSize = out.size();
 
         out.push_back(flags);
@@ -551,7 +551,7 @@ protected:
         LOG_TRC("#" << socket->getFD() << ": Upgrading to WebSocket.");
         assert(!socket->isWebSocket());
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         // create our websocket goodness ...
         const int wsVersion = std::stoi(req.get("Sec-WebSocket-Version", "13"));
         const std::string wsKey = req.get("Sec-WebSocket-Key", "");
@@ -579,7 +579,7 @@ protected:
         setWebSocket();
     }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     // Handle incoming upgrade to full socket as client WS.
     void handleClientUpgrade()
     {
diff --git a/test/fakesockettest.cpp b/test/fakesockettest.cpp
index 5d7efc2c4..e425b4d4d 100644
--- a/test/fakesockettest.cpp
+++ b/test/fakesockettest.cpp
@@ -25,8 +25,9 @@
 #include <cppunit/extensions/HelperMacros.h>
 #include <cppunit/extensions/TestFactoryRegistry.h>
 
-#define MOBILEAPP // A bit ugly, but currently FakeSocket.hpp is surrounded by a MOBILEAPP ifdef,
-                  // and probably it is not a good idea to remove that?
+#undef MOBILEAPP
+#define MOBILEAPP 1 // A bit ugly, but currently FakeSocket.hpp is surrounded by a MOBILEAPP ifdef,
+                    // and probably it is not a good idea to remove that?
 #include "FakeSocket.hpp"
 
 class FakeSocketTest : public CPPUNIT_NS::TestFixture
diff --git a/wsd/Auth.hpp b/wsd/Auth.hpp
index 3659a6d38..1220aee21 100644
--- a/wsd/Auth.hpp
+++ b/wsd/Auth.hpp
@@ -14,7 +14,7 @@
 #include <cassert>
 #include <string>
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 #include <Poco/Crypto/RSADigestEngine.h>
 #include <Poco/Crypto/RSAKey.h>
 #endif
@@ -33,7 +33,7 @@ public:
     virtual bool verify(const std::string& token) = 0;
 };
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
 /// JWT Authorization.
 class JWTAuth : public AuthBase
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 3c53fdb53..fcd449744 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -683,7 +683,7 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt
         return false;
     }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     LOOLWSD::dumpOutgoingTrace(docBroker->getJailId(), getId(), firstLine);
 #endif
 
@@ -774,7 +774,7 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt
                 return false;
          }
     }
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     else if (tokens.size() == 3 && tokens[0] == "saveas:")
     {
         bool isConvertTo = static_cast<bool>(_saveAsSocket);
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 93ad6c04b..ae071e8ac 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -210,7 +210,7 @@ void DocumentBroker::pollThread()
     _threadStart = std::chrono::steady_clock::now();
 
     // Request a kit process for this doc.
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     do
     {
         static const int timeoutMs = COMMAND_TIMEOUT_MS * 5;
@@ -260,7 +260,7 @@ void DocumentBroker::pollThread()
     static const size_t IdleDocTimeoutSecs = LOOLWSD::getConfigValue<int>(
                                                       "per_document.idle_timeout_secs", 3600);
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     // Used to accumulate B/W deltas.
     uint64_t adminSent = 0;
     uint64_t adminRecv = 0;
@@ -278,7 +278,7 @@ void DocumentBroker::pollThread()
 
         const auto now = std::chrono::steady_clock::now();
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         if (!_isLoaded && (limit_load_secs > 0) && (now > loadDeadline))
         {
             // Brutal but effective.
@@ -386,7 +386,7 @@ void DocumentBroker::pollThread()
     _poll->stop();
     _poll->removeSockets();
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     // Async cleanup.
     LOOLWSD::doHousekeeping();
 #endif
@@ -411,7 +411,7 @@ DocumentBroker::~DocumentBroker()
 {
     assertCorrectThread();
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     Admin::instance().rmDoc(_docKey);
 #endif
 
@@ -499,7 +499,7 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s
     std::string userExtraInfo;
     std::string watermarkText;
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     std::chrono::duration<double> getInfoCallDuration(0);
 
     WopiStorage* wopiStorage = dynamic_cast<WopiStorage*>(_storage.get());
@@ -655,7 +655,7 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s
     {
         std::string localPath = _storage->loadStorageFileToLocal(session->getAuthorization());
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         // Check if we have a prefilter "plugin" for this document format
         for (const auto& plugin : LOOLWSD::PluginConfigurations)
         {
@@ -731,7 +731,7 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s
         _tileCache->setThreadOwner(std::this_thread::get_id());
     }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     LOOLWSD::dumpNewSessionTrace(getJailId(), sessionId, _uriOrig, _storage->getRootFilePath());
 
     // Since document has been loaded, send the stats if its WOPI
@@ -1131,7 +1131,7 @@ size_t DocumentBroker::addSessionInternal(const std::shared_ptr<ClientSession>&
     const std::string aMessage = "session " + id + ' ' + _docKey + ' ' + _docId;
     _childProcess->sendTextFrame(aMessage);
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     // Tell the admin console about this new doc
     Admin::instance().addDoc(_docKey, getPid(), getFilename(), id, session->getUserName(), session->getUserId());
 #endif
@@ -1187,13 +1187,13 @@ size_t DocumentBroker::removeSessionInternal(const std::string& id)
     assertCorrectThread();
     try
     {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         Admin::instance().rmDoc(_docKey, id);
 #endif
         auto it = _sessions.find(id);
         if (it != _sessions.end())
         {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
             LOOLWSD::dumpEndSessionTrace(getJailId(), id, _uriOrig);
 #endif
 
@@ -1269,7 +1269,7 @@ bool DocumentBroker::handleInput(const std::vector<char>& payload)
     const auto& msg = message->abbr();
     LOG_TRC("DocumentBroker handling child message: [" << msg << "].");
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     LOOLWSD::dumpOutgoingTrace(getJailId(), "0", msg);
 #endif
 
@@ -1298,7 +1298,7 @@ bool DocumentBroker::handleInput(const std::vector<char>& payload)
             LOG_CHECK_RET(kind != "", false);
             Util::alertAllUsers(cmd, kind);
         }
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         else if (command == "procmemstats:")
         {
             int dirty;
@@ -1680,7 +1680,7 @@ void DocumentBroker::setModified(const bool value)
     if (_isModified != value)
     {
         _isModified = value;
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         Admin::instance().modificationAlert(_docKey, getPid(), value);
 #endif
     }
@@ -1870,7 +1870,7 @@ void DocumentBroker::broadcastMessage(const std::string& message)
 void DocumentBroker::updateLastActivityTime()
 {
     _lastActivityTime = std::chrono::steady_clock::now();
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     Admin::instance().updateLastActivityTime(_docKey);
 #endif
 }
diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index c9865a7eb..87d80bbdd 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -129,7 +129,7 @@ public:
         if (_pid < 0)
             return;
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         if (::kill(_pid, 0) == 0)
         {
             LOG_INF("Killing child [" << _pid << "].");
@@ -176,7 +176,7 @@ public:
     /// time after the other end-point closes. So this isn't accurate.
     bool isAlive() const
     {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         try
         {
             return _pid > 1 && _ws && ::kill(_pid, 0) == 0;
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index a26fb31bb..5dfec75a7 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -49,7 +49,7 @@
 #include <sstream>
 #include <thread>
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
 #include <Poco/Net/Context.h>
 #include <Poco/Net/HTMLForm.h>
@@ -111,7 +111,7 @@ using Poco::Net::PartHandler;
 #include "FileServer.hpp"
 #include <FileUtil.hpp>
 #include <IoUtil.hpp>
-#if defined KIT_IN_PROCESS || defined MOBILEAPP
+#if defined KIT_IN_PROCESS || MOBILEAPP
 #  include <Kit.hpp>
 #endif
 #include <Log.hpp>
@@ -135,7 +135,7 @@ using Poco::Net::PartHandler;
 
 #include <ServerSocket.hpp>
 
-#ifdef MOBILEAPP
+#if MOBILEAPP
 #ifdef IOS
 #include "ios.h"
 #elif GTKAPP
@@ -213,7 +213,7 @@ std::atomic<unsigned> LOOLWSD::NumConnections;
 std::string LOOLWSD::Cache = LOOLWSD_CACHEDIR;
 std::set<std::string> LOOLWSD::EditFileExtensions;
 
-#ifdef MOBILEAPP
+#if MOBILEAPP
 
 // Or can this be retreieved in some other way?
 int LOOLWSD::prisonerServerSocketFD;
@@ -255,7 +255,7 @@ inline void shutdownLimitReached(WebSocketHandler& ws)
 
 inline void checkSessionLimitsAndWarnClients()
 {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
     if (DocBrokers.size() > LOOLWSD::MaxDocuments || LOOLWSD::NumConnections >= LOOLWSD::MaxConnections)
     {
@@ -274,7 +274,7 @@ inline void checkSessionLimitsAndWarnClients()
 #endif
 }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 /// Internal implementation to alert all clients
 /// connected to any document.
 void alertAllUsersInternal(const std::string& msg)
@@ -297,7 +297,7 @@ void alertAllUsersInternal(const std::string& msg)
 
 static void checkDiskSpaceAndWarnClients(const bool cacheLastCheck)
 {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     try
     {
         const std::string fs = FileUtil::checkDiskSpaceOnRegisteredFileSystems(cacheLastCheck);
@@ -355,7 +355,7 @@ void cleanupDocBrokers()
     }
 }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
 /// Forks as many children as requested.
 /// Returns the number of children requested to spawn,
@@ -479,7 +479,7 @@ static size_t addNewChild(const std::shared_ptr<ChildProcess>& child)
 }
 
 std::shared_ptr<ChildProcess> getNewChild_Blocks(
-#ifdef MOBILEAPP
+#if MOBILEAPP
                                                  const std::string& uri
 #endif
                                                  )
@@ -488,7 +488,7 @@ std::shared_ptr<ChildProcess> getNewChild_Blocks(
 
     const auto startTime = std::chrono::steady_clock::now();
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     LOG_DBG("getNewChild: Rebalancing children.");
     int numPreSpawn = LOOLWSD::NumPreSpawnedChildren;
     ++numPreSpawn; // Replace the one we'll dispatch just now.
@@ -558,7 +558,7 @@ std::shared_ptr<ChildProcess> getNewChild_Blocks(
     return nullptr;
 }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
 /// Handles the filename part of the convert-to POST request payload.
 class ConvertToPartHandler : public PartHandler
@@ -735,7 +735,7 @@ LOOLWSD::~LOOLWSD()
 
 void LOOLWSD::initialize(Application& self)
 {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     if (geteuid() == 0)
     {
         throw std::runtime_error("Do not run as root. Please run as lool user.");
@@ -827,7 +827,7 @@ void LOOLWSD::initialize(Application& self)
     AutoPtr<AppConfigMap> defConfig(new AppConfigMap(DefAppConfig));
     conf.addWriteable(defConfig, PRIO_SYSTEM); // Lowest priority
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
     // Load default configuration files, if present.
     if (loadConfiguration(PRIO_DEFAULT) == 0)
@@ -1019,7 +1019,7 @@ void LOOLWSD::initialize(Application& self)
     }
     LOG_INF("NumPreSpawnedChildren set to " << NumPreSpawnedChildren << ".");
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     const auto maxConcurrency = getConfigValue<int>(conf, "per_document.max_concurrency", 4);
     if (maxConcurrency > 0)
     {
@@ -1129,13 +1129,13 @@ void LOOLWSD::initialize(Application& self)
         TraceDumper.reset(new TraceFileWriter(path, recordOutgoing, compress, takeSnapshot, filters));
     }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     FileServerRequestHandler::initialize();
 #endif
 
     StorageBase::initialize();
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     ServerApplication::initialize(self);
 
     DocProcSettings docProcSettings;
@@ -1243,7 +1243,7 @@ void LOOLWSD::dumpOutgoingTrace(const std::string& id, const std::string& sessio
 
 void LOOLWSD::defineOptions(OptionSet& optionSet)
 {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     ServerApplication::defineOptions(optionSet);
 
     optionSet.addOption(Option("help", "", "Display help information on command line arguments.")
@@ -1307,7 +1307,7 @@ void LOOLWSD::defineOptions(OptionSet& optionSet)
 void LOOLWSD::handleOption(const std::string& optionName,
                            const std::string& value)
 {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     ServerApplication::handleOption(optionName, value);
 
     if (optionName == "help")
@@ -1360,7 +1360,7 @@ void LOOLWSD::handleOption(const std::string& optionName,
 #endif
 }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
 void LOOLWSD::displayHelp()
 {
@@ -1493,7 +1493,7 @@ void LOOLWSD::autoSave(const std::string& docKey)
 /// Really do the house-keeping
 void PrisonerPoll::wakeupHook()
 {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     if (!LOOLWSD::checkAndRestoreForKit())
     {
         // No children have died.
@@ -1529,7 +1529,7 @@ void PrisonerPoll::wakeupHook()
         cleanupDocBrokers();
 }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
 bool LOOLWSD::createForKit()
 {
@@ -1812,7 +1812,7 @@ private:
 
         try
         {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
             size_t requestSize = 0;
 
             if (!socket->parseHeader("Prisoner", message, request, &requestSize))
@@ -2020,7 +2020,7 @@ private:
         // LOG_TRC("***** ClientRequestDispatcher::handleIncomingMessage()");
         std::shared_ptr<StreamSocket> socket = _socket.lock();
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         if (!LOOLWSD::isSSLEnabled() && socket->sniffSSL())
         {
             LOG_ERR("Looks like SSL/TLS traffic on plain http port");
@@ -2171,7 +2171,7 @@ private:
     {
     }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     void handleFileServerRequest(const Poco::Net::HTTPRequest& request, Poco::MemoryInputStream& message)
     {
         std::shared_ptr<StreamSocket> socket = _socket.lock();
@@ -2713,7 +2713,7 @@ private:
     /// Process the discovery.xml file and return as string.
     static std::string getDiscoveryXML()
     {
-#if defined __linux && defined MOBILEAPP
+#if defined __linux && MOBILEAPP
         // discovery.xml is in the top directory
         std::string discoveryPath = Path(Application::instance().commandPath()).parent().parent().toString() + "discovery.xml";
 #else
@@ -2809,7 +2809,7 @@ class PlainSocketFactory final : public SocketFactory
     std::shared_ptr<Socket> create(const int physicalFd) override
     {
         int fd = physicalFd;
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         if (SimulatedLatencyMs > 0)
             fd = Delay::create(SimulatedLatencyMs, physicalFd);
 #endif
@@ -2828,7 +2828,7 @@ class SslSocketFactory final : public SocketFactory
     {
         int fd = physicalFd;
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         if (SimulatedLatencyMs > 0)
             fd = Delay::create(SimulatedLatencyMs, physicalFd);
 #endif
@@ -2884,13 +2884,13 @@ public:
         std::shared_ptr<ServerSocket> serverSocket(findServerPort(port));
         _acceptPoll.insertNewSocket(serverSocket);
 
-#ifdef MOBILEAPP
+#if MOBILEAPP
         loolwsd_server_socket_fd = serverSocket->getFD();
 #endif
 
         WebServerPoll.startThread();
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         Admin::instance().start();
 #endif
     }
@@ -2929,7 +2929,7 @@ public:
         os << "Prisoner poll:\n";
         PrisonerPoll.dumpState(os);
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         os << "Admin poll:\n";
         Admin::instance().dumpState(os);
 
@@ -3010,7 +3010,7 @@ private:
         }
 
         MasterPortNumber = port;
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         LOG_INF("Listening to prisoner connections on port " << port);
 #else
         LOOLWSD::prisonerServerSocketFD = socket->getFD();
@@ -3052,7 +3052,7 @@ private:
 
         ClientPortNumber = port;
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
         LOG_INF("Listening to client connections on port " << port);
 #else
         LOG_INF("Listening to client connections on #" << socket->getFD());
@@ -3065,7 +3065,7 @@ static LOOLWSDServer srv;
 
 int LOOLWSD::innerMain()
 {
-#if !defined FUZZER && !defined MOBILEAPP
+#if !defined FUZZER && !MOBILEAPP
     SigUtil::setUserSignals();
     SigUtil::setFatalSignals();
     SigUtil::setTerminationSignals();
@@ -3075,7 +3075,7 @@ int LOOLWSD::innerMain()
     // down-pay all the forkit linking cost once & early.
     Environment::set("LD_BIND_NOW", "1");
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     if (DisplayVersion)
     {
         std::string version, hash;
@@ -3091,7 +3091,7 @@ int LOOLWSD::innerMain()
     ::setenv("LC_ALL", "en_US.UTF-8", 1);
     setlocale(LC_ALL, "en_US.UTF-8");
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     if (access(Cache.c_str(), R_OK | W_OK | X_OK) != 0)
     {
         const auto err = "Unable to access cache [" + Cache +
@@ -3142,7 +3142,7 @@ int LOOLWSD::innerMain()
     srv.startPrisoners(MasterPortNumber);
 
 // No need to "have at least one child" beforehand on mobile
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
 #ifndef KIT_IN_PROCESS
     {
@@ -3266,7 +3266,7 @@ int LOOLWSD::innerMain()
 
     DocBrokers.clear();
 
-#if !defined(KIT_IN_PROCESS) && !defined(MOBILEAPP)
+#if !defined(KIT_IN_PROCESS) && !MOBILEAPP
     // Terminate child processes
     LOG_INF("Requesting forkit process " << ForKitProcId << " to terminate.");
     SigUtil::killChild(ForKitProcId);
@@ -3281,7 +3281,7 @@ int LOOLWSD::innerMain()
         child->terminate();
     }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 #ifndef KIT_IN_PROCESS
     // Wait for forkit process finish.
     LOG_INF("Waiting for forkit process to exit");
@@ -3307,7 +3307,7 @@ int LOOLWSD::innerMain()
 
 void LOOLWSD::cleanup()
 {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     FileServerRequestHandler::uninitialize();
 
 #if ENABLE_SSL
@@ -3324,7 +3324,7 @@ void LOOLWSD::cleanup()
 
 int LOOLWSD::main(const std::vector<std::string>& /*args*/)
 {
-#ifdef MOBILEAPP
+#if MOBILEAPP
     TerminationFlag = false;
 #endif
 
@@ -3346,14 +3346,14 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/)
 
     LOG_INF("Process [loolwsd] finished.");
 
-#ifdef MOBILEAPP
+#if MOBILEAPP
     fakeSocketDumpState();
 #endif
 
     return returnValue;
 }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
 void UnitWSD::testHandleRequest(TestRequest type, UnitHTTPServerRequest& /* request */, UnitHTTPServerResponse& /* response */)
 {
@@ -3412,7 +3412,7 @@ void dump_state()
     LOG_TRC(msg);
 }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
 POCO_SERVER_MAIN(LOOLWSD)
 
diff --git a/wsd/LOOLWSD.hpp b/wsd/LOOLWSD.hpp
index 9e8f7b254..9fc6577c7 100644
--- a/wsd/LOOLWSD.hpp
+++ b/wsd/LOOLWSD.hpp
@@ -29,7 +29,7 @@ class TraceFileWriter;
 class DocumentBroker;
 
 std::shared_ptr<ChildProcess> getNewChild_Blocks(
-#ifdef MOBILEAPP
+#if MOBILEAPP
                                                  const std::string& uri
 #endif
                                                  );
@@ -248,7 +248,7 @@ private:
     /// Settings passed from the command-line to override those in the config file.
     std::map<std::string, std::string> _overrideSettings;
 
-#ifdef MOBILEAPP
+#if MOBILEAPP
 public:
     static int prisonerServerSocketFD;
 #endif
diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp
index a5ebcdc39..9d97cc1b6 100644
--- a/wsd/Storage.cpp
+++ b/wsd/Storage.cpp
@@ -24,7 +24,7 @@
 #include <Poco/JSON/Object.h>
 #include <Poco/JSON/Parser.h>
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
 #include <Poco/Net/AcceptCertificateHandler.h>
 #include <Poco/Net/Context.h>
@@ -59,7 +59,7 @@ bool StorageBase::FilesystemEnabled;
 bool StorageBase::WopiEnabled;
 Util::RegexListMatcher StorageBase::WopiHosts;
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
 std::string StorageBase::getLocalRootPath() const
 {
@@ -86,7 +86,7 @@ size_t StorageBase::getFileSize(const std::string& filename)
 
 void StorageBase::initialize()
 {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     const auto& app = Poco::Util::Application::instance();
     FilesystemEnabled = app.config().getBool("storage.filesystem[@allow]", false);
 
@@ -146,7 +146,7 @@ bool StorageBase::allowedWopiHost(const std::string& host)
     return WopiEnabled && WopiHosts.match(host);
 }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
 bool isLocalhost(const std::string& targetHost)
 {
@@ -238,7 +238,7 @@ std::unique_ptr<StorageBase> StorageBase::create(const Poco::URI& uri, const std
 
         LOG_ERR("Local Storage is disabled by default. Enable in the config file or on the command-line to enable.");
     }
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     else if (WopiEnabled)
     {
         LOG_INF("Public URI [" << LOOLWSD::anonymizeUrl(uri.toString()) << "] considered WOPI.");
@@ -274,7 +274,7 @@ std::unique_ptr<LocalStorage::LocalFileInfo> LocalStorage::getLocalFileInfo()
 
 std::string LocalStorage::loadStorageFileToLocal(const Authorization& /*auth*/)
 {
-#ifndef MOBILEAPP
+#if !MOBILEAPP
     // /chroot/jailId/user/doc/childId/file.ext
     const std::string filename = Poco::Path(getUri().getPath()).getFileName();
     setRootFilePath(Poco::Path(getLocalRootPath(), filename).toString());
@@ -363,7 +363,7 @@ StorageBase::SaveResult LocalStorage::saveLocalFileToStorage(const Authorization
     return StorageBase::SaveResult(StorageBase::SaveResult::OK);
 }
 
-#ifndef MOBILEAPP
+#if !MOBILEAPP
 
 namespace
 {


More information about the Libreoffice-commits mailing list