X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FServer.cpp;h=1de758a5f46bd1b9507c9e2ad9b213d9a015c550;hb=f08f5821ec5d29232bccb342a5b1ff86600b0716;hp=b6ae8d8b1fece30f7e71df4dea4b5213421e9c84;hpb=299745b635faadcf62340c5f914005244c01bc5b;p=lyx.git diff --git a/src/Server.cpp b/src/Server.cpp index b6ae8d8b1f..1de758a5f4 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -695,6 +695,7 @@ string const LyXComm::pipeName(DWORD index) const LyXComm::LyXComm(string const &, Server *, ClientCallbackfct) {} + void LyXComm::openConnection() {} @@ -716,6 +717,7 @@ void LyXComm::endPipe(int & fd, string const & filename, bool write) void LyXComm::emergencyCleanup() {} + void LyXComm::read_ready() {} @@ -726,7 +728,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) { @@ -915,7 +916,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 +966,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); @@ -1015,7 +1016,8 @@ bool LyXComm::loadFilesInOtherInstance() break; string const cmd = "LYXCMD:pipe:file-open:" + fname.absFileName() + '\n'; - ::write(pipefd, cmd.c_str(), cmd.length()); + if (::write(pipefd, cmd.c_str(), cmd.length()) < 0) + LYXERR0("Cannot write to pipe!"); ::close(pipefd); ++loaded_files; it = theFilesToLoad().erase(it); @@ -1067,7 +1069,6 @@ Server::~Server() int compare(char const * a, char const * b, unsigned int len) { - using namespace std; return strncmp(a, b, len); } @@ -1172,10 +1173,10 @@ void Server::callback(string const & msg) // connect to the lyxfunc in the single GuiView we // support currently. (Lgb) - FuncRequest const fr(lyxaction.lookupFunc(cmd), arg); + FuncRequest fr(lyxaction.lookupFunc(cmd), arg); + fr.setOrigin(FuncRequest::LYXSERVER); DispatchResult dr; theApp()->dispatch(fr, dr); - theApp()->dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE)); string const rval = to_utf8(dr.message()); // all commands produce an INFO or ERROR message