mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-08 10:51:03 +00:00
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
This commit is contained in:
parent
0c9dedfe01
commit
0e40512c86
@ -249,12 +249,12 @@ static bool rmdir(QFileInfo const & fi)
|
|||||||
bool success;
|
bool success;
|
||||||
if (list.at(i).isDir()) {
|
if (list.at(i).isDir()) {
|
||||||
LYXERR(Debug::FILES, "Erasing dir "
|
LYXERR(Debug::FILES, "Erasing dir "
|
||||||
<< fromqstr(list.at(i).absoluteFilePath()) << endl);
|
<< fromqstr(list.at(i).absoluteFilePath()));
|
||||||
success = rmdir(list.at(i));
|
success = rmdir(list.at(i));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LYXERR(Debug::FILES, "Erasing file "
|
LYXERR(Debug::FILES, "Erasing file "
|
||||||
<< fromqstr(list.at(i).absoluteFilePath()) << endl);
|
<< fromqstr(list.at(i).absoluteFilePath()));
|
||||||
success = dir.remove(list.at(i).fileName());
|
success = dir.remove(list.at(i).fileName());
|
||||||
}
|
}
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <boost/crc.hpp>
|
#include <boost/crc.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
@ -50,7 +50,6 @@ int accept(int)
|
|||||||
|
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
|
||||||
using std::endl;
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
#ifndef CXX_GLOBAL_CSTD
|
#ifndef CXX_GLOBAL_CSTD
|
||||||
@ -82,8 +81,7 @@ int listen(FileName const & name, int queue)
|
|||||||
string::size_type len = localname.size();
|
string::size_type len = localname.size();
|
||||||
// the field sun_path in sockaddr_un is a char[108]
|
// the field sun_path in sockaddr_un is a char[108]
|
||||||
if (len > 107) {
|
if (len > 107) {
|
||||||
lyxerr << "lyx: Socket address '" << name.absFilename() << "' too long."
|
LYXERR(Debug::ANY, "lyx: Socket address '" << name.absFilename() << "' too long.");
|
||||||
<< endl;
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// Synonims for AF_UNIX are AF_LOCAL and AF_FILE
|
// 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
|
// For local sockets, the protocol is always 0
|
||||||
// socket() returns -1 in case of error
|
// socket() returns -1 in case of error
|
||||||
if ((fd = ::socket(PF_UNIX, SOCK_STREAM, 0))== -1) {
|
if ((fd = ::socket(PF_UNIX, SOCK_STREAM, 0))== -1) {
|
||||||
lyxerr << "lyx: Could not create socket descriptor: "
|
LYXERR(Debug::ANY, "lyx: Could not create socket descriptor: "
|
||||||
<< strerror(errno) << endl;
|
<< strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set NONBLOCK mode for the file descriptor
|
// Set NONBLOCK mode for the file descriptor
|
||||||
if (::fcntl(fd, F_SETFL, O_NONBLOCK) == -1) {
|
if (::fcntl(fd, F_SETFL, O_NONBLOCK) == -1) {
|
||||||
lyxerr << "lyx: Could not set NONBLOCK mode for socket descriptor: "
|
LYXERR(Debug::ANY, "lyx: Could not set NONBLOCK mode for socket descriptor: "
|
||||||
<< strerror(errno) << endl;
|
<< strerror(errno));
|
||||||
::close(fd);
|
::close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -113,8 +111,8 @@ int listen(FileName const & name, int queue)
|
|||||||
// the socket special file in the filesystem. bind() returns -1
|
// the socket special file in the filesystem. bind() returns -1
|
||||||
// in case of error
|
// in case of error
|
||||||
if ((::bind (fd, reinterpret_cast<sockaddr *>(&addr), SUN_LEN(&addr))) == -1) {
|
if ((::bind (fd, reinterpret_cast<sockaddr *>(&addr), SUN_LEN(&addr))) == -1) {
|
||||||
lyxerr << "lyx: Could not bind address '" << name.absFilename()
|
LYXERR(Debug::ANY, "lyx: Could not bind address '" << name.absFilename()
|
||||||
<< "' to socket descriptor: " << strerror(errno) << endl;
|
<< "' to socket descriptor: " << strerror(errno));
|
||||||
::close(fd);
|
::close(fd);
|
||||||
unlink(name);
|
unlink(name);
|
||||||
return -1;
|
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
|
// It is not a restriction on the number of connections the socket
|
||||||
// can accept. Returns -1 in case of error
|
// can accept. Returns -1 in case of error
|
||||||
if (::listen (fd, queue) == -1) {
|
if (::listen (fd, queue) == -1) {
|
||||||
lyxerr << "lyx: Could not put socket in 'listen' state: "
|
LYXERR(Debug::ANY, "lyx: Could not put socket in 'listen' state: "
|
||||||
<< strerror(errno) << endl;
|
<< strerror(errno));
|
||||||
::close(fd);
|
::close(fd);
|
||||||
unlink(name);
|
unlink(name);
|
||||||
return -1;
|
return -1;
|
||||||
@ -146,15 +144,15 @@ int accept(int sd)
|
|||||||
// Using null pointers for the second and third arguments
|
// Using null pointers for the second and third arguments
|
||||||
// dismiss all information about the connecting client
|
// dismiss all information about the connecting client
|
||||||
if ((fd = accept(sd, reinterpret_cast<sockaddr *>(0), reinterpret_cast<socklen_t *>(0))) == -1) {
|
if ((fd = accept(sd, reinterpret_cast<sockaddr *>(0), reinterpret_cast<socklen_t *>(0))) == -1) {
|
||||||
lyxerr << "lyx: Could not accept connection: "
|
LYXERR(Debug::ANY, "lyx: Could not accept connection: "
|
||||||
<< strerror(errno) << endl;
|
<< strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets NONBLOCK mode for the file descriptor
|
// Sets NONBLOCK mode for the file descriptor
|
||||||
if (::fcntl(fd, F_SETFL, O_NONBLOCK) == -1) {
|
if (::fcntl(fd, F_SETFL, O_NONBLOCK) == -1) {
|
||||||
lyxerr << "lyx: Could not set NONBLOCK mode for connection: "
|
LYXERR(Debug::ANY, "lyx: Could not set NONBLOCK mode for connection: "
|
||||||
<< strerror(errno) << endl;
|
<< strerror(errno));
|
||||||
::close(fd);
|
::close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,6 @@ extern "C" int mkstemp(char *);
|
|||||||
using boost::scoped_array;
|
using boost::scoped_array;
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::endl;
|
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace support {
|
namespace support {
|
||||||
@ -84,10 +83,9 @@ int make_tempfile(char * templ)
|
|||||||
|
|
||||||
FileName const tempName(FileName const & dir, string const & mask)
|
FileName const tempName(FileName const & dir, string const & mask)
|
||||||
{
|
{
|
||||||
string const tmpdir(dir.empty() ?
|
string const tmpdir = dir.empty()
|
||||||
package().temp_dir().absFilename() :
|
? package().temp_dir().absFilename() : dir.absFilename();
|
||||||
dir.absFilename());
|
string tmpfl = to_filesystem8bit(from_utf8(addName(tmpdir, mask)));
|
||||||
string tmpfl(to_filesystem8bit(from_utf8(addName(tmpdir, mask))));
|
|
||||||
#if defined (HAVE_GETPID)
|
#if defined (HAVE_GETPID)
|
||||||
tmpfl += convert<string>(getpid());
|
tmpfl += convert<string>(getpid());
|
||||||
#elif defined (HAVE__GETPID)
|
#elif defined (HAVE__GETPID)
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
#include <ostream>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
@ -162,7 +163,7 @@ int IconvProcessor::convert(char const * buf, size_t buflen,
|
|||||||
// something like 0xffffffc2
|
// something like 0xffffffc2
|
||||||
boost::uint32_t const b =
|
boost::uint32_t const b =
|
||||||
*reinterpret_cast<unsigned char const *>(buf + i);
|
*reinterpret_cast<unsigned char const *>(buf + i);
|
||||||
lyxerr << " 0x" << b;
|
lyxerr << " 0x" << (unsigned int)b;
|
||||||
}
|
}
|
||||||
lyxerr << std::dec << endl;
|
lyxerr << std::dec << endl;
|
||||||
break;
|
break;
|
||||||
@ -177,7 +178,7 @@ int IconvProcessor::convert(char const * buf, size_t buflen,
|
|||||||
// something like 0xffffffc2
|
// something like 0xffffffc2
|
||||||
boost::uint32_t const b =
|
boost::uint32_t const b =
|
||||||
*reinterpret_cast<unsigned char const *>(buf + i);
|
*reinterpret_cast<unsigned char const *>(buf + i);
|
||||||
lyxerr << " 0x" << b;
|
lyxerr << " 0x" << (unsigned int)b;
|
||||||
}
|
}
|
||||||
lyxerr << std::dec << endl;
|
lyxerr << std::dec << endl;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user