From 0e40512c861cf69088d422de7bc159cddbde5c64 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Tue, 27 Nov 2007 21:43:46 +0000 Subject: [PATCH] use LYXERR macro to avoid unneeded argument evaluations... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21835 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/support/FileName.cpp | 4 ++-- src/support/lyxsum.cpp | 1 + src/support/socktools.cpp | 28 +++++++++++++--------------- src/support/tempname.cpp | 8 +++----- src/support/unicode.cpp | 5 +++-- 5 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp index 91b9a33cc4..8203da462b 100644 --- a/src/support/FileName.cpp +++ b/src/support/FileName.cpp @@ -249,12 +249,12 @@ static bool rmdir(QFileInfo const & fi) bool success; if (list.at(i).isDir()) { LYXERR(Debug::FILES, "Erasing dir " - << fromqstr(list.at(i).absoluteFilePath()) << endl); + << fromqstr(list.at(i).absoluteFilePath())); success = rmdir(list.at(i)); } else { LYXERR(Debug::FILES, "Erasing file " - << fromqstr(list.at(i).absoluteFilePath()) << endl); + << fromqstr(list.at(i).absoluteFilePath())); success = dir.remove(list.at(i).fileName()); } if (!success) { diff --git a/src/support/lyxsum.cpp b/src/support/lyxsum.cpp index e1be53ee93..4a932bb117 100644 --- a/src/support/lyxsum.cpp +++ b/src/support/lyxsum.cpp @@ -17,6 +17,7 @@ #include #include +#include using std::endl; using std::string; diff --git a/src/support/socktools.cpp b/src/support/socktools.cpp index 98fda7be93..b6c6e5ac07 100644 --- a/src/support/socktools.cpp +++ b/src/support/socktools.cpp @@ -50,7 +50,6 @@ int accept(int) #include -using std::endl; using std::string; #ifndef CXX_GLOBAL_CSTD @@ -82,8 +81,7 @@ int listen(FileName const & name, int queue) string::size_type len = localname.size(); // the field sun_path in sockaddr_un is a char[108] if (len > 107) { - lyxerr << "lyx: Socket address '" << name.absFilename() << "' too long." - << endl; + LYXERR(Debug::ANY, "lyx: Socket address '" << name.absFilename() << "' too long."); return -1; } // Synonims for AF_UNIX are AF_LOCAL and AF_FILE @@ -96,15 +94,15 @@ int listen(FileName const & name, int queue) // For local sockets, the protocol is always 0 // socket() returns -1 in case of error if ((fd = ::socket(PF_UNIX, SOCK_STREAM, 0))== -1) { - lyxerr << "lyx: Could not create socket descriptor: " - << strerror(errno) << endl; + LYXERR(Debug::ANY, "lyx: Could not create socket descriptor: " + << strerror(errno)); return -1; } // Set NONBLOCK mode for the file descriptor if (::fcntl(fd, F_SETFL, O_NONBLOCK) == -1) { - lyxerr << "lyx: Could not set NONBLOCK mode for socket descriptor: " - << strerror(errno) << endl; + LYXERR(Debug::ANY, "lyx: Could not set NONBLOCK mode for socket descriptor: " + << strerror(errno)); ::close(fd); return -1; } @@ -113,8 +111,8 @@ int listen(FileName const & name, int queue) // the socket special file in the filesystem. bind() returns -1 // in case of error if ((::bind (fd, reinterpret_cast(&addr), SUN_LEN(&addr))) == -1) { - lyxerr << "lyx: Could not bind address '" << name.absFilename() - << "' to socket descriptor: " << strerror(errno) << endl; + LYXERR(Debug::ANY, "lyx: Could not bind address '" << name.absFilename() + << "' to socket descriptor: " << strerror(errno)); ::close(fd); unlink(name); return -1; @@ -126,8 +124,8 @@ int listen(FileName const & name, int queue) // It is not a restriction on the number of connections the socket // can accept. Returns -1 in case of error if (::listen (fd, queue) == -1) { - lyxerr << "lyx: Could not put socket in 'listen' state: " - << strerror(errno) << endl; + LYXERR(Debug::ANY, "lyx: Could not put socket in 'listen' state: " + << strerror(errno)); ::close(fd); unlink(name); return -1; @@ -146,15 +144,15 @@ int accept(int sd) // Using null pointers for the second and third arguments // dismiss all information about the connecting client if ((fd = accept(sd, reinterpret_cast(0), reinterpret_cast(0))) == -1) { - lyxerr << "lyx: Could not accept connection: " - << strerror(errno) << endl; + LYXERR(Debug::ANY, "lyx: Could not accept connection: " + << strerror(errno)); return -1; } // Sets NONBLOCK mode for the file descriptor if (::fcntl(fd, F_SETFL, O_NONBLOCK) == -1) { - lyxerr << "lyx: Could not set NONBLOCK mode for connection: " - << strerror(errno) << endl; + LYXERR(Debug::ANY, "lyx: Could not set NONBLOCK mode for connection: " + << strerror(errno)); ::close(fd); return -1; } diff --git a/src/support/tempname.cpp b/src/support/tempname.cpp index 6c6e998210..e3e8023b7c 100644 --- a/src/support/tempname.cpp +++ b/src/support/tempname.cpp @@ -46,7 +46,6 @@ extern "C" int mkstemp(char *); using boost::scoped_array; using std::string; -using std::endl; namespace lyx { namespace support { @@ -84,10 +83,9 @@ int make_tempfile(char * templ) FileName const tempName(FileName const & dir, string const & mask) { - string const tmpdir(dir.empty() ? - package().temp_dir().absFilename() : - dir.absFilename()); - string tmpfl(to_filesystem8bit(from_utf8(addName(tmpdir, mask)))); + string const tmpdir = dir.empty() + ? package().temp_dir().absFilename() : dir.absFilename(); + string tmpfl = to_filesystem8bit(from_utf8(addName(tmpdir, mask))); #if defined (HAVE_GETPID) tmpfl += convert(getpid()); #elif defined (HAVE__GETPID) diff --git a/src/support/unicode.cpp b/src/support/unicode.cpp index 682ac3e966..f929d56653 100644 --- a/src/support/unicode.cpp +++ b/src/support/unicode.cpp @@ -22,6 +22,7 @@ #include #include +#include #include using std::endl; @@ -162,7 +163,7 @@ int IconvProcessor::convert(char const * buf, size_t buflen, // something like 0xffffffc2 boost::uint32_t const b = *reinterpret_cast(buf + i); - lyxerr << " 0x" << b; + lyxerr << " 0x" << (unsigned int)b; } lyxerr << std::dec << endl; break; @@ -177,7 +178,7 @@ int IconvProcessor::convert(char const * buf, size_t buflen, // something like 0xffffffc2 boost::uint32_t const b = *reinterpret_cast(buf + i); - lyxerr << " 0x" << b; + lyxerr << " 0x" << (unsigned int)b; } lyxerr << std::dec << endl; break; -- 2.39.5