]> git.lyx.org Git - features.git/commitdiff
use LYXERR macro to avoid unneeded argument evaluations...
authorAndré Pönitz <poenitz@gmx.net>
Tue, 27 Nov 2007 21:43:46 +0000 (21:43 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 27 Nov 2007 21:43:46 +0000 (21:43 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21835 a592a061-630c-0410-9148-cb99ea01b6c8

src/support/FileName.cpp
src/support/lyxsum.cpp
src/support/socktools.cpp
src/support/tempname.cpp
src/support/unicode.cpp

index 91b9a33cc4db809d17927a84737af8b7a5e7373d..8203da462b7dc80d91cf5fd66623040e530dd1a4 100644 (file)
@@ -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) {
index e1be53ee9300174676427d822b26de37008d5556..4a932bb117bed41c36c08f83091e5f5903ef2c38 100644 (file)
@@ -17,6 +17,7 @@
 #include <boost/crc.hpp>
 
 #include <algorithm>
+#include <iomanip>
 
 using std::endl;
 using std::string;
index 98fda7be93e791a6757d3143e334d7dafc98c8bd..b6c6e5ac07824ccb2b6eede373dc5737bdf557da 100644 (file)
@@ -50,7 +50,6 @@ int accept(int)
 
 #include <cerrno>
 
-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<sockaddr *>(&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<sockaddr *>(0), reinterpret_cast<socklen_t *>(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;
        }
index 6c6e998210acbf7337b3ae5f283a96a0d94e717b..e3e8023b7c3a498b7c60ef6697dc3c49a09ade3a 100644 (file)
@@ -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<string>(getpid());
 #elif defined (HAVE__GETPID)
index 682ac3e9664f5ee9a080b7424f251255787a66db..f929d5665378ba122c15fb1d9a6f9d407ebf361f 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <cerrno>
 #include <iomanip>
+#include <ostream>
 #include <map>
 
 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<unsigned char const *>(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<unsigned char const *>(buf + i);
-                               lyxerr << " 0x" << b;
+                               lyxerr << " 0x" << (unsigned int)b;
                        }
                        lyxerr << std::dec << endl;
                        break;