X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FServer.cpp;h=b89e834f20408275b6200ec6de2a3b9ff1367fef;hb=bf56e2c8e1afa857cd5e313c19948040e41b8227;hp=1e673e6f8708e9fa1701b74dc0572dcc0d271c42;hpb=8995a8387a03361b6a7ff44b447a90a6187b1a14;p=lyx.git diff --git a/src/Server.cpp b/src/Server.cpp index 1e673e6f87..b89e834f20 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -58,6 +58,8 @@ #include "support/bind.h" +#include + #ifdef _WIN32 #include #include @@ -136,7 +138,7 @@ DWORD WINAPI pipeServerWrapper(void * arg) LyXComm::LyXComm(string const & pip, Server * cli, ClientCallbackfct ccb) - : pipename_(pip), client_(cli), clientcb_(ccb), stopserver_(0) + : stopserver_(0), pipename_(pip), client_(cli), clientcb_(ccb) { for (int i = 0; i < MAX_PIPES; ++i) { event_[i] = 0; @@ -209,7 +211,7 @@ bool LyXComm::pipeServer() // Determine which pipe instance completed the operation. i = wait - WAIT_OBJECT_0; - LASSERT(i >= 0 && i <= MAX_PIPES, /**/); + LASSERT(i <= MAX_PIPES, /**/); // Check whether we were waked up for stopping the pipe server. if (i == MAX_PIPES) @@ -695,6 +697,7 @@ string const LyXComm::pipeName(DWORD index) const LyXComm::LyXComm(string const &, Server *, ClientCallbackfct) {} + void LyXComm::openConnection() {} @@ -716,6 +719,7 @@ void LyXComm::endPipe(int & fd, string const & filename, bool write) void LyXComm::emergencyCleanup() {} + void LyXComm::read_ready() {} @@ -726,7 +730,6 @@ void LyXComm::send(string const & msg) #else // defined (HAVE_MKFIFO) - LyXComm::LyXComm(string const & pip, Server * cli, ClientCallbackfct ccb) : pipename_(pip), client_(cli), clientcb_(ccb) { @@ -877,7 +880,7 @@ void LyXComm::endPipe(int & fd, string const & filename, bool write) << '\n' << strerror(errno) << endl; } - if (FileName(filename).removeFile() < 0) { + if (!FileName(filename).removeFile()) { lyxerr << "LyXComm: Could not remove pipe " << filename << '\n' << strerror(errno) << endl; } @@ -915,7 +918,6 @@ void LyXComm::read_ready() int status; // the single = is intended here. while ((status = ::read(infd_, charbuf, charbuf_size - 1))) { - if (status > 0) { charbuf[status] = '\0'; // turn it into a c string read_buffer_ += rtrim(charbuf, "\r"); @@ -966,7 +968,8 @@ void LyXComm::send(string const & msg) LYXERR(Debug::LYXSERVER, "LyXComm: Sending '" << msg << '\''); - if (pipename_.empty()) return; + if (pipename_.empty()) + return; if (!ready_) { LYXERR0("LyXComm: Pipes are closed. Could not send " << msg); @@ -1068,7 +1071,6 @@ Server::~Server() int compare(char const * a, char const * b, unsigned int len) { - using namespace std; return strncmp(a, b, len); } @@ -1173,7 +1175,7 @@ void Server::callback(string const & msg) // connect to the lyxfunc in the single GuiView we // support currently. (Lgb) - FuncRequest fr(lyxaction.lookupFunc(cmd), arg); + FuncRequest fr(lyxaction.lookupFunc(cmd), from_ascii(arg)); fr.setOrigin(FuncRequest::LYXSERVER); DispatchResult dr; theApp()->dispatch(fr, dr);