]> git.lyx.org Git - lyx.git/blobdiff - src/ServerSocket.cpp
This patch does two closely related things.
[lyx.git] / src / ServerSocket.cpp
index 3535ee4560a94c309ebed3ab80ff58a41f72d9c3..72a70d4edaac9bcede9ede09fa9d0709055ce3c8 100644 (file)
@@ -110,8 +110,7 @@ void ServerSocket::serverCallback()
        }
 
        // Register the new client.
-       clients[client_fd] =
-               shared_ptr<LyXDataSocket>(new LyXDataSocket(client_fd));
+       clients[client_fd] = make_shared<LyXDataSocket>(client_fd);
        theApp()->registerSocketCallback(
                client_fd,
                bind(&ServerSocket::dataCallback,
@@ -129,11 +128,11 @@ void ServerSocket::dataCallback(int fd)
                return;
        shared_ptr<LyXDataSocket> client = it->second;
        string line;
-       size_t pos;
        bool saidbye = false;
        while (!saidbye && client->readln(line)) {
                // The protocol must be programmed here
                // Split the key and the data
+               size_t pos;
                if ((pos = line.find(':')) == string::npos) {
                        client->writeln("ERROR:" + line + ":malformed message");
                        continue;