diff --git a/cmd/synergyc/synergyc.cpp b/cmd/synergyc/synergyc.cpp
index aa7906d3..495c0b6f 100644
--- a/cmd/synergyc/synergyc.cpp
+++ b/cmd/synergyc/synergyc.cpp
@@ -196,7 +196,7 @@ realMain(CMutex* mutex)
#undef FINALLY
}
catch (XBase& e) {
- log((CLOG_CRIT "failed: %s", e.what()));
+ LOG((CLOG_CRIT "failed: %s", e.what()));
}
catch (XThread&) {
// terminated
@@ -230,7 +230,7 @@ static
void
version()
{
- log((CLOG_PRINT
+ LOG((CLOG_PRINT
"%s %s, protocol version %d.%d\n"
"%s",
pname,
@@ -244,7 +244,7 @@ static
void
help()
{
- log((CLOG_PRINT
+ LOG((CLOG_PRINT
"Usage: %s"
" [--camp|--no-camp]"
" [--daemon|--no-daemon]"
@@ -293,7 +293,7 @@ isArg(int argi, int argc, const char** argv,
(name2 != NULL && strcmp(argv[argi], name2) == 0)) {
// match. check args left.
if (argi + minRequiredParameters >= argc) {
- log((CLOG_PRINT "%s: missing arguments for `%s'" BYE,
+ LOG((CLOG_PRINT "%s: missing arguments for `%s'" BYE,
pname, argv[argi], pname));
bye(kExitArgs);
}
@@ -382,7 +382,7 @@ parse(int argc, const char** argv)
}
else if (argv[i][0] == '-') {
- log((CLOG_PRINT "%s: unrecognized option `%s'" BYE,
+ LOG((CLOG_PRINT "%s: unrecognized option `%s'" BYE,
pname, argv[i], pname));
bye(kExitArgs);
}
@@ -395,12 +395,12 @@ parse(int argc, const char** argv)
// exactly one non-option argument (server-address)
if (i == argc) {
- log((CLOG_PRINT "%s: a server address or name is required" BYE,
+ LOG((CLOG_PRINT "%s: a server address or name is required" BYE,
pname, pname));
bye(kExitArgs);
}
if (i + 1 != argc) {
- log((CLOG_PRINT "%s: unrecognized option `%s'" BYE,
+ LOG((CLOG_PRINT "%s: unrecognized option `%s'" BYE,
pname, argv[i], pname));
bye(kExitArgs);
}
@@ -410,7 +410,7 @@ parse(int argc, const char** argv)
s_serverAddress = CNetworkAddress(argv[i], kDefaultPort);
}
catch (XSocketAddress& e) {
- log((CLOG_PRINT "%s: %s" BYE,
+ LOG((CLOG_PRINT "%s: %s" BYE,
pname, e.what(), pname));
bye(kExitFailed);
}
@@ -433,7 +433,7 @@ parse(int argc, const char** argv)
// set log filter
if (!CLog::setFilter(s_logFilter)) {
- log((CLOG_PRINT "%s: unrecognized log level `%s'" BYE,
+ LOG((CLOG_PRINT "%s: unrecognized log level `%s'" BYE,
pname, s_logFilter, pname));
bye(kExitArgs);
}
@@ -537,7 +537,7 @@ WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
if (__argc <= 1 && !CWin32Platform::isWindows95Family()) {
int result = platform.daemonize(DAEMON_NAME, &daemonStartup);
if (result == -1) {
- log((CLOG_CRIT "failed to start as a service" BYE, pname));
+ LOG((CLOG_CRIT "failed to start as a service" BYE, pname));
return kExitFailed;
}
return result;
@@ -556,7 +556,7 @@ WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
if (CWin32Platform::isWindows95Family()) {
result = platform.daemonize(DAEMON_NAME, &daemonStartup95);
if (result == -1) {
- log((CLOG_CRIT "failed to start as a service" BYE, pname));
+ LOG((CLOG_CRIT "failed to start as a service" BYE, pname));
result = kExitFailed;
}
}
@@ -613,7 +613,7 @@ main(int argc, char** argv)
if (s_daemon) {
result = platform.daemonize(DAEMON_NAME, &daemonStartup);
if (result == -1) {
- log((CLOG_CRIT "failed to daemonize"));
+ LOG((CLOG_CRIT "failed to daemonize"));
return kExitFailed;
}
}
diff --git a/cmd/synergys/synergys.cpp b/cmd/synergys/synergys.cpp
index 4f60ff9e..7191a440 100644
--- a/cmd/synergys/synergys.cpp
+++ b/cmd/synergys/synergys.cpp
@@ -220,7 +220,7 @@ realMain(CMutex* mutex)
#undef FINALLY
}
catch (XBase& e) {
- log((CLOG_CRIT "failed: %s", e.what()));
+ LOG((CLOG_CRIT "failed: %s", e.what()));
}
catch (XThread&) {
// terminated
@@ -254,7 +254,7 @@ static
void
version()
{
- log((CLOG_PRINT
+ LOG((CLOG_PRINT
"%s %s, protocol version %d.%d\n"
"%s",
pname,
@@ -289,7 +289,7 @@ help()
CPlatform platform;
- log((CLOG_PRINT
+ LOG((CLOG_PRINT
"Usage: %s"
" [--address
]"
" [--config ]"
@@ -353,7 +353,7 @@ isArg(int argi, int argc, const char** argv,
(name2 != NULL && strcmp(argv[argi], name2) == 0)) {
// match. check args left.
if (argi + minRequiredParameters >= argc) {
- log((CLOG_PRINT "%s: missing arguments for `%s'" BYE,
+ LOG((CLOG_PRINT "%s: missing arguments for `%s'" BYE,
pname, argv[argi], pname));
bye(kExitArgs);
}
@@ -392,7 +392,7 @@ parse(int argc, const char** argv)
s_synergyAddress = CNetworkAddress(argv[i + 1], kDefaultPort);
}
catch (XSocketAddress& e) {
- log((CLOG_PRINT "%s: %s" BYE,
+ LOG((CLOG_PRINT "%s: %s" BYE,
pname, e.what(), pname));
bye(kExitArgs);
}
@@ -405,7 +405,7 @@ parse(int argc, const char** argv)
s_httpAddress = CNetworkAddress(argv[i + 1], kDefaultPort + 1);
}
catch (XSocketAddress& e) {
- log((CLOG_PRINT "%s: %s" BYE,
+ LOG((CLOG_PRINT "%s: %s" BYE,
pname, e.what(), pname));
bye(kExitArgs);
}
@@ -463,7 +463,7 @@ parse(int argc, const char** argv)
}
else if (argv[i][0] == '-') {
- log((CLOG_PRINT "%s: unrecognized option `%s'" BYE,
+ LOG((CLOG_PRINT "%s: unrecognized option `%s'" BYE,
pname, argv[i], pname));
bye(kExitArgs);
}
@@ -476,7 +476,7 @@ parse(int argc, const char** argv)
// no non-option arguments are allowed
if (i != argc) {
- log((CLOG_PRINT "%s: unrecognized option `%s'" BYE,
+ LOG((CLOG_PRINT "%s: unrecognized option `%s'" BYE,
pname, argv[i], pname));
bye(kExitArgs);
}
@@ -499,7 +499,7 @@ parse(int argc, const char** argv)
// set log filter
if (!CLog::setFilter(s_logFilter)) {
- log((CLOG_PRINT "%s: unrecognized log level `%s'" BYE,
+ LOG((CLOG_PRINT "%s: unrecognized log level `%s'" BYE,
pname, s_logFilter, pname));
bye(kExitArgs);
}
@@ -513,23 +513,23 @@ loadConfig(const char* pathname, bool require)
try {
// load configuration
- log((CLOG_DEBUG "opening configuration \"%s\"", pathname));
+ LOG((CLOG_DEBUG "opening configuration \"%s\"", pathname));
std::ifstream configStream(pathname);
if (!configStream) {
throw XConfigRead("cannot open configuration");
}
configStream >> s_config;
- log((CLOG_DEBUG "configuration read successfully"));
+ LOG((CLOG_DEBUG "configuration read successfully"));
return true;
}
catch (XConfigRead& e) {
if (require) {
- log((CLOG_PRINT "%s: cannot read configuration '%s': %s",
+ LOG((CLOG_PRINT "%s: cannot read configuration '%s': %s",
pname, pathname, e.what()));
bye(kExitConfig);
}
else {
- log((CLOG_DEBUG "cannot read configuration \"%s\": %s",
+ LOG((CLOG_DEBUG "cannot read configuration \"%s\": %s",
pathname, e.what()));
}
}
@@ -672,7 +672,7 @@ WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
if (__argc <= 1 && !CWin32Platform::isWindows95Family()) {
int result = platform.daemonize(DAEMON_NAME, &daemonStartup);
if (result == -1) {
- log((CLOG_CRIT "failed to start as a service" BYE, pname));
+ LOG((CLOG_CRIT "failed to start as a service" BYE, pname));
return kExitFailed;
}
return result;
@@ -694,7 +694,7 @@ WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
if (CWin32Platform::isWindows95Family()) {
result = platform.daemonize(DAEMON_NAME, &daemonStartup95);
if (result == -1) {
- log((CLOG_CRIT "failed to start as a service" BYE, pname));
+ LOG((CLOG_CRIT "failed to start as a service" BYE, pname));
result = kExitFailed;
}
}
@@ -754,7 +754,7 @@ main(int argc, char** argv)
if (s_daemon) {
result = platform.daemonize(DAEMON_NAME, &daemonStartup);
if (result == -1) {
- log((CLOG_CRIT "failed to daemonize"));
+ LOG((CLOG_CRIT "failed to daemonize"));
return kExitFailed;
}
}
diff --git a/lib/base/CLog.h b/lib/base/CLog.h
index e364e8ac..302e748a 100644
--- a/lib/base/CLog.h
+++ b/lib/base/CLog.h
@@ -22,8 +22,8 @@
/*!
The logging class; all console output should go through this class.
It supports multithread safe operation, several message priority levels,
-filtering by priority, and output redirection. The macros log() and
-clog() provide convenient access.
+filtering by priority, and output redirection. The macros LOG() and
+LOGC() provide convenient access.
*/
class CLog {
public:
@@ -150,11 +150,11 @@ private:
};
/*!
-\def log(arg)
+\def LOG(arg)
Write to the log. Because macros cannot accept variable arguments, this
should be invoked like so:
\code
-log((CLOG_XXX "%d and %d are %s", x, y, x == y ? "equal" : "not equal"));
+LOG((CLOG_XXX "%d and %d are %s", x, y, x == y ? "equal" : "not equal"));
\endcode
In particular, notice the double open and close parentheses. Also note
that there is no comma after the \c CLOG_XXX. The \c XXX should be
@@ -169,11 +169,11 @@ which includes the filename and line number.
*/
/*!
-\def logc(expr, arg)
+\def LOGC(expr, arg)
Write to the log if and only if expr is true. Because macros cannot accept
variable arguments, this should be invoked like so:
\code
-clog(x == y, (CLOG_XXX "%d and %d are equal", x, y));
+LOGC(x == y, (CLOG_XXX "%d and %d are equal", x, y));
\endcode
In particular, notice the parentheses around everything after the boolean
expression. Also note that there is no comma after the \c CLOG_XXX.
@@ -189,16 +189,16 @@ which includes the filename and line number.
*/
#if defined(NOLOGGING)
-#define log(_a1)
-#define logc(_a1, _a2)
+#define LOG(_a1)
+#define LOGC(_a1, _a2)
#define CLOG_TRACE
#elif defined(NDEBUG)
-#define log(_a1) CLog::print _a1
-#define logc(_a1, _a2) if (_a1) CLog::print _a2
+#define LOG(_a1) CLog::print _a1
+#define LOGC(_a1, _a2) if (_a1) CLog::print _a2
#define CLOG_TRACE
#else
-#define log(_a1) CLog::printt _a1
-#define logc(_a1, _a2) if (_a1) CLog::printt _a2
+#define LOG(_a1) CLog::printt _a1
+#define LOGC(_a1, _a2) if (_a1) CLog::printt _a2
#define CLOG_TRACE __FILE__, __LINE__,
#endif
diff --git a/lib/client/CClient.cpp b/lib/client/CClient.cpp
index de6b086d..44076bd0 100644
--- a/lib/client/CClient.cpp
+++ b/lib/client/CClient.cpp
@@ -122,7 +122,7 @@ CClient::onError()
void
CClient::onInfoChanged(const CClientInfo& info)
{
- log((CLOG_DEBUG "resolution changed"));
+ LOG((CLOG_DEBUG "resolution changed"));
CLock lock(&m_mutex);
if (m_server != NULL) {
@@ -168,12 +168,12 @@ CClient::open()
{
// open the screen
try {
- log((CLOG_INFO "opening screen"));
+ LOG((CLOG_INFO "opening screen"));
openSecondaryScreen();
}
catch (XScreenOpenFailure&) {
// can't open screen
- log((CLOG_INFO "failed to open screen"));
+ LOG((CLOG_INFO "failed to open screen"));
throw;
}
}
@@ -193,7 +193,7 @@ CClient::mainLoop()
}
try {
- log((CLOG_NOTE "starting client \"%s\"", m_name.c_str()));
+ LOG((CLOG_NOTE "starting client \"%s\"", m_name.c_str()));
// start server interactions
{
@@ -207,29 +207,29 @@ CClient::mainLoop()
// clean up
deleteSession();
- log((CLOG_NOTE "stopping client \"%s\"", m_name.c_str()));
+ LOG((CLOG_NOTE "stopping client \"%s\"", m_name.c_str()));
}
catch (XBase& e) {
- log((CLOG_ERR "client error: %s", e.what()));
+ LOG((CLOG_ERR "client error: %s", e.what()));
// clean up
deleteSession();
- log((CLOG_NOTE "stopping client \"%s\"", m_name.c_str()));
+ LOG((CLOG_NOTE "stopping client \"%s\"", m_name.c_str()));
CLock lock(&m_mutex);
m_rejected = false;
}
catch (XThread&) {
// clean up
deleteSession();
- log((CLOG_NOTE "stopping client \"%s\"", m_name.c_str()));
+ LOG((CLOG_NOTE "stopping client \"%s\"", m_name.c_str()));
throw;
}
catch (...) {
- log((CLOG_DEBUG "unknown client error"));
+ LOG((CLOG_DEBUG "unknown client error"));
// clean up
deleteSession();
- log((CLOG_NOTE "stopping client \"%s\"", m_name.c_str()));
+ LOG((CLOG_NOTE "stopping client \"%s\"", m_name.c_str()));
throw;
}
}
@@ -238,7 +238,7 @@ void
CClient::close()
{
closeSecondaryScreen();
- log((CLOG_INFO "closed screen"));
+ LOG((CLOG_INFO "closed screen"));
}
void
@@ -392,7 +392,7 @@ CClient::openSecondaryScreen()
}
// create screen
- log((CLOG_DEBUG1 "creating secondary screen"));
+ LOG((CLOG_DEBUG1 "creating secondary screen"));
if (m_screenFactory != NULL) {
m_screen = m_screenFactory->create(this);
}
@@ -402,11 +402,11 @@ CClient::openSecondaryScreen()
// open screen
try {
- log((CLOG_DEBUG1 "opening secondary screen"));
+ LOG((CLOG_DEBUG1 "opening secondary screen"));
m_screen->open();
}
catch (...) {
- log((CLOG_DEBUG1 "destroying secondary screen"));
+ LOG((CLOG_DEBUG1 "destroying secondary screen"));
delete m_screen;
m_screen = NULL;
throw;
@@ -419,7 +419,7 @@ CClient::closeSecondaryScreen()
// close the secondary screen
try {
if (m_screen != NULL) {
- log((CLOG_DEBUG1 "closing secondary screen"));
+ LOG((CLOG_DEBUG1 "closing secondary screen"));
m_screen->close();
}
}
@@ -428,7 +428,7 @@ CClient::closeSecondaryScreen()
}
// clean up
- log((CLOG_DEBUG1 "destroying secondary screen"));
+ LOG((CLOG_DEBUG1 "destroying secondary screen"));
delete m_screen;
m_screen = NULL;
}
@@ -471,14 +471,14 @@ void
CClient::runSession(void*)
{
try {
- log((CLOG_DEBUG "starting server proxy"));
+ LOG((CLOG_DEBUG "starting server proxy"));
runServer();
m_screen->exitMainLoop();
- log((CLOG_DEBUG "stopping server proxy"));
+ LOG((CLOG_DEBUG "stopping server proxy"));
}
catch (...) {
m_screen->exitMainLoop();
- log((CLOG_DEBUG "stopping server proxy"));
+ LOG((CLOG_DEBUG "stopping server proxy"));
throw;
}
}
@@ -514,17 +514,17 @@ CClient::runServer()
CTimerThread timer(15.0);
// create socket and attempt to connect to server
- log((CLOG_DEBUG1 "connecting to server"));
+ LOG((CLOG_DEBUG1 "connecting to server"));
if (m_socketFactory != NULL) {
socket = m_socketFactory->create();
}
assert(socket != NULL);
socket->connect(m_serverAddress);
- log((CLOG_INFO "connected to server"));
+ LOG((CLOG_INFO "connected to server"));
break;
}
catch (XSocketConnect& e) {
- log((CLOG_DEBUG1 "failed to connect to server: %s", e.getErrstr()));
+ LOG((CLOG_DEBUG1 "failed to connect to server: %s", e.getErrstr()));
// failed to connect. if not camping then rethrow.
if (!m_camp) {
@@ -537,25 +537,25 @@ CClient::runServer()
}
// create proxy
- log((CLOG_DEBUG1 "negotiating with server"));
+ LOG((CLOG_DEBUG1 "negotiating with server"));
proxy = handshakeServer(socket);
CLock lock(&m_mutex);
m_server = proxy;
}
catch (XThread&) {
- log((CLOG_ERR "connection timed out"));
+ LOG((CLOG_ERR "connection timed out"));
delete socket;
throw;
}
catch (XBase& e) {
- log((CLOG_ERR "connection failed: %s", e.what()));
- log((CLOG_DEBUG "disconnecting from server"));
+ LOG((CLOG_ERR "connection failed: %s", e.what()));
+ LOG((CLOG_DEBUG "disconnecting from server"));
delete socket;
return;
}
catch (...) {
- log((CLOG_ERR "connection failed: "));
- log((CLOG_DEBUG "disconnecting from server"));
+ LOG((CLOG_ERR "connection failed: "));
+ LOG((CLOG_DEBUG "disconnecting from server"));
delete socket;
return;
}
@@ -564,7 +564,7 @@ CClient::runServer()
// process messages
bool rejected = true;
if (proxy != NULL) {
- log((CLOG_DEBUG1 "communicating with server"));
+ LOG((CLOG_DEBUG1 "communicating with server"));
rejected = !proxy->mainLoop();
}
@@ -573,7 +573,7 @@ CClient::runServer()
m_rejected = rejected;
m_server = NULL;
delete proxy;
- log((CLOG_DEBUG "disconnecting from server"));
+ LOG((CLOG_DEBUG "disconnecting from server"));
socket->close();
delete socket;
}
@@ -582,7 +582,7 @@ CClient::runServer()
m_rejected = false;
m_server = NULL;
delete proxy;
- log((CLOG_DEBUG "disconnecting from server"));
+ LOG((CLOG_DEBUG "disconnecting from server"));
socket->close();
delete socket;
throw;
@@ -615,19 +615,19 @@ CClient::handshakeServer(IDataSocket* socket)
CTimerThread timer(30.0);
// wait for hello from server
- log((CLOG_DEBUG1 "wait for hello"));
+ LOG((CLOG_DEBUG1 "wait for hello"));
SInt16 major, minor;
CProtocolUtil::readf(input, kMsgHello, &major, &minor);
// check versions
- log((CLOG_DEBUG1 "got hello version %d.%d", major, minor));
+ LOG((CLOG_DEBUG1 "got hello version %d.%d", major, minor));
if (major < kProtocolMajorVersion ||
(major == kProtocolMajorVersion && minor < kProtocolMinorVersion)) {
throw XIncompatibleClient(major, minor);
}
// say hello back
- log((CLOG_DEBUG1 "say hello version %d.%d", kProtocolMajorVersion, kProtocolMinorVersion));
+ LOG((CLOG_DEBUG1 "say hello version %d.%d", kProtocolMajorVersion, kProtocolMinorVersion));
CProtocolUtil::writef(output, kMsgHelloBack,
kProtocolMajorVersion,
kProtocolMinorVersion, &m_name);
@@ -641,10 +641,10 @@ CClient::handshakeServer(IDataSocket* socket)
return proxy;
}
catch (XIncompatibleClient& e) {
- log((CLOG_ERR "server has incompatible version %d.%d", e.getMajor(), e.getMinor()));
+ LOG((CLOG_ERR "server has incompatible version %d.%d", e.getMajor(), e.getMinor()));
}
catch (XBase& e) {
- log((CLOG_WARN "error communicating with server: %s", e.what()));
+ LOG((CLOG_WARN "error communicating with server: %s", e.what()));
}
catch (...) {
// probably timed out
diff --git a/lib/client/CMSWindowsSecondaryScreen.cpp b/lib/client/CMSWindowsSecondaryScreen.cpp
index a42f3763..4357e615 100644
--- a/lib/client/CMSWindowsSecondaryScreen.cpp
+++ b/lib/client/CMSWindowsSecondaryScreen.cpp
@@ -492,7 +492,7 @@ CMSWindowsSecondaryScreen::updateKeys()
m_mask |= KeyModifierScrollLock;
}
// note -- do not save KeyModifierModeSwitch in m_mask
- log((CLOG_DEBUG2 "modifiers on update: 0x%04x", m_mask));
+ LOG((CLOG_DEBUG2 "modifiers on update: 0x%04x", m_mask));
}
void
@@ -625,7 +625,7 @@ CMSWindowsSecondaryScreen::mapKey(Keystrokes& keys, UINT& virtualKey,
virtualKey = g_mapEF00[id & 0xff];
}
if (virtualKey == 0) {
- log((CLOG_DEBUG2 "unknown special key"));
+ LOG((CLOG_DEBUG2 "unknown special key"));
return m_mask;
}
}
@@ -685,7 +685,7 @@ CMSWindowsSecondaryScreen::mapKey(Keystrokes& keys, UINT& virtualKey,
TCHAR ascii = static_cast(id & 0x000000ff);
SHORT vk = VkKeyScan(ascii);
if (vk == 0xffff) {
- log((CLOG_DEBUG2 "no virtual key for character %d", id));
+ LOG((CLOG_DEBUG2 "no virtual key for character %d", id));
return m_mask;
}
@@ -712,7 +712,7 @@ CMSWindowsSecondaryScreen::mapKey(Keystrokes& keys, UINT& virtualKey,
// are subject to case conversion.
if ((outMask & KeyModifierCapsLock) != 0) {
if (tolower(ascii) != toupper(ascii)) {
- log((CLOG_DEBUG2 "flip shift"));
+ LOG((CLOG_DEBUG2 "flip shift"));
outMask ^= KeyModifierShift;
}
}
@@ -734,11 +734,11 @@ CMSWindowsSecondaryScreen::mapKey(Keystrokes& keys, UINT& virtualKey,
// set required shift state based on current numlock state
if ((outMask & KeyModifierNumLock) == 0) {
if ((m_mask & KeyModifierNumLock) == 0) {
- log((CLOG_DEBUG2 "turn on num lock for keypad key"));
+ LOG((CLOG_DEBUG2 "turn on num lock for keypad key"));
outMask |= KeyModifierNumLock;
}
else {
- log((CLOG_DEBUG2 "turn on shift for keypad key"));
+ LOG((CLOG_DEBUG2 "turn on shift for keypad key"));
outMask |= KeyModifierShift;
}
}
@@ -749,7 +749,7 @@ CMSWindowsSecondaryScreen::mapKey(Keystrokes& keys, UINT& virtualKey,
outMask |= KeyModifierShift;
}
}
- log((CLOG_DEBUG2 "KeyID %d to virtual key %d mask 0x%04x", id, virtualKey, outMask));
+ LOG((CLOG_DEBUG2 "KeyID %d to virtual key %d mask 0x%04x", id, virtualKey, outMask));
// a list of modifier key info
class CModifierInfo {
@@ -956,7 +956,7 @@ CMSWindowsSecondaryScreen::mapKey(Keystrokes& keys, UINT& virtualKey,
}
}
- log((CLOG_DEBUG2 "previous modifiers 0x%04x, final modifiers 0x%04x", m_mask, mask));
+ LOG((CLOG_DEBUG2 "previous modifiers 0x%04x, final modifiers 0x%04x", m_mask, mask));
return mask;
}
@@ -1145,5 +1145,5 @@ CMSWindowsSecondaryScreen::sendKeyEvent(UINT virtualKey, bool press)
const UINT code = virtualKeyToScanCode(virtualKey);
keybd_event(static_cast(virtualKey & 0xff),
static_cast(code), flags, 0);
- log((CLOG_DEBUG1 "send key %d, 0x%04x, %s%s", virtualKey & 0xff, code, ((flags & KEYEVENTF_KEYUP) ? "release" : "press"), ((flags & KEYEVENTF_EXTENDEDKEY) ? " extended" : "")));
+ LOG((CLOG_DEBUG1 "send key %d, 0x%04x, %s%s", virtualKey & 0xff, code, ((flags & KEYEVENTF_KEYUP) ? "release" : "press"), ((flags & KEYEVENTF_EXTENDEDKEY) ? " extended" : "")));
}
diff --git a/lib/client/CSecondaryScreen.cpp b/lib/client/CSecondaryScreen.cpp
index dd2b9169..71283bc5 100644
--- a/lib/client/CSecondaryScreen.cpp
+++ b/lib/client/CSecondaryScreen.cpp
@@ -40,15 +40,15 @@ CSecondaryScreen::mainLoop()
// run event loop
try {
- log((CLOG_DEBUG "entering event loop"));
+ LOG((CLOG_DEBUG "entering event loop"));
onPreMainLoop();
getScreen()->mainLoop();
onPostMainLoop();
- log((CLOG_DEBUG "exiting event loop"));
+ LOG((CLOG_DEBUG "exiting event loop"));
}
catch (...) {
onPostMainLoop();
- log((CLOG_DEBUG "exiting event loop"));
+ LOG((CLOG_DEBUG "exiting event loop"));
throw;
}
}
@@ -115,7 +115,7 @@ CSecondaryScreen::enter(SInt32 x, SInt32 y, KeyModifierMask mask)
CLock lock(&m_mutex);
assert(m_active == false);
- log((CLOG_INFO "entering screen at %d,%d mask=%04x", x, y, mask));
+ LOG((CLOG_INFO "entering screen at %d,%d mask=%04x", x, y, mask));
getScreen()->syncDesktop();
@@ -144,7 +144,7 @@ CSecondaryScreen::enter(SInt32 x, SInt32 y, KeyModifierMask mask)
void
CSecondaryScreen::leave()
{
- log((CLOG_INFO "leaving screen"));
+ LOG((CLOG_INFO "leaving screen"));
CLock lock(&m_mutex);
assert(m_active == true);
diff --git a/lib/client/CServerProxy.cpp b/lib/client/CServerProxy.cpp
index 44cb8e52..920be85d 100644
--- a/lib/client/CServerProxy.cpp
+++ b/lib/client/CServerProxy.cpp
@@ -69,13 +69,13 @@ CServerProxy::mainLoop()
}
// wait for a message
- log((CLOG_DEBUG2 "waiting for message"));
+ LOG((CLOG_DEBUG2 "waiting for message"));
UInt8 code[4];
UInt32 n = getInputStream()->read(code, 4, kHeartRate);
// check if server hungup
if (n == 0) {
- log((CLOG_NOTE "server disconnected"));
+ LOG((CLOG_NOTE "server disconnected"));
break;
}
@@ -95,12 +95,12 @@ CServerProxy::mainLoop()
// verify we got an entire code
if (n != 4) {
// client sent an incomplete message
- log((CLOG_ERR "incomplete message from server"));
+ LOG((CLOG_ERR "incomplete message from server"));
break;
}
// parse message
- log((CLOG_DEBUG2 "msg from server: %c%c%c%c", code[0], code[1], code[2], code[3]));
+ LOG((CLOG_DEBUG2 "msg from server: %c%c%c%c", code[0], code[1], code[2], code[3]));
if (memcmp(code, kMsgDMouseMove, 4) == 0) {
mouseMove();
}
@@ -163,7 +163,7 @@ CServerProxy::mainLoop()
else if (memcmp(code, kMsgCClose, 4) == 0) {
// server wants us to hangup
- log((CLOG_DEBUG1 "recv close"));
+ LOG((CLOG_DEBUG1 "recv close"));
break;
}
@@ -171,39 +171,39 @@ CServerProxy::mainLoop()
SInt32 major, minor;
CProtocolUtil::readf(getInputStream(),
kMsgEIncompatible + 4, &major, &minor);
- log((CLOG_ERR "server has incompatible version %d.%d", major, minor));
+ LOG((CLOG_ERR "server has incompatible version %d.%d", major, minor));
failedToConnect = true;
break;
}
else if (memcmp(code, kMsgEBusy, 4) == 0) {
- log((CLOG_ERR "server already has a connected client with name \"%s\"", getName().c_str()));
+ LOG((CLOG_ERR "server already has a connected client with name \"%s\"", getName().c_str()));
failedToConnect = true;
break;
}
else if (memcmp(code, kMsgEUnknown, 4) == 0) {
- log((CLOG_ERR "server refused client with name \"%s\"", getName().c_str()));
+ LOG((CLOG_ERR "server refused client with name \"%s\"", getName().c_str()));
failedToConnect = true;
break;
}
else if (memcmp(code, kMsgEBad, 4) == 0) {
- log((CLOG_ERR "server disconnected due to a protocol error"));
+ LOG((CLOG_ERR "server disconnected due to a protocol error"));
failedToConnect = true;
break;
}
else {
// unknown message
- log((CLOG_ERR "unknown message from server"));
+ LOG((CLOG_ERR "unknown message from server"));
failedToConnect = true;
break;
}
}
}
catch (XBase& e) {
- log((CLOG_ERR "error: %s", e.what()));
+ LOG((CLOG_ERR "error: %s", e.what()));
}
catch (...) {
throw;
@@ -257,7 +257,7 @@ CServerProxy::onInfoChanged(const CClientInfo& info)
bool
CServerProxy::onGrabClipboard(ClipboardID id)
{
- log((CLOG_DEBUG1 "sending clipboard %d changed", id));
+ LOG((CLOG_DEBUG1 "sending clipboard %d changed", id));
CLock lock(&m_mutex);
CProtocolUtil::writef(getOutputStream(), kMsgCClipboard, id, m_seqNum);
return true;
@@ -267,7 +267,7 @@ void
CServerProxy::onClipboardChanged(ClipboardID id, const CString& data)
{
CLock lock(&m_mutex);
- log((CLOG_DEBUG1 "sending clipboard %d seqnum=%d, size=%d", id, m_seqNum, data.size()));
+ LOG((CLOG_DEBUG1 "sending clipboard %d seqnum=%d, size=%d", id, m_seqNum, data.size()));
CProtocolUtil::writef(getOutputStream(), kMsgDClipboard, id, m_seqNum, &data);
}
@@ -295,7 +295,7 @@ void
CServerProxy::sendInfo(const CClientInfo& info)
{
// note -- m_mutex should be locked on entry
- log((CLOG_DEBUG1 "sending info shape=%d,%d %dx%d zone=%d pos=%d,%d", info.m_x, info.m_y, info.m_w, info.m_h, info.m_zoneSize, info.m_mx, info.m_my));
+ LOG((CLOG_DEBUG1 "sending info shape=%d,%d %dx%d zone=%d pos=%d,%d", info.m_x, info.m_y, info.m_w, info.m_h, info.m_zoneSize, info.m_mx, info.m_my));
CProtocolUtil::writef(getOutputStream(), kMsgDInfo,
info.m_x, info.m_y,
info.m_w, info.m_h,
@@ -312,7 +312,7 @@ CServerProxy::enter()
UInt32 seqNum;
CProtocolUtil::readf(getInputStream(),
kMsgCEnter + 4, &x, &y, &seqNum, &mask);
- log((CLOG_DEBUG1 "recv enter, %d,%d %d %04x", x, y, seqNum, mask));
+ LOG((CLOG_DEBUG1 "recv enter, %d,%d %d %04x", x, y, seqNum, mask));
// discard old compressed mouse motion, if any
{
@@ -329,7 +329,7 @@ void
CServerProxy::leave()
{
// parse
- log((CLOG_DEBUG1 "recv leave"));
+ LOG((CLOG_DEBUG1 "recv leave"));
// send last mouse motion
flushCompressedMouse();
@@ -347,7 +347,7 @@ CServerProxy::setClipboard()
CString data;
CProtocolUtil::readf(getInputStream(),
kMsgDClipboard + 4, &id, &seqNum, &data);
- log((CLOG_DEBUG "recv clipboard %d size=%d", id, data.size()));
+ LOG((CLOG_DEBUG "recv clipboard %d size=%d", id, data.size()));
// validate
if (id >= kClipboardEnd) {
@@ -365,7 +365,7 @@ CServerProxy::grabClipboard()
ClipboardID id;
UInt32 seqNum;
CProtocolUtil::readf(getInputStream(), kMsgCClipboard + 4, &id, &seqNum);
- log((CLOG_DEBUG "recv grab clipboard %d", id));
+ LOG((CLOG_DEBUG "recv grab clipboard %d", id));
// validate
if (id >= kClipboardEnd) {
@@ -385,7 +385,7 @@ CServerProxy::keyDown()
// parse
UInt16 id, mask;
CProtocolUtil::readf(getInputStream(), kMsgDKeyDown + 4, &id, &mask);
- log((CLOG_DEBUG1 "recv key down id=%d, mask=0x%04x", id, mask));
+ LOG((CLOG_DEBUG1 "recv key down id=%d, mask=0x%04x", id, mask));
// forward
getClient()->keyDown(static_cast(id),
@@ -402,7 +402,7 @@ CServerProxy::keyRepeat()
UInt16 id, mask, count;
CProtocolUtil::readf(getInputStream(),
kMsgDKeyRepeat + 4, &id, &mask, &count);
- log((CLOG_DEBUG1 "recv key repeat id=%d, mask=0x%04x, count=%d", id, mask, count));
+ LOG((CLOG_DEBUG1 "recv key repeat id=%d, mask=0x%04x, count=%d", id, mask, count));
// forward
getClient()->keyRepeat(static_cast(id),
@@ -419,7 +419,7 @@ CServerProxy::keyUp()
// parse
UInt16 id, mask;
CProtocolUtil::readf(getInputStream(), kMsgDKeyUp + 4, &id, &mask);
- log((CLOG_DEBUG1 "recv key up id=%d, mask=0x%04x", id, mask));
+ LOG((CLOG_DEBUG1 "recv key up id=%d, mask=0x%04x", id, mask));
// forward
getClient()->keyUp(static_cast(id),
@@ -435,7 +435,7 @@ CServerProxy::mouseDown()
// parse
SInt8 id;
CProtocolUtil::readf(getInputStream(), kMsgDMouseDown + 4, &id);
- log((CLOG_DEBUG1 "recv mouse down id=%d", id));
+ LOG((CLOG_DEBUG1 "recv mouse down id=%d", id));
// forward
getClient()->mouseDown(static_cast(id));
@@ -450,7 +450,7 @@ CServerProxy::mouseUp()
// parse
SInt8 id;
CProtocolUtil::readf(getInputStream(), kMsgDMouseUp + 4, &id);
- log((CLOG_DEBUG1 "recv mouse up id=%d", id));
+ LOG((CLOG_DEBUG1 "recv mouse up id=%d", id));
// forward
getClient()->mouseUp(static_cast(id));
@@ -481,7 +481,7 @@ CServerProxy::mouseMove()
m_yMouse = y;
}
}
- log((CLOG_DEBUG2 "recv mouse move %d,%d", x, y));
+ LOG((CLOG_DEBUG2 "recv mouse move %d,%d", x, y));
// forward
if (!ignore) {
@@ -498,7 +498,7 @@ CServerProxy::mouseWheel()
// parse
SInt16 delta;
CProtocolUtil::readf(getInputStream(), kMsgDMouseWheel + 4, &delta);
- log((CLOG_DEBUG2 "recv mouse wheel %+d", delta));
+ LOG((CLOG_DEBUG2 "recv mouse wheel %+d", delta));
// forward
getClient()->mouseWheel(delta);
@@ -510,7 +510,7 @@ CServerProxy::screensaver()
// parse
SInt8 on;
CProtocolUtil::readf(getInputStream(), kMsgCScreenSaver + 4, &on);
- log((CLOG_DEBUG1 "recv screen saver on=%d", on));
+ LOG((CLOG_DEBUG1 "recv screen saver on=%d", on));
// forward
getClient()->screensaver(on != 0);
@@ -534,7 +534,7 @@ void
CServerProxy::infoAcknowledgment()
{
// parse
- log((CLOG_DEBUG1 "recv info acknowledgment"));
+ LOG((CLOG_DEBUG1 "recv info acknowledgment"));
// now allow mouse motion
CLock lock(&m_mutex);
diff --git a/lib/client/CXWindowsSecondaryScreen.cpp b/lib/client/CXWindowsSecondaryScreen.cpp
index 4cb71fba..6095a478 100644
--- a/lib/client/CXWindowsSecondaryScreen.cpp
+++ b/lib/client/CXWindowsSecondaryScreen.cpp
@@ -293,7 +293,7 @@ CXWindowsSecondaryScreen::createWindow()
int majorOpcode, firstEvent, firstError;
if (!XQueryExtension(display, XTestExtensionName,
&majorOpcode, &firstEvent, &firstError)) {
- log((CLOG_ERR "XTEST extension not available"));
+ LOG((CLOG_ERR "XTEST extension not available"));
throw XScreenOpenFailure();
}
@@ -317,7 +317,7 @@ CXWindowsSecondaryScreen::createWindow()
if (m_window == None) {
throw XScreenOpenFailure();
}
- log((CLOG_DEBUG "window is 0x%08x", m_window));
+ LOG((CLOG_DEBUG "window is 0x%08x", m_window));
// become impervious to server grabs
XTestGrabControl(display, True);
@@ -490,28 +490,28 @@ CXWindowsSecondaryScreen::mapKey(Keystrokes& keys, KeyCode& keycode,
// keys affected by CapsLock.
bool desireShift = (getBits(desired, ShiftMask) != 0);
bool invertShift = false;
-log((CLOG_DEBUG1 "desire shift 1: %s", desireShift?"yes":"no"));
+LOG((CLOG_DEBUG1 "desire shift 1: %s", desireShift?"yes":"no"));
if (adjustForNumLock(keysym)) {
-log((CLOG_DEBUG1 "num lock sensitive"));
+LOG((CLOG_DEBUG1 "num lock sensitive"));
if (m_numLockMask != 0) {
-log((CLOG_DEBUG1 "we have num lock"));
+LOG((CLOG_DEBUG1 "we have num lock"));
if (getBits(desired, m_numLockMask) != 0) {
-log((CLOG_DEBUG1 "num lock desired, invert shift"));
+LOG((CLOG_DEBUG1 "num lock desired, invert shift"));
invertShift = true;
}
}
}
else if (adjustForCapsLock(keysym)) {
-log((CLOG_DEBUG1 "caps lock sensitive"));
+LOG((CLOG_DEBUG1 "caps lock sensitive"));
if (m_capsLockMask != 0) {
-log((CLOG_DEBUG1 "we have caps lock"));
+LOG((CLOG_DEBUG1 "we have caps lock"));
if (getBits(desired, m_capsLockMask) != 0) {
-log((CLOG_DEBUG1 "caps lock desired, invert shift"));
+LOG((CLOG_DEBUG1 "caps lock desired, invert shift"));
invertShift = true;
}
}
}
-log((CLOG_DEBUG1 "desire shift 2: %s", desireShift?"yes":"no"));
+LOG((CLOG_DEBUG1 "desire shift 2: %s", desireShift?"yes":"no"));
if (desireShift != invertShift) {
index[0] ^= 1;
index[1] ^= 1;
@@ -538,7 +538,7 @@ log((CLOG_DEBUG1 "desire shift 2: %s", desireShift?"yes":"no"));
// get the keycode
keycode = entry.m_keycode[bestIndex];
-log((CLOG_DEBUG1 "bestIndex = %d, keycode = %d", bestIndex, keycode));
+LOG((CLOG_DEBUG1 "bestIndex = %d, keycode = %d", bestIndex, keycode));
// note if the key is a modifier
ModifierMap::const_iterator modIndex = m_keycodeToModifier.find(keycode);
@@ -553,13 +553,13 @@ log((CLOG_DEBUG1 "bestIndex = %d, keycode = %d", bestIndex, keycode));
// though.
if (modifierBit != 0) {
if (action == kRepeat) {
-log((CLOG_DEBUG1 "ignore repeating modifier"));
+LOG((CLOG_DEBUG1 "ignore repeating modifier"));
return m_mask;
}
if (getBits(m_toggleModifierMask, modifierBit) == 0) {
if ((action == kPress && (m_mask & modifierBit) != 0) ||
(action == kRelease && (m_mask & modifierBit) == 0)) {
-log((CLOG_DEBUG1 "modifier in proper state: 0x%04x", m_mask));
+LOG((CLOG_DEBUG1 "modifier in proper state: 0x%04x", m_mask));
return m_mask;
}
}
@@ -594,7 +594,7 @@ log((CLOG_DEBUG1 "modifier in proper state: 0x%04x", m_mask));
// the same bit in m_mask, meaning it's already in the right state.
desired = assignBits(desired, modifierBit, m_mask);
required = clearBits(required, modifierBit);
-log((CLOG_DEBUG1 "desired = 0x%04x, current = 0x%04x", desired, m_mask));
+LOG((CLOG_DEBUG1 "desired = 0x%04x, current = 0x%04x", desired, m_mask));
// add the key events required to get to the modifier state
// necessary to generate an event yielding id. also save the
@@ -607,13 +607,13 @@ log((CLOG_DEBUG1 "desired = 0x%04x, current = 0x%04x", desired, m_mask));
for (unsigned int i = 0; i < 8; ++i) {
unsigned int bit = (1 << i);
if (getBits(desired, bit) != getBits(m_mask, bit)) {
-log((CLOG_DEBUG1 "fix modifier %d", i));
+LOG((CLOG_DEBUG1 "fix modifier %d", i));
// get the keycode we're using for this modifier. if
// there isn't one then bail if the modifier is required
// or ignore it if not required.
KeyCode modifierKey = m_modifierToKeycode[i];
if (modifierKey == 0) {
- log((CLOG_DEBUG1 "no key mapped to modifier 0x%04x", bit));
+ LOG((CLOG_DEBUG1 "no key mapped to modifier 0x%04x", bit));
if (getBits(required, bit) != 0) {
keys.clear();
return m_mask;
@@ -630,9 +630,9 @@ log((CLOG_DEBUG1 "fix modifier %d", i));
// modifier is a toggle then toggle it on with a
// press/release, otherwise activate it with a
// press. use the first keycode for the modifier.
- log((CLOG_DEBUG2 "modifier 0x%04x is not active", bit));
+ LOG((CLOG_DEBUG2 "modifier 0x%04x is not active", bit));
if (getBits(m_toggleModifierMask, bit) != 0) {
- log((CLOG_DEBUG2 "modifier 0x%04x is a toggle", bit));
+ LOG((CLOG_DEBUG2 "modifier 0x%04x is a toggle", bit));
if ((bit == m_capsLockMask && m_capsLockHalfDuplex) ||
(bit == m_numLockMask && m_numLockHalfDuplex)) {
keystroke.m_press = True;
@@ -664,9 +664,9 @@ log((CLOG_DEBUG1 "fix modifier %d", i));
// press/release, otherwise deactivate it with a
// release. we must check each keycode for the
// modifier if not a toggle.
- log((CLOG_DEBUG2 "modifier 0x%04x is active", bit));
+ LOG((CLOG_DEBUG2 "modifier 0x%04x is active", bit));
if (getBits(m_toggleModifierMask, bit) != 0) {
- log((CLOG_DEBUG2 "modifier 0x%04x is a toggle", bit));
+ LOG((CLOG_DEBUG2 "modifier 0x%04x is a toggle", bit));
if ((bit == m_capsLockMask && m_capsLockHalfDuplex) ||
(bit == m_numLockMask && m_numLockHalfDuplex)) {
keystroke.m_press = False;
@@ -773,7 +773,7 @@ log((CLOG_DEBUG1 "fix modifier %d", i));
}
}
-log((CLOG_DEBUG1 "final mask: 0x%04x", mask));
+LOG((CLOG_DEBUG1 "final mask: 0x%04x", mask));
return mask;
}
@@ -1308,7 +1308,7 @@ CXWindowsSecondaryScreen::adjustForNumLock(KeySym keysym) const
{
if (IsKeypadKey(keysym) || IsPrivateKeypadKey(keysym)) {
// it's NumLock sensitive
- log((CLOG_DEBUG2 "keypad key: NumLock %s", ((m_mask & m_numLockMask) != 0) ? "active" : "inactive"));
+ LOG((CLOG_DEBUG2 "keypad key: NumLock %s", ((m_mask & m_numLockMask) != 0) ? "active" : "inactive"));
return true;
}
return false;
@@ -1321,7 +1321,7 @@ CXWindowsSecondaryScreen::adjustForCapsLock(KeySym keysym) const
XConvertCase(keysym, &lKey, &uKey);
if (lKey != uKey) {
// it's CapsLock sensitive
- log((CLOG_DEBUG2 "case convertible: CapsLock %s", ((m_mask & m_capsLockMask) != 0) ? "active" : "inactive"));
+ LOG((CLOG_DEBUG2 "case convertible: CapsLock %s", ((m_mask & m_capsLockMask) != 0) ? "active" : "inactive"));
return true;
}
return false;
diff --git a/lib/http/CHTTPProtocol.cpp b/lib/http/CHTTPProtocol.cpp
index c02198db..ae385d6d 100644
--- a/lib/http/CHTTPProtocol.cpp
+++ b/lib/http/CHTTPProtocol.cpp
@@ -128,7 +128,7 @@ CHTTPProtocol::readRequest(IInputStream* stream, UInt32 maxSize)
CString version;
s >> request->m_method >> request->m_uri >> version;
if (!s || request->m_uri.empty() || version.find("HTTP/") != 0) {
- log((CLOG_DEBUG1 "failed to parse HTTP request line: %s", line.c_str()));
+ LOG((CLOG_DEBUG1 "failed to parse HTTP request line: %s", line.c_str()));
throw XHTTP(400);
}
@@ -141,16 +141,16 @@ CHTTPProtocol::readRequest(IInputStream* stream, UInt32 maxSize)
s.get(dot);
s >> request->m_minorVersion;
if (!s || dot != '.') {
- log((CLOG_DEBUG1 "failed to parse HTTP request line: %s", line.c_str()));
+ LOG((CLOG_DEBUG1 "failed to parse HTTP request line: %s", line.c_str()));
throw XHTTP(400);
}
}
if (!isValidToken(request->m_method)) {
- log((CLOG_DEBUG1 "invalid HTTP method: %s", line.c_str()));
+ LOG((CLOG_DEBUG1 "invalid HTTP method: %s", line.c_str()));
throw XHTTP(400);
}
if (request->m_majorVersion < 1 || request->m_minorVersion < 0) {
- log((CLOG_DEBUG1 "invalid HTTP version: %s", line.c_str()));
+ LOG((CLOG_DEBUG1 "invalid HTTP version: %s", line.c_str()));
throw XHTTP(400);
}
@@ -162,7 +162,7 @@ CHTTPProtocol::readRequest(IInputStream* stream, UInt32 maxSize)
if (request->m_majorVersion > 1 ||
(request->m_majorVersion == 1 && request->m_minorVersion >= 1)) {
if (request->isHeader("Host") == 0) {
- log((CLOG_DEBUG1 "Host header missing"));
+ LOG((CLOG_DEBUG1 "Host header missing"));
throw XHTTP(400);
}
}
@@ -174,7 +174,7 @@ CHTTPProtocol::readRequest(IInputStream* stream, UInt32 maxSize)
request->isHeader("Content-Length")) ==
(request->m_method == "GET" ||
request->m_method == "HEAD")) {
- log((CLOG_DEBUG1 "HTTP method (%s)/body mismatch", request->m_method.c_str()));
+ LOG((CLOG_DEBUG1 "HTTP method (%s)/body mismatch", request->m_method.c_str()));
throw XHTTP(400);
}
@@ -187,7 +187,7 @@ CHTTPProtocol::readRequest(IInputStream* stream, UInt32 maxSize)
if (!(header = request->getHeader("Transfer-Encoding")).empty()) {
// we only understand "chunked" encodings
if (!CStringUtil::CaselessCmp::equal(header, "chunked")) {
- log((CLOG_DEBUG1 "unsupported Transfer-Encoding %s", header.c_str()));
+ LOG((CLOG_DEBUG1 "unsupported Transfer-Encoding %s", header.c_str()));
throw XHTTP(501);
}
@@ -218,7 +218,7 @@ CHTTPProtocol::readRequest(IInputStream* stream, UInt32 maxSize)
s.exceptions(std::ios::goodbit);
s >> length;
if (!s) {
- log((CLOG_DEBUG1 "cannot parse Content-Length", header.c_str()));
+ LOG((CLOG_DEBUG1 "cannot parse Content-Length", header.c_str()));
throw XHTTP(400);
}
}
@@ -232,7 +232,7 @@ CHTTPProtocol::readRequest(IInputStream* stream, UInt32 maxSize)
request->m_body = readBlock(stream, length, scratch);
if (request->m_body.size() != length) {
// length must match size of body
- log((CLOG_DEBUG1 "Content-Length/actual length mismatch (%d vs %d)", length, request->m_body.size()));
+ LOG((CLOG_DEBUG1 "Content-Length/actual length mismatch (%d vs %d)", length, request->m_body.size()));
throw XHTTP(400);
}
}
@@ -559,7 +559,7 @@ CHTTPProtocol::readChunk(IInputStream* stream,
s.exceptions(std::ios::goodbit);
s >> std::hex >> size;
if (!s) {
- log((CLOG_DEBUG1 "cannot parse chunk size", line.c_str()));
+ LOG((CLOG_DEBUG1 "cannot parse chunk size", line.c_str()));
throw XHTTP(400);
}
}
@@ -578,14 +578,14 @@ CHTTPProtocol::readChunk(IInputStream* stream,
// read size bytes
CString data = readBlock(stream, size, tmpBuffer);
if (data.size() != size) {
- log((CLOG_DEBUG1 "expected/actual chunk size mismatch", size, data.size()));
+ LOG((CLOG_DEBUG1 "expected/actual chunk size mismatch", size, data.size()));
throw XHTTP(400);
}
// read an discard CRLF
line = readLine(stream, tmpBuffer);
if (!line.empty()) {
- log((CLOG_DEBUG1 "missing CRLF after chunk"));
+ LOG((CLOG_DEBUG1 "missing CRLF after chunk"));
throw XHTTP(400);
}
@@ -614,7 +614,7 @@ CHTTPProtocol::readHeaders(IInputStream* stream,
// throw.
if (line[0] == ' ' || line[0] == '\t') {
if (name.empty()) {
- log((CLOG_DEBUG1 "first header is a continuation"));
+ LOG((CLOG_DEBUG1 "first header is a continuation"));
throw XHTTP(400);
}
request->appendHeader(name, line);
@@ -628,7 +628,7 @@ CHTTPProtocol::readHeaders(IInputStream* stream,
s.exceptions(std::ios::goodbit);
std::getline(s, name, ':');
if (!s || !isValidToken(name)) {
- log((CLOG_DEBUG1 "invalid header: %s", line.c_str()));
+ LOG((CLOG_DEBUG1 "invalid header: %s", line.c_str()));
throw XHTTP(400);
}
std::getline(s, value);
diff --git a/lib/mt/CMutex.cpp b/lib/mt/CMutex.cpp
index 94b654b0..6e51ea7e 100644
--- a/lib/mt/CMutex.cpp
+++ b/lib/mt/CMutex.cpp
@@ -61,7 +61,7 @@ CMutex::fini()
{
pthread_mutex_t* mutex = reinterpret_cast(m_mutex);
int status = pthread_mutex_destroy(mutex);
- logc(status != 0, (CLOG_ERR "pthread_mutex_destroy status %d", status));
+ LOGC(status != 0, (CLOG_ERR "pthread_mutex_destroy status %d", status));
assert(status == 0);
delete mutex;
}
@@ -86,7 +86,7 @@ CMutex::lock() const
break;
default:
- log((CLOG_ERR "pthread_mutex_lock status %d", status));
+ LOG((CLOG_ERR "pthread_mutex_lock status %d", status));
assert(0 && "unexpected error");
}
}
@@ -107,7 +107,7 @@ CMutex::unlock() const
break;
default:
- log((CLOG_ERR "pthread_mutex_unlock status %d", status));
+ LOG((CLOG_ERR "pthread_mutex_unlock status %d", status));
assert(0 && "unexpected error");
}
}
diff --git a/lib/mt/CThread.cpp b/lib/mt/CThread.cpp
index eb5ca957..5afd3122 100644
--- a/lib/mt/CThread.cpp
+++ b/lib/mt/CThread.cpp
@@ -77,7 +77,7 @@ void
CThread::exit(void* result)
{
CThreadPtr currentRep(CThreadRep::getCurrentThreadRep());
- log((CLOG_DEBUG1 "throw exit on thread %p", currentRep.operator->()));
+ LOG((CLOG_DEBUG1 "throw exit on thread %p", currentRep.operator->()));
throw XThreadExit(result);
}
diff --git a/lib/mt/CThreadRep.cpp b/lib/mt/CThreadRep.cpp
index 4c15acfe..f79a2787 100644
--- a/lib/mt/CThreadRep.cpp
+++ b/lib/mt/CThreadRep.cpp
@@ -296,23 +296,23 @@ CThreadRep::doThreadFunc()
void* result = NULL;
try {
// go
- log((CLOG_DEBUG1 "thread %p entry", this));
+ LOG((CLOG_DEBUG1 "thread %p entry", this));
m_job->run();
- log((CLOG_DEBUG1 "thread %p exit", this));
+ LOG((CLOG_DEBUG1 "thread %p exit", this));
}
catch (XThreadCancel&) {
// client called cancel()
- log((CLOG_DEBUG1 "caught cancel on thread %p", this));
+ LOG((CLOG_DEBUG1 "caught cancel on thread %p", this));
}
catch (XThreadExit& e) {
// client called exit()
result = e.m_result;
- log((CLOG_DEBUG1 "caught exit on thread %p", this));
+ LOG((CLOG_DEBUG1 "caught exit on thread %p", this));
}
catch (...) {
- log((CLOG_DEBUG1 "exception on thread %p", this));
+ LOG((CLOG_DEBUG1 "exception on thread %p", this));
// note -- don't catch (...) to avoid masking bugs
delete m_job;
throw;
@@ -385,7 +385,7 @@ CThreadRep::cancel()
}
// break out of system calls
- log((CLOG_DEBUG1 "cancel thread %p", this));
+ LOG((CLOG_DEBUG1 "cancel thread %p", this));
pthread_kill(m_thread, SIGWAKEUP);
}
@@ -406,7 +406,7 @@ CThreadRep::testCancel()
}
// start cancel
- log((CLOG_DEBUG1 "throw cancel on thread %p", this));
+ LOG((CLOG_DEBUG1 "throw cancel on thread %p", this));
throw XThreadCancel();
}
@@ -556,7 +556,7 @@ CThreadRep::sleep(
void
CThreadRep::cancel()
{
- log((CLOG_DEBUG1 "cancel thread %p", this));
+ LOG((CLOG_DEBUG1 "cancel thread %p", this));
SetEvent(m_cancel);
}
@@ -581,7 +581,7 @@ CThreadRep::testCancel()
}
// start cancel
- log((CLOG_DEBUG1 "throw cancel on thread %p", this));
+ LOG((CLOG_DEBUG1 "throw cancel on thread %p", this));
throw XThreadCancel();
}
diff --git a/lib/mt/CTimerThread.cpp b/lib/mt/CTimerThread.cpp
index 0d3e0b36..91355bc7 100644
--- a/lib/mt/CTimerThread.cpp
+++ b/lib/mt/CTimerThread.cpp
@@ -37,10 +37,10 @@ CTimerThread::CTimerThread(double timeout) : m_timeout(timeout)
CTimerThread::~CTimerThread()
{
if (m_timingThread != NULL) {
- log((CLOG_DEBUG1 "cancelling timeout"));
+ LOG((CLOG_DEBUG1 "cancelling timeout"));
m_timingThread->cancel();
m_timingThread->wait();
- log((CLOG_DEBUG1 "cancelled timeout"));
+ LOG((CLOG_DEBUG1 "cancelled timeout"));
delete m_timingThread;
delete m_callingThread;
}
@@ -49,8 +49,8 @@ CTimerThread::~CTimerThread()
void
CTimerThread::timer(void*)
{
- log((CLOG_DEBUG1 "timeout in %f seconds", m_timeout));
+ LOG((CLOG_DEBUG1 "timeout in %f seconds", m_timeout));
CThread::sleep(m_timeout);
- log((CLOG_DEBUG1 "timeout"));
+ LOG((CLOG_DEBUG1 "timeout"));
m_callingThread->cancel();
}
diff --git a/lib/net/CNetwork.cpp b/lib/net/CNetwork.cpp
index 9a74f553..918095c9 100644
--- a/lib/net/CNetwork.cpp
+++ b/lib/net/CNetwork.cpp
@@ -85,7 +85,7 @@ CNetwork::init()
// try winsock 2
HMODULE module = (HMODULE)::LoadLibrary("ws2_32.dll");
if (module == NULL) {
- log((CLOG_NOTE "ws2_32.dll not found"));
+ LOG((CLOG_NOTE "ws2_32.dll not found"));
}
else {
try {
@@ -93,14 +93,14 @@ CNetwork::init()
return;
}
catch (XNetwork& e) {
- log((CLOG_NOTE "ws2_32.dll error: %s", e.what()));
+ LOG((CLOG_NOTE "ws2_32.dll error: %s", e.what()));
}
}
// try winsock 1
module = (HMODULE)::LoadLibrary("wsock32.dll");
if (module == NULL) {
- log((CLOG_NOTE "wsock32.dll not found"));
+ LOG((CLOG_NOTE "wsock32.dll not found"));
}
else {
try {
@@ -108,7 +108,7 @@ CNetwork::init()
return;
}
catch (XNetwork& e) {
- log((CLOG_NOTE "wsock32.dll error: %s", e.what()));
+ LOG((CLOG_NOTE "wsock32.dll error: %s", e.what()));
}
}
diff --git a/lib/platform/CMSWindowsClipboard.cpp b/lib/platform/CMSWindowsClipboard.cpp
index b746f56e..32aad8e1 100644
--- a/lib/platform/CMSWindowsClipboard.cpp
+++ b/lib/platform/CMSWindowsClipboard.cpp
@@ -38,10 +38,10 @@ CMSWindowsClipboard::~CMSWindowsClipboard()
bool
CMSWindowsClipboard::empty()
{
- log((CLOG_DEBUG "empty clipboard"));
+ LOG((CLOG_DEBUG "empty clipboard"));
if (!EmptyClipboard()) {
- log((CLOG_DEBUG "failed to grab clipboard"));
+ LOG((CLOG_DEBUG "failed to grab clipboard"));
return false;
}
@@ -51,7 +51,7 @@ CMSWindowsClipboard::empty()
void
CMSWindowsClipboard::add(EFormat format, const CString& data)
{
- log((CLOG_DEBUG "add %d bytes to clipboard format: %d", data.size(), format));
+ LOG((CLOG_DEBUG "add %d bytes to clipboard format: %d", data.size(), format));
// convert data to win32 form
for (ConverterList::const_iterator index = m_converters.begin();
@@ -76,10 +76,10 @@ CMSWindowsClipboard::add(EFormat format, const CString& data)
bool
CMSWindowsClipboard::open(Time time) const
{
- log((CLOG_DEBUG "open clipboard"));
+ LOG((CLOG_DEBUG "open clipboard"));
if (!OpenClipboard(m_window)) {
- log((CLOG_WARN "failed to open clipboard"));
+ LOG((CLOG_WARN "failed to open clipboard"));
return false;
}
@@ -91,7 +91,7 @@ CMSWindowsClipboard::open(Time time) const
void
CMSWindowsClipboard::close() const
{
- log((CLOG_DEBUG "close clipboard"));
+ LOG((CLOG_DEBUG "close clipboard"));
CloseClipboard();
}
diff --git a/lib/platform/CMSWindowsScreen.cpp b/lib/platform/CMSWindowsScreen.cpp
index 56f054f4..ee33dead 100644
--- a/lib/platform/CMSWindowsScreen.cpp
+++ b/lib/platform/CMSWindowsScreen.cpp
@@ -149,7 +149,7 @@ CMSWindowsScreen::open()
assert(s_instance != NULL);
assert(m_class == 0);
- log((CLOG_DEBUG "opening display"));
+ LOG((CLOG_DEBUG "opening display"));
// create the transparent cursor
createBlankCursor();
@@ -253,7 +253,7 @@ CMSWindowsScreen::close()
m_cursor = NULL;
}
- log((CLOG_DEBUG "closed display"));
+ LOG((CLOG_DEBUG "closed display"));
}
bool
@@ -349,7 +349,7 @@ CMSWindowsScreen::syncDesktop()
// change calling thread's desktop
if (!m_is95Family) {
if (SetThreadDesktop(m_desk) == 0) {
-// log((CLOG_WARN "failed to set desktop: %d", GetLastError()));
+// LOG((CLOG_WARN "failed to set desktop: %d", GetLastError()));
}
}
@@ -413,7 +413,7 @@ CMSWindowsScreen::updateScreenShape()
m_y = GetSystemMetrics(SM_YVIRTUALSCREEN);
m_w = GetSystemMetrics(SM_CXVIRTUALSCREEN);
m_h = GetSystemMetrics(SM_CYVIRTUALSCREEN);
- log((CLOG_INFO "screen shape: %d,%d %dx%d", m_x, m_y, m_w, m_h));
+ LOG((CLOG_INFO "screen shape: %d,%d %dx%d", m_x, m_y, m_w, m_h));
// check for multiple monitors
m_multimon = (m_w != GetSystemMetrics(SM_CXSCREEN) ||
@@ -504,7 +504,7 @@ CMSWindowsScreen::onEvent(CEvent* event)
return true;
case WM_DRAWCLIPBOARD:
- log((CLOG_DEBUG "clipboard was taken"));
+ LOG((CLOG_DEBUG "clipboard was taken"));
// first pass it on
if (m_nextClipboardWindow != NULL) {
@@ -615,7 +615,7 @@ CMSWindowsScreen::switchDesktop(HDESK desk)
// if no new desktop then we're done
if (desk == NULL) {
- log((CLOG_INFO "disconnecting desktop"));
+ LOG((CLOG_INFO "disconnecting desktop"));
return true;
}
@@ -629,7 +629,7 @@ CMSWindowsScreen::switchDesktop(HDESK desk)
// set the desktop. can only do this when there are no windows
// and hooks on the current desktop owned by this thread.
if (SetThreadDesktop(desk) == 0) {
- log((CLOG_ERR "failed to set desktop: %d", GetLastError()));
+ LOG((CLOG_ERR "failed to set desktop: %d", GetLastError()));
if (!m_is95Family) {
CloseDesktop(desk);
}
@@ -648,7 +648,7 @@ CMSWindowsScreen::switchDesktop(HDESK desk)
getInstance(),
NULL);
if (m_window == NULL) {
- log((CLOG_ERR "failed to create window: %d", GetLastError()));
+ LOG((CLOG_ERR "failed to create window: %d", GetLastError()));
if (!m_is95Family) {
CloseDesktop(desk);
}
@@ -675,7 +675,7 @@ CMSWindowsScreen::switchDesktop(HDESK desk)
// save new desktop
m_desk = desk;
m_deskName = getDesktopName(m_desk);
- log((CLOG_INFO "switched to desktop \"%s\"", m_deskName.c_str()));
+ LOG((CLOG_INFO "switched to desktop \"%s\"", m_deskName.c_str()));
// let client prepare the window
m_eventHandler->postCreateWindow(m_window);
diff --git a/lib/platform/CMSWindowsScreenSaver.cpp b/lib/platform/CMSWindowsScreenSaver.cpp
index d08c9b9e..7ee439d7 100644
--- a/lib/platform/CMSWindowsScreenSaver.cpp
+++ b/lib/platform/CMSWindowsScreenSaver.cpp
@@ -73,7 +73,7 @@ CMSWindowsScreenSaver::checkStarted(UINT msg, WPARAM wParam, LPARAM lParam)
HWND hwnd = findScreenSaver();
if (hwnd == NULL) {
// didn't start
- log((CLOG_DEBUG "can't find screen saver window"));
+ LOG((CLOG_DEBUG "can't find screen saver window"));
return false;
}
@@ -83,7 +83,7 @@ CMSWindowsScreenSaver::checkStarted(UINT msg, WPARAM wParam, LPARAM lParam)
HANDLE process = OpenProcess(SYNCHRONIZE, FALSE, processID);
if (process == NULL) {
// didn't start
- log((CLOG_DEBUG "can't open screen saver process"));
+ LOG((CLOG_DEBUG "can't open screen saver process"));
return false;
}
@@ -273,7 +273,7 @@ CMSWindowsScreenSaver::watchProcess(HANDLE process)
// watch new process in another thread
if (process != NULL) {
- log((CLOG_DEBUG "watching screen saver process"));
+ LOG((CLOG_DEBUG "watching screen saver process"));
m_process = process;
m_watch = new CThread(new TMethodJob(this,
&CMSWindowsScreenSaver::watchProcessThread));
@@ -284,7 +284,7 @@ void
CMSWindowsScreenSaver::unwatchProcess()
{
if (m_watch != NULL) {
- log((CLOG_DEBUG "stopped watching screen saver process"));
+ LOG((CLOG_DEBUG "stopped watching screen saver process"));
m_watch->cancel();
m_watch->wait();
delete m_watch;
@@ -304,7 +304,7 @@ CMSWindowsScreenSaver::watchProcessThread(void*)
if (WaitForSingleObject(m_process, 50) == WAIT_OBJECT_0) {
// process terminated. send screen saver deactivation
// message.
- log((CLOG_DEBUG "screen saver died"));
+ LOG((CLOG_DEBUG "screen saver died"));
PostThreadMessage(m_threadID, m_msg, m_wParam, m_lParam);
return;
}
diff --git a/lib/platform/CWin32Platform.cpp b/lib/platform/CWin32Platform.cpp
index 29dece5b..fc1fa4ae 100644
--- a/lib/platform/CWin32Platform.cpp
+++ b/lib/platform/CWin32Platform.cpp
@@ -45,7 +45,7 @@ CWin32Platform::isWindows95Family()
OSVERSIONINFO version;
version.dwOSVersionInfoSize = sizeof(version);
if (GetVersionEx(&version) == 0) {
- log((CLOG_WARN "cannot determine OS: %d", GetLastError()));
+ LOG((CLOG_WARN "cannot determine OS: %d", GetLastError()));
return true;
}
return (version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS);
@@ -103,7 +103,7 @@ CWin32Platform::installDaemon(const char* name, const char* description,
HKEY key = isWindows95Family() ? open95ServicesKey() :
openUserStartupKey();
if (key == NULL) {
- log((CLOG_ERR "cannot open registry key", GetLastError()));
+ LOG((CLOG_ERR "cannot open registry key", GetLastError()));
return false;
}
@@ -128,7 +128,7 @@ CWin32Platform::installDaemon(const char* name, const char* description,
// open service manager
SC_HANDLE mgr = OpenSCManager(NULL, NULL, GENERIC_WRITE);
if (mgr == NULL) {
- log((CLOG_ERR "OpenSCManager failed with %d", GetLastError()));
+ LOG((CLOG_ERR "OpenSCManager failed with %d", GetLastError()));
return false;
}
@@ -156,7 +156,7 @@ CWin32Platform::installDaemon(const char* name, const char* description,
else {
// FIXME -- handle ERROR_SERVICE_EXISTS
- log((CLOG_ERR "CreateService failed with %d", GetLastError()));
+ LOG((CLOG_ERR "CreateService failed with %d", GetLastError()));
CloseServiceHandle(mgr);
return false;
}
@@ -199,7 +199,7 @@ CWin32Platform::uninstallDaemon(const char* name, bool allUsers)
HKEY key = isWindows95Family() ? open95ServicesKey() :
openUserStartupKey();
if (key == NULL) {
- log((CLOG_ERR "cannot open registry key", GetLastError()));
+ LOG((CLOG_ERR "cannot open registry key", GetLastError()));
return kAlready;
}
@@ -225,7 +225,7 @@ CWin32Platform::uninstallDaemon(const char* name, bool allUsers)
// open service manager
SC_HANDLE mgr = OpenSCManager(NULL, NULL, GENERIC_WRITE);
if (mgr == NULL) {
- log((CLOG_ERR "OpenSCManager failed with %d", GetLastError()));
+ LOG((CLOG_ERR "OpenSCManager failed with %d", GetLastError()));
return kFailed;
}
@@ -234,7 +234,7 @@ CWin32Platform::uninstallDaemon(const char* name, bool allUsers)
SC_HANDLE service = OpenService(mgr, name, DELETE);
if (service == NULL) {
const DWORD e = GetLastError();
- log((CLOG_ERR "OpenService failed with %d", e));
+ LOG((CLOG_ERR "OpenService failed with %d", e));
result = (e == ERROR_SERVICE_DOES_NOT_EXIST) ? kAlready : kFailed;
}
@@ -278,7 +278,7 @@ CWin32Platform::daemonize(const char* name, DaemonFunc func)
// user logs off.
HINSTANCE kernel = LoadLibrary("kernel32.dll");
if (kernel == NULL) {
- log((CLOG_ERR "LoadLibrary failed with %d", GetLastError()));
+ LOG((CLOG_ERR "LoadLibrary failed with %d", GetLastError()));
return -1;
}
RegisterServiceProcessT RegisterServiceProcess =
@@ -286,12 +286,12 @@ CWin32Platform::daemonize(const char* name, DaemonFunc func)
GetProcAddress(kernel,
_T("RegisterServiceProcess")));
if (RegisterServiceProcess == NULL) {
- log((CLOG_ERR "can't lookup RegisterServiceProcess: %d", GetLastError()));
+ LOG((CLOG_ERR "can't lookup RegisterServiceProcess: %d", GetLastError()));
FreeLibrary(kernel);
return -1;
}
if (RegisterServiceProcess(NULL, 1) == 0) {
- log((CLOG_ERR "RegisterServiceProcess failed with %d", GetLastError()));
+ LOG((CLOG_ERR "RegisterServiceProcess failed with %d", GetLastError()));
FreeLibrary(kernel);
return -1;
}
@@ -320,7 +320,7 @@ CWin32Platform::daemonize(const char* name, DaemonFunc func)
s_daemonPlatform = NULL;
return m_daemonResult;
}
- log((CLOG_ERR "StartServiceCtrlDispatcher failed with %d", GetLastError()));
+ LOG((CLOG_ERR "StartServiceCtrlDispatcher failed with %d", GetLastError()));
s_daemonPlatform = NULL;
return -1;
}
@@ -943,7 +943,7 @@ CWin32Platform::serviceHandler(DWORD ctrl)
break;
default:
- log((CLOG_WARN "unknown service command: %d", ctrl));
+ LOG((CLOG_WARN "unknown service command: %d", ctrl));
// fall through
case SERVICE_CONTROL_INTERROGATE:
diff --git a/lib/platform/CXWindowsClipboard.cpp b/lib/platform/CXWindowsClipboard.cpp
index 39418dc8..32ae8cde 100644
--- a/lib/platform/CXWindowsClipboard.cpp
+++ b/lib/platform/CXWindowsClipboard.cpp
@@ -93,7 +93,7 @@ CXWindowsClipboard::~CXWindowsClipboard()
void
CXWindowsClipboard::lost(Time time)
{
- log((CLOG_DEBUG "lost clipboard %d ownership at %d", m_id, time));
+ LOG((CLOG_DEBUG "lost clipboard %d ownership at %d", m_id, time));
if (m_owner) {
m_owner = false;
m_timeLost = time;
@@ -109,7 +109,7 @@ CXWindowsClipboard::addRequest(Window owner, Window requestor,
// at the given time.
bool success = false;
if (owner == m_window) {
- log((CLOG_DEBUG1 "request for clipboard %d, target %d by 0x%08x (property=%d)", m_selection, target, requestor, property));
+ LOG((CLOG_DEBUG1 "request for clipboard %d, target %d by 0x%08x (property=%d)", m_selection, target, requestor, property));
if (wasOwnedAtTime(time)) {
if (target == m_atomMultiple) {
// add a multiple request. property may not be None
@@ -126,13 +126,13 @@ CXWindowsClipboard::addRequest(Window owner, Window requestor,
}
}
else {
- log((CLOG_DEBUG1 "failed, not owned at time %d", time));
+ LOG((CLOG_DEBUG1 "failed, not owned at time %d", time));
}
}
if (!success) {
// send failure
- log((CLOG_DEBUG1 "failed"));
+ LOG((CLOG_DEBUG1 "failed"));
insertReply(new CReply(requestor, target, time));
}
@@ -180,14 +180,14 @@ CXWindowsClipboard::addSimpleRequest(Window requestor,
if (type != None) {
// success
- log((CLOG_DEBUG1 "success"));
+ LOG((CLOG_DEBUG1 "success"));
insertReply(new CReply(requestor, target, time,
property, data, type, format));
return true;
}
else {
// failure
- log((CLOG_DEBUG1 "failed"));
+ LOG((CLOG_DEBUG1 "failed"));
insertReply(new CReply(requestor, target, time));
return false;
}
@@ -202,7 +202,7 @@ CXWindowsClipboard::processRequest(Window requestor,
// unknown requestor window
return false;
}
- log((CLOG_DEBUG1 "received property %d delete from 0x08%x", property, requestor));
+ LOG((CLOG_DEBUG1 "received property %d delete from 0x08%x", property, requestor));
// find the property in the known requests. it should be the
// first property but we'll check 'em all if we have to.
@@ -257,12 +257,12 @@ CXWindowsClipboard::empty()
{
assert(m_open);
- log((CLOG_DEBUG "empty clipboard %d", m_id));
+ LOG((CLOG_DEBUG "empty clipboard %d", m_id));
// assert ownership of clipboard
XSetSelectionOwner(m_display, m_selection, m_window, m_time);
if (XGetSelectionOwner(m_display, m_selection) != m_window) {
- log((CLOG_DEBUG "failed to grab clipboard %d", m_id));
+ LOG((CLOG_DEBUG "failed to grab clipboard %d", m_id));
return false;
}
@@ -280,7 +280,7 @@ CXWindowsClipboard::empty()
// we're the owner now
m_owner = true;
- log((CLOG_DEBUG "grabbed clipboard %d", m_id));
+ LOG((CLOG_DEBUG "grabbed clipboard %d", m_id));
return true;
}
@@ -291,7 +291,7 @@ CXWindowsClipboard::add(EFormat format, const CString& data)
assert(m_open);
assert(m_owner);
- log((CLOG_DEBUG "add %d bytes to clipboard %d format: %d", data.size(), m_id, format));
+ LOG((CLOG_DEBUG "add %d bytes to clipboard %d format: %d", data.size(), m_id, format));
m_data[format] = data;
m_added[format] = true;
@@ -304,7 +304,7 @@ CXWindowsClipboard::open(Time time) const
{
assert(!m_open);
- log((CLOG_DEBUG "open clipboard %d", m_id));
+ LOG((CLOG_DEBUG "open clipboard %d", m_id));
// assume not motif
m_motif = false;
@@ -318,7 +318,7 @@ CXWindowsClipboard::open(Time time) const
// check if motif owns the selection. unlock motif clipboard
// if it does not.
m_motif = motifOwnsClipboard();
- log((CLOG_DEBUG1 "motif does %sown clipboard", m_motif ? "" : "not "));
+ LOG((CLOG_DEBUG1 "motif does %sown clipboard", m_motif ? "" : "not "));
if (!m_motif) {
motifUnlockClipboard();
}
@@ -339,7 +339,7 @@ CXWindowsClipboard::close() const
{
assert(m_open);
- log((CLOG_DEBUG "close clipboard %d", m_id));
+ LOG((CLOG_DEBUG "close clipboard %d", m_id));
// unlock clipboard
if (m_motif) {
@@ -397,14 +397,14 @@ CXWindowsClipboard::getConverter(Atom target, bool onlyIfNotAdded) const
}
}
if (converter == NULL) {
- log((CLOG_DEBUG1 " no converter for target %d", target));
+ LOG((CLOG_DEBUG1 " no converter for target %d", target));
return NULL;
}
// optionally skip already handled targets
if (onlyIfNotAdded) {
if (m_added[converter->getFormat()]) {
- log((CLOG_DEBUG1 " skipping handled format %d", converter->getFormat()));
+ LOG((CLOG_DEBUG1 " skipping handled format %d", converter->getFormat()));
return NULL;
}
}
@@ -484,7 +484,7 @@ CXWindowsClipboard::doFillCache()
void
CXWindowsClipboard::icccmFillCache()
{
- log((CLOG_DEBUG "ICCCM fill clipboard %d", m_id));
+ LOG((CLOG_DEBUG "ICCCM fill clipboard %d", m_id));
// see if we can get the list of available formats from the selection.
// if not then use a default list of formats.
@@ -493,7 +493,7 @@ CXWindowsClipboard::icccmFillCache()
CString data;
if (!icccmGetSelection(atomTargets, &target, &data) ||
target != m_atomAtom) {
- log((CLOG_DEBUG1 "selection doesn't support TARGETS"));
+ LOG((CLOG_DEBUG1 "selection doesn't support TARGETS"));
data = "";
target = XA_STRING;
@@ -529,7 +529,7 @@ CXWindowsClipboard::icccmFillCache()
Atom actualTarget;
CString targetData;
if (!icccmGetSelection(target, &actualTarget, &targetData)) {
- log((CLOG_DEBUG1 " no data for target %d", target));
+ LOG((CLOG_DEBUG1 " no data for target %d", target));
continue;
}
@@ -537,7 +537,7 @@ CXWindowsClipboard::icccmFillCache()
IClipboard::EFormat format = converter->getFormat();
m_data[format] = converter->toIClipboard(targetData);
m_added[format] = true;
- log((CLOG_DEBUG " added format %d for target %d", format, target));
+ LOG((CLOG_DEBUG " added format %d for target %d", format, target));
}
}
@@ -552,12 +552,12 @@ CXWindowsClipboard::icccmGetSelection(Atom target,
CICCCMGetClipboard getter(m_window, m_time, m_atomData);
if (!getter.readClipboard(m_display, m_selection,
target, actualTarget, data)) {
- log((CLOG_DEBUG1 "can't get data for selection target %d", target));
- logc(getter.m_error, (CLOG_WARN "ICCCM violation by clipboard owner"));
+ LOG((CLOG_DEBUG1 "can't get data for selection target %d", target));
+ LOGC(getter.m_error, (CLOG_WARN "ICCCM violation by clipboard owner"));
return false;
}
else if (*actualTarget == None) {
- log((CLOG_DEBUG1 "selection conversion failed for target %d", target));
+ LOG((CLOG_DEBUG1 "selection conversion failed for target %d", target));
return false;
}
return true;
@@ -571,12 +571,12 @@ CXWindowsClipboard::icccmGetTime() const
if (icccmGetSelection(m_atomTimestamp, &actualTarget, &data) &&
actualTarget == m_atomInteger) {
Time time = *reinterpret_cast(data.data());
- log((CLOG_DEBUG1 "got ICCCM time %d", time));
+ LOG((CLOG_DEBUG1 "got ICCCM time %d", time));
return time;
}
else {
// no timestamp
- log((CLOG_DEBUG1 "can't get ICCCM time"));
+ LOG((CLOG_DEBUG1 "can't get ICCCM time"));
return 0;
}
}
@@ -587,7 +587,7 @@ CXWindowsClipboard::motifLockClipboard() const
// fail if anybody owns the lock (even us, so this is non-recursive)
Window lockOwner = XGetSelectionOwner(m_display, m_atomMotifClipLock);
if (lockOwner != None) {
- log((CLOG_DEBUG1 "motif lock owner 0x%08x", lockOwner));
+ LOG((CLOG_DEBUG1 "motif lock owner 0x%08x", lockOwner));
return false;
}
@@ -599,18 +599,18 @@ CXWindowsClipboard::motifLockClipboard() const
XSetSelectionOwner(m_display, m_atomMotifClipLock, m_window, time);
lockOwner = XGetSelectionOwner(m_display, m_atomMotifClipLock);
if (lockOwner != m_window) {
- log((CLOG_DEBUG1 "motif lock owner 0x%08x", lockOwner));
+ LOG((CLOG_DEBUG1 "motif lock owner 0x%08x", lockOwner));
return false;
}
- log((CLOG_DEBUG1 "locked motif clipboard"));
+ LOG((CLOG_DEBUG1 "locked motif clipboard"));
return true;
}
void
CXWindowsClipboard::motifUnlockClipboard() const
{
- log((CLOG_DEBUG1 "unlocked motif clipboard"));
+ LOG((CLOG_DEBUG1 "unlocked motif clipboard"));
// fail if we don't own the lock
Window lockOwner = XGetSelectionOwner(m_display, m_atomMotifClipLock);
@@ -662,7 +662,7 @@ CXWindowsClipboard::motifOwnsClipboard() const
void
CXWindowsClipboard::motifFillCache()
{
- log((CLOG_DEBUG "Motif fill clipboard %d", m_id));
+ LOG((CLOG_DEBUG "Motif fill clipboard %d", m_id));
// get the Motif clipboard header property from the root window
Atom target;
@@ -767,7 +767,7 @@ CXWindowsClipboard::motifFillCache()
Atom actualTarget;
CString targetData;
if (!motifGetSelection(motifFormat, &actualTarget, &targetData)) {
- log((CLOG_DEBUG1 " no data for target %d", target));
+ LOG((CLOG_DEBUG1 " no data for target %d", target));
continue;
}
@@ -775,7 +775,7 @@ CXWindowsClipboard::motifFillCache()
IClipboard::EFormat format = converter->getFormat();
m_data[format] = converter->toIClipboard(targetData);
m_added[format] = true;
- log((CLOG_DEBUG " added format %d for target %d", format, target));
+ LOG((CLOG_DEBUG " added format %d for target %d", format, target));
}
}
@@ -957,14 +957,14 @@ CXWindowsClipboard::sendReply(CReply* reply)
// bail out immediately if reply is done
if (reply->m_done) {
- log((CLOG_DEBUG1 "clipboard: finished reply to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property));
+ LOG((CLOG_DEBUG1 "clipboard: finished reply to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property));
return true;
}
// start in failed state if property is None
bool failed = (reply->m_property == None);
if (!failed) {
- log((CLOG_DEBUG1 "clipboard: setting property on 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property));
+ LOG((CLOG_DEBUG1 "clipboard: setting property on 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property));
// send using INCR if already sending incrementally or if reply
// is too large, otherwise just send it.
@@ -1013,7 +1013,7 @@ CXWindowsClipboard::sendReply(CReply* reply)
// the final zero-length property.
// FIXME -- how do you gracefully cancel an incremental transfer?
if (failed) {
- log((CLOG_DEBUG1 "clipboard: sending failure to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property));
+ LOG((CLOG_DEBUG1 "clipboard: sending failure to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property));
reply->m_done = true;
if (reply->m_property != None) {
CXWindowsUtil::CErrorLock lock(m_display);
@@ -1043,7 +1043,7 @@ CXWindowsClipboard::sendReply(CReply* reply)
// send notification if we haven't yet
if (!reply->m_replied) {
- log((CLOG_DEBUG1 "clipboard: sending notify to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property));
+ LOG((CLOG_DEBUG1 "clipboard: sending notify to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property));
reply->m_replied = true;
// HACK -- work around apparent bug in lesstif, which doesn't
@@ -1219,7 +1219,7 @@ CXWindowsClipboard::CICCCMGetClipboard::readClipboard(Display* display,
assert(actualTarget != NULL);
assert(data != NULL);
- log((CLOG_DEBUG1 "request selection=%d, target=%d, window=%x", selection, target, m_requestor));
+ LOG((CLOG_DEBUG1 "request selection=%d, target=%d, window=%x", selection, target, m_requestor));
// save output pointers
m_actualTarget = actualTarget;
@@ -1296,7 +1296,7 @@ CXWindowsClipboard::CICCCMGetClipboard::readClipboard(Display* display,
XSelectInput(display, m_requestor, attr.your_event_mask);
// return success or failure
- log((CLOG_DEBUG1 "request %s", m_failed ? "failed" : "succeeded"));
+ LOG((CLOG_DEBUG1 "request %s", m_failed ? "failed" : "succeeded"));
return !m_failed;
}
@@ -1387,14 +1387,14 @@ CXWindowsClipboard::CICCCMGetClipboard::processEvent(
else if (m_incr) {
// if first incremental chunk then save target
if (oldSize == 0) {
- log((CLOG_DEBUG1 " INCR first chunk, target %d", target));
+ LOG((CLOG_DEBUG1 " INCR first chunk, target %d", target));
*m_actualTarget = target;
}
// secondary chunks must have the same target
else {
if (target != *m_actualTarget) {
- log((CLOG_WARN " INCR target mismatch"));
+ LOG((CLOG_WARN " INCR target mismatch"));
m_failed = true;
m_error = true;
}
@@ -1402,20 +1402,20 @@ CXWindowsClipboard::CICCCMGetClipboard::processEvent(
// note if this is the final chunk
if (m_data->size() == oldSize) {
- log((CLOG_DEBUG1 " INCR final chunk: %d bytes total", m_data->size()));
+ LOG((CLOG_DEBUG1 " INCR final chunk: %d bytes total", m_data->size()));
m_done = true;
}
}
// not incremental; save the target.
else {
- log((CLOG_DEBUG1 " target %d", target));
+ LOG((CLOG_DEBUG1 " target %d", target));
*m_actualTarget = target;
m_done = true;
}
// this event has been processed
- logc(!m_incr, (CLOG_DEBUG1 " got data, %d bytes", m_data->size()));
+ LOGC(!m_incr, (CLOG_DEBUG1 " got data, %d bytes", m_data->size()));
return true;
}
diff --git a/lib/platform/CXWindowsScreen.cpp b/lib/platform/CXWindowsScreen.cpp
index 225d9c4e..920c98de 100644
--- a/lib/platform/CXWindowsScreen.cpp
+++ b/lib/platform/CXWindowsScreen.cpp
@@ -208,7 +208,7 @@ CXWindowsScreen::open()
}
// open the display
- log((CLOG_DEBUG "XOpenDisplay(\"%s\")", display));
+ LOG((CLOG_DEBUG "XOpenDisplay(\"%s\")", display));
m_display = XOpenDisplay(display);
if (m_display == NULL) {
throw XScreenUnavailable(60.0);
@@ -337,7 +337,7 @@ CXWindowsScreen::close()
if (m_display != NULL) {
XCloseDisplay(m_display);
m_display = NULL;
- log((CLOG_DEBUG "closed display"));
+ LOG((CLOG_DEBUG "closed display"));
}
XSetIOErrorHandler(NULL);
}
@@ -495,7 +495,7 @@ CXWindowsScreen::updateScreenShape()
m_y = 0;
m_w = WidthOfScreen(DefaultScreenOfDisplay(m_display));
m_h = HeightOfScreen(DefaultScreenOfDisplay(m_display));
- log((CLOG_INFO "screen shape: %d,%d %dx%d", m_x, m_y, m_w, m_h));
+ LOG((CLOG_INFO "screen shape: %d,%d %dx%d", m_x, m_y, m_w, m_h));
}
bool
@@ -519,7 +519,7 @@ CXWindowsScreen::onPreDispatch(CEvent* event)
// selection owner. report that to the receiver.
ClipboardID id = getClipboardID(xevent->xselectionclear.selection);
if (id != kClipboardEnd) {
- log((CLOG_DEBUG "lost clipboard %d ownership at time %d", id, xevent->xselectionclear.time));
+ LOG((CLOG_DEBUG "lost clipboard %d ownership at time %d", id, xevent->xselectionclear.time));
m_clipboard[id]->lost(xevent->xselectionclear.time);
m_receiver->onGrabClipboard(id);
return true;
@@ -724,10 +724,10 @@ CXWindowsScreen::ioErrorHandler(Display*)
// handle not having a Display* anymore. we'll simply log the
// error, notify the subclass (which must not use the display
// so we set it to NULL), and exit.
- log((CLOG_WARN "X display has unexpectedly disconnected"));
+ LOG((CLOG_WARN "X display has unexpectedly disconnected"));
s_screen->m_display = NULL;
s_screen->m_receiver->onError();
- log((CLOG_CRIT "quiting due to X display disconnection"));
+ LOG((CLOG_CRIT "quiting due to X display disconnection"));
exit(17);
}
diff --git a/lib/platform/CXWindowsScreenSaver.cpp b/lib/platform/CXWindowsScreenSaver.cpp
index 3581ed6a..e32f13c3 100644
--- a/lib/platform/CXWindowsScreenSaver.cpp
+++ b/lib/platform/CXWindowsScreenSaver.cpp
@@ -65,7 +65,7 @@ CXWindowsScreenSaver::CXWindowsScreenSaver(
CWDontPropagate | CWEventMask |
CWOverrideRedirect,
&attr);
- log((CLOG_DEBUG "xscreensaver sink window is 0x%08x", m_xscreensaverSink));
+ LOG((CLOG_DEBUG "xscreensaver sink window is 0x%08x", m_xscreensaverSink));
// watch top-level windows for changes
{
@@ -77,7 +77,7 @@ CXWindowsScreenSaver::CXWindowsScreenSaver(
m_rootEventMask = attr.your_event_mask;
XSelectInput(m_display, root, m_rootEventMask | SubstructureNotifyMask);
if (error) {
- log((CLOG_DEBUG "didn't set root event mask"));
+ LOG((CLOG_DEBUG "didn't set root event mask"));
m_rootEventMask = 0;
}
}
@@ -136,7 +136,7 @@ CXWindowsScreenSaver::onPreDispatch(const XEvent* xevent)
case DestroyNotify:
if (xevent->xdestroywindow.window == m_xscreensaver) {
// xscreensaver is gone
- log((CLOG_DEBUG "xscreensaver died"));
+ LOG((CLOG_DEBUG "xscreensaver died"));
setXScreenSaver(None);
return true;
}
@@ -302,7 +302,7 @@ CXWindowsScreenSaver::findXScreenSaver()
void
CXWindowsScreenSaver::setXScreenSaver(Window window)
{
- log((CLOG_DEBUG "xscreensaver window: 0x%08x", window));
+ LOG((CLOG_DEBUG "xscreensaver window: 0x%08x", window));
// save window
m_xscreensaver = window;
@@ -342,7 +342,7 @@ void
CXWindowsScreenSaver::setXScreenSaverActive(bool activated)
{
if (m_xscreensaverActive != activated) {
- log((CLOG_DEBUG "xscreensaver %s", activated ? "activated" : "deactivated"));
+ LOG((CLOG_DEBUG "xscreensaver %s", activated ? "activated" : "deactivated"));
m_xscreensaverActive = activated;
sendNotify(activated);
}
@@ -363,7 +363,7 @@ CXWindowsScreenSaver::sendXScreenSaverCommand(Atom cmd, long arg1, long arg2)
event.xclient.data.l[3] = 0;
event.xclient.data.l[4] = 0;
- log((CLOG_DEBUG "send xscreensaver command: %d %d %d", (long)cmd, arg1, arg2));
+ LOG((CLOG_DEBUG "send xscreensaver command: %d %d %d", (long)cmd, arg1, arg2));
bool error = false;
CXWindowsUtil::CErrorLock lock(m_display, &error);
XSendEvent(m_display, m_xscreensaver, False, 0, &event);
diff --git a/lib/platform/CXWindowsUtil.cpp b/lib/platform/CXWindowsUtil.cpp
index 376febe3..63cd1ca7 100644
--- a/lib/platform/CXWindowsUtil.cpp
+++ b/lib/platform/CXWindowsUtil.cpp
@@ -99,11 +99,11 @@ CXWindowsUtil::getWindowProperty(Display* display, Window window,
}
if (result == Success) {
- log((CLOG_DEBUG1 "read property %d on window 0x%08x: bytes=%d", property, window, (data == NULL) ? 0 : data->size()));
+ LOG((CLOG_DEBUG1 "read property %d on window 0x%08x: bytes=%d", property, window, (data == NULL) ? 0 : data->size()));
return true;
}
else {
- log((CLOG_DEBUG1 "can't read property %d on window 0x%08x", property, window));
+ LOG((CLOG_DEBUG1 "can't read property %d on window 0x%08x", property, window));
return false;
}
}
@@ -265,12 +265,12 @@ CXWindowsUtil::CErrorLock::internalHandler(Display* display, XErrorEvent* event)
void
CXWindowsUtil::CErrorLock::ignoreHandler(Display*, XErrorEvent* e, void*)
{
- log((CLOG_DEBUG1 "ignoring X error: %d", e->error_code));
+ LOG((CLOG_DEBUG1 "ignoring X error: %d", e->error_code));
}
void
CXWindowsUtil::CErrorLock::saveHandler(Display*, XErrorEvent* e, void* flag)
{
- log((CLOG_DEBUG1 "flagging X error: %d", e->error_code));
+ LOG((CLOG_DEBUG1 "flagging X error: %d", e->error_code));
*reinterpret_cast(flag) = true;
}
diff --git a/lib/server/CClientProxy1_0.cpp b/lib/server/CClientProxy1_0.cpp
index 656d4ccd..b21c8cfc 100644
--- a/lib/server/CClientProxy1_0.cpp
+++ b/lib/server/CClientProxy1_0.cpp
@@ -47,7 +47,7 @@ void
CClientProxy1_0::open()
{
// send request
- log((CLOG_DEBUG1 "querying client \"%s\" info", getName().c_str()));
+ LOG((CLOG_DEBUG1 "querying client \"%s\" info", getName().c_str()));
CProtocolUtil::writef(getOutputStream(), kMsgQInfo);
getOutputStream()->flush();
@@ -86,14 +86,14 @@ CClientProxy1_0::mainLoop()
// check if client hungup
if (n == 0) {
- log((CLOG_NOTE "client \"%s\" disconnected", getName().c_str()));
+ LOG((CLOG_NOTE "client \"%s\" disconnected", getName().c_str()));
return;
}
// check if client has stopped sending heartbeats
if (n == (UInt32)-1) {
if (kHeartDeath >= 0.0 && heartTimer.getTime() > kHeartDeath) {
- log((CLOG_NOTE "client \"%s\" is dead", getName().c_str()));
+ LOG((CLOG_NOTE "client \"%s\" is dead", getName().c_str()));
return;
}
continue;
@@ -104,14 +104,14 @@ CClientProxy1_0::mainLoop()
// verify we got an entire code
if (n != 4) {
- log((CLOG_ERR "incomplete message from \"%s\": %d bytes", getName().c_str(), n));
+ LOG((CLOG_ERR "incomplete message from \"%s\": %d bytes", getName().c_str(), n));
// client sent an incomplete message
throw XBadClient();
}
// parse message
- log((CLOG_DEBUG2 "msg from \"%s\": %c%c%c%c", getName().c_str(), code[0], code[1], code[2], code[3]));
+ LOG((CLOG_DEBUG2 "msg from \"%s\": %c%c%c%c", getName().c_str(), code[0], code[1], code[2], code[3]));
if (memcmp(code, kMsgDInfo, 4) == 0) {
recvInfo(true);
}
@@ -127,7 +127,7 @@ CClientProxy1_0::mainLoop()
}
// note -- more message handlers go here
else {
- log((CLOG_ERR "invalid message from client \"%s\"", getName().c_str()));
+ LOG((CLOG_ERR "invalid message from client \"%s\"", getName().c_str()));
// unknown message
throw XBadClient();
@@ -138,7 +138,7 @@ CClientProxy1_0::mainLoop()
void
CClientProxy1_0::close()
{
- log((CLOG_DEBUG1 "send close to \"%s\"", getName().c_str()));
+ LOG((CLOG_DEBUG1 "send close to \"%s\"", getName().c_str()));
CProtocolUtil::writef(getOutputStream(), kMsgCClose);
// force the close to be sent before we return
@@ -149,7 +149,7 @@ void
CClientProxy1_0::enter(SInt32 xAbs, SInt32 yAbs,
UInt32 seqNum, KeyModifierMask mask, bool)
{
- log((CLOG_DEBUG1 "send enter to \"%s\", %d,%d %d %04x", getName().c_str(), xAbs, yAbs, seqNum, mask));
+ LOG((CLOG_DEBUG1 "send enter to \"%s\", %d,%d %d %04x", getName().c_str(), xAbs, yAbs, seqNum, mask));
CProtocolUtil::writef(getOutputStream(), kMsgCEnter,
xAbs, yAbs, seqNum, mask);
}
@@ -157,7 +157,7 @@ CClientProxy1_0::enter(SInt32 xAbs, SInt32 yAbs,
bool
CClientProxy1_0::leave()
{
- log((CLOG_DEBUG1 "send leave to \"%s\"", getName().c_str()));
+ LOG((CLOG_DEBUG1 "send leave to \"%s\"", getName().c_str()));
CProtocolUtil::writef(getOutputStream(), kMsgCLeave);
// we can never prevent the user from leaving
@@ -173,7 +173,7 @@ CClientProxy1_0::setClipboard(ClipboardID id, const CString& data)
// this clipboard is now clean
m_clipboardDirty[id] = false;
- log((CLOG_DEBUG "send clipboard %d to \"%s\" size=%d", id, getName().c_str(), data.size()));
+ LOG((CLOG_DEBUG "send clipboard %d to \"%s\" size=%d", id, getName().c_str(), data.size()));
CProtocolUtil::writef(getOutputStream(), kMsgDClipboard, id, 0, &data);
}
}
@@ -181,7 +181,7 @@ CClientProxy1_0::setClipboard(ClipboardID id, const CString& data)
void
CClientProxy1_0::grabClipboard(ClipboardID id)
{
- log((CLOG_DEBUG "send grab clipboard %d to \"%s\"", id, getName().c_str()));
+ LOG((CLOG_DEBUG "send grab clipboard %d to \"%s\"", id, getName().c_str()));
CProtocolUtil::writef(getOutputStream(), kMsgCClipboard, id, 0);
// this clipboard is now dirty
@@ -199,56 +199,56 @@ CClientProxy1_0::setClipboardDirty(ClipboardID id, bool dirty)
void
CClientProxy1_0::keyDown(KeyID key, KeyModifierMask mask)
{
- log((CLOG_DEBUG1 "send key down to \"%s\" id=%d, mask=0x%04x", getName().c_str(), key, mask));
+ LOG((CLOG_DEBUG1 "send key down to \"%s\" id=%d, mask=0x%04x", getName().c_str(), key, mask));
CProtocolUtil::writef(getOutputStream(), kMsgDKeyDown, key, mask);
}
void
CClientProxy1_0::keyRepeat(KeyID key, KeyModifierMask mask, SInt32 count)
{
- log((CLOG_DEBUG1 "send key repeat to \"%s\" id=%d, mask=0x%04x, count=%d", getName().c_str(), key, mask, count));
+ LOG((CLOG_DEBUG1 "send key repeat to \"%s\" id=%d, mask=0x%04x, count=%d", getName().c_str(), key, mask, count));
CProtocolUtil::writef(getOutputStream(), kMsgDKeyRepeat, key, mask, count);
}
void
CClientProxy1_0::keyUp(KeyID key, KeyModifierMask mask)
{
- log((CLOG_DEBUG1 "send key up to \"%s\" id=%d, mask=0x%04x", getName().c_str(), key, mask));
+ LOG((CLOG_DEBUG1 "send key up to \"%s\" id=%d, mask=0x%04x", getName().c_str(), key, mask));
CProtocolUtil::writef(getOutputStream(), kMsgDKeyUp, key, mask);
}
void
CClientProxy1_0::mouseDown(ButtonID button)
{
- log((CLOG_DEBUG1 "send mouse down to \"%s\" id=%d", getName().c_str(), button));
+ LOG((CLOG_DEBUG1 "send mouse down to \"%s\" id=%d", getName().c_str(), button));
CProtocolUtil::writef(getOutputStream(), kMsgDMouseDown, button);
}
void
CClientProxy1_0::mouseUp(ButtonID button)
{
- log((CLOG_DEBUG1 "send mouse up to \"%s\" id=%d", getName().c_str(), button));
+ LOG((CLOG_DEBUG1 "send mouse up to \"%s\" id=%d", getName().c_str(), button));
CProtocolUtil::writef(getOutputStream(), kMsgDMouseUp, button);
}
void
CClientProxy1_0::mouseMove(SInt32 xAbs, SInt32 yAbs)
{
- log((CLOG_DEBUG2 "send mouse move to \"%s\" %d,%d", getName().c_str(), xAbs, yAbs));
+ LOG((CLOG_DEBUG2 "send mouse move to \"%s\" %d,%d", getName().c_str(), xAbs, yAbs));
CProtocolUtil::writef(getOutputStream(), kMsgDMouseMove, xAbs, yAbs);
}
void
CClientProxy1_0::mouseWheel(SInt32 delta)
{
- log((CLOG_DEBUG2 "send mouse wheel to \"%s\" %+d", getName().c_str(), delta));
+ LOG((CLOG_DEBUG2 "send mouse wheel to \"%s\" %+d", getName().c_str(), delta));
CProtocolUtil::writef(getOutputStream(), kMsgDMouseWheel, delta);
}
void
CClientProxy1_0::screensaver(bool on)
{
- log((CLOG_DEBUG1 "send screen saver to \"%s\" on=%d", getName().c_str(), on ? 1 : 0));
+ LOG((CLOG_DEBUG1 "send screen saver to \"%s\" on=%d", getName().c_str(), on ? 1 : 0));
CProtocolUtil::writef(getOutputStream(), kMsgCScreenSaver, on ? 1 : 0);
}
@@ -293,7 +293,7 @@ CClientProxy1_0::recvInfo(bool notify)
SInt16 x, y, w, h, zoneSize, mx, my;
CProtocolUtil::readf(getInputStream(), kMsgDInfo + 4,
&x, &y, &w, &h, &zoneSize, &mx, &my);
- log((CLOG_DEBUG "received client \"%s\" info shape=%d,%d %dx%d, zone=%d, pos=%d,%d", getName().c_str(), x, y, w, h, zoneSize, mx, my));
+ LOG((CLOG_DEBUG "received client \"%s\" info shape=%d,%d %dx%d, zone=%d, pos=%d,%d", getName().c_str(), x, y, w, h, zoneSize, mx, my));
// validate
if (w <= 0 || h <= 0 || zoneSize < 0) {
@@ -319,7 +319,7 @@ CClientProxy1_0::recvInfo(bool notify)
}
// acknowledge receipt
- log((CLOG_DEBUG1 "send info ack to \"%s\"", getName().c_str()));
+ LOG((CLOG_DEBUG1 "send info ack to \"%s\"", getName().c_str()));
CProtocolUtil::writef(getOutputStream(), kMsgCInfoAck);
}
@@ -331,7 +331,7 @@ CClientProxy1_0::recvClipboard()
UInt32 seqNum;
CString data;
CProtocolUtil::readf(getInputStream(), kMsgDClipboard + 4, &id, &seqNum, &data);
- log((CLOG_DEBUG "received client \"%s\" clipboard %d seqnum=%d, size=%d", getName().c_str(), id, seqNum, data.size()));
+ LOG((CLOG_DEBUG "received client \"%s\" clipboard %d seqnum=%d, size=%d", getName().c_str(), id, seqNum, data.size()));
// validate
if (id >= kClipboardEnd) {
@@ -350,7 +350,7 @@ CClientProxy1_0::recvGrabClipboard()
ClipboardID id;
UInt32 seqNum;
CProtocolUtil::readf(getInputStream(), kMsgCClipboard + 4, &id, &seqNum);
- log((CLOG_DEBUG "received client \"%s\" grabbed clipboard %d seqnum=%d", getName().c_str(), id, seqNum));
+ LOG((CLOG_DEBUG "received client \"%s\" grabbed clipboard %d seqnum=%d", getName().c_str(), id, seqNum));
// validate
if (id >= kClipboardEnd) {
diff --git a/lib/server/CHTTPServer.cpp b/lib/server/CHTTPServer.cpp
index c202d795..d3582ac4 100644
--- a/lib/server/CHTTPServer.cpp
+++ b/lib/server/CHTTPServer.cpp
@@ -80,13 +80,13 @@ CHTTPServer::processRequest(IDataSocket* socket)
// send reply
CHTTPProtocol::reply(socket->getOutputStream(), reply);
- log((CLOG_INFO "HTTP reply %d for %s %s", reply.m_status, request->m_method.c_str(), request->m_uri.c_str()));
+ LOG((CLOG_INFO "HTTP reply %d for %s %s", reply.m_status, request->m_method.c_str(), request->m_uri.c_str()));
// clean up
delete request;
}
catch (XHTTP& e) {
- log((CLOG_WARN "returning HTTP error %d %s for %s", e.getStatus(), e.getReason().c_str(), (request != NULL) ? request->m_uri.c_str() : ""));
+ LOG((CLOG_WARN "returning HTTP error %d %s for %s", e.getStatus(), e.getReason().c_str(), (request != NULL) ? request->m_uri.c_str() : ""));
// clean up
delete request;
@@ -256,7 +256,7 @@ CHTTPServer::doProcessPostEditMap(CHTTPRequest& request, CHTTPReply& reply)
// parse the result
CHTTPProtocol::CFormParts parts;
if (!CHTTPProtocol::parseFormData(request, parts)) {
- log((CLOG_WARN "editmap: cannot parse form data"));
+ LOG((CLOG_WARN "editmap: cannot parse form data"));
throw XHTTP(400);
}
@@ -270,7 +270,7 @@ CHTTPServer::doProcessPostEditMap(CHTTPRequest& request, CHTTPReply& reply)
if (index == parts.end() ||
!parseXY(index->second, w, h) ||
w <= 0 || h <= 0) {
- log((CLOG_WARN "editmap: cannot parse size or size is invalid"));
+ LOG((CLOG_WARN "editmap: cannot parse size or size is invalid"));
throw XHTTP(400);
}
ScreenSet screenNames;
@@ -297,7 +297,7 @@ CHTTPServer::doProcessPostEditMap(CHTTPRequest& request, CHTTPReply& reply)
// already been seen.
if (screenNames.count(name)) {
// FIXME -- better error message
- log((CLOG_WARN "editmap: duplicate name %s", name.c_str()));
+ LOG((CLOG_WARN "editmap: duplicate name %s", name.c_str()));
throw XHTTP(400);
}
// FIXME -- check that name is legal
@@ -315,12 +315,12 @@ CHTTPServer::doProcessPostEditMap(CHTTPRequest& request, CHTTPReply& reply)
if (screenNames.empty()) {
// no screens
// FIXME -- need better no screens
- log((CLOG_WARN "editmap: no screens"));
+ LOG((CLOG_WARN "editmap: no screens"));
throw XHTTP(400);
}
if (!screens.isValid()) {
// FIXME -- need better unconnected screens error
- log((CLOG_WARN "editmap: unconnected screens"));
+ LOG((CLOG_WARN "editmap: unconnected screens"));
throw XHTTP(400);
}
diff --git a/lib/server/CMSWindowsPrimaryScreen.cpp b/lib/server/CMSWindowsPrimaryScreen.cpp
index 912cc219..05188335 100644
--- a/lib/server/CMSWindowsPrimaryScreen.cpp
+++ b/lib/server/CMSWindowsPrimaryScreen.cpp
@@ -40,7 +40,7 @@ CMSWindowsPrimaryScreen::CMSWindowsPrimaryScreen(
// load the hook library
m_hookLibrary = LoadLibrary("synrgyhk");
if (m_hookLibrary == NULL) {
- log((CLOG_ERR "failed to load hook library"));
+ LOG((CLOG_ERR "failed to load hook library"));
throw XScreenOpenFailure();
}
m_setSides = (SetSidesFunc)GetProcAddress(m_hookLibrary, "setSides");
@@ -57,7 +57,7 @@ CMSWindowsPrimaryScreen::CMSWindowsPrimaryScreen(
m_uninstall == NULL ||
m_init == NULL ||
m_cleanup == NULL) {
- log((CLOG_ERR "invalid hook library"));
+ LOG((CLOG_ERR "invalid hook library"));
FreeLibrary(m_hookLibrary);
throw XScreenOpenFailure();
}
@@ -192,11 +192,11 @@ CMSWindowsPrimaryScreen::onPreDispatch(const CEvent* event)
// key press
const SInt32 repeat = (SInt32)(msg->lParam & 0xffff);
if (repeat >= 2) {
- log((CLOG_DEBUG1 "event: key repeat key=%d mask=0x%04x count=%d", key, mask, repeat));
+ LOG((CLOG_DEBUG1 "event: key repeat key=%d mask=0x%04x count=%d", key, mask, repeat));
m_receiver->onKeyRepeat(key, mask, repeat);
}
else {
- log((CLOG_DEBUG1 "event: key press key=%d mask=0x%04x", key, mask));
+ LOG((CLOG_DEBUG1 "event: key press key=%d mask=0x%04x", key, mask));
m_receiver->onKeyDown(key, mask);
}
@@ -205,7 +205,7 @@ CMSWindowsPrimaryScreen::onPreDispatch(const CEvent* event)
}
else {
// key release
- log((CLOG_DEBUG1 "event: key release key=%d mask=0x%04x", key, mask));
+ LOG((CLOG_DEBUG1 "event: key release key=%d mask=0x%04x", key, mask));
m_receiver->onKeyUp(key, mask);
// update key state
@@ -213,7 +213,7 @@ CMSWindowsPrimaryScreen::onPreDispatch(const CEvent* event)
}
}
else {
- log((CLOG_DEBUG2 "event: cannot map key wParam=%d lParam=0x%08x", msg->wParam, msg->lParam));
+ LOG((CLOG_DEBUG2 "event: cannot map key wParam=%d lParam=0x%08x", msg->wParam, msg->lParam));
}
}
return true;
@@ -233,7 +233,7 @@ CMSWindowsPrimaryScreen::onPreDispatch(const CEvent* event)
case WM_LBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_RBUTTONDOWN:
- log((CLOG_DEBUG1 "event: button press button=%d", button));
+ LOG((CLOG_DEBUG1 "event: button press button=%d", button));
if (button != kButtonNone) {
m_receiver->onMouseDown(button);
m_keys[s_vkButton[button]] |= 0x80;
@@ -243,7 +243,7 @@ CMSWindowsPrimaryScreen::onPreDispatch(const CEvent* event)
case WM_LBUTTONUP:
case WM_MBUTTONUP:
case WM_RBUTTONUP:
- log((CLOG_DEBUG1 "event: button release button=%d", button));
+ LOG((CLOG_DEBUG1 "event: button release button=%d", button));
if (button != kButtonNone) {
m_receiver->onMouseUp(button);
m_keys[s_vkButton[button]] &= ~0x80;
@@ -256,7 +256,7 @@ CMSWindowsPrimaryScreen::onPreDispatch(const CEvent* event)
case SYNERGY_MSG_MOUSE_WHEEL:
// ignore message if posted prior to last mark change
if (!ignore()) {
- log((CLOG_DEBUG1 "event: button wheel delta=%d %d", msg->wParam, msg->lParam));
+ LOG((CLOG_DEBUG1 "event: button wheel delta=%d %d", msg->wParam, msg->lParam));
m_receiver->onMouseWheel(msg->wParam);
}
return true;
@@ -282,7 +282,7 @@ CMSWindowsPrimaryScreen::onPreDispatch(const CEvent* event)
}
case SYNERGY_MSG_POST_WARP:
- log((CLOG_WARN "unmatched post warp"));
+ LOG((CLOG_WARN "unmatched post warp"));
return true;
case SYNERGY_MSG_MOUSE_MOVE:
@@ -413,7 +413,7 @@ CMSWindowsPrimaryScreen::onPreOpen()
// initialize hook library
m_threadID = GetCurrentThreadId();
if (m_init(m_threadID) == 0) {
- log((CLOG_ERR "cannot initialize hook library"));
+ LOG((CLOG_ERR "cannot initialize hook library"));
throw XScreenOpenFailure();
}
}
@@ -927,12 +927,12 @@ CMSWindowsPrimaryScreen::mapKey(
mask &= ~(KeyModifierControl | KeyModifierAlt);
}
*maskOut = mask;
- log((CLOG_DEBUG2 "key in vk=%d info=0x%08x mask=0x%04x", vkCode, info, mask));
+ LOG((CLOG_DEBUG2 "key in vk=%d info=0x%08x mask=0x%04x", vkCode, info, mask));
// get the scan code and the extended keyboard flag
UINT scanCode = static_cast((info & 0x00ff0000u) >> 16);
int extended = ((info & 0x01000000) == 0) ? 0 : 1;
- log((CLOG_DEBUG1 "key vk=%d ext=%d scan=%d", vkCode, extended, scanCode));
+ LOG((CLOG_DEBUG1 "key vk=%d ext=%d scan=%d", vkCode, extended, scanCode));
// handle some keys via table lookup
KeyID id = g_virtualKey[vkCode][extended];
diff --git a/lib/server/CPrimaryClient.cpp b/lib/server/CPrimaryClient.cpp
index 4a557fea..47279c5c 100644
--- a/lib/server/CPrimaryClient.cpp
+++ b/lib/server/CPrimaryClient.cpp
@@ -36,7 +36,7 @@ CPrimaryClient::CPrimaryClient(IPrimaryScreenFactory* screenFactory,
assert(m_server != NULL);
// create screen
- log((CLOG_DEBUG1 "creating primary screen"));
+ LOG((CLOG_DEBUG1 "creating primary screen"));
if (screenFactory != NULL) {
m_screen = screenFactory->create(this, receiver);
}
@@ -47,7 +47,7 @@ CPrimaryClient::CPrimaryClient(IPrimaryScreenFactory* screenFactory,
CPrimaryClient::~CPrimaryClient()
{
- log((CLOG_DEBUG1 "destroying primary screen"));
+ LOG((CLOG_DEBUG1 "destroying primary screen"));
delete m_screen;
}
diff --git a/lib/server/CPrimaryScreen.cpp b/lib/server/CPrimaryScreen.cpp
index 19fd9b1e..a9cd4297 100644
--- a/lib/server/CPrimaryScreen.cpp
+++ b/lib/server/CPrimaryScreen.cpp
@@ -44,15 +44,15 @@ CPrimaryScreen::mainLoop()
// run event loop
try {
- log((CLOG_DEBUG "entering event loop"));
+ LOG((CLOG_DEBUG "entering event loop"));
onPreMainLoop();
getScreen()->mainLoop();
onPostMainLoop();
- log((CLOG_DEBUG "exiting event loop"));
+ LOG((CLOG_DEBUG "exiting event loop"));
}
catch (...) {
onPostMainLoop();
- log((CLOG_DEBUG "exiting event loop"));
+ LOG((CLOG_DEBUG "exiting event loop"));
throw;
}
}
@@ -119,7 +119,7 @@ CPrimaryScreen::close()
void
CPrimaryScreen::enter(SInt32 x, SInt32 y, bool forScreensaver)
{
- log((CLOG_INFO "entering primary at %d,%d%s", x, y, forScreensaver ? " for screen saver" : ""));
+ LOG((CLOG_INFO "entering primary at %d,%d%s", x, y, forScreensaver ? " for screen saver" : ""));
CLock lock(&m_mutex);
assert(m_active == true);
@@ -153,7 +153,7 @@ CPrimaryScreen::enterNoWarp()
bool
CPrimaryScreen::leave()
{
- log((CLOG_INFO "leaving primary"));
+ LOG((CLOG_INFO "leaving primary"));
CLock lock(&m_mutex);
assert(m_active == false);
diff --git a/lib/server/CServer.cpp b/lib/server/CServer.cpp
index 4df38195..9be9b299 100644
--- a/lib/server/CServer.cpp
+++ b/lib/server/CServer.cpp
@@ -72,17 +72,17 @@ CServer::open()
{
// open the screen
try {
- log((CLOG_INFO "opening screen"));
+ LOG((CLOG_INFO "opening screen"));
openPrimaryScreen();
}
catch (XScreen&) {
// can't open screen
- log((CLOG_INFO "failed to open screen"));
+ LOG((CLOG_INFO "failed to open screen"));
throw;
}
catch (XUnknownClient& e) {
// can't open screen
- log((CLOG_CRIT "unknown screen name `%s'", e.getName().c_str()));
+ LOG((CLOG_CRIT "unknown screen name `%s'", e.getName().c_str()));
throw;
}
}
@@ -97,7 +97,7 @@ CServer::mainLoop()
}
try {
- log((CLOG_NOTE "starting server"));
+ LOG((CLOG_NOTE "starting server"));
// start listening for new clients
m_acceptClientThread = new CThread(startThread(
@@ -115,7 +115,7 @@ CServer::mainLoop()
m_primaryClient->mainLoop();
// clean up
- log((CLOG_NOTE "stopping server"));
+ LOG((CLOG_NOTE "stopping server"));
// use a macro to write the stuff that should go into a finally
// block so we can repeat it easily. stroustrup's view that
@@ -131,23 +131,23 @@ CServer::mainLoop()
FINALLY;
}
catch (XBase& e) {
- log((CLOG_ERR "server error: %s", e.what()));
+ LOG((CLOG_ERR "server error: %s", e.what()));
// clean up
- log((CLOG_NOTE "stopping server"));
+ LOG((CLOG_NOTE "stopping server"));
FINALLY;
}
catch (XThread&) {
// clean up
- log((CLOG_NOTE "stopping server"));
+ LOG((CLOG_NOTE "stopping server"));
FINALLY;
throw;
}
catch (...) {
- log((CLOG_DEBUG "unknown server error"));
+ LOG((CLOG_DEBUG "unknown server error"));
// clean up
- log((CLOG_NOTE "stopping server"));
+ LOG((CLOG_NOTE "stopping server"));
FINALLY;
throw;
}
@@ -166,7 +166,7 @@ CServer::close()
if (m_primaryClient != NULL) {
closePrimaryScreen();
}
- log((CLOG_INFO "closed screen"));
+ LOG((CLOG_INFO "closed screen"));
}
bool
@@ -289,7 +289,7 @@ CServer::onInfoChanged(const CString& name, const CClientInfo& info)
m_x = info.m_mx;
m_y = info.m_my;
}
- log((CLOG_INFO "screen \"%s\" shape=%d,%d %dx%d zone=%d pos=%d,%d", name.c_str(), info.m_x, info.m_y, info.m_w, info.m_h, info.m_zoneSize, info.m_mx, info.m_my));
+ LOG((CLOG_INFO "screen \"%s\" shape=%d,%d %dx%d zone=%d pos=%d,%d", name.c_str(), info.m_x, info.m_y, info.m_w, info.m_h, info.m_zoneSize, info.m_mx, info.m_my));
// handle resolution change to primary screen
if (client == m_primaryClient) {
@@ -318,12 +318,12 @@ CServer::onGrabClipboard(const CString& name, ClipboardID id, UInt32 seqNum)
CClipboardInfo& clipboard = m_clipboards[id];
if (name != m_primaryClient->getName() &&
seqNum < clipboard.m_clipboardSeqNum) {
- log((CLOG_INFO "ignored screen \"%s\" grab of clipboard %d", name.c_str(), id));
+ LOG((CLOG_INFO "ignored screen \"%s\" grab of clipboard %d", name.c_str(), id));
return false;
}
// mark screen as owning clipboard
- log((CLOG_INFO "screen \"%s\" grabbed clipboard %d from \"%s\"", name.c_str(), id, clipboard.m_clipboardOwner.c_str()));
+ LOG((CLOG_INFO "screen \"%s\" grabbed clipboard %d from \"%s\"", name.c_str(), id, clipboard.m_clipboardOwner.c_str()));
clipboard.m_clipboardOwner = name;
clipboard.m_clipboardSeqNum = seqNum;
@@ -365,18 +365,18 @@ CServer::onClipboardChangedNoLock(ClipboardID id,
// ignore update if sequence number is old
if (seqNum < clipboard.m_clipboardSeqNum) {
- log((CLOG_INFO "ignored screen \"%s\" update of clipboard %d (missequenced)", clipboard.m_clipboardOwner.c_str(), id));
+ LOG((CLOG_INFO "ignored screen \"%s\" update of clipboard %d (missequenced)", clipboard.m_clipboardOwner.c_str(), id));
return;
}
// ignore if data hasn't changed
if (data == clipboard.m_clipboardData) {
- log((CLOG_DEBUG "ignored screen \"%s\" update of clipboard %d (unchanged)", clipboard.m_clipboardOwner.c_str(), id));
+ LOG((CLOG_DEBUG "ignored screen \"%s\" update of clipboard %d (unchanged)", clipboard.m_clipboardOwner.c_str(), id));
return;
}
// unmarshall into our clipboard buffer
- log((CLOG_INFO "screen \"%s\" updated clipboard %d", clipboard.m_clipboardOwner.c_str(), id));
+ LOG((CLOG_INFO "screen \"%s\" updated clipboard %d", clipboard.m_clipboardOwner.c_str(), id));
clipboard.m_clipboardData = data;
clipboard.m_clipboard.unmarshall(clipboard.m_clipboardData, 0);
@@ -396,7 +396,7 @@ CServer::onClipboardChangedNoLock(ClipboardID id,
void
CServer::onScreensaver(bool activated)
{
- log((CLOG_DEBUG "onScreenSaver %s", activated ? "activated" : "deactivated"));
+ LOG((CLOG_DEBUG "onScreenSaver %s", activated ? "activated" : "deactivated"));
CLock lock(&m_mutex);
if (activated) {
@@ -452,7 +452,7 @@ CServer::onScreensaver(bool activated)
void
CServer::onKeyDown(KeyID id, KeyModifierMask mask)
{
- log((CLOG_DEBUG1 "onKeyDown id=%d mask=0x%04x", id, mask));
+ LOG((CLOG_DEBUG1 "onKeyDown id=%d mask=0x%04x", id, mask));
CLock lock(&m_mutex);
assert(m_active != NULL);
@@ -468,7 +468,7 @@ CServer::onKeyDown(KeyID id, KeyModifierMask mask)
void
CServer::onKeyUp(KeyID id, KeyModifierMask mask)
{
- log((CLOG_DEBUG1 "onKeyUp id=%d mask=0x%04x", id, mask));
+ LOG((CLOG_DEBUG1 "onKeyUp id=%d mask=0x%04x", id, mask));
CLock lock(&m_mutex);
assert(m_active != NULL);
@@ -484,7 +484,7 @@ CServer::onKeyUp(KeyID id, KeyModifierMask mask)
void
CServer::onKeyRepeat(KeyID id, KeyModifierMask mask, SInt32 count)
{
- log((CLOG_DEBUG1 "onKeyRepeat id=%d mask=0x%04x count=%d", id, mask, count));
+ LOG((CLOG_DEBUG1 "onKeyRepeat id=%d mask=0x%04x count=%d", id, mask, count));
CLock lock(&m_mutex);
assert(m_active != NULL);
@@ -501,7 +501,7 @@ CServer::onKeyRepeat(KeyID id, KeyModifierMask mask, SInt32 count)
void
CServer::onMouseDown(ButtonID id)
{
- log((CLOG_DEBUG1 "onMouseDown id=%d", id));
+ LOG((CLOG_DEBUG1 "onMouseDown id=%d", id));
CLock lock(&m_mutex);
assert(m_active != NULL);
@@ -512,7 +512,7 @@ CServer::onMouseDown(ButtonID id)
void
CServer::onMouseUp(ButtonID id)
{
- log((CLOG_DEBUG1 "onMouseUp id=%d", id));
+ LOG((CLOG_DEBUG1 "onMouseUp id=%d", id));
CLock lock(&m_mutex);
assert(m_active != NULL);
@@ -523,7 +523,7 @@ CServer::onMouseUp(ButtonID id)
bool
CServer::onMouseMovePrimary(SInt32 x, SInt32 y)
{
- log((CLOG_DEBUG2 "onMouseMovePrimary %d,%d", x, y));
+ LOG((CLOG_DEBUG2 "onMouseMovePrimary %d,%d", x, y));
CLock lock(&m_mutex);
return onMouseMovePrimaryNoLock(x, y);
}
@@ -550,22 +550,22 @@ CServer::onMouseMovePrimaryNoLock(SInt32 x, SInt32 y)
if (x < ax + zoneSize) {
x -= zoneSize;
dir = kLeft;
- log((CLOG_DEBUG1 "switch to left"));
+ LOG((CLOG_DEBUG1 "switch to left"));
}
else if (x >= ax + aw - zoneSize) {
x += zoneSize;
dir = kRight;
- log((CLOG_DEBUG1 "switch to right"));
+ LOG((CLOG_DEBUG1 "switch to right"));
}
else if (y < ay + zoneSize) {
y -= zoneSize;
dir = kTop;
- log((CLOG_DEBUG1 "switch to top"));
+ LOG((CLOG_DEBUG1 "switch to top"));
}
else if (y >= ay + ah - zoneSize) {
y += zoneSize;
dir = kBottom;
- log((CLOG_DEBUG1 "switch to bottom"));
+ LOG((CLOG_DEBUG1 "switch to bottom"));
}
else {
// still on local screen
@@ -587,7 +587,7 @@ CServer::onMouseMovePrimaryNoLock(SInt32 x, SInt32 y)
void
CServer::onMouseMoveSecondary(SInt32 dx, SInt32 dy)
{
- log((CLOG_DEBUG2 "onMouseMoveSecondary %+d,%+d", dx, dy));
+ LOG((CLOG_DEBUG2 "onMouseMoveSecondary %+d,%+d", dx, dy));
CLock lock(&m_mutex);
onMouseMoveSecondaryNoLock(dx, dy);
}
@@ -647,12 +647,12 @@ CServer::onMouseMoveSecondaryNoLock(SInt32 dx, SInt32 dy)
// get neighbor if we should switch
if (newScreen == NULL) {
- log((CLOG_DEBUG1 "leave \"%s\" on %s", m_active->getName().c_str(), CConfig::dirName(dir)));
+ LOG((CLOG_DEBUG1 "leave \"%s\" on %s", m_active->getName().c_str(), CConfig::dirName(dir)));
// get new position or clamp to current screen
newScreen = getNeighbor(m_active, dir, m_x, m_y);
if (newScreen == NULL) {
- log((CLOG_DEBUG1 "no neighbor; clamping"));
+ LOG((CLOG_DEBUG1 "no neighbor; clamping"));
if (m_x < ax) {
m_x = ax;
}
@@ -670,7 +670,7 @@ CServer::onMouseMoveSecondaryNoLock(SInt32 dx, SInt32 dy)
}
else {
// clamp to edge when locked
- log((CLOG_DEBUG1 "clamp to \"%s\"", m_active->getName().c_str()));
+ LOG((CLOG_DEBUG1 "clamp to \"%s\"", m_active->getName().c_str()));
if (m_x < ax) {
m_x = ax;
}
@@ -689,7 +689,7 @@ CServer::onMouseMoveSecondaryNoLock(SInt32 dx, SInt32 dy)
if (newScreen == NULL || newScreen == m_active) {
// do nothing if mouse didn't move
if (m_x != xOld || m_y != yOld) {
- log((CLOG_DEBUG2 "move on %s to %d,%d", m_active->getName().c_str(), m_x, m_y));
+ LOG((CLOG_DEBUG2 "move on %s to %d,%d", m_active->getName().c_str(), m_x, m_y));
m_active->mouseMove(m_x, m_y);
}
}
@@ -703,7 +703,7 @@ CServer::onMouseMoveSecondaryNoLock(SInt32 dx, SInt32 dy)
void
CServer::onMouseWheel(SInt32 delta)
{
- log((CLOG_DEBUG1 "onMouseWheel %+d", delta));
+ LOG((CLOG_DEBUG1 "onMouseWheel %+d", delta));
CLock lock(&m_mutex);
assert(m_active != NULL);
@@ -749,7 +749,7 @@ CServer::switchScreen(IClient* dst, SInt32 x, SInt32 y, bool forScreensaver)
#endif
assert(m_active != NULL);
- log((CLOG_INFO "switch from \"%s\" to \"%s\" at %d,%d", m_active->getName().c_str(), dst->getName().c_str(), x, y));
+ LOG((CLOG_INFO "switch from \"%s\" to \"%s\" at %d,%d", m_active->getName().c_str(), dst->getName().c_str(), x, y));
// record new position
m_x = x;
@@ -762,7 +762,7 @@ CServer::switchScreen(IClient* dst, SInt32 x, SInt32 y, bool forScreensaver)
// leave active screen
if (!m_active->leave()) {
// cannot leave screen
- log((CLOG_WARN "can't leave screen"));
+ LOG((CLOG_WARN "can't leave screen"));
return;
}
@@ -808,14 +808,14 @@ CServer::getNeighbor(IClient* src, EDirection dir) const
CString srcName = src->getName();
assert(!srcName.empty());
- log((CLOG_DEBUG2 "find neighbor on %s of \"%s\"", CConfig::dirName(dir), srcName.c_str()));
+ LOG((CLOG_DEBUG2 "find neighbor on %s of \"%s\"", CConfig::dirName(dir), srcName.c_str()));
for (;;) {
// look up name of neighbor
const CString dstName(m_config.getNeighbor(srcName, dir));
// if nothing in that direction then return NULL
if (dstName.empty()) {
- log((CLOG_DEBUG2 "no neighbor on %s of \"%s\"", CConfig::dirName(dir), srcName.c_str()));
+ LOG((CLOG_DEBUG2 "no neighbor on %s of \"%s\"", CConfig::dirName(dir), srcName.c_str()));
return NULL;
}
@@ -824,11 +824,11 @@ CServer::getNeighbor(IClient* src, EDirection dir) const
// unconnected screen.
CClientList::const_iterator index = m_clients.find(dstName);
if (index != m_clients.end()) {
- log((CLOG_DEBUG2 "\"%s\" is on %s of \"%s\"", dstName.c_str(), CConfig::dirName(dir), srcName.c_str()));
+ LOG((CLOG_DEBUG2 "\"%s\" is on %s of \"%s\"", dstName.c_str(), CConfig::dirName(dir), srcName.c_str()));
return index->second;
}
- log((CLOG_DEBUG2 "ignored \"%s\" on %s of \"%s\"", dstName.c_str(), CConfig::dirName(dir), srcName.c_str()));
+ LOG((CLOG_DEBUG2 "ignored \"%s\" on %s of \"%s\"", dstName.c_str(), CConfig::dirName(dir), srcName.c_str()));
srcName = dstName;
}
}
@@ -867,7 +867,7 @@ CServer::getNeighbor(IClient* src,
if (x >= 0) {
break;
}
- log((CLOG_DEBUG2 "skipping over screen %s", dst->getName().c_str()));
+ LOG((CLOG_DEBUG2 "skipping over screen %s", dst->getName().c_str()));
dst = getNeighbor(lastGoodScreen, srcSide);
}
assert(lastGoodScreen != NULL);
@@ -883,7 +883,7 @@ CServer::getNeighbor(IClient* src,
if (x < dw) {
break;
}
- log((CLOG_DEBUG2 "skipping over screen %s", dst->getName().c_str()));
+ LOG((CLOG_DEBUG2 "skipping over screen %s", dst->getName().c_str()));
dst = getNeighbor(lastGoodScreen, srcSide);
}
assert(lastGoodScreen != NULL);
@@ -899,7 +899,7 @@ CServer::getNeighbor(IClient* src,
if (y >= 0) {
break;
}
- log((CLOG_DEBUG2 "skipping over screen %s", dst->getName().c_str()));
+ LOG((CLOG_DEBUG2 "skipping over screen %s", dst->getName().c_str()));
dst = getNeighbor(lastGoodScreen, srcSide);
}
assert(lastGoodScreen != NULL);
@@ -915,7 +915,7 @@ CServer::getNeighbor(IClient* src,
if (y < sh) {
break;
}
- log((CLOG_DEBUG2 "skipping over screen %s", dst->getName().c_str()));
+ LOG((CLOG_DEBUG2 "skipping over screen %s", dst->getName().c_str()));
dst = getNeighbor(lastGoodScreen, srcSide);
}
assert(lastGoodScreen != NULL);
@@ -1073,14 +1073,14 @@ CServer::startThread(IJob* job)
// add new thread to list. use the job as user data for logging.
CThread thread(job, job);
m_threads.push_back(thread);
- log((CLOG_DEBUG1 "started thread %p", thread.getUserData()));
+ LOG((CLOG_DEBUG1 "started thread %p", thread.getUserData()));
return thread;
}
void
CServer::stopThreads(double timeout)
{
- log((CLOG_DEBUG1 "stopping threads"));
+ LOG((CLOG_DEBUG1 "stopping threads"));
// cancel the accept client thread to prevent more clients from
// connecting while we're shutting down.
@@ -1125,10 +1125,10 @@ CServer::stopThreads(double timeout)
// delete remaining threads
for (CThreadList::iterator index = threads.begin();
index != threads.end(); ++index) {
- log((CLOG_DEBUG1 "reaped running thread %p", index->getUserData()));
+ LOG((CLOG_DEBUG1 "reaped running thread %p", index->getUserData()));
}
- log((CLOG_DEBUG1 "stopped threads"));
+ LOG((CLOG_DEBUG1 "stopped threads"));
}
void
@@ -1145,7 +1145,7 @@ CServer::doReapThreads(CThreadList& threads)
index != threads.end(); ) {
if (index->wait(0.0)) {
// thread terminated
- log((CLOG_DEBUG1 "reaped thread %p", index->getUserData()));
+ LOG((CLOG_DEBUG1 "reaped thread %p", index->getUserData()));
index = threads.erase(index);
}
else {
@@ -1158,7 +1158,7 @@ CServer::doReapThreads(CThreadList& threads)
void
CServer::acceptClients(void*)
{
- log((CLOG_DEBUG1 "starting to wait for clients"));
+ LOG((CLOG_DEBUG1 "starting to wait for clients"));
IListenSocket* listen = NULL;
try {
@@ -1173,16 +1173,16 @@ CServer::acceptClients(void*)
CStopwatch timer;
for (;;) {
try {
- log((CLOG_DEBUG1 "binding listen socket"));
+ LOG((CLOG_DEBUG1 "binding listen socket"));
listen->bind(m_config.getSynergyAddress());
break;
}
catch (XSocketBind& e) {
- log((CLOG_WARN "bind failed: %s", e.getErrstr()));
+ LOG((CLOG_WARN "bind failed: %s", e.getErrstr()));
// give up if we've waited too long
if (timer.getTime() >= m_bindTimeout) {
- log((CLOG_ERR "waited too long to bind, giving up"));
+ LOG((CLOG_ERR "waited too long to bind, giving up"));
throw;
}
@@ -1192,12 +1192,12 @@ CServer::acceptClients(void*)
}
// accept connections and begin processing them
- log((CLOG_DEBUG1 "waiting for client connections"));
+ LOG((CLOG_DEBUG1 "waiting for client connections"));
for (;;) {
// accept connection
CThread::testCancel();
IDataSocket* socket = listen->accept();
- log((CLOG_NOTE "accepted client connection"));
+ LOG((CLOG_NOTE "accepted client connection"));
CThread::testCancel();
// start handshake thread
@@ -1209,7 +1209,7 @@ CServer::acceptClients(void*)
delete listen;
}
catch (XBase& e) {
- log((CLOG_ERR "cannot listen for clients: %s", e.what()));
+ LOG((CLOG_ERR "cannot listen for clients: %s", e.what()));
delete listen;
exitMainLoop();
}
@@ -1251,7 +1251,7 @@ CServer::runClient(void* vsocket)
}
catch (XDuplicateClient& e) {
// client has duplicate name
- log((CLOG_WARN "a client with name \"%s\" is already connected", e.getName().c_str()));
+ LOG((CLOG_WARN "a client with name \"%s\" is already connected", e.getName().c_str()));
CProtocolUtil::writef(proxy->getOutputStream(), kMsgEBusy);
delete proxy;
delete socket;
@@ -1259,7 +1259,7 @@ CServer::runClient(void* vsocket)
}
catch (XUnknownClient& e) {
// client has unknown name
- log((CLOG_WARN "a client with name \"%s\" is not in the map", e.getName().c_str()));
+ LOG((CLOG_WARN "a client with name \"%s\" is not in the map", e.getName().c_str()));
CProtocolUtil::writef(proxy->getOutputStream(), kMsgEUnknown);
delete proxy;
delete socket;
@@ -1281,17 +1281,17 @@ CServer::runClient(void* vsocket)
// handle client messages
try {
- log((CLOG_NOTE "client \"%s\" has connected", proxy->getName().c_str()));
+ LOG((CLOG_NOTE "client \"%s\" has connected", proxy->getName().c_str()));
proxy->mainLoop();
}
catch (XBadClient&) {
// client not behaving
- log((CLOG_WARN "protocol error from client \"%s\"", proxy->getName().c_str()));
+ LOG((CLOG_WARN "protocol error from client \"%s\"", proxy->getName().c_str()));
CProtocolUtil::writef(proxy->getOutputStream(), kMsgEBad);
}
catch (XBase& e) {
// misc error
- log((CLOG_WARN "error communicating with client \"%s\": %s", proxy->getName().c_str(), e.what()));
+ LOG((CLOG_WARN "error communicating with client \"%s\": %s", proxy->getName().c_str(), e.what()));
}
catch (...) {
// mainLoop() was probably cancelled
@@ -1308,7 +1308,7 @@ CServer::runClient(void* vsocket)
CClientProxy*
CServer::handshakeClient(IDataSocket* socket)
{
- log((CLOG_DEBUG1 "negotiating with new client"));
+ LOG((CLOG_DEBUG1 "negotiating with new client"));
// get the input and output streams
IInputStream* input = socket->getInputStream();
@@ -1334,14 +1334,14 @@ CServer::handshakeClient(IDataSocket* socket)
CTimerThread timer(30.0);
// say hello
- log((CLOG_DEBUG1 "saying hello"));
+ LOG((CLOG_DEBUG1 "saying hello"));
CProtocolUtil::writef(output, kMsgHello,
kProtocolMajorVersion,
kProtocolMinorVersion);
output->flush();
// wait for the reply
- log((CLOG_DEBUG1 "waiting for hello reply"));
+ LOG((CLOG_DEBUG1 "waiting for hello reply"));
UInt32 n = input->getSize();
// limit the maximum length of the hello
@@ -1352,7 +1352,7 @@ CServer::handshakeClient(IDataSocket* socket)
// get and parse the reply to hello
SInt16 major, minor;
try {
- log((CLOG_DEBUG1 "parsing hello reply"));
+ LOG((CLOG_DEBUG1 "parsing hello reply"));
CProtocolUtil::readf(input, kMsgHelloBack,
&major, &minor, &name);
}
@@ -1382,32 +1382,32 @@ CServer::handshakeClient(IDataSocket* socket)
}
// create client proxy for highest version supported by the client
- log((CLOG_DEBUG1 "creating proxy for client \"%s\" version %d.%d", name.c_str(), major, minor));
+ LOG((CLOG_DEBUG1 "creating proxy for client \"%s\" version %d.%d", name.c_str(), major, minor));
proxy = new CClientProxy1_0(this, name, input, output);
// negotiate
// FIXME
// ask and wait for the client's info
- log((CLOG_DEBUG1 "waiting for info for client \"%s\"", name.c_str()));
+ LOG((CLOG_DEBUG1 "waiting for info for client \"%s\"", name.c_str()));
proxy->open();
return proxy;
}
catch (XIncompatibleClient& e) {
// client is incompatible
- log((CLOG_WARN "client \"%s\" has incompatible version %d.%d)", name.c_str(), e.getMajor(), e.getMinor()));
+ LOG((CLOG_WARN "client \"%s\" has incompatible version %d.%d)", name.c_str(), e.getMajor(), e.getMinor()));
CProtocolUtil::writef(output, kMsgEIncompatible,
kProtocolMajorVersion, kProtocolMinorVersion);
}
catch (XBadClient&) {
// client not behaving
- log((CLOG_WARN "protocol error from client \"%s\"", name.c_str()));
+ LOG((CLOG_WARN "protocol error from client \"%s\"", name.c_str()));
CProtocolUtil::writef(output, kMsgEBad);
}
catch (XBase& e) {
// misc error
- log((CLOG_WARN "error communicating with client \"%s\": %s", name.c_str(), e.what()));
+ LOG((CLOG_WARN "error communicating with client \"%s\": %s", name.c_str(), e.what()));
}
catch (...) {
// probably timed out
@@ -1436,7 +1436,7 @@ CServer::handshakeClient(IDataSocket* socket)
void
CServer::acceptHTTPClients(void*)
{
- log((CLOG_DEBUG1 "starting to wait for HTTP clients"));
+ LOG((CLOG_DEBUG1 "starting to wait for HTTP clients"));
IListenSocket* listen = NULL;
try {
@@ -1448,16 +1448,16 @@ CServer::acceptHTTPClients(void*)
CStopwatch timer;
for (;;) {
try {
- log((CLOG_DEBUG1 "binding HTTP listen socket"));
+ LOG((CLOG_DEBUG1 "binding HTTP listen socket"));
listen->bind(m_config.getHTTPAddress());
break;
}
catch (XSocketBind& e) {
- log((CLOG_DEBUG1 "bind HTTP failed: %s", e.getErrstr()));
+ LOG((CLOG_DEBUG1 "bind HTTP failed: %s", e.getErrstr()));
// give up if we've waited too long
if (timer.getTime() >= m_bindTimeout) {
- log((CLOG_DEBUG1 "waited too long to bind HTTP, giving up"));
+ LOG((CLOG_DEBUG1 "waited too long to bind HTTP, giving up"));
throw;
}
@@ -1467,7 +1467,7 @@ CServer::acceptHTTPClients(void*)
}
// accept connections and begin processing them
- log((CLOG_DEBUG1 "waiting for HTTP connections"));
+ LOG((CLOG_DEBUG1 "waiting for HTTP connections"));
for (;;) {
// limit the number of HTTP requests being handled at once
{
@@ -1482,7 +1482,7 @@ CServer::acceptHTTPClients(void*)
// accept connection
CThread::testCancel();
IDataSocket* socket = listen->accept();
- log((CLOG_NOTE "accepted HTTP connection"));
+ LOG((CLOG_NOTE "accepted HTTP connection"));
CThread::testCancel();
// handle HTTP request
@@ -1494,7 +1494,7 @@ CServer::acceptHTTPClients(void*)
delete listen;
}
catch (XBase& e) {
- log((CLOG_ERR "cannot listen for HTTP clients: %s", e.what()));
+ LOG((CLOG_ERR "cannot listen for HTTP clients: %s", e.what()));
delete listen;
exitMainLoop();
}
@@ -1574,7 +1574,7 @@ CServer::openPrimaryScreen()
m_active = m_primaryClient;
// open the screen
- log((CLOG_DEBUG1 "opening primary screen"));
+ LOG((CLOG_DEBUG1 "opening primary screen"));
m_primaryClient->open();
// tell it about the active sides
@@ -1600,7 +1600,7 @@ CServer::closePrimaryScreen()
// close the primary screen
try {
- log((CLOG_DEBUG1 "closing primary screen"));
+ LOG((CLOG_DEBUG1 "closing primary screen"));
m_primaryClient->close();
}
catch (...) {
@@ -1617,7 +1617,7 @@ CServer::addConnection(IClient* client)
{
assert(client != NULL);
- log((CLOG_DEBUG "adding connection \"%s\"", client->getName().c_str()));
+ LOG((CLOG_DEBUG "adding connection \"%s\"", client->getName().c_str()));
CLock lock(&m_mutex);
@@ -1633,13 +1633,13 @@ CServer::addConnection(IClient* client)
// save screen info
m_clients.insert(std::make_pair(client->getName(), client));
- log((CLOG_DEBUG "added connection \"%s\"", client->getName().c_str()));
+ LOG((CLOG_DEBUG "added connection \"%s\"", client->getName().c_str()));
}
void
CServer::removeConnection(const CString& name)
{
- log((CLOG_DEBUG "removing connection \"%s\"", name.c_str()));
+ LOG((CLOG_DEBUG "removing connection \"%s\"", name.c_str()));
CLock lock(&m_mutex);
// find client
@@ -1653,7 +1653,7 @@ CServer::removeConnection(const CString& name)
m_primaryClient->getCursorCenter(m_x, m_y);
// don't notify active screen since it probably already disconnected
- log((CLOG_INFO "jump from \"%s\" to \"%s\" at %d,%d", active->getName().c_str(), m_primaryClient->getName().c_str(), m_x, m_y));
+ LOG((CLOG_INFO "jump from \"%s\" to \"%s\" at %d,%d", active->getName().c_str(), m_primaryClient->getName().c_str(), m_x, m_y));
// cut over
m_active = m_primaryClient;
diff --git a/lib/server/CXWindowsPrimaryScreen.cpp b/lib/server/CXWindowsPrimaryScreen.cpp
index 756dcb03..57e0092d 100644
--- a/lib/server/CXWindowsPrimaryScreen.cpp
+++ b/lib/server/CXWindowsPrimaryScreen.cpp
@@ -182,7 +182,7 @@ CXWindowsPrimaryScreen::onEvent(CEvent* event)
case KeyPress:
{
- log((CLOG_DEBUG1 "event: KeyPress code=%d, state=0x%04x", xevent.xkey.keycode, xevent.xkey.state));
+ LOG((CLOG_DEBUG1 "event: KeyPress code=%d, state=0x%04x", xevent.xkey.keycode, xevent.xkey.state));
const KeyModifierMask mask = mapModifier(xevent.xkey.state);
const KeyID key = mapKey(&xevent.xkey);
if (key != kKeyNone) {
@@ -223,7 +223,7 @@ CXWindowsPrimaryScreen::onEvent(CEvent* event)
}
if (!hasPress) {
// no press event follows so it's a plain release
- log((CLOG_DEBUG1 "event: KeyRelease code=%d, state=0x%04x", xevent.xkey.keycode, xevent.xkey.state));
+ LOG((CLOG_DEBUG1 "event: KeyRelease code=%d, state=0x%04x", xevent.xkey.keycode, xevent.xkey.state));
if (key == kKeyCapsLock && m_capsLockHalfDuplex) {
m_receiver->onKeyDown(key, mask);
}
@@ -237,7 +237,7 @@ CXWindowsPrimaryScreen::onEvent(CEvent* event)
// we could attempt to count the already queued
// repeats but we'll just send a repeat of 1.
// note that we discard the press event.
- log((CLOG_DEBUG1 "event: repeat code=%d, state=0x%04x", xevent.xkey.keycode, xevent.xkey.state));
+ LOG((CLOG_DEBUG1 "event: repeat code=%d, state=0x%04x", xevent.xkey.keycode, xevent.xkey.state));
m_receiver->onKeyRepeat(key, mask, 1);
}
}
@@ -246,7 +246,7 @@ CXWindowsPrimaryScreen::onEvent(CEvent* event)
case ButtonPress:
{
- log((CLOG_DEBUG1 "event: ButtonPress button=%d", xevent.xbutton.button));
+ LOG((CLOG_DEBUG1 "event: ButtonPress button=%d", xevent.xbutton.button));
const ButtonID button = mapButton(xevent.xbutton.button);
if (button != kButtonNone) {
m_receiver->onMouseDown(button);
@@ -256,7 +256,7 @@ CXWindowsPrimaryScreen::onEvent(CEvent* event)
case ButtonRelease:
{
- log((CLOG_DEBUG1 "event: ButtonRelease button=%d", xevent.xbutton.button));
+ LOG((CLOG_DEBUG1 "event: ButtonRelease button=%d", xevent.xbutton.button));
const ButtonID button = mapButton(xevent.xbutton.button);
if (button != kButtonNone) {
m_receiver->onMouseUp(button);
@@ -274,7 +274,7 @@ CXWindowsPrimaryScreen::onEvent(CEvent* event)
case MotionNotify:
{
- log((CLOG_DEBUG2 "event: MotionNotify %d,%d", xevent.xmotion.x_root, xevent.xmotion.y_root));
+ LOG((CLOG_DEBUG2 "event: MotionNotify %d,%d", xevent.xmotion.x_root, xevent.xmotion.y_root));
// compute motion delta (relative to the last known
// mouse position)
@@ -427,7 +427,7 @@ CXWindowsPrimaryScreen::createWindow()
if (m_window == None) {
throw XScreenOpenFailure();
}
- log((CLOG_DEBUG "window is 0x%08x", m_window));
+ LOG((CLOG_DEBUG "window is 0x%08x", m_window));
// start watching for events on other windows
selectEvents(display, m_screen->getRoot());
@@ -474,16 +474,16 @@ CXWindowsPrimaryScreen::showWindow()
GrabModeAsync, GrabModeAsync, CurrentTime);
assert(result != GrabNotViewable);
if (result != GrabSuccess) {
- log((CLOG_DEBUG2 "waiting to grab keyboard"));
+ LOG((CLOG_DEBUG2 "waiting to grab keyboard"));
CThread::sleep(0.05);
if (timer.getTime() >= s_timeout) {
- log((CLOG_DEBUG2 "grab keyboard timed out"));
+ LOG((CLOG_DEBUG2 "grab keyboard timed out"));
XUnmapWindow(display, m_window);
return false;
}
}
} while (result != GrabSuccess);
- log((CLOG_DEBUG2 "grabbed keyboard"));
+ LOG((CLOG_DEBUG2 "grabbed keyboard"));
// now the mouse
result = XGrabPointer(display, m_window, True, 0,
@@ -493,16 +493,16 @@ CXWindowsPrimaryScreen::showWindow()
if (result != GrabSuccess) {
// back off to avoid grab deadlock
XUngrabKeyboard(display, CurrentTime);
- log((CLOG_DEBUG2 "ungrabbed keyboard, waiting to grab pointer"));
+ LOG((CLOG_DEBUG2 "ungrabbed keyboard, waiting to grab pointer"));
CThread::sleep(0.05);
if (timer.getTime() >= s_timeout) {
- log((CLOG_DEBUG2 "grab pointer timed out"));
+ LOG((CLOG_DEBUG2 "grab pointer timed out"));
XUnmapWindow(display, m_window);
return false;
}
}
} while (result != GrabSuccess);
- log((CLOG_DEBUG1 "grabbed pointer and keyboard"));
+ LOG((CLOG_DEBUG1 "grabbed pointer and keyboard"));
return true;
}
@@ -554,7 +554,7 @@ CXWindowsPrimaryScreen::warpCursorNoFlush(
XSendEvent(display, m_window, False, 0, &eventAfter);
XSync(display, False);
- log((CLOG_DEBUG2 "warped to %d,%d", x, y));
+ LOG((CLOG_DEBUG2 "warped to %d,%d", x, y));
}
void
diff --git a/lib/synergy/CProtocolUtil.cpp b/lib/synergy/CProtocolUtil.cpp
index 30274f08..c68b9a7e 100644
--- a/lib/synergy/CProtocolUtil.cpp
+++ b/lib/synergy/CProtocolUtil.cpp
@@ -28,7 +28,7 @@ CProtocolUtil::writef(IOutputStream* stream, const char* fmt, ...)
{
assert(stream != NULL);
assert(fmt != NULL);
- log((CLOG_DEBUG2 "writef(%s)", fmt));
+ LOG((CLOG_DEBUG2 "writef(%s)", fmt));
va_list args;
@@ -52,7 +52,7 @@ CProtocolUtil::writef(IOutputStream* stream, const char* fmt, ...)
UInt8* scan = buffer;
while (count > 0) {
const UInt32 n = stream->write(scan, count);
- log((CLOG_DEBUG2 "wrote %d of %d bytes", n, count));
+ LOG((CLOG_DEBUG2 "wrote %d of %d bytes", n, count));
count -= n;
scan += n;
}
@@ -65,7 +65,7 @@ CProtocolUtil::readf(IInputStream* stream, const char* fmt, ...)
{
assert(stream != NULL);
assert(fmt != NULL);
- log((CLOG_DEBUG2 "readf(%s)", fmt));
+ LOG((CLOG_DEBUG2 "readf(%s)", fmt));
va_list args;
va_start(args, fmt);
@@ -91,7 +91,7 @@ CProtocolUtil::readf(IInputStream* stream, const char* fmt, ...)
case 1:
// 1 byte integer
*reinterpret_cast(v) = buffer[0];
- log((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast(v), *reinterpret_cast(v)));
+ LOG((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast(v), *reinterpret_cast(v)));
break;
case 2:
@@ -100,7 +100,7 @@ CProtocolUtil::readf(IInputStream* stream, const char* fmt, ...)
static_cast(
(static_cast(buffer[0]) << 8) |
static_cast(buffer[1]));
- log((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast(v), *reinterpret_cast(v)));
+ LOG((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast(v), *reinterpret_cast(v)));
break;
case 4:
@@ -110,7 +110,7 @@ CProtocolUtil::readf(IInputStream* stream, const char* fmt, ...)
(static_cast(buffer[1]) << 16) |
(static_cast(buffer[2]) << 8) |
static_cast(buffer[3]);
- log((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast(v), *reinterpret_cast(v)));
+ LOG((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast(v), *reinterpret_cast(v)));
break;
}
break;
@@ -149,7 +149,7 @@ CProtocolUtil::readf(IInputStream* stream, const char* fmt, ...)
}
throw;
}
- log((CLOG_DEBUG2 "readf: read %d byte string: %.*s", len, len, sBuffer));
+ LOG((CLOG_DEBUG2 "readf: read %d byte string: %.*s", len, len, sBuffer));
// save the data
CString* dst = va_arg(args, CString*);
@@ -180,7 +180,7 @@ CProtocolUtil::readf(IInputStream* stream, const char* fmt, ...)
// verify match
if (buffer[0] != *fmt) {
- log((CLOG_DEBUG2 "readf: format mismatch: %c vs %c", *fmt, buffer[0]));
+ LOG((CLOG_DEBUG2 "readf: format mismatch: %c vs %c", *fmt, buffer[0]));
throw XIOReadMismatch();
}
@@ -366,7 +366,7 @@ CProtocolUtil::read(IInputStream* stream, void* vbuffer, UInt32 count)
// bail if stream has hungup
if (n == 0) {
- log((CLOG_DEBUG2 "unexpected disconnect in readf(), %d bytes left", count));
+ LOG((CLOG_DEBUG2 "unexpected disconnect in readf(), %d bytes left", count));
throw XIOEndOfStream();
}