formatting changes.

This commit is contained in:
crs 2002-06-17 13:31:21 +00:00
parent 57fb87ad10
commit fe16546a1d
46 changed files with 485 additions and 1214 deletions

View File

@ -54,9 +54,7 @@ CLog::Lock CLog::s_lock = &CLog::dummyLock;
int CLog::s_maxPriority = -1; int CLog::s_maxPriority = -1;
void void
CLog::print( CLog::print(const char* fmt, ...)
const char* fmt,
...)
{ {
// check if fmt begins with a priority argument // check if fmt begins with a priority argument
int priority = 4; int priority = 4;
@ -90,11 +88,7 @@ CLog::print(
} }
void void
CLog::printt( CLog::printt(const char* file, int line, const char* fmt, ...)
const char* file,
int line,
const char* fmt,
...)
{ {
// check if fmt begins with a priority argument // check if fmt begins with a priority argument
int priority = 4; int priority = 4;
@ -141,8 +135,7 @@ CLog::printt(
} }
void void
CLog::setOutputter( CLog::setOutputter(Outputter outputter)
Outputter outputter)
{ {
CHoldLock lock(s_lock); CHoldLock lock(s_lock);
s_outputter = outputter; s_outputter = outputter;
@ -156,8 +149,7 @@ CLog::getOutputter()
} }
void void
CLog::setLock( CLog::setLock(Lock newLock)
Lock newLock)
{ {
CHoldLock lock(s_lock); CHoldLock lock(s_lock);
s_lock = (newLock == NULL) ? dummyLock : newLock; s_lock = (newLock == NULL) ? dummyLock : newLock;
@ -171,8 +163,7 @@ CLog::getLock()
} }
bool bool
CLog::setFilter( CLog::setFilter(const char* maxPriority)
const char* maxPriority)
{ {
if (maxPriority != NULL) { if (maxPriority != NULL) {
for (int i = 0; i < g_numPriority; ++i) { for (int i = 0; i < g_numPriority; ++i) {
@ -187,8 +178,7 @@ CLog::setFilter(
} }
void void
CLog::setFilter( CLog::setFilter(int maxPriority)
int maxPriority)
{ {
CHoldLock lock(s_lock); CHoldLock lock(s_lock);
s_maxPriority = maxPriority; s_maxPriority = maxPriority;
@ -202,8 +192,7 @@ CLog::getFilter()
} }
void void
CLog::dummyLock( CLog::dummyLock(bool)
bool)
{ {
// do nothing // do nothing
} }
@ -222,9 +211,7 @@ CLog::getMaxPriority()
} }
void void
CLog::output( CLog::output(int priority, char* msg)
int priority,
char* msg)
{ {
assert(priority >= -1 && priority < g_numPriority); assert(priority >= -1 && priority < g_numPriority);
assert(msg != NULL); assert(msg != NULL);
@ -257,12 +244,7 @@ CLog::output(
} }
char* char*
CLog::vsprint( CLog::vsprint(int pad, char* buffer, int len, const char* fmt, va_list args)
int pad,
char* buffer,
int len,
const char* fmt,
va_list args)
{ {
assert(len > 0); assert(len > 0);

View File

@ -25,9 +25,7 @@ CStringUtil::CaselessCmp::cmpLess(
} }
bool bool
CStringUtil::CaselessCmp::less( CStringUtil::CaselessCmp::less(const CString& a, const CString& b)
const CString& a,
const CString& b)
{ {
return std::lexicographical_compare( return std::lexicographical_compare(
a.begin(), a.end(), a.begin(), a.end(),
@ -36,17 +34,13 @@ CStringUtil::CaselessCmp::less(
} }
bool bool
CStringUtil::CaselessCmp::equal( CStringUtil::CaselessCmp::equal(const CString& a, const CString& b)
const CString& a,
const CString& b)
{ {
return !(less(a, b) || less(b, a)); return !(less(a, b) || less(b, a));
} }
bool bool
CStringUtil::CaselessCmp::operator()( CStringUtil::CaselessCmp::operator()(const CString& a, const CString& b) const
const CString& a,
const CString& b) const
{ {
return less(a, b); return less(a, b);
} }

View File

@ -44,9 +44,7 @@ XBase::what() const
} }
CString CString
XBase::format( XBase::format(const char* /*id*/, const char* fmt, ...) const throw()
const char* /*id*/,
const char* fmt, ...) const throw()
{ {
// FIXME -- use id to lookup formating string // FIXME -- use id to lookup formating string
// FIXME -- format string with arguments // FIXME -- format string with arguments

View File

@ -28,8 +28,7 @@
// CClient // CClient
// //
CClient::CClient( CClient::CClient(const CString& clientName) :
const CString& clientName) :
m_name(clientName), m_name(clientName),
m_input(NULL), m_input(NULL),
m_output(NULL), m_output(NULL),
@ -48,15 +47,13 @@ CClient::~CClient()
} }
void void
CClient::camp( CClient::camp(bool on)
bool on)
{ {
m_camp = on; m_camp = on;
} }
bool bool
CClient::run( CClient::run(const CNetworkAddress& serverAddress)
const CNetworkAddress& serverAddress)
{ {
CThread* thread = NULL; CThread* thread = NULL;
try { try {
@ -140,8 +137,7 @@ CClient::quit()
} }
void void
CClient::onClipboardChanged( CClient::onClipboardChanged(ClipboardID id)
ClipboardID id)
{ {
log((CLOG_DEBUG "sending clipboard %d changed", id)); log((CLOG_DEBUG "sending clipboard %d changed", id));
CLock lock(&m_mutex); CLock lock(&m_mutex);

View File

@ -69,8 +69,7 @@ CMSWindowsSecondaryScreen::stop()
} }
void void
CMSWindowsSecondaryScreen::open( CMSWindowsSecondaryScreen::open(CClient* client)
CClient* client)
{ {
assert(m_client == NULL); assert(m_client == NULL);
assert(client != NULL); assert(client != NULL);
@ -108,10 +107,7 @@ CMSWindowsSecondaryScreen::close()
} }
void void
CMSWindowsSecondaryScreen::enter( CMSWindowsSecondaryScreen::enter(SInt32 x, SInt32 y, KeyModifierMask mask)
SInt32 x,
SInt32 y,
KeyModifierMask mask)
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);
assert(m_window != NULL); assert(m_window != NULL);
@ -182,9 +178,7 @@ CMSWindowsSecondaryScreen::leave()
} }
void void
CMSWindowsSecondaryScreen::keyDown( CMSWindowsSecondaryScreen::keyDown(KeyID key, KeyModifierMask mask)
KeyID key,
KeyModifierMask mask)
{ {
Keystrokes keys; Keystrokes keys;
UINT virtualKey; UINT virtualKey;
@ -224,10 +218,8 @@ CMSWindowsSecondaryScreen::keyDown(
} }
void void
CMSWindowsSecondaryScreen::keyRepeat( CMSWindowsSecondaryScreen::keyRepeat(KeyID key,
KeyID key, KeyModifierMask mask, SInt32 count)
KeyModifierMask mask,
SInt32 count)
{ {
Keystrokes keys; Keystrokes keys;
UINT virtualKey; UINT virtualKey;
@ -248,9 +240,7 @@ CMSWindowsSecondaryScreen::keyRepeat(
} }
void void
CMSWindowsSecondaryScreen::keyUp( CMSWindowsSecondaryScreen::keyUp(KeyID key, KeyModifierMask mask)
KeyID key,
KeyModifierMask mask)
{ {
Keystrokes keys; Keystrokes keys;
UINT virtualKey; UINT virtualKey;
@ -311,8 +301,7 @@ CMSWindowsSecondaryScreen::keyUp(
} }
void void
CMSWindowsSecondaryScreen::mouseDown( CMSWindowsSecondaryScreen::mouseDown(ButtonID button)
ButtonID button)
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);
assert(m_window != NULL); assert(m_window != NULL);
@ -328,8 +317,7 @@ CMSWindowsSecondaryScreen::mouseDown(
} }
void void
CMSWindowsSecondaryScreen::mouseUp( CMSWindowsSecondaryScreen::mouseUp(ButtonID button)
ButtonID button)
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);
assert(m_window != NULL); assert(m_window != NULL);
@ -345,9 +333,7 @@ CMSWindowsSecondaryScreen::mouseUp(
} }
void void
CMSWindowsSecondaryScreen::mouseMove( CMSWindowsSecondaryScreen::mouseMove(SInt32 x, SInt32 y)
SInt32 x,
SInt32 y)
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);
assert(m_window != NULL); assert(m_window != NULL);
@ -362,8 +348,7 @@ CMSWindowsSecondaryScreen::mouseMove(
} }
void void
CMSWindowsSecondaryScreen::mouseWheel( CMSWindowsSecondaryScreen::mouseWheel(SInt32 delta)
SInt32 delta)
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);
assert(m_window != NULL); assert(m_window != NULL);
@ -373,8 +358,7 @@ CMSWindowsSecondaryScreen::mouseWheel(
} }
void void
CMSWindowsSecondaryScreen::setClipboard( CMSWindowsSecondaryScreen::setClipboard(ClipboardID /*id*/,
ClipboardID /*id*/,
const IClipboard* src) const IClipboard* src)
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);
@ -385,8 +369,7 @@ CMSWindowsSecondaryScreen::setClipboard(
} }
void void
CMSWindowsSecondaryScreen::grabClipboard( CMSWindowsSecondaryScreen::grabClipboard(ClipboardID /*id*/)
ClipboardID /*id*/)
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);
assert(m_window != NULL); assert(m_window != NULL);
@ -398,9 +381,7 @@ CMSWindowsSecondaryScreen::grabClipboard(
} }
void void
CMSWindowsSecondaryScreen::getMousePos( CMSWindowsSecondaryScreen::getMousePos(SInt32* x, SInt32* y) const
SInt32* x,
SInt32* y) const
{ {
assert(x != NULL); assert(x != NULL);
assert(y != NULL); assert(y != NULL);
@ -421,9 +402,7 @@ CMSWindowsSecondaryScreen::getMousePos(
} }
void void
CMSWindowsSecondaryScreen::getSize( CMSWindowsSecondaryScreen::getSize(SInt32* width, SInt32* height) const
SInt32* width,
SInt32* height) const
{ {
getScreenSize(width, height); getScreenSize(width, height);
} }
@ -435,8 +414,7 @@ CMSWindowsSecondaryScreen::getJumpZoneSize() const
} }
void void
CMSWindowsSecondaryScreen::getClipboard( CMSWindowsSecondaryScreen::getClipboard(ClipboardID /*id*/,
ClipboardID /*id*/,
IClipboard* dst) const IClipboard* dst) const
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);
@ -486,8 +464,7 @@ CMSWindowsSecondaryScreen::onCloseDisplay()
} }
bool bool
CMSWindowsSecondaryScreen::onPreTranslate( CMSWindowsSecondaryScreen::onPreTranslate(MSG* msg)
MSG* msg)
{ {
// handle event // handle event
switch (msg->message) { switch (msg->message) {
@ -511,11 +488,8 @@ CMSWindowsSecondaryScreen::onPreTranslate(
} }
LRESULT LRESULT
CMSWindowsSecondaryScreen::onEvent( CMSWindowsSecondaryScreen::onEvent(HWND hwnd, UINT msg,
HWND hwnd, WPARAM wParam, LPARAM lParam)
UINT msg,
WPARAM wParam,
LPARAM lParam)
{ {
switch (msg) { switch (msg) {
case WM_QUERYENDSESSION: case WM_QUERYENDSESSION:
@ -582,9 +556,7 @@ CMSWindowsSecondaryScreen::onEvent(
} }
void void
CMSWindowsSecondaryScreen::onEnter( CMSWindowsSecondaryScreen::onEnter(SInt32 x, SInt32 y)
SInt32 x,
SInt32 y)
{ {
// warp to requested location // warp to requested location
SInt32 w, h; SInt32 w, h;
@ -655,8 +627,7 @@ CMSWindowsSecondaryScreen::closeDesktop()
} }
bool bool
CMSWindowsSecondaryScreen::switchDesktop( CMSWindowsSecondaryScreen::switchDesktop(HDESK desk)
HDESK desk)
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);
@ -1255,9 +1226,7 @@ static const UINT* g_mapTable[] =
}; };
DWORD DWORD
CMSWindowsSecondaryScreen::mapButton( CMSWindowsSecondaryScreen::mapButton(ButtonID button, bool press) const
ButtonID button,
bool press) const
{ {
// map button id to button flag // map button id to button flag
switch (button) { switch (button) {
@ -1276,12 +1245,8 @@ CMSWindowsSecondaryScreen::mapButton(
} }
KeyModifierMask KeyModifierMask
CMSWindowsSecondaryScreen::mapKey( CMSWindowsSecondaryScreen::mapKey(Keystrokes& keys, UINT& virtualKey,
Keystrokes& keys, KeyID id, KeyModifierMask mask, EKeyAction action) const
UINT& virtualKey,
KeyID id,
KeyModifierMask mask,
EKeyAction action) const
{ {
// lookup the key table // lookup the key table
const UInt32 mapID = ((id >> 8) & 0xff); const UInt32 mapID = ((id >> 8) & 0xff);
@ -1597,9 +1562,7 @@ CMSWindowsSecondaryScreen::mapKey(
} }
void void
CMSWindowsSecondaryScreen::doKeystrokes( CMSWindowsSecondaryScreen::doKeystrokes(const Keystrokes& keys, SInt32 count)
const Keystrokes& keys,
SInt32 count)
{ {
// do nothing if no keys or no repeats // do nothing if no keys or no repeats
if (count < 1 || keys.empty()) { if (count < 1 || keys.empty()) {
@ -1687,9 +1650,7 @@ CMSWindowsSecondaryScreen::updateModifiers()
} }
void void
CMSWindowsSecondaryScreen::toggleKey( CMSWindowsSecondaryScreen::toggleKey(UINT virtualKey, KeyModifierMask mask)
UINT virtualKey,
KeyModifierMask mask)
{ {
// send key events to simulate a press and release // send key events to simulate a press and release
sendKeyEvent(virtualKey, true); sendKeyEvent(virtualKey, true);
@ -1701,8 +1662,7 @@ CMSWindowsSecondaryScreen::toggleKey(
} }
UINT UINT
CMSWindowsSecondaryScreen::virtualKeyToScanCode( CMSWindowsSecondaryScreen::virtualKeyToScanCode(UINT& virtualKey)
UINT& virtualKey)
{ {
// try mapping given virtual key // try mapping given virtual key
UINT code = MapVirtualKey(virtualKey & 0xff, 0); UINT code = MapVirtualKey(virtualKey & 0xff, 0);
@ -1754,8 +1714,7 @@ CMSWindowsSecondaryScreen::virtualKeyToScanCode(
} }
bool bool
CMSWindowsSecondaryScreen::isExtendedKey( CMSWindowsSecondaryScreen::isExtendedKey(UINT virtualKey)
UINT virtualKey)
{ {
// see if we've already encoded the extended flag // see if we've already encoded the extended flag
if ((virtualKey & 0x100) != 0) { if ((virtualKey & 0x100) != 0) {
@ -1778,9 +1737,7 @@ CMSWindowsSecondaryScreen::isExtendedKey(
} }
void void
CMSWindowsSecondaryScreen::sendKeyEvent( CMSWindowsSecondaryScreen::sendKeyEvent(UINT virtualKey, bool press)
UINT virtualKey,
bool press)
{ {
DWORD flags = 0; DWORD flags = 0;
if (isExtendedKey(virtualKey)) { if (isExtendedKey(virtualKey)) {

View File

@ -72,8 +72,7 @@ CXWindowsSecondaryScreen::stop()
} }
void void
CXWindowsSecondaryScreen::open( CXWindowsSecondaryScreen::open(CClient* client)
CClient* client)
{ {
assert(m_client == NULL); assert(m_client == NULL);
assert(client != NULL); assert(client != NULL);
@ -126,10 +125,7 @@ CXWindowsSecondaryScreen::close()
} }
void void
CXWindowsSecondaryScreen::enter( CXWindowsSecondaryScreen::enter(SInt32 x, SInt32 y, KeyModifierMask mask)
SInt32 x,
SInt32 y,
KeyModifierMask mask)
{ {
assert(m_window != None); assert(m_window != None);
@ -168,9 +164,7 @@ CXWindowsSecondaryScreen::leave()
} }
void void
CXWindowsSecondaryScreen::keyDown( CXWindowsSecondaryScreen::keyDown(KeyID key, KeyModifierMask mask)
KeyID key,
KeyModifierMask mask)
{ {
Keystrokes keys; Keystrokes keys;
KeyCode keycode; KeyCode keycode;
@ -190,10 +184,8 @@ CXWindowsSecondaryScreen::keyDown(
} }
void void
CXWindowsSecondaryScreen::keyRepeat( CXWindowsSecondaryScreen::keyRepeat(KeyID key,
KeyID key, KeyModifierMask mask, SInt32 count)
KeyModifierMask mask,
SInt32 count)
{ {
Keystrokes keys; Keystrokes keys;
KeyCode keycode; KeyCode keycode;
@ -210,9 +202,7 @@ CXWindowsSecondaryScreen::keyRepeat(
} }
void void
CXWindowsSecondaryScreen::keyUp( CXWindowsSecondaryScreen::keyUp(KeyID key, KeyModifierMask mask)
KeyID key,
KeyModifierMask mask)
{ {
Keystrokes keys; Keystrokes keys;
KeyCode keycode; KeyCode keycode;
@ -232,8 +222,7 @@ CXWindowsSecondaryScreen::keyUp(
} }
void void
CXWindowsSecondaryScreen::mouseDown( CXWindowsSecondaryScreen::mouseDown(ButtonID button)
ButtonID button)
{ {
CDisplayLock display(this); CDisplayLock display(this);
XTestFakeButtonEvent(display, mapButton(button), True, CurrentTime); XTestFakeButtonEvent(display, mapButton(button), True, CurrentTime);
@ -241,8 +230,7 @@ CXWindowsSecondaryScreen::mouseDown(
} }
void void
CXWindowsSecondaryScreen::mouseUp( CXWindowsSecondaryScreen::mouseUp(ButtonID button)
ButtonID button)
{ {
CDisplayLock display(this); CDisplayLock display(this);
XTestFakeButtonEvent(display, mapButton(button), False, CurrentTime); XTestFakeButtonEvent(display, mapButton(button), False, CurrentTime);
@ -250,9 +238,7 @@ CXWindowsSecondaryScreen::mouseUp(
} }
void void
CXWindowsSecondaryScreen::mouseMove( CXWindowsSecondaryScreen::mouseMove(SInt32 x, SInt32 y)
SInt32 x,
SInt32 y)
{ {
CDisplayLock display(this); CDisplayLock display(this);
XTestFakeMotionEvent(display, getScreen(), x, y, CurrentTime); XTestFakeMotionEvent(display, getScreen(), x, y, CurrentTime);
@ -260,8 +246,7 @@ CXWindowsSecondaryScreen::mouseMove(
} }
void void
CXWindowsSecondaryScreen::mouseWheel( CXWindowsSecondaryScreen::mouseWheel(SInt32 delta)
SInt32 delta)
{ {
// choose button depending on rotation direction // choose button depending on rotation direction
const unsigned int button = (delta >= 0) ? 4 : 5; const unsigned int button = (delta >= 0) ? 4 : 5;
@ -281,24 +266,20 @@ CXWindowsSecondaryScreen::mouseWheel(
} }
void void
CXWindowsSecondaryScreen::setClipboard( CXWindowsSecondaryScreen::setClipboard(ClipboardID id,
ClipboardID id,
const IClipboard* clipboard) const IClipboard* clipboard)
{ {
setDisplayClipboard(id, clipboard); setDisplayClipboard(id, clipboard);
} }
void void
CXWindowsSecondaryScreen::grabClipboard( CXWindowsSecondaryScreen::grabClipboard(ClipboardID id)
ClipboardID id)
{ {
setDisplayClipboard(id, NULL); setDisplayClipboard(id, NULL);
} }
void void
CXWindowsSecondaryScreen::getMousePos( CXWindowsSecondaryScreen::getMousePos(SInt32* x, SInt32* y) const
SInt32* x,
SInt32* y) const
{ {
CDisplayLock display(this); CDisplayLock display(this);
int xTmp, yTmp, dummy; int xTmp, yTmp, dummy;
@ -311,9 +292,7 @@ CXWindowsSecondaryScreen::getMousePos(
} }
void void
CXWindowsSecondaryScreen::getSize( CXWindowsSecondaryScreen::getSize(SInt32* width, SInt32* height) const
SInt32* width,
SInt32* height) const
{ {
getScreenSize(width, height); getScreenSize(width, height);
} }
@ -325,16 +304,14 @@ CXWindowsSecondaryScreen::getJumpZoneSize() const
} }
void void
CXWindowsSecondaryScreen::getClipboard( CXWindowsSecondaryScreen::getClipboard(ClipboardID id,
ClipboardID id,
IClipboard* clipboard) const IClipboard* clipboard) const
{ {
getDisplayClipboard(id, clipboard); getDisplayClipboard(id, clipboard);
} }
void void
CXWindowsSecondaryScreen::onOpenDisplay( CXWindowsSecondaryScreen::onOpenDisplay(Display* display)
Display* display)
{ {
assert(m_window == None); assert(m_window == None);
@ -362,16 +339,14 @@ CXWindowsSecondaryScreen::onOpenDisplay(
} }
CXWindowsClipboard* CXWindowsClipboard*
CXWindowsSecondaryScreen::createClipboard( CXWindowsSecondaryScreen::createClipboard(ClipboardID id)
ClipboardID id)
{ {
CDisplayLock display(this); CDisplayLock display(this);
return new CXWindowsClipboard(display, m_window, id); return new CXWindowsClipboard(display, m_window, id);
} }
void void
CXWindowsSecondaryScreen::onCloseDisplay( CXWindowsSecondaryScreen::onCloseDisplay(Display* display)
Display* display)
{ {
assert(m_window != None); assert(m_window != None);
@ -386,16 +361,14 @@ CXWindowsSecondaryScreen::onCloseDisplay(
} }
void void
CXWindowsSecondaryScreen::onLostClipboard( CXWindowsSecondaryScreen::onLostClipboard(ClipboardID id)
ClipboardID id)
{ {
// tell client that the clipboard was grabbed locally // tell client that the clipboard was grabbed locally
m_client->onClipboardChanged(id); m_client->onClipboardChanged(id);
} }
void void
CXWindowsSecondaryScreen::leaveNoLock( CXWindowsSecondaryScreen::leaveNoLock(Display* display)
Display* display)
{ {
assert(display != NULL); assert(display != NULL);
assert(m_window != None); assert(m_window != None);
@ -417,20 +390,15 @@ CXWindowsSecondaryScreen::leaveNoLock(
} }
unsigned int unsigned int
CXWindowsSecondaryScreen::mapButton( CXWindowsSecondaryScreen::mapButton(ButtonID id) const
ButtonID id) const
{ {
// FIXME -- should use button mapping? // FIXME -- should use button mapping?
return static_cast<unsigned int>(id); return static_cast<unsigned int>(id);
} }
KeyModifierMask KeyModifierMask
CXWindowsSecondaryScreen::mapKey( CXWindowsSecondaryScreen::mapKey(Keystrokes& keys, KeyCode& keycode,
Keystrokes& keys, KeyID id, KeyModifierMask mask, EKeyAction action) const
KeyCode& keycode,
KeyID id,
KeyModifierMask mask,
EKeyAction action) const
{ {
// note -- must have display locked on entry // note -- must have display locked on entry
@ -654,11 +622,8 @@ CXWindowsSecondaryScreen::mapKey(
} }
bool bool
CXWindowsSecondaryScreen::findKeyCode( CXWindowsSecondaryScreen::findKeyCode(KeyCode& keycode,
KeyCode& keycode, unsigned int& maskOut, KeyID id, unsigned int maskIn) const
unsigned int& maskOut,
KeyID id,
unsigned int maskIn) const
{ {
// if XK_Tab is requested with shift active then try XK_ISO_Left_Tab // if XK_Tab is requested with shift active then try XK_ISO_Left_Tab
// instead. if that doesn't work, we'll fall back to XK_Tab with // instead. if that doesn't work, we'll fall back to XK_Tab with
@ -787,9 +752,7 @@ CXWindowsSecondaryScreen::findKeyCode(
} }
void void
CXWindowsSecondaryScreen::doKeystrokes( CXWindowsSecondaryScreen::doKeystrokes(const Keystrokes& keys, SInt32 count)
const Keystrokes& keys,
SInt32 count)
{ {
// do nothing if no keys or no repeats // do nothing if no keys or no repeats
if (count < 1 || keys.empty()) { if (count < 1 || keys.empty()) {
@ -830,8 +793,7 @@ CXWindowsSecondaryScreen::doKeystrokes(
} }
unsigned int unsigned int
CXWindowsSecondaryScreen::maskToX( CXWindowsSecondaryScreen::maskToX(KeyModifierMask inMask) const
KeyModifierMask inMask) const
{ {
// FIXME -- should be configurable. also not using Mod3Mask. // FIXME -- should be configurable. also not using Mod3Mask.
unsigned int outMask = 0; unsigned int outMask = 0;
@ -860,8 +822,7 @@ CXWindowsSecondaryScreen::maskToX(
} }
void void
CXWindowsSecondaryScreen::updateKeys( CXWindowsSecondaryScreen::updateKeys(Display* display)
Display* display)
{ {
// ask server which keys are pressed // ask server which keys are pressed
char keys[32]; char keys[32];
@ -881,8 +842,7 @@ CXWindowsSecondaryScreen::updateKeys(
} }
void void
CXWindowsSecondaryScreen::updateModifiers( CXWindowsSecondaryScreen::updateModifiers(Display* display)
Display* display)
{ {
// query the pointer to get the keyboard state // query the pointer to get the keyboard state
Window root, window; Window root, window;
@ -911,8 +871,7 @@ CXWindowsSecondaryScreen::updateModifiers(
} }
void void
CXWindowsSecondaryScreen::updateKeycodeMap( CXWindowsSecondaryScreen::updateKeycodeMap(Display* display)
Display* display)
{ {
// get the number of keycodes // get the number of keycodes
int minKeycode, maxKeycode; int minKeycode, maxKeycode;
@ -966,8 +925,7 @@ CXWindowsSecondaryScreen::updateKeycodeMap(
} }
void void
CXWindowsSecondaryScreen::updateModifierMap( CXWindowsSecondaryScreen::updateModifierMap(Display* display)
Display* display)
{ {
// get modifier map from server // get modifier map from server
XModifierKeymap* keymap = XGetModifierMapping(display); XModifierKeymap* keymap = XGetModifierMapping(display);
@ -1022,10 +980,8 @@ CXWindowsSecondaryScreen::updateModifierMap(
} }
void void
CXWindowsSecondaryScreen::toggleKey( CXWindowsSecondaryScreen::toggleKey(Display* display,
Display* display, KeySym keysym, unsigned int mask)
KeySym keysym,
unsigned int mask)
{ {
// lookup the keycode // lookup the keycode
KeyCodeMap::const_iterator index = m_keycodeMap.find(keysym); KeyCodeMap::const_iterator index = m_keycodeMap.find(keysym);
@ -1051,8 +1007,7 @@ CXWindowsSecondaryScreen::toggleKey(
} }
bool bool
CXWindowsSecondaryScreen::isToggleKeysym( CXWindowsSecondaryScreen::isToggleKeysym(KeySym key)
KeySym key)
{ {
switch (key) { switch (key) {
case XK_Caps_Lock: case XK_Caps_Lock:

View File

@ -44,8 +44,7 @@ static CMutex* s_logMutex = NULL;
static static
void void
logLock( logLock(bool lock)
bool lock)
{ {
assert(s_logMutex != NULL); assert(s_logMutex != NULL);
@ -66,8 +65,7 @@ static CClient* s_client = NULL;
static static
int int
realMain( realMain(CMutex* mutex)
CMutex* mutex)
{ {
try { try {
// initialize threading library // initialize threading library
@ -242,11 +240,8 @@ PLATFORM_DESC
static static
bool bool
isArg(int argi, isArg(int argi, int argc, const char** argv,
int argc, const char* name1, const char* name2,
const char** argv,
const char* name1,
const char* name2,
int minRequiredParameters = 0) int minRequiredParameters = 0)
{ {
if ((name1 != NULL && strcmp(argv[argi], name1) == 0) || if ((name1 != NULL && strcmp(argv[argi], name1) == 0) ||
@ -266,9 +261,7 @@ isArg(int argi,
static static
void void
parse( parse(int argc, const char** argv)
int argc,
const char** argv)
{ {
assert(pname != NULL); assert(pname != NULL);
assert(argv != NULL); assert(argv != NULL);
@ -443,9 +436,7 @@ parse(
static static
bool bool
logMessageBox( logMessageBox(int priority, const char* msg)
int priority,
const char* msg)
{ {
if (priority <= CLog::kFATAL) { if (priority <= CLog::kFATAL) {
MessageBox(NULL, msg, pname, MB_OK | MB_ICONWARNING); MessageBox(NULL, msg, pname, MB_OK | MB_ICONWARNING);
@ -472,10 +463,7 @@ daemonStop(void)
static static
int int
daemonStartup( daemonStartup(IPlatform* iplatform, int argc, const char** argv)
IPlatform* iplatform,
int argc,
const char** argv)
{ {
// get platform pointer // get platform pointer
CWin32Platform* platform = static_cast<CWin32Platform*>(iplatform); CWin32Platform* platform = static_cast<CWin32Platform*>(iplatform);
@ -498,9 +486,7 @@ daemonStartup(
static static
bool bool
logDiscard( logDiscard(int, const char*)
int,
const char*)
{ {
return true; return true;
} }
@ -520,11 +506,7 @@ checkParse(int e)
} }
int WINAPI int WINAPI
WinMain( WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
HINSTANCE instance,
HINSTANCE,
LPSTR,
int)
{ {
CPlatform platform; CPlatform platform;
@ -656,18 +638,13 @@ WinMain(
static static
int int
daemonStartup( daemonStartup(IPlatform*, int, const char**)
IPlatform*,
int,
const char**)
{ {
return restartableMain(); return restartableMain();
} }
int int
main( main(int argc, char** argv)
int argc,
char** argv)
{ {
CPlatform platform; CPlatform platform;

View File

@ -23,9 +23,7 @@ CHTTPRequest::~CHTTPRequest()
} }
void void
CHTTPRequest::insertHeader( CHTTPRequest::insertHeader(const CString& name, const CString& value)
const CString& name,
const CString& value)
{ {
CHeaderMap::iterator index = m_headerByName.find(name); CHeaderMap::iterator index = m_headerByName.find(name);
if (index != m_headerByName.end()) { if (index != m_headerByName.end()) {
@ -39,9 +37,7 @@ CHTTPRequest::insertHeader(
} }
void void
CHTTPRequest::appendHeader( CHTTPRequest::appendHeader(const CString& name, const CString& value)
const CString& name,
const CString& value)
{ {
CHeaderMap::iterator index = m_headerByName.find(name); CHeaderMap::iterator index = m_headerByName.find(name);
if (index != m_headerByName.end()) { if (index != m_headerByName.end()) {
@ -56,8 +52,7 @@ CHTTPRequest::appendHeader(
} }
void void
CHTTPRequest::eraseHeader( CHTTPRequest::eraseHeader(const CString& name)
const CString& name)
{ {
CHeaderMap::iterator index = m_headerByName.find(name); CHeaderMap::iterator index = m_headerByName.find(name);
if (index != m_headerByName.end()) { if (index != m_headerByName.end()) {
@ -66,15 +61,13 @@ CHTTPRequest::eraseHeader(
} }
bool bool
CHTTPRequest::isHeader( CHTTPRequest::isHeader(const CString& name) const
const CString& name) const
{ {
return (m_headerByName.find(name) != m_headerByName.end()); return (m_headerByName.find(name) != m_headerByName.end());
} }
CString CString
CHTTPRequest::getHeader( CHTTPRequest::getHeader(const CString& name) const
const CString& name) const
{ {
CHeaderMap::const_iterator index = m_headerByName.find(name); CHeaderMap::const_iterator index = m_headerByName.find(name);
if (index != m_headerByName.end()) { if (index != m_headerByName.end()) {
@ -91,9 +84,7 @@ CHTTPRequest::getHeader(
// //
CHTTPRequest* CHTTPRequest*
CHTTPProtocol::readRequest( CHTTPProtocol::readRequest(IInputStream* stream, UInt32 maxSize)
IInputStream* stream,
UInt32 maxSize)
{ {
CString scratch; CString scratch;
@ -241,9 +232,7 @@ CHTTPProtocol::readRequest(
} }
void void
CHTTPProtocol::reply( CHTTPProtocol::reply(IOutputStream* stream, CHTTPReply& reply)
IOutputStream* stream,
CHTTPReply& reply)
{ {
// suppress body for certain replies // suppress body for certain replies
bool hasBody = true; bool hasBody = true;
@ -321,9 +310,7 @@ CHTTPProtocol::reply(
} }
bool bool
CHTTPProtocol::parseFormData( CHTTPProtocol::parseFormData(const CHTTPRequest& request, CFormParts& parts)
const CHTTPRequest& request,
CFormParts& parts)
{ {
static const char formData[] = "multipart/form-data"; static const char formData[] = "multipart/form-data";
static const char boundary[] = "boundary="; static const char boundary[] = "boundary=";
@ -458,9 +445,7 @@ CHTTPProtocol::parseFormData(
} }
CString CString
CHTTPProtocol::readLine( CHTTPProtocol::readLine(IInputStream* stream, CString& tmpBuffer)
IInputStream* stream,
CString& tmpBuffer)
{ {
// read up to and including a CRLF from stream, using whatever // read up to and including a CRLF from stream, using whatever
// is in tmpBuffer as if it were at the head of the stream. // is in tmpBuffer as if it were at the head of the stream.
@ -493,10 +478,8 @@ CHTTPProtocol::readLine(
} }
CString CString
CHTTPProtocol::readBlock( CHTTPProtocol::readBlock(IInputStream* stream,
IInputStream* stream, UInt32 numBytes, CString& tmpBuffer)
UInt32 numBytes,
CString& tmpBuffer)
{ {
CString data; CString data;
@ -543,10 +526,8 @@ CHTTPProtocol::readBlock(
} }
CString CString
CHTTPProtocol::readChunk( CHTTPProtocol::readChunk(IInputStream* stream,
IInputStream* stream, CString& tmpBuffer, UInt32* maxSize)
CString& tmpBuffer,
UInt32* maxSize)
{ {
CString line; CString line;
@ -594,12 +575,9 @@ CHTTPProtocol::readChunk(
} }
void void
CHTTPProtocol::readHeaders( CHTTPProtocol::readHeaders(IInputStream* stream,
IInputStream* stream, CHTTPRequest* request, bool isFooter,
CHTTPRequest* request, CString& tmpBuffer, UInt32* maxSize)
bool isFooter,
CString& tmpBuffer,
UInt32* maxSize)
{ {
// parse headers. done with headers when we get a blank line. // parse headers. done with headers when we get a blank line.
CString name; CString name;
@ -652,8 +630,7 @@ CHTTPProtocol::readHeaders(
} }
bool bool
CHTTPProtocol::isValidToken( CHTTPProtocol::isValidToken(const CString& token)
const CString& token)
{ {
return (token.find("()<>@,;:\\\"/[]?={} " return (token.find("()<>@,;:\\\"/[]?={} "
"\0\1\2\3\4\5\6\7" "\0\1\2\3\4\5\6\7"

View File

@ -6,8 +6,7 @@
// XHTTP // XHTTP
// //
XHTTP::XHTTP( XHTTP::XHTTP(SInt32 statusCode) :
SInt32 statusCode) :
XBase(), XBase(),
m_status(statusCode), m_status(statusCode),
m_reason(getReason(statusCode)) m_reason(getReason(statusCode))
@ -15,9 +14,7 @@ XHTTP::XHTTP(
// do nothing // do nothing
} }
XHTTP::XHTTP( XHTTP::XHTTP(SInt32 statusCode, const CString& reasonPhrase) :
SInt32 statusCode,
const CString& reasonPhrase) :
XBase(), XBase(),
m_status(statusCode), m_status(statusCode),
m_reason(reasonPhrase) m_reason(reasonPhrase)
@ -43,8 +40,7 @@ XHTTP::getReason() const
} }
void void
XHTTP::addHeaders( XHTTP::addHeaders(CHTTPReply&) const
CHTTPReply&) const
{ {
// do nothing // do nothing
} }
@ -69,8 +65,7 @@ XHTTP::getWhat() const throw()
} }
const char* const char*
XHTTP::getReason( XHTTP::getReason(SInt32 status)
SInt32 status)
{ {
switch (status) { switch (status) {
case 300: return "Multiple Choices"; case 300: return "Multiple Choices";
@ -110,8 +105,7 @@ XHTTP::getReason(
// XHTTPAllow // XHTTPAllow
// //
XHTTPAllow::XHTTPAllow( XHTTPAllow::XHTTPAllow(const CString& allowed) :
const CString& allowed) :
XHTTP(405), XHTTP(405),
m_allowed(allowed) m_allowed(allowed)
{ {
@ -124,8 +118,7 @@ XHTTPAllow::~XHTTPAllow()
} }
void void
XHTTPAllow::addHeaders( XHTTPAllow::addHeaders(CHTTPReply& reply) const
CHTTPReply& reply) const
{ {
reply.m_headers.push_back(std::make_pair(CString("Allow"), m_allowed)); reply.m_headers.push_back(std::make_pair(CString("Allow"), m_allowed));
} }

View File

@ -10,9 +10,7 @@
// CBufferedInputStream // CBufferedInputStream
// //
CBufferedInputStream::CBufferedInputStream( CBufferedInputStream::CBufferedInputStream(CMutex* mutex, IJob* closeCB) :
CMutex* mutex,
IJob* closeCB) :
m_mutex(mutex), m_mutex(mutex),
m_empty(mutex, true), m_empty(mutex, true),
m_closeCB(closeCB), m_closeCB(closeCB),
@ -28,9 +26,7 @@ CBufferedInputStream::~CBufferedInputStream()
} }
void void
CBufferedInputStream::write( CBufferedInputStream::write(const void* data, UInt32 n)
const void* data,
UInt32 n)
{ {
if (!m_hungup && n > 0) { if (!m_hungup && n > 0) {
m_buffer.write(data, n); m_buffer.write(data, n);
@ -47,9 +43,7 @@ CBufferedInputStream::hangup()
} }
UInt32 UInt32
CBufferedInputStream::readNoLock( CBufferedInputStream::readNoLock(void* dst, UInt32 n)
void* dst,
UInt32 n)
{ {
if (m_closed) { if (m_closed) {
throw XIOClosed(); throw XIOClosed();
@ -104,9 +98,7 @@ CBufferedInputStream::close()
} }
UInt32 UInt32
CBufferedInputStream::read( CBufferedInputStream::read(void* dst, UInt32 n)
void* dst,
UInt32 n)
{ {
CLock lock(m_mutex); CLock lock(m_mutex);
return readNoLock(dst, n); return readNoLock(dst, n);

View File

@ -9,9 +9,7 @@
// CBufferedOutputStream // CBufferedOutputStream
// //
CBufferedOutputStream::CBufferedOutputStream( CBufferedOutputStream::CBufferedOutputStream(CMutex* mutex, IJob* closeCB) :
CMutex* mutex,
IJob* closeCB) :
m_mutex(mutex), m_mutex(mutex),
m_closeCB(closeCB), m_closeCB(closeCB),
m_empty(mutex, true), m_empty(mutex, true),
@ -26,15 +24,13 @@ CBufferedOutputStream::~CBufferedOutputStream()
} }
const void* const void*
CBufferedOutputStream::peek( CBufferedOutputStream::peek(UInt32 n)
UInt32 n)
{ {
return m_buffer.peek(n); return m_buffer.peek(n);
} }
void void
CBufferedOutputStream::pop( CBufferedOutputStream::pop(UInt32 n)
UInt32 n)
{ {
m_buffer.pop(n); m_buffer.pop(n);
if (m_buffer.getSize() == 0) { if (m_buffer.getSize() == 0) {
@ -64,9 +60,7 @@ CBufferedOutputStream::close()
} }
UInt32 UInt32
CBufferedOutputStream::write( CBufferedOutputStream::write(const void* data, UInt32 n)
const void* data,
UInt32 n)
{ {
CLock lock(m_mutex); CLock lock(m_mutex);
if (m_closed) { if (m_closed) {

View File

@ -4,9 +4,7 @@
// CInputStreamFilter // CInputStreamFilter
// //
CInputStreamFilter::CInputStreamFilter( CInputStreamFilter::CInputStreamFilter(IInputStream* stream, bool adopted) :
IInputStream* stream,
bool adopted) :
m_stream(stream), m_stream(stream),
m_adopted(adopted) m_adopted(adopted)
{ {

View File

@ -4,9 +4,7 @@
// COutputStreamFilter // COutputStreamFilter
// //
COutputStreamFilter::COutputStreamFilter( COutputStreamFilter::COutputStreamFilter(IOutputStream* stream, bool adopted) :
IOutputStream* stream,
bool adopted) :
m_stream(stream), m_stream(stream),
m_adopted(adopted) m_adopted(adopted)
{ {

View File

@ -19,8 +19,7 @@ CStreamBuffer::~CStreamBuffer()
} }
const void* const void*
CStreamBuffer::peek( CStreamBuffer::peek(UInt32 n)
UInt32 n)
{ {
assert(n <= m_size); assert(n <= m_size);
@ -40,8 +39,7 @@ CStreamBuffer::peek(
} }
void void
CStreamBuffer::pop( CStreamBuffer::pop(UInt32 n)
UInt32 n)
{ {
// discard all chunks if n is greater than or equal to m_size // discard all chunks if n is greater than or equal to m_size
if (n >= m_size) { if (n >= m_size) {
@ -71,9 +69,7 @@ CStreamBuffer::pop(
} }
void void
CStreamBuffer::write( CStreamBuffer::write(const void* vdata, UInt32 n)
const void* vdata,
UInt32 n)
{ {
assert(vdata != NULL); assert(vdata != NULL);

View File

@ -87,9 +87,7 @@ CCondVarBase::broadcast()
} }
bool bool
CCondVarBase::wait( CCondVarBase::wait(CStopwatch& timer, double timeout) const
CStopwatch& timer,
double timeout) const
{ {
// check timeout against timer // check timeout against timer
if (timeout >= 0.0) { if (timeout >= 0.0) {
@ -245,9 +243,7 @@ CCondVarBase::broadcast()
} }
bool bool
CCondVarBase::wait( CCondVarBase::wait(CStopwatch& timer, double timeout) const
CStopwatch& timer,
double timeout) const
{ {
// check timeout against timer // check timeout against timer
if (timeout >= 0.0) { if (timeout >= 0.0) {

View File

@ -21,8 +21,7 @@ CMutex::~CMutex()
} }
CMutex& CMutex&
CMutex::operator=( CMutex::operator=(const CMutex&)
const CMutex&)
{ {
return *this; return *this;
} }

View File

@ -32,8 +32,7 @@ CThread::~CThread()
} }
CThread& CThread&
CThread::operator=( CThread::operator=(const CThread& thread)
const CThread& thread)
{ {
if (thread.m_rep != m_rep) { if (thread.m_rep != m_rep) {
m_rep->unref(); m_rep->unref();
@ -50,8 +49,7 @@ CThread::init()
} }
void void
CThread::sleep( CThread::sleep(double timeout)
double timeout)
{ {
CThreadPtr currentRep(CThreadRep::getCurrentThreadRep()); CThreadPtr currentRep(CThreadRep::getCurrentThreadRep());
if (timeout >= 0.0) { if (timeout >= 0.0) {
@ -62,8 +60,7 @@ CThread::sleep(
} }
void void
CThread::exit( CThread::exit(void* result)
void* result)
{ {
CThreadPtr currentRep(CThreadRep::getCurrentThreadRep()); CThreadPtr currentRep(CThreadRep::getCurrentThreadRep());
log((CLOG_DEBUG1 "throw exit on thread %p", currentRep.operator->())); log((CLOG_DEBUG1 "throw exit on thread %p", currentRep.operator->()));
@ -71,8 +68,7 @@ CThread::exit(
} }
bool bool
CThread::enableCancel( CThread::enableCancel(bool enable)
bool enable)
{ {
CThreadPtr currentRep(CThreadRep::getCurrentThreadRep()); CThreadPtr currentRep(CThreadRep::getCurrentThreadRep());
return currentRep->enableCancel(enable); return currentRep->enableCancel(enable);
@ -85,8 +81,7 @@ CThread::cancel()
} }
void void
CThread::setPriority( CThread::setPriority(int n)
int n)
{ {
m_rep->setPriority(n); m_rep->setPriority(n);
} }
@ -98,8 +93,7 @@ CThread::getCurrentThread()
} }
bool bool
CThread::wait( CThread::wait(double timeout) const
double timeout) const
{ {
CThreadPtr currentRep(CThreadRep::getCurrentThreadRep()); CThreadPtr currentRep(CThreadRep::getCurrentThreadRep());
return currentRep->wait(m_rep, timeout); return currentRep->wait(m_rep, timeout);
@ -107,8 +101,7 @@ CThread::wait(
#if defined(CONFIG_PLATFORM_WIN32) #if defined(CONFIG_PLATFORM_WIN32)
bool bool
CThread::waitForEvent( CThread::waitForEvent(double timeout)
double timeout)
{ {
CThreadPtr currentRep(CThreadRep::getCurrentThreadRep()); CThreadPtr currentRep(CThreadRep::getCurrentThreadRep());
return currentRep->waitForEvent(timeout); return currentRep->waitForEvent(timeout);
@ -139,15 +132,13 @@ CThread::getUserData()
} }
bool bool
CThread::operator==( CThread::operator==(const CThread& thread) const
const CThread& thread) const
{ {
return (m_rep == thread.m_rep); return (m_rep == thread.m_rep);
} }
bool bool
CThread::operator!=( CThread::operator!=(const CThread& thread) const
const CThread& thread) const
{ {
return (m_rep != thread.m_rep); return (m_rep != thread.m_rep);
} }

View File

@ -402,9 +402,7 @@ CThreadRep::testCancel()
} }
bool bool
CThreadRep::wait( CThreadRep::wait(CThreadRep* target, double timeout)
CThreadRep* target,
double timeout)
{ {
if (target == this) { if (target == this) {
return false; return false;
@ -430,8 +428,7 @@ CThreadRep::wait(
} }
void void
CThreadRep::setPriority( CThreadRep::setPriority(int)
int)
{ {
// FIXME // FIXME
} }
@ -468,15 +465,13 @@ CThreadRep::threadFunc(void* arg)
} }
void void
CThreadRep::threadCancel( CThreadRep::threadCancel(int)
int)
{ {
// do nothing // do nothing
} }
void* void*
CThreadRep::threadSignalHandler( CThreadRep::threadSignalHandler(void* vrep)
void* vrep)
{ {
CThreadRep* mainThreadRep = reinterpret_cast<CThreadRep*>(vrep); CThreadRep* mainThreadRep = reinterpret_cast<CThreadRep*>(vrep);
@ -567,9 +562,7 @@ CThreadRep::testCancel()
} }
bool bool
CThreadRep::wait( CThreadRep::wait(CThreadRep* target, double timeout)
CThreadRep* target,
double timeout)
{ {
// get the current thread. if it's the same as the target thread // get the current thread. if it's the same as the target thread
// then the thread is waiting on itself. // then the thread is waiting on itself.
@ -620,8 +613,7 @@ CThreadRep::wait(
} }
bool bool
CThreadRep::waitForEvent( CThreadRep::waitForEvent(double timeout)
double timeout)
{ {
// is cancellation enabled? // is cancellation enabled?
const DWORD n = (isCancellable() ? 1 : 0); const DWORD n = (isCancellable() ? 1 : 0);
@ -658,8 +650,7 @@ CThreadRep::waitForEvent(
} }
void void
CThreadRep::setPriority( CThreadRep::setPriority(int n)
int n)
{ {
DWORD pClass = NORMAL_PRIORITY_CLASS; DWORD pClass = NORMAL_PRIORITY_CLASS;
if (n < 0) { if (n < 0) {
@ -705,8 +696,7 @@ CThreadRep::getCancelEvent() const
} }
unsigned int __stdcall unsigned int __stdcall
CThreadRep::threadFunc( CThreadRep::threadFunc(void* arg)
void* arg)
{ {
CThreadRep* rep = (CThreadRep*)arg; CThreadRep* rep = (CThreadRep*)arg;

View File

@ -33,8 +33,7 @@ CTimerThread::~CTimerThread()
} }
void void
CTimerThread::timer( CTimerThread::timer(void*)
void*)
{ {
log((CLOG_DEBUG1 "timeout in %f seconds", m_timeout)); log((CLOG_DEBUG1 "timeout in %f seconds", m_timeout));
CThread::sleep(m_timeout); CThread::sleep(m_timeout);

View File

@ -52,9 +52,7 @@ static HMODULE s_networkModule = NULL;
static static
FARPROC FARPROC
netGetProcAddress( netGetProcAddress(HMODULE module, LPCSTR name)
HMODULE module,
LPCSTR name)
{ {
FARPROC func = ::GetProcAddress(module, name); FARPROC func = ::GetProcAddress(module, name);
if (!func) { if (!func) {
@ -116,8 +114,7 @@ CNetwork::cleanup()
} }
UInt32 UInt32
CNetwork::swaphtonl( CNetwork::swaphtonl(UInt32 v)
UInt32 v)
{ {
static const union { UInt16 s; UInt8 b[2]; } s_endian = { 0x1234 }; static const union { UInt16 s; UInt8 b[2]; } s_endian = { 0x1234 };
if (s_endian.b[0] == 0x34) { if (s_endian.b[0] == 0x34) {
@ -132,8 +129,7 @@ CNetwork::swaphtonl(
} }
UInt16 UInt16
CNetwork::swaphtons( CNetwork::swaphtons(UInt16 v)
UInt16 v)
{ {
static const union { UInt16 s; UInt8 b[2]; } s_endian = { 0x1234 }; static const union { UInt16 s; UInt8 b[2]; } s_endian = { 0x1234 };
if (s_endian.b[0] == 0x34) { if (s_endian.b[0] == 0x34) {
@ -146,15 +142,13 @@ CNetwork::swaphtons(
} }
UInt32 UInt32
CNetwork::swapntohl( CNetwork::swapntohl(UInt32 v)
UInt32 v)
{ {
return swaphtonl(v); return swaphtonl(v);
} }
UInt16 UInt16
CNetwork::swapntohs( CNetwork::swapntohs(UInt16 v)
UInt16 v)
{ {
return swaphtons(v); return swaphtons(v);
} }
@ -221,10 +215,7 @@ CNetwork::init2(
} }
int PASCAL FAR int PASCAL FAR
CNetwork::poll2( CNetwork::poll2(PollEntry fd[], int nfds, int timeout)
PollEntry fd[],
int nfds,
int timeout)
{ {
int i; int i;
@ -293,19 +284,13 @@ CNetwork::poll2(
} }
ssize_t PASCAL FAR ssize_t PASCAL FAR
CNetwork::read2( CNetwork::read2(Socket s, void FAR* buf, size_t len)
Socket s,
void FAR* buf,
size_t len)
{ {
return recv(s, buf, len, 0); return recv(s, buf, len, 0);
} }
ssize_t PASCAL FAR ssize_t PASCAL FAR
CNetwork::write2( CNetwork::write2(Socket s, const void FAR* buf, size_t len)
Socket s,
const void FAR* buf,
size_t len)
{ {
return send(s, buf, len, 0); return send(s, buf, len, 0);
} }
@ -323,29 +308,25 @@ CNetwork::write2(
#define setfunc(var, name, type) var = (type)::name #define setfunc(var, name, type) var = (type)::name
UInt32 UInt32
CNetwork::swaphtonl( CNetwork::swaphtonl(UInt32 v)
UInt32 v)
{ {
return htonl(v); return htonl(v);
} }
UInt16 UInt16
CNetwork::swaphtons( CNetwork::swaphtons(UInt16 v)
UInt16 v)
{ {
return htons(v); return htons(v);
} }
UInt32 UInt32
CNetwork::swapntohl( CNetwork::swapntohl(UInt32 v)
UInt32 v)
{ {
return ntohl(v); return ntohl(v);
} }
UInt16 UInt16
CNetwork::swapntohs( CNetwork::swapntohs(UInt16 v)
UInt16 v)
{ {
return ntohs(v); return ntohs(v);
} }
@ -366,9 +347,7 @@ myherrno()
static static
int int
mygethostname( mygethostname(char* name, int namelen)
char* name,
int namelen)
{ {
return gethostname(name, namelen); return gethostname(name, namelen);
} }

View File

@ -21,8 +21,7 @@ CNetworkAddress::CNetworkAddress() :
memset(inetAddress->sin_zero, 0, sizeof(inetAddress->sin_zero)); memset(inetAddress->sin_zero, 0, sizeof(inetAddress->sin_zero));
} }
CNetworkAddress::CNetworkAddress( CNetworkAddress::CNetworkAddress(UInt16 port) :
UInt16 port) :
m_port(port) m_port(port)
{ {
if (port == 0) { if (port == 0) {
@ -37,9 +36,7 @@ CNetworkAddress::CNetworkAddress(
memset(inetAddress->sin_zero, 0, sizeof(inetAddress->sin_zero)); memset(inetAddress->sin_zero, 0, sizeof(inetAddress->sin_zero));
} }
CNetworkAddress::CNetworkAddress( CNetworkAddress::CNetworkAddress(const CString& hostname_, UInt16 port) :
const CString& hostname_,
UInt16 port) :
m_hostname(hostname_), m_hostname(hostname_),
m_port(port) m_port(port)
{ {

View File

@ -28,8 +28,7 @@ CTCPListenSocket::~CTCPListenSocket()
} }
void void
CTCPListenSocket::bind( CTCPListenSocket::bind(const CNetworkAddress& addr)
const CNetworkAddress& addr)
{ {
if (CNetwork::bind(m_fd, addr.getAddress(), if (CNetwork::bind(m_fd, addr.getAddress(),
addr.getAddressLength()) == CNetwork::Error) { addr.getAddressLength()) == CNetwork::Error) {

View File

@ -55,8 +55,7 @@ CTCPSocket::~CTCPSocket()
} }
void void
CTCPSocket::bind( CTCPSocket::bind(const CNetworkAddress& addr)
const CNetworkAddress& addr)
{ {
if (CNetwork::bind(m_fd, addr.getAddress(), if (CNetwork::bind(m_fd, addr.getAddress(),
addr.getAddressLength()) == CNetwork::Error) { addr.getAddressLength()) == CNetwork::Error) {
@ -108,8 +107,7 @@ CTCPSocket::close()
} }
void void
CTCPSocket::connect( CTCPSocket::connect(const CNetworkAddress& addr)
const CNetworkAddress& addr)
{ {
CThread::testCancel(); CThread::testCancel();
if (CNetwork::connect(m_fd, addr.getAddress(), if (CNetwork::connect(m_fd, addr.getAddress(),

View File

@ -26,9 +26,7 @@ XNetworkFailed::getWhat() const throw()
// XNetworkVersion // XNetworkVersion
// //
XNetworkVersion::XNetworkVersion( XNetworkVersion::XNetworkVersion(int major, int minor) throw() :
int major,
int minor) throw() :
m_major(major), m_major(major),
m_minor(minor) m_minor(minor)
{ {

View File

@ -4,10 +4,8 @@
// XSocketAddress // XSocketAddress
// //
XSocketAddress::XSocketAddress( XSocketAddress::XSocketAddress(Error error,
Error error, const CString& hostname, UInt16 port) throw() :
const CString& hostname,
UInt16 port) throw() :
m_error(error), m_error(error),
m_hostname(hostname), m_hostname(hostname),
m_port(port) m_port(port)
@ -55,8 +53,7 @@ XSocketErrno::XSocketErrno() :
// do nothing // do nothing
} }
XSocketErrno::XSocketErrno( XSocketErrno::XSocketErrno(int err) :
int err) :
MXErrno(err) MXErrno(err)
{ {
// do nothing // do nothing

View File

@ -5,8 +5,7 @@
// CMSWindowsClipboard // CMSWindowsClipboard
// //
CMSWindowsClipboard::CMSWindowsClipboard( CMSWindowsClipboard::CMSWindowsClipboard(HWND window) :
HWND window) :
m_window(window), m_window(window),
m_time(0) m_time(0)
{ {
@ -32,9 +31,7 @@ CMSWindowsClipboard::empty()
} }
void void
CMSWindowsClipboard::add( CMSWindowsClipboard::add(EFormat format, const CString& data)
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));
@ -58,8 +55,7 @@ CMSWindowsClipboard::add(
} }
bool bool
CMSWindowsClipboard::open( CMSWindowsClipboard::open(Time time) const
Time time) const
{ {
log((CLOG_DEBUG "open clipboard")); log((CLOG_DEBUG "open clipboard"));
@ -87,16 +83,14 @@ CMSWindowsClipboard::getTime() const
} }
bool bool
CMSWindowsClipboard::has( CMSWindowsClipboard::has(EFormat format) const
EFormat format) const
{ {
const UINT win32Format = convertFormatToWin32(format); const UINT win32Format = convertFormatToWin32(format);
return (win32Format != 0 && IsClipboardFormatAvailable(win32Format) != 0); return (win32Format != 0 && IsClipboardFormatAvailable(win32Format) != 0);
} }
CString CString
CMSWindowsClipboard::get( CMSWindowsClipboard::get(EFormat format) const
EFormat format) const
{ {
// get the win32 format. return empty data if unknown format. // get the win32 format. return empty data if unknown format.
const UINT win32Format = convertFormatToWin32(format); const UINT win32Format = convertFormatToWin32(format);
@ -119,8 +113,7 @@ CMSWindowsClipboard::get(
} }
UINT UINT
CMSWindowsClipboard::convertFormatToWin32( CMSWindowsClipboard::convertFormatToWin32(EFormat format) const
EFormat format) const
{ {
switch (format) { switch (format) {
case kText: case kText:
@ -132,8 +125,7 @@ CMSWindowsClipboard::convertFormatToWin32(
} }
HANDLE HANDLE
CMSWindowsClipboard::convertTextToWin32( CMSWindowsClipboard::convertTextToWin32(const CString& data) const
const CString& data) const
{ {
// compute size of converted text // compute size of converted text
UInt32 dstSize = 1; UInt32 dstSize = 1;
@ -172,8 +164,7 @@ CMSWindowsClipboard::convertTextToWin32(
} }
CString CString
CMSWindowsClipboard::convertTextFromWin32( CMSWindowsClipboard::convertTextFromWin32(HANDLE handle) const
HANDLE handle) const
{ {
// get source data and it's size // get source data and it's size
const char* src = (const char*)GlobalLock(handle); const char* src = (const char*)GlobalLock(handle);

View File

@ -30,8 +30,7 @@ CMSWindowsScreen::~CMSWindowsScreen()
} }
void void
CMSWindowsScreen::init( CMSWindowsScreen::init(HINSTANCE instance)
HINSTANCE instance)
{ {
s_instance = instance; s_instance = instance;
} }
@ -151,9 +150,7 @@ CMSWindowsScreen::updateScreenSize()
} }
void void
CMSWindowsScreen::getScreenSize( CMSWindowsScreen::getScreenSize(SInt32* w, SInt32* h) const
SInt32* w,
SInt32* h) const
{ {
assert(m_class != 0); assert(m_class != 0);
assert(w != NULL && h != NULL); assert(w != NULL && h != NULL);
@ -172,8 +169,7 @@ CMSWindowsScreen::openInputDesktop() const
} }
CString CString
CMSWindowsScreen::getDesktopName( CMSWindowsScreen::getDesktopName(HDESK desk) const
HDESK desk) const
{ {
if (desk == NULL) { if (desk == NULL) {
return CString(); return CString();
@ -190,16 +186,14 @@ CMSWindowsScreen::getDesktopName(
} }
bool bool
CMSWindowsScreen::isCurrentDesktop( CMSWindowsScreen::isCurrentDesktop(HDESK desk) const
HDESK desk) const
{ {
return CStringUtil::CaselessCmp::equal(getDesktopName(desk), return CStringUtil::CaselessCmp::equal(getDesktopName(desk),
getCurrentDesktopName()); getCurrentDesktopName());
} }
void void
CMSWindowsScreen::getEvent( CMSWindowsScreen::getEvent(MSG* msg) const
MSG* msg) const
{ {
// wait for an event in a cancellable way // wait for an event in a cancellable way
CThread::waitForEvent(); CThread::waitForEvent();
@ -207,11 +201,7 @@ CMSWindowsScreen::getEvent(
} }
LRESULT CALLBACK LRESULT CALLBACK
CMSWindowsScreen::wndProc( CMSWindowsScreen::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam)
{ {
assert(s_screen != NULL); assert(s_screen != NULL);
return s_screen->onEvent(hwnd, msg, wParam, lParam); return s_screen->onEvent(hwnd, msg, wParam, lParam);

View File

@ -25,28 +25,21 @@ CUnixPlatform::~CUnixPlatform()
} }
bool bool
CUnixPlatform::installDaemon( CUnixPlatform::installDaemon(const char*, const char*, const char*, const char*)
const char*,
const char*,
const char*,
const char*)
{ {
// daemons don't require special installation // daemons don't require special installation
return true; return true;
} }
CUnixPlatform::EResult CUnixPlatform::EResult
CUnixPlatform::uninstallDaemon( CUnixPlatform::uninstallDaemon(const char*)
const char*)
{ {
// daemons don't require special installation // daemons don't require special installation
return kSuccess; return kSuccess;
} }
int int
CUnixPlatform::daemonize( CUnixPlatform::daemonize(const char* name, DaemonFunc func)
const char* name,
DaemonFunc func)
{ {
// fork so shell thinks we're done and so we're not a process // fork so shell thinks we're done and so we're not a process
// group leader // group leader
@ -92,17 +85,14 @@ CUnixPlatform::daemonize(
} }
void void
CUnixPlatform::installDaemonLogger( CUnixPlatform::installDaemonLogger(const char* name)
const char* name)
{ {
openlog(name, 0, LOG_DAEMON); openlog(name, 0, LOG_DAEMON);
CLog::setOutputter(&CUnixPlatform::deamonLogger); CLog::setOutputter(&CUnixPlatform::deamonLogger);
} }
int int
CUnixPlatform::restart( CUnixPlatform::restart(RestartFunc func, int minErrorCode)
RestartFunc func,
int minErrorCode)
{ {
for (;;) { for (;;) {
switch (fork()) { switch (fork()) {
@ -153,8 +143,7 @@ CUnixPlatform::restart(
} }
const char* const char*
CUnixPlatform::getBasename( CUnixPlatform::getBasename(const char* pathname) const
const char* pathname) const
{ {
if (pathname == NULL) { if (pathname == NULL) {
return NULL; return NULL;
@ -189,8 +178,7 @@ CUnixPlatform::getSystemDirectory() const
} }
CString CString
CUnixPlatform::addPathComponent( CUnixPlatform::addPathComponent(const CString& prefix,
const CString& prefix,
const CString& suffix) const const CString& suffix) const
{ {
CString path; CString path;
@ -204,9 +192,7 @@ CUnixPlatform::addPathComponent(
} }
bool bool
CUnixPlatform::deamonLogger( CUnixPlatform::deamonLogger(int priority, const char* msg)
int priority,
const char* msg)
{ {
// convert priority // convert priority
switch (priority) { switch (priority) {

View File

@ -37,19 +37,14 @@ CWin32Platform::isWindows95Family()
} }
void void
CWin32Platform::setStatus( CWin32Platform::setStatus(SERVICE_STATUS_HANDLE handle, DWORD state)
SERVICE_STATUS_HANDLE handle,
DWORD state)
{ {
setStatus(handle, state, 0, 0); setStatus(handle, state, 0, 0);
} }
void void
CWin32Platform::setStatus( CWin32Platform::setStatus(SERVICE_STATUS_HANDLE handle,
SERVICE_STATUS_HANDLE handle, DWORD state, DWORD step, DWORD waitHint)
DWORD state,
DWORD step,
DWORD waitHint)
{ {
SERVICE_STATUS status; SERVICE_STATUS status;
status.dwServiceType = SERVICE_WIN32_OWN_PROCESS | status.dwServiceType = SERVICE_WIN32_OWN_PROCESS |
@ -66,9 +61,7 @@ CWin32Platform::setStatus(
} }
void void
CWin32Platform::setStatusError( CWin32Platform::setStatusError(SERVICE_STATUS_HANDLE handle, DWORD error)
SERVICE_STATUS_HANDLE handle,
DWORD error)
{ {
SERVICE_STATUS status; SERVICE_STATUS status;
status.dwServiceType = SERVICE_WIN32_OWN_PROCESS | status.dwServiceType = SERVICE_WIN32_OWN_PROCESS |
@ -85,11 +78,8 @@ CWin32Platform::setStatusError(
} }
bool bool
CWin32Platform::installDaemon( CWin32Platform::installDaemon(const char* name, const char* description,
const char* name, const char* pathname, const char* commandLine)
const char* description,
const char* pathname,
const char* commandLine)
{ {
// windows 95 family services // windows 95 family services
if (isWindows95Family()) { if (isWindows95Family()) {
@ -181,8 +171,7 @@ CWin32Platform::installDaemon(
} }
IPlatform::EResult IPlatform::EResult
CWin32Platform::uninstallDaemon( CWin32Platform::uninstallDaemon(const char* name)
const char* name)
{ {
// windows 95 family services // windows 95 family services
if (isWindows95Family()) { if (isWindows95Family()) {
@ -255,9 +244,7 @@ CWin32Platform::uninstallDaemon(
} }
int int
CWin32Platform::daemonize( CWin32Platform::daemonize(const char* name, DaemonFunc func)
const char* name,
DaemonFunc func)
{ {
assert(name != NULL); assert(name != NULL);
assert(func != NULL); assert(func != NULL);
@ -319,8 +306,7 @@ CWin32Platform::daemonize(
} }
void void
CWin32Platform::installDaemonLogger( CWin32Platform::installDaemonLogger(const char* name)
const char* name)
{ {
if (!CWin32Platform::isWindows95Family()) { if (!CWin32Platform::isWindows95Family()) {
// open event log and direct log messages to it // open event log and direct log messages to it
@ -334,9 +320,7 @@ CWin32Platform::installDaemonLogger(
} }
int int
CWin32Platform::restart( CWin32Platform::restart(RestartFunc func, int /*minErrorCode*/)
RestartFunc func,
int /*minErrorCode*/)
{ {
// FIXME -- start in separate process or thread. note that this // FIXME -- start in separate process or thread. note that this
// isn't too critical as win32 doesn't force us to terminate for // isn't too critical as win32 doesn't force us to terminate for
@ -345,8 +329,7 @@ CWin32Platform::restart(
} }
const char* const char*
CWin32Platform::getBasename( CWin32Platform::getBasename(const char* pathname) const
const char* pathname) const
{ {
if (pathname == NULL) { if (pathname == NULL) {
return NULL; return NULL;
@ -429,8 +412,7 @@ CWin32Platform::getSystemDirectory() const
} }
CString CString
CWin32Platform::addPathComponent( CWin32Platform::addPathComponent(const CString& prefix,
const CString& prefix,
const CString& suffix) const const CString& suffix) const
{ {
CString path; CString path;
@ -446,9 +428,7 @@ CWin32Platform::addPathComponent(
} }
HKEY HKEY
CWin32Platform::openKey( CWin32Platform::openKey(HKEY key, const char* keyName)
HKEY key,
const char* keyName)
{ {
// open next key // open next key
HKEY newKey; HKEY newKey;
@ -471,9 +451,7 @@ CWin32Platform::openKey(
} }
HKEY HKEY
CWin32Platform::openKey( CWin32Platform::openKey(HKEY key, const char** keyNames)
HKEY key,
const char** keyNames)
{ {
for (UInt32 i = 0; key != NULL && keyNames[i] != NULL; ++i) { for (UInt32 i = 0; key != NULL && keyNames[i] != NULL; ++i) {
// open next key // open next key
@ -483,17 +461,14 @@ CWin32Platform::openKey(
} }
void void
CWin32Platform::closeKey( CWin32Platform::closeKey(HKEY key)
HKEY key)
{ {
assert(key != NULL); assert(key != NULL);
RegCloseKey(key); RegCloseKey(key);
} }
void void
CWin32Platform::deleteKey( CWin32Platform::deleteKey(HKEY key, const char* name)
HKEY key,
const char* name)
{ {
assert(key != NULL); assert(key != NULL);
assert(name != NULL); assert(name != NULL);
@ -501,9 +476,7 @@ CWin32Platform::deleteKey(
} }
void void
CWin32Platform::deleteValue( CWin32Platform::deleteValue(HKEY key, const char* name)
HKEY key,
const char* name)
{ {
assert(key != NULL); assert(key != NULL);
assert(name != NULL); assert(name != NULL);
@ -511,10 +484,7 @@ CWin32Platform::deleteValue(
} }
void void
CWin32Platform::setValue( CWin32Platform::setValue(HKEY key, const char* name, const CString& value)
HKEY key,
const char* name,
const CString& value)
{ {
assert(key != NULL); assert(key != NULL);
assert(name != NULL); assert(name != NULL);
@ -524,9 +494,7 @@ CWin32Platform::setValue(
} }
CString CString
CWin32Platform::readValueString( CWin32Platform::readValueString(HKEY key, const char* name)
HKEY key,
const char* name)
{ {
// get the size of the string // get the size of the string
DWORD type; DWORD type;
@ -582,9 +550,7 @@ CWin32Platform::open95ServicesKey()
} }
int int
CWin32Platform::runDaemon( CWin32Platform::runDaemon(RunFunc run, StopFunc stop)
RunFunc run,
StopFunc stop)
{ {
// should only be called from DaemonFunc // should only be called from DaemonFunc
assert(m_serviceMutex != NULL); assert(m_serviceMutex != NULL);
@ -664,9 +630,7 @@ CWin32Platform::runDaemon(
} }
void void
CWin32Platform::serviceMain( CWin32Platform::serviceMain(DWORD argc, LPTSTR* argvIn)
DWORD argc,
LPTSTR* argvIn)
{ {
typedef std::vector<LPCTSTR> ArgList; typedef std::vector<LPCTSTR> ArgList;
typedef std::vector<CString> Arguments; typedef std::vector<CString> Arguments;
@ -784,16 +748,13 @@ CWin32Platform::serviceMain(
} }
void WINAPI void WINAPI
CWin32Platform::serviceMainEntry( CWin32Platform::serviceMainEntry(DWORD argc, LPTSTR* argv)
DWORD argc,
LPTSTR* argv)
{ {
s_daemonPlatform->serviceMain(argc, argv); s_daemonPlatform->serviceMain(argc, argv);
} }
void void
CWin32Platform::serviceHandler( CWin32Platform::serviceHandler(DWORD ctrl)
DWORD ctrl)
{ {
assert(m_serviceMutex != NULL); assert(m_serviceMutex != NULL);
assert(m_serviceState != NULL); assert(m_serviceState != NULL);
@ -866,16 +827,13 @@ CWin32Platform::serviceHandler(
} }
void WINAPI void WINAPI
CWin32Platform::serviceHandlerEntry( CWin32Platform::serviceHandlerEntry(DWORD ctrl)
DWORD ctrl)
{ {
s_daemonPlatform->serviceHandler(ctrl); s_daemonPlatform->serviceHandler(ctrl);
} }
bool bool
CWin32Platform::serviceLogger( CWin32Platform::serviceLogger(int priority, const char* msg)
int priority,
const char* msg)
{ {
if (s_eventLog == NULL) { if (s_eventLog == NULL) {
return false; return false;

View File

@ -10,10 +10,8 @@
// CXWindowsClipboard // CXWindowsClipboard
// //
CXWindowsClipboard::CXWindowsClipboard( CXWindowsClipboard::CXWindowsClipboard(Display* display,
Display* display, Window window, ClipboardID id) :
Window window,
ClipboardID id) :
m_display(display), m_display(display),
m_window(window), m_window(window),
m_id(id), m_id(id),
@ -63,8 +61,7 @@ CXWindowsClipboard::~CXWindowsClipboard()
} }
void void
CXWindowsClipboard::lost( CXWindowsClipboard::lost(Time time)
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) { if (m_owner) {
@ -75,12 +72,8 @@ CXWindowsClipboard::lost(
} }
void void
CXWindowsClipboard::addRequest( CXWindowsClipboard::addRequest(Window owner, Window requestor,
Window owner, Atom target, ::Time time, Atom property)
Window requestor,
Atom target,
::Time time,
Atom property)
{ {
// must be for our window and we must have owned the selection // must be for our window and we must have owned the selection
// at the given time. // at the given time.
@ -118,11 +111,8 @@ CXWindowsClipboard::addRequest(
} }
bool bool
CXWindowsClipboard::addSimpleRequest( CXWindowsClipboard::addSimpleRequest(Window requestor,
Window requestor, Atom target, ::Time time, Atom property)
Atom target,
::Time time,
Atom property)
{ {
// obsolete requestors may supply a None property. in // obsolete requestors may supply a None property. in
// that case we use the target as the property to store // that case we use the target as the property to store
@ -162,10 +152,8 @@ CXWindowsClipboard::addSimpleRequest(
} }
bool bool
CXWindowsClipboard::processRequest( CXWindowsClipboard::processRequest(Window requestor,
Window requestor, ::Time /*time*/, Atom property)
::Time /*time*/,
Atom property)
{ {
CReplyMap::iterator index = m_replies.find(requestor); CReplyMap::iterator index = m_replies.find(requestor);
if (index == m_replies.end()) { if (index == m_replies.end()) {
@ -192,8 +180,7 @@ CXWindowsClipboard::processRequest(
} }
bool bool
CXWindowsClipboard::destroyRequest( CXWindowsClipboard::destroyRequest(Window requestor)
Window requestor)
{ {
CReplyMap::iterator index = m_replies.find(requestor); CReplyMap::iterator index = m_replies.find(requestor);
if (index == m_replies.end()) { if (index == m_replies.end()) {
@ -257,9 +244,7 @@ CXWindowsClipboard::empty()
} }
void void
CXWindowsClipboard::add( CXWindowsClipboard::add(EFormat format, const CString& data)
EFormat format,
const CString& data)
{ {
assert(m_open); assert(m_open);
assert(m_owner); assert(m_owner);
@ -273,8 +258,7 @@ CXWindowsClipboard::add(
} }
bool bool
CXWindowsClipboard::open( CXWindowsClipboard::open(Time time) const
Time time) const
{ {
assert(!m_open); assert(!m_open);
@ -347,8 +331,7 @@ CXWindowsClipboard::getTime() const
} }
bool bool
CXWindowsClipboard::has( CXWindowsClipboard::has(EFormat format) const
EFormat format) const
{ {
assert(m_open); assert(m_open);
@ -357,8 +340,7 @@ CXWindowsClipboard::has(
} }
CString CString
CXWindowsClipboard::get( CXWindowsClipboard::get(EFormat format) const
EFormat format) const
{ {
assert(m_open); assert(m_open);
@ -367,8 +349,7 @@ CXWindowsClipboard::get(
} }
IClipboard::EFormat IClipboard::EFormat
CXWindowsClipboard::getFormat( CXWindowsClipboard::getFormat(Atom src) const
Atom src) const
{ {
// FIXME -- handle more formats (especially mime-type-like formats // FIXME -- handle more formats (especially mime-type-like formats
// and various character encodings like unicode). // and various character encodings like unicode).
@ -482,10 +463,8 @@ CXWindowsClipboard::icccmFillCache()
} }
bool bool
CXWindowsClipboard::icccmGetSelection( CXWindowsClipboard::icccmGetSelection(Atom target,
Atom target, Atom* actualTarget, CString* data) const
Atom* actualTarget,
CString* data) const
{ {
assert(actualTarget != NULL); assert(actualTarget != NULL);
assert(data != NULL); assert(data != NULL);
@ -725,10 +704,8 @@ CXWindowsClipboard::motifGetTime() const
} }
bool bool
CXWindowsClipboard::insertMultipleReply( CXWindowsClipboard::insertMultipleReply(Window requestor,
Window requestor, ::Time time, Atom property)
::Time time,
Atom property)
{ {
// get the requested targets // get the requested targets
Atom target; Atom target;
@ -780,8 +757,7 @@ CXWindowsClipboard::insertMultipleReply(
} }
void void
CXWindowsClipboard::insertReply( CXWindowsClipboard::insertReply(CReply* reply)
CReply* reply)
{ {
assert(reply != NULL); assert(reply != NULL);
@ -841,10 +817,8 @@ CXWindowsClipboard::pushReplies()
} }
void void
CXWindowsClipboard::pushReplies( CXWindowsClipboard::pushReplies(CReplyMap::iterator mapIndex,
CReplyMap::iterator mapIndex, CReplyList& replies, CReplyList::iterator index)
CReplyList& replies,
CReplyList::iterator index)
{ {
CReply* reply = *index; CReply* reply = *index;
while (sendReply(reply)) { while (sendReply(reply)) {
@ -870,8 +844,7 @@ CXWindowsClipboard::pushReplies(
} }
bool bool
CXWindowsClipboard::sendReply( CXWindowsClipboard::sendReply(CReply* reply)
CReply* reply)
{ {
assert(reply != NULL); assert(reply != NULL);
@ -1005,8 +978,7 @@ CXWindowsClipboard::clearReplies()
} }
void void
CXWindowsClipboard::clearReplies( CXWindowsClipboard::clearReplies(CReplyList& replies)
CReplyList& replies)
{ {
for (CReplyList::iterator index = replies.begin(); for (CReplyList::iterator index = replies.begin();
index != replies.end(); ++index) { index != replies.end(); ++index) {
@ -1016,12 +988,8 @@ CXWindowsClipboard::clearReplies(
} }
void void
CXWindowsClipboard::sendNotify( CXWindowsClipboard::sendNotify(Window requestor,
Window requestor, Atom selection, Atom target, Atom property, Time time)
Atom selection,
Atom target,
Atom property,
Time time)
{ {
XEvent event; XEvent event;
event.xselection.type = SelectionNotify; event.xselection.type = SelectionNotify;
@ -1036,8 +1004,7 @@ CXWindowsClipboard::sendNotify(
} }
bool bool
CXWindowsClipboard::wasOwnedAtTime( CXWindowsClipboard::wasOwnedAtTime(::Time time) const
::Time time) const
{ {
// not owned if we've never owned the selection // not owned if we've never owned the selection
if (m_timeOwned == 0) { if (m_timeOwned == 0) {
@ -1070,9 +1037,7 @@ CXWindowsClipboard::wasOwnedAtTime(
} }
Atom Atom
CXWindowsClipboard::getTargetsData( CXWindowsClipboard::getTargetsData(CString& data, int* format) const
CString& data,
int* format) const
{ {
assert(format != NULL); assert(format != NULL);
@ -1096,9 +1061,7 @@ CXWindowsClipboard::getTargetsData(
} }
Atom Atom
CXWindowsClipboard::getTimestampData( CXWindowsClipboard::getTimestampData(CString& data, int* format) const
CString& data,
int* format) const
{ {
assert(format != NULL); assert(format != NULL);
@ -1109,9 +1072,7 @@ CXWindowsClipboard::getTimestampData(
} }
Atom Atom
CXWindowsClipboard::getStringData( CXWindowsClipboard::getStringData(CString& data, int* format) const
CString& data,
int* format) const
{ {
assert(format != NULL); assert(format != NULL);
@ -1131,9 +1092,7 @@ CXWindowsClipboard::getStringData(
// //
CXWindowsClipboard::CICCCMGetClipboard::CICCCMGetClipboard( CXWindowsClipboard::CICCCMGetClipboard::CICCCMGetClipboard(
Window requestor, Window requestor, Time time, Atom property) :
Time time,
Atom property) :
m_requestor(requestor), m_requestor(requestor),
m_time(time), m_time(time),
m_property(property), m_property(property),
@ -1154,12 +1113,8 @@ CXWindowsClipboard::CICCCMGetClipboard::~CICCCMGetClipboard()
} }
bool bool
CXWindowsClipboard::CICCCMGetClipboard::readClipboard( CXWindowsClipboard::CICCCMGetClipboard::readClipboard(Display* display,
Display* display, Atom selection, Atom target, Atom* actualTarget, CString* data)
Atom selection,
Atom target,
Atom* actualTarget,
CString* data)
{ {
assert(actualTarget != NULL); assert(actualTarget != NULL);
assert(data != NULL); assert(data != NULL);
@ -1216,8 +1171,7 @@ CXWindowsClipboard::CICCCMGetClipboard::readClipboard(
bool bool
CXWindowsClipboard::CICCCMGetClipboard::doEventPredicate( CXWindowsClipboard::CICCCMGetClipboard::doEventPredicate(
Display* display, Display* display, XEvent* xevent)
XEvent* xevent)
{ {
// process event // process event
switch (xevent->type) { switch (xevent->type) {
@ -1354,17 +1308,14 @@ log((CLOG_INFO " INCR secondary chunk")); // FIXME
Bool Bool
CXWindowsClipboard::CICCCMGetClipboard::eventPredicate( CXWindowsClipboard::CICCCMGetClipboard::eventPredicate(
Display* display, Display* display, XEvent* xevent, XPointer arg)
XEvent* xevent,
XPointer arg)
{ {
CICCCMGetClipboard* self = reinterpret_cast<CICCCMGetClipboard*>(arg); CICCCMGetClipboard* self = reinterpret_cast<CICCCMGetClipboard*>(arg);
return self->doEventPredicate(display, xevent) ? True : False; return self->doEventPredicate(display, xevent) ? True : False;
} }
void void
CXWindowsClipboard::CICCCMGetClipboard::timeout( CXWindowsClipboard::CICCCMGetClipboard::timeout(void* vdisplay)
void* vdisplay)
{ {
// wait // wait
CThread::sleep(0.2); // FIXME -- is this too short? CThread::sleep(0.2); // FIXME -- is this too short?
@ -1386,10 +1337,7 @@ CXWindowsClipboard::CICCCMGetClipboard::timeout(
// CXWindowsClipboard::CReply // CXWindowsClipboard::CReply
// //
CXWindowsClipboard::CReply::CReply( CXWindowsClipboard::CReply::CReply(Window requestor, Atom target, ::Time time) :
Window requestor,
Atom target,
::Time time) :
m_requestor(requestor), m_requestor(requestor),
m_target(target), m_target(target),
m_time(time), m_time(time),
@ -1404,14 +1352,8 @@ CXWindowsClipboard::CReply::CReply(
// do nothing // do nothing
} }
CXWindowsClipboard::CReply::CReply( CXWindowsClipboard::CReply::CReply(Window requestor, Atom target, ::Time time,
Window requestor, Atom property, const CString& data, Atom type, int format) :
Atom target,
::Time time,
Atom property,
const CString& data,
Atom type,
int format) :
m_requestor(requestor), m_requestor(requestor),
m_target(target), m_target(target),
m_time(time), m_time(time),

View File

@ -113,9 +113,7 @@ CXWindowsScreen::getRoot() const
} }
void void
CXWindowsScreen::getScreenSize( CXWindowsScreen::getScreenSize(SInt32* w, SInt32* h) const
SInt32* w,
SInt32* h) const
{ {
assert(m_display != NULL); assert(m_display != NULL);
assert(w != NULL && h != NULL); assert(w != NULL && h != NULL);
@ -161,8 +159,7 @@ CXWindowsScreen::createBlankCursor() const
} }
bool bool
CXWindowsScreen::getEvent( CXWindowsScreen::getEvent(XEvent* xevent) const
XEvent* xevent) const
{ {
// wait for an event in a cancellable way and don't lock the // wait for an event in a cancellable way and don't lock the
// display while we're waiting. // display while we're waiting.
@ -217,8 +214,7 @@ CXWindowsScreen::onUnexpectedClose()
} }
bool bool
CXWindowsScreen::processEvent( CXWindowsScreen::processEvent(XEvent* xevent)
XEvent* xevent)
{ {
switch (xevent->type) { switch (xevent->type) {
case SelectionClear: case SelectionClear:
@ -288,8 +284,7 @@ CXWindowsScreen::processEvent(
} }
bool bool
CXWindowsScreen::setDisplayClipboard( CXWindowsScreen::setDisplayClipboard(ClipboardID id,
ClipboardID id,
const IClipboard* clipboard) const IClipboard* clipboard)
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);
@ -319,8 +314,7 @@ CXWindowsScreen::setDisplayClipboard(
} }
bool bool
CXWindowsScreen::getDisplayClipboard( CXWindowsScreen::getDisplayClipboard(ClipboardID id,
ClipboardID id,
IClipboard* clipboard) const IClipboard* clipboard) const
{ {
assert(clipboard != NULL); assert(clipboard != NULL);
@ -342,10 +336,8 @@ CXWindowsScreen::getDisplayClipboard(
} }
void void
CXWindowsScreen::processClipboardRequest( CXWindowsScreen::processClipboardRequest(Window requestor,
Window requestor, Time time, Atom property)
Time time,
Atom property)
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);
@ -359,8 +351,7 @@ CXWindowsScreen::processClipboardRequest(
} }
void void
CXWindowsScreen::destroyClipboardRequest( CXWindowsScreen::destroyClipboardRequest(Window requestor)
Window requestor)
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);
@ -374,8 +365,7 @@ CXWindowsScreen::destroyClipboardRequest(
} }
int int
CXWindowsScreen::ioErrorHandler( CXWindowsScreen::ioErrorHandler(Display*)
Display*)
{ {
// the display has disconnected, probably because X is shutting // the display has disconnected, probably because X is shutting
// down. X forces us to exit at this point. that's arguably // down. X forces us to exit at this point. that's arguably
@ -395,8 +385,7 @@ CXWindowsScreen::ioErrorHandler(
// CXWindowsScreen::CDisplayLock // CXWindowsScreen::CDisplayLock
// //
CXWindowsScreen::CDisplayLock::CDisplayLock( CXWindowsScreen::CDisplayLock::CDisplayLock(const CXWindowsScreen* screen) :
const CXWindowsScreen* screen) :
m_mutex(&screen->m_mutex), m_mutex(&screen->m_mutex),
m_display(screen->m_display) m_display(screen->m_display)
{ {

View File

@ -8,14 +8,9 @@
// //
bool bool
CXWindowsUtil::getWindowProperty( CXWindowsUtil::getWindowProperty(Display* display, Window window,
Display* display, Atom property, CString* data, Atom* type,
Window window, int* format, bool deleteProperty)
Atom property,
CString* data,
Atom* type,
int* format,
bool deleteProperty)
{ {
assert(display != NULL); assert(display != NULL);
assert(data != NULL); assert(data != NULL);
@ -88,14 +83,9 @@ CXWindowsUtil::getWindowProperty(
} }
bool bool
CXWindowsUtil::setWindowProperty( CXWindowsUtil::setWindowProperty(Display* display, Window window,
Display* display, Atom property, const void* vdata, UInt32 size,
Window window, Atom type, SInt32 format)
Atom property,
const void* vdata,
UInt32 size,
Atom type,
SInt32 format)
{ {
const UInt32 length = 4 * XMaxRequestSize(display); const UInt32 length = 4 * XMaxRequestSize(display);
const unsigned char* data = reinterpret_cast<const unsigned char*>(vdata); const unsigned char* data = reinterpret_cast<const unsigned char*>(vdata);
@ -135,9 +125,7 @@ CXWindowsUtil::setWindowProperty(
} }
Time Time
CXWindowsUtil::getCurrentTime( CXWindowsUtil::getCurrentTime(Display* display, Window window)
Display* display,
Window window)
{ {
// select property events on window // select property events on window
XWindowAttributes attr; XWindowAttributes attr;
@ -174,10 +162,7 @@ CXWindowsUtil::getCurrentTime(
} }
Bool Bool
CXWindowsUtil::propertyNotifyPredicate( CXWindowsUtil::propertyNotifyPredicate(Display*, XEvent* xevent, XPointer arg)
Display*,
XEvent* xevent,
XPointer arg)
{ {
CPropertyNotifyPredicateInfo* filter = CPropertyNotifyPredicateInfo* filter =
reinterpret_cast<CPropertyNotifyPredicateInfo*>(arg); reinterpret_cast<CPropertyNotifyPredicateInfo*>(arg);
@ -199,15 +184,12 @@ CXWindowsUtil::CErrorLock::CErrorLock()
install(&CXWindowsUtil::CErrorLock::ignoreHandler, NULL); install(&CXWindowsUtil::CErrorLock::ignoreHandler, NULL);
} }
CXWindowsUtil::CErrorLock::CErrorLock( CXWindowsUtil::CErrorLock::CErrorLock(bool* flag)
bool* flag)
{ {
install(&CXWindowsUtil::CErrorLock::saveHandler, flag); install(&CXWindowsUtil::CErrorLock::saveHandler, flag);
} }
CXWindowsUtil::CErrorLock::CErrorLock( CXWindowsUtil::CErrorLock::CErrorLock(ErrorHandler handler, void* data)
ErrorHandler handler,
void* data)
{ {
install(handler, data); install(handler, data);
} }
@ -219,9 +201,7 @@ CXWindowsUtil::CErrorLock::~CErrorLock()
} }
void void
CXWindowsUtil::CErrorLock::install( CXWindowsUtil::CErrorLock::install(ErrorHandler handler, void* data)
ErrorHandler handler,
void* data)
{ {
m_handler = handler; m_handler = handler;
m_userData = data; m_userData = data;
@ -232,9 +212,7 @@ CXWindowsUtil::CErrorLock::install(
} }
int int
CXWindowsUtil::CErrorLock::internalHandler( CXWindowsUtil::CErrorLock::internalHandler(Display* display, XErrorEvent* event)
Display* display,
XErrorEvent* event)
{ {
if (s_top != NULL && s_top->m_handler != NULL) { if (s_top != NULL && s_top->m_handler != NULL) {
s_top->m_handler(display, event, s_top->m_userData); s_top->m_handler(display, event, s_top->m_userData);
@ -243,19 +221,13 @@ CXWindowsUtil::CErrorLock::internalHandler(
} }
void void
CXWindowsUtil::CErrorLock::ignoreHandler( CXWindowsUtil::CErrorLock::ignoreHandler(Display*, XErrorEvent*, void*)
Display*,
XErrorEvent*,
void*)
{ {
// do nothing // do nothing
} }
void void
CXWindowsUtil::CErrorLock::saveHandler( CXWindowsUtil::CErrorLock::saveHandler(Display*, XErrorEvent*, void* flag)
Display*,
XErrorEvent*,
void* flag)
{ {
*reinterpret_cast<bool*>(flag) = true; *reinterpret_cast<bool*>(flag) = true;
} }

View File

@ -19,8 +19,7 @@ CConfig::~CConfig()
} }
bool bool
CConfig::addScreen( CConfig::addScreen(const CString& name)
const CString& name)
{ {
// alias name must not exist // alias name must not exist
if (m_nameToCanonicalName.find(name) != m_nameToCanonicalName.end()) { if (m_nameToCanonicalName.find(name) != m_nameToCanonicalName.end()) {
@ -37,8 +36,7 @@ CConfig::addScreen(
} }
void void
CConfig::removeScreen( CConfig::removeScreen(const CString& name)
const CString& name)
{ {
// get canonical name and find cell // get canonical name and find cell
CString canonical = getCanonicalName(name); CString canonical = getCanonicalName(name);
@ -79,9 +77,7 @@ CConfig::removeAllScreens()
} }
bool bool
CConfig::addAlias( CConfig::addAlias(const CString& canonical, const CString& alias)
const CString& canonical,
const CString& alias)
{ {
// alias name must not exist // alias name must not exist
if (m_nameToCanonicalName.find(alias) != m_nameToCanonicalName.end()) { if (m_nameToCanonicalName.find(alias) != m_nameToCanonicalName.end()) {
@ -100,8 +96,7 @@ CConfig::addAlias(
} }
bool bool
CConfig::removeAlias( CConfig::removeAlias(const CString& alias)
const CString& alias)
{ {
// must not be a canonical name // must not be a canonical name
if (m_map.find(alias) != m_map.end()) { if (m_map.find(alias) != m_map.end()) {
@ -135,10 +130,8 @@ CConfig::removeAllAliases()
} }
bool bool
CConfig::connect( CConfig::connect(const CString& srcName,
const CString& srcName, EDirection srcSide, const CString& dstName)
EDirection srcSide,
const CString& dstName)
{ {
// find source cell // find source cell
CCellMap::iterator index = m_map.find(getCanonicalName(srcName)); CCellMap::iterator index = m_map.find(getCanonicalName(srcName));
@ -155,9 +148,7 @@ CConfig::connect(
} }
bool bool
CConfig::disconnect( CConfig::disconnect(const CString& srcName, EDirection srcSide)
const CString& srcName,
EDirection srcSide)
{ {
// find source cell // find source cell
CCellMap::iterator index = m_map.find(srcName); CCellMap::iterator index = m_map.find(srcName);
@ -172,22 +163,19 @@ CConfig::disconnect(
} }
void void
CConfig::setSynergyAddress( CConfig::setSynergyAddress(const CNetworkAddress& addr)
const CNetworkAddress& addr)
{ {
m_synergyAddress = addr; m_synergyAddress = addr;
} }
void void
CConfig::setHTTPAddress( CConfig::setHTTPAddress(const CNetworkAddress& addr)
const CNetworkAddress& addr)
{ {
m_httpAddress = addr; m_httpAddress = addr;
} }
bool bool
CConfig::isValidScreenName( CConfig::isValidScreenName(const CString& name) const
const CString& name) const
{ {
// name is valid if matches validname // name is valid if matches validname
// name ::= [A-Za-z0-9] | [A-Za-z0-9][-A-Za-z0-9]*[A-Za-z0-9] // name ::= [A-Za-z0-9] | [A-Za-z0-9][-A-Za-z0-9]*[A-Za-z0-9]
@ -244,22 +232,19 @@ CConfig::end() const
} }
bool bool
CConfig::isScreen( CConfig::isScreen(const CString& name) const
const CString& name) const
{ {
return (m_nameToCanonicalName.count(name) > 0); return (m_nameToCanonicalName.count(name) > 0);
} }
bool bool
CConfig::isCanonicalName( CConfig::isCanonicalName(const CString& name) const
const CString& name) const
{ {
return CStringUtil::CaselessCmp::equal(getCanonicalName(name), name); return CStringUtil::CaselessCmp::equal(getCanonicalName(name), name);
} }
CString CString
CConfig::getCanonicalName( CConfig::getCanonicalName(const CString& name) const
const CString& name) const
{ {
CNameMap::const_iterator index = m_nameToCanonicalName.find(name); CNameMap::const_iterator index = m_nameToCanonicalName.find(name);
if (index == m_nameToCanonicalName.end()) { if (index == m_nameToCanonicalName.end()) {
@ -271,9 +256,7 @@ CConfig::getCanonicalName(
} }
CString CString
CConfig::getNeighbor( CConfig::getNeighbor(const CString& srcName, EDirection srcSide) const
const CString& srcName,
EDirection srcSide) const
{ {
// find source cell // find source cell
CCellMap::const_iterator index = m_map.find(getCanonicalName(srcName)); CCellMap::const_iterator index = m_map.find(getCanonicalName(srcName));
@ -299,17 +282,14 @@ CConfig::getHTTPAddress() const
} }
const char* const char*
CConfig::dirName( CConfig::dirName(EDirection dir)
EDirection dir)
{ {
static const char* s_name[] = { "left", "right", "top", "bottom" }; static const char* s_name[] = { "left", "right", "top", "bottom" };
return s_name[dir - kFirstDirection]; return s_name[dir - kFirstDirection];
} }
bool bool
CConfig::readLine( CConfig::readLine(std::istream& s, CString& line)
std::istream& s,
CString& line)
{ {
s >> std::ws; s >> std::ws;
while (std::getline(s, line)) { while (std::getline(s, line)) {
@ -333,8 +313,7 @@ CConfig::readLine(
} }
void void
CConfig::readSection( CConfig::readSection(std::istream& s)
std::istream& s)
{ {
static const char s_section[] = "section:"; static const char s_section[] = "section:";
static const char s_network[] = "network"; static const char s_network[] = "network";
@ -383,8 +362,7 @@ CConfig::readSection(
} }
void void
CConfig::readSectionNetwork( CConfig::readSectionNetwork(std::istream& s)
std::istream& s)
{ {
CString line; CString line;
CString name; CString name;
@ -440,8 +418,7 @@ CConfig::readSectionNetwork(
} }
void void
CConfig::readSectionScreens( CConfig::readSectionScreens(std::istream& s)
std::istream& s)
{ {
CString line; CString line;
CString name; CString name;
@ -477,8 +454,7 @@ CConfig::readSectionScreens(
} }
void void
CConfig::readSectionLinks( CConfig::readSectionLinks(std::istream& s)
std::istream& s)
{ {
CString line; CString line;
CString screen; CString screen;
@ -559,8 +535,7 @@ CConfig::readSectionLinks(
} }
void void
CConfig::readSectionAliases( CConfig::readSectionAliases(std::istream& s)
std::istream& s)
{ {
CString line; CString line;
CString screen; CString screen;
@ -607,9 +582,7 @@ CConfig::readSectionAliases(
// //
std::istream& std::istream&
operator>>( operator>>(std::istream& s, CConfig& config)
std::istream& s,
CConfig& config)
{ {
// FIXME -- should track line and column to improve error reporting // FIXME -- should track line and column to improve error reporting
@ -622,9 +595,7 @@ operator>>(
} }
std::ostream& std::ostream&
operator<<( operator<<(std::ostream& s, const CConfig& config)
std::ostream& s,
const CConfig& config)
{ {
// network section // network section
s << "section: network" << std::endl; s << "section: network" << std::endl;
@ -710,8 +681,7 @@ operator<<(
// CConfig I/O exceptions // CConfig I/O exceptions
// //
XConfigRead::XConfigRead( XConfigRead::XConfigRead(const CString& error) :
const CString& error) :
m_error(error) m_error(error)
{ {
// do nothing // do nothing

View File

@ -31,8 +31,7 @@ CHTTPServer::~CHTTPServer()
} }
void void
CHTTPServer::processRequest( CHTTPServer::processRequest(IDataSocket* socket)
IDataSocket* socket)
{ {
assert(socket != NULL); assert(socket != NULL);
@ -92,9 +91,7 @@ CHTTPServer::processRequest(
} }
void void
CHTTPServer::doProcessRequest( CHTTPServer::doProcessRequest(CHTTPRequest& request, CHTTPReply& reply)
CHTTPRequest& request,
CHTTPReply& reply)
{ {
reply.m_majorVersion = request.m_majorVersion; reply.m_majorVersion = request.m_majorVersion;
reply.m_minorVersion = request.m_minorVersion; reply.m_minorVersion = request.m_minorVersion;
@ -123,9 +120,7 @@ CHTTPServer::doProcessRequest(
} }
void void
CHTTPServer::doProcessGetEditMap( CHTTPServer::doProcessGetEditMap(CHTTPRequest& /*request*/, CHTTPReply& reply)
CHTTPRequest& /*request*/,
CHTTPReply& reply)
{ {
static const char* s_editMapProlog1 = static const char* s_editMapProlog1 =
"<html>\r\n" "<html>\r\n"
@ -234,9 +229,7 @@ CHTTPServer::doProcessGetEditMap(
} }
void void
CHTTPServer::doProcessPostEditMap( CHTTPServer::doProcessPostEditMap(CHTTPRequest& request, CHTTPReply& reply)
CHTTPRequest& request,
CHTTPReply& reply)
{ {
typedef std::vector<CString> ScreenArray; typedef std::vector<CString> ScreenArray;
typedef std::set<CString> ScreenSet; typedef std::set<CString> ScreenSet;
@ -330,10 +323,7 @@ CHTTPServer::doProcessPostEditMap(
} }
bool bool
CHTTPServer::parseXY( CHTTPServer::parseXY(const CString& xy, SInt32& x, SInt32& y)
const CString& xy,
SInt32& x,
SInt32& y)
{ {
std::istringstream s(xy); std::istringstream s(xy);
char delimiter; char delimiter;
@ -361,9 +351,7 @@ CHTTPServer::CScreenArray::~CScreenArray()
} }
void void
CHTTPServer::CScreenArray::resize( CHTTPServer::CScreenArray::resize(SInt32 w, SInt32 h)
SInt32 w,
SInt32 h)
{ {
m_screens.clear(); m_screens.clear();
m_screens.resize(w * h); m_screens.resize(w * h);
@ -372,8 +360,7 @@ CHTTPServer::CScreenArray::resize(
} }
void void
CHTTPServer::CScreenArray::insertRow( CHTTPServer::CScreenArray::insertRow(SInt32 i)
SInt32 i)
{ {
assert(i >= 0 && i <= m_h); assert(i >= 0 && i <= m_h);
@ -396,8 +383,7 @@ CHTTPServer::CScreenArray::insertRow(
} }
void void
CHTTPServer::CScreenArray::insertColumn( CHTTPServer::CScreenArray::insertColumn(SInt32 i)
SInt32 i)
{ {
assert(i >= 0 && i <= m_w); assert(i >= 0 && i <= m_w);
@ -418,8 +404,7 @@ CHTTPServer::CScreenArray::insertColumn(
} }
void void
CHTTPServer::CScreenArray::eraseRow( CHTTPServer::CScreenArray::eraseRow(SInt32 i)
SInt32 i)
{ {
assert(i >= 0 && i < m_h); assert(i >= 0 && i < m_h);
@ -442,8 +427,7 @@ CHTTPServer::CScreenArray::eraseRow(
} }
void void
CHTTPServer::CScreenArray::eraseColumn( CHTTPServer::CScreenArray::eraseColumn(SInt32 i)
SInt32 i)
{ {
assert(i >= 0 && i < m_w); assert(i >= 0 && i < m_w);
@ -464,8 +448,7 @@ CHTTPServer::CScreenArray::eraseColumn(
} }
void void
CHTTPServer::CScreenArray::rotateRows( CHTTPServer::CScreenArray::rotateRows(SInt32 i)
SInt32 i)
{ {
// nothing to do if no rows // nothing to do if no rows
if (m_h == 0) { if (m_h == 0) {
@ -496,8 +479,7 @@ CHTTPServer::CScreenArray::rotateRows(
} }
void void
CHTTPServer::CScreenArray::rotateColumns( CHTTPServer::CScreenArray::rotateColumns(SInt32 i)
SInt32 i)
{ {
// nothing to do if no columns // nothing to do if no columns
if (m_h == 0) { if (m_h == 0) {
@ -528,18 +510,13 @@ CHTTPServer::CScreenArray::rotateColumns(
} }
void void
CHTTPServer::CScreenArray::remove( CHTTPServer::CScreenArray::remove(SInt32 x, SInt32 y)
SInt32 x,
SInt32 y)
{ {
set(x, y, CString()); set(x, y, CString());
} }
void void
CHTTPServer::CScreenArray::set( CHTTPServer::CScreenArray::set(SInt32 x, SInt32 y, const CString& name)
SInt32 x,
SInt32 y,
const CString& name)
{ {
assert(x >= 0 && x < m_w); assert(x >= 0 && x < m_w);
assert(y >= 0 && y < m_h); assert(y >= 0 && y < m_h);
@ -548,9 +525,7 @@ CHTTPServer::CScreenArray::set(
} }
bool bool
CHTTPServer::CScreenArray::isAllowed( CHTTPServer::CScreenArray::isAllowed(SInt32 x, SInt32 y) const
SInt32 x,
SInt32 y) const
{ {
assert(x >= 0 && x < m_w); assert(x >= 0 && x < m_w);
assert(y >= 0 && y < m_h); assert(y >= 0 && y < m_h);
@ -571,9 +546,7 @@ CHTTPServer::CScreenArray::isAllowed(
} }
bool bool
CHTTPServer::CScreenArray::isSet( CHTTPServer::CScreenArray::isSet(SInt32 x, SInt32 y) const
SInt32 x,
SInt32 y) const
{ {
assert(x >= 0 && x < m_w); assert(x >= 0 && x < m_w);
assert(y >= 0 && y < m_h); assert(y >= 0 && y < m_h);
@ -582,9 +555,7 @@ CHTTPServer::CScreenArray::isSet(
} }
CString CString
CHTTPServer::CScreenArray::get( CHTTPServer::CScreenArray::get(SInt32 x, SInt32 y) const
SInt32 x,
SInt32 y) const
{ {
assert(x >= 0 && x < m_w); assert(x >= 0 && x < m_w);
assert(y >= 0 && y < m_h); assert(y >= 0 && y < m_h);
@ -593,10 +564,8 @@ CHTTPServer::CScreenArray::get(
} }
bool bool
CHTTPServer::CScreenArray::find( CHTTPServer::CScreenArray::find(const CString& name,
const CString& name, SInt32& xOut, SInt32& yOut) const
SInt32& xOut,
SInt32& yOut) const
{ {
for (SInt32 y = 0; y < m_h; ++y) { for (SInt32 y = 0; y < m_h; ++y) {
for (SInt32 x = 0; x < m_w; ++x) { for (SInt32 x = 0; x < m_w; ++x) {
@ -628,8 +597,7 @@ CHTTPServer::CScreenArray::isValid() const
} }
bool bool
CHTTPServer::CScreenArray::convertFrom( CHTTPServer::CScreenArray::convertFrom(const CConfig& config)
const CConfig& config)
{ {
typedef std::set<CString> ScreenSet; typedef std::set<CString> ScreenSet;
@ -760,8 +728,7 @@ CHTTPServer::CScreenArray::convertFrom(
} }
void void
CHTTPServer::CScreenArray::convertTo( CHTTPServer::CScreenArray::convertTo(CConfig& config) const
CConfig& config) const
{ {
config.removeAllScreens(); config.removeAllScreens();

View File

@ -94,8 +94,7 @@ CMSWindowsPrimaryScreen::stop()
} }
void void
CMSWindowsPrimaryScreen::open( CMSWindowsPrimaryScreen::open(CServer* server)
CServer* server)
{ {
assert(m_server == NULL); assert(m_server == NULL);
assert(server != NULL); assert(server != NULL);
@ -142,9 +141,7 @@ CMSWindowsPrimaryScreen::close()
} }
void void
CMSWindowsPrimaryScreen::enter( CMSWindowsPrimaryScreen::enter(SInt32 x, SInt32 y)
SInt32 x,
SInt32 y)
{ {
log((CLOG_INFO "entering primary at %d,%d", x, y)); log((CLOG_INFO "entering primary at %d,%d", x, y));
assert(m_active == true); assert(m_active == true);
@ -239,17 +236,14 @@ CMSWindowsPrimaryScreen::onConfigure()
} }
void void
CMSWindowsPrimaryScreen::warpCursor( CMSWindowsPrimaryScreen::warpCursor(SInt32 x, SInt32 y)
SInt32 x,
SInt32 y)
{ {
// set the cursor position without generating an event // set the cursor position without generating an event
SetCursorPos(x, y); SetCursorPos(x, y);
} }
void void
CMSWindowsPrimaryScreen::setClipboard( CMSWindowsPrimaryScreen::setClipboard(ClipboardID /*id*/,
ClipboardID /*id*/,
const IClipboard* src) const IClipboard* src)
{ {
assert(m_window != NULL); assert(m_window != NULL);
@ -259,8 +253,7 @@ CMSWindowsPrimaryScreen::setClipboard(
} }
void void
CMSWindowsPrimaryScreen::grabClipboard( CMSWindowsPrimaryScreen::grabClipboard(ClipboardID /*id*/)
ClipboardID /*id*/)
{ {
assert(m_window != NULL); assert(m_window != NULL);
@ -271,9 +264,7 @@ CMSWindowsPrimaryScreen::grabClipboard(
} }
void void
CMSWindowsPrimaryScreen::getSize( CMSWindowsPrimaryScreen::getSize(SInt32* width, SInt32* height) const
SInt32* width,
SInt32* height) const
{ {
getScreenSize(width, height); getScreenSize(width, height);
} }
@ -285,8 +276,7 @@ CMSWindowsPrimaryScreen::getJumpZoneSize() const
} }
void void
CMSWindowsPrimaryScreen::getClipboard( CMSWindowsPrimaryScreen::getClipboard(ClipboardID /*id*/,
ClipboardID /*id*/,
IClipboard* dst) const IClipboard* dst) const
{ {
assert(m_window != NULL); assert(m_window != NULL);
@ -373,8 +363,7 @@ CMSWindowsPrimaryScreen::onCloseDisplay()
} }
bool bool
CMSWindowsPrimaryScreen::onPreTranslate( CMSWindowsPrimaryScreen::onPreTranslate(MSG* msg)
MSG* msg)
{ {
// handle event // handle event
switch (msg->message) { switch (msg->message) {
@ -504,11 +493,8 @@ CMSWindowsPrimaryScreen::onPreTranslate(
} }
LRESULT LRESULT
CMSWindowsPrimaryScreen::onEvent( CMSWindowsPrimaryScreen::onEvent(HWND hwnd, UINT msg,
HWND hwnd, WPARAM wParam, LPARAM lParam)
UINT msg,
WPARAM wParam,
LPARAM lParam)
{ {
switch (msg) { switch (msg) {
case WM_QUERYENDSESSION: case WM_QUERYENDSESSION:
@ -750,8 +736,7 @@ CMSWindowsPrimaryScreen::closeDesktop()
} }
bool bool
CMSWindowsPrimaryScreen::switchDesktop( CMSWindowsPrimaryScreen::switchDesktop(HDESK desk)
HDESK desk)
{ {
// did we own the clipboard? // did we own the clipboard?
bool ownClipboard = (m_clipboardOwner == m_window); bool ownClipboard = (m_clipboardOwner == m_window);
@ -1300,8 +1285,7 @@ CMSWindowsPrimaryScreen::mapKey(
} }
ButtonID ButtonID
CMSWindowsPrimaryScreen::mapButton( CMSWindowsPrimaryScreen::mapButton(WPARAM button) const
WPARAM button) const
{ {
switch (button) { switch (button) {
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
@ -1350,9 +1334,7 @@ CMSWindowsPrimaryScreen::updateKeys()
} }
void void
CMSWindowsPrimaryScreen::updateKey( CMSWindowsPrimaryScreen::updateKey(UINT vkCode, bool press)
UINT vkCode,
bool press)
{ {
if (press) { if (press) {
switch (vkCode) { switch (vkCode) {

View File

@ -36,8 +36,7 @@
const SInt32 CServer::s_httpMaxSimultaneousRequests = 3; const SInt32 CServer::s_httpMaxSimultaneousRequests = 3;
CServer::CServer( CServer::CServer(const CString& serverName) :
const CString& serverName) :
m_name(serverName), m_name(serverName),
m_cleanupSize(&m_mutex, 0), m_cleanupSize(&m_mutex, 0),
m_primary(NULL), m_primary(NULL),
@ -160,8 +159,7 @@ CServer::shutdown()
} }
bool bool
CServer::setConfig( CServer::setConfig(const CConfig& config)
const CConfig& config)
{ {
typedef std::vector<CThread> CThreads; typedef std::vector<CThread> CThreads;
CThreads threads; CThreads threads;
@ -229,8 +227,7 @@ CServer::getPrimaryScreenName() const
} }
void void
CServer::getConfig( CServer::getConfig(CConfig* config) const
CConfig* config) const
{ {
assert(config != NULL); assert(config != NULL);
@ -263,12 +260,7 @@ CServer::getActivePrimarySides() const
} }
void void
CServer::setInfo( CServer::setInfo(SInt32 w, SInt32 h, SInt32 zoneSize, SInt32 x, SInt32 y)
SInt32 w,
SInt32 h,
SInt32 zoneSize,
SInt32 x,
SInt32 y)
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);
assert(m_primaryInfo != NULL); assert(m_primaryInfo != NULL);
@ -276,26 +268,16 @@ CServer::setInfo(
} }
void void
CServer::setInfo( CServer::setInfo(const CString& client,
const CString& client, SInt32 w, SInt32 h, SInt32 zoneSize, SInt32 x, SInt32 y)
SInt32 w,
SInt32 h,
SInt32 zoneSize,
SInt32 x,
SInt32 y)
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);
setInfoNoLock(client, w, h, zoneSize, x, y); setInfoNoLock(client, w, h, zoneSize, x, y);
} }
void void
CServer::setInfoNoLock( CServer::setInfoNoLock(const CString& screen,
const CString& screen, SInt32 w, SInt32 h, SInt32 zoneSize, SInt32 x, SInt32 y)
SInt32 w,
SInt32 h,
SInt32 zoneSize,
SInt32 x,
SInt32 y)
{ {
assert(!screen.empty()); assert(!screen.empty());
assert(w > 0); assert(w > 0);
@ -340,8 +322,7 @@ CServer::setInfoNoLock(
} }
void void
CServer::grabClipboard( CServer::grabClipboard(ClipboardID id)
ClipboardID id)
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);
assert(m_primaryInfo != NULL); assert(m_primaryInfo != NULL);
@ -349,20 +330,15 @@ CServer::grabClipboard(
} }
void void
CServer::grabClipboard( CServer::grabClipboard(ClipboardID id, UInt32 seqNum, const CString& client)
ClipboardID id,
UInt32 seqNum,
const CString& client)
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);
grabClipboardNoLock(id, seqNum, client); grabClipboardNoLock(id, seqNum, client);
} }
void void
CServer::grabClipboardNoLock( CServer::grabClipboardNoLock(ClipboardID id,
ClipboardID id, UInt32 seqNum, const CString& screen)
UInt32 seqNum,
const CString& screen)
{ {
// note -- must be locked on entry // note -- must be locked on entry
CClipboardInfo& clipboard = m_clipboards[id]; CClipboardInfo& clipboard = m_clipboards[id];
@ -421,10 +397,7 @@ CServer::grabClipboardNoLock(
} }
void void
CServer::setClipboard( CServer::setClipboard(ClipboardID id, UInt32 seqNum, const CString& data)
ClipboardID id,
UInt32 seqNum,
const CString& data)
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);
CClipboardInfo& clipboard = m_clipboards[id]; CClipboardInfo& clipboard = m_clipboards[id];
@ -455,18 +428,13 @@ CServer::setClipboard(
} }
bool bool
CServer::onCommandKey( CServer::onCommandKey(KeyID /*id*/, KeyModifierMask /*mask*/, bool /*down*/)
KeyID /*id*/,
KeyModifierMask /*mask*/,
bool /*down*/)
{ {
return false; return false;
} }
void void
CServer::onKeyDown( CServer::onKeyDown(KeyID id, KeyModifierMask mask)
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); CLock lock(&m_mutex);
@ -484,9 +452,7 @@ CServer::onKeyDown(
} }
void void
CServer::onKeyUp( CServer::onKeyUp(KeyID id, KeyModifierMask mask)
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); CLock lock(&m_mutex);
@ -504,10 +470,7 @@ CServer::onKeyUp(
} }
void void
CServer::onKeyRepeat( CServer::onKeyRepeat(KeyID id, KeyModifierMask mask, SInt32 count)
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); CLock lock(&m_mutex);
@ -526,8 +489,7 @@ CServer::onKeyRepeat(
} }
void void
CServer::onMouseDown( CServer::onMouseDown(ButtonID id)
ButtonID id)
{ {
log((CLOG_DEBUG1 "onMouseDown id=%d", id)); log((CLOG_DEBUG1 "onMouseDown id=%d", id));
CLock lock(&m_mutex); CLock lock(&m_mutex);
@ -540,8 +502,7 @@ CServer::onMouseDown(
} }
void void
CServer::onMouseUp( CServer::onMouseUp(ButtonID id)
ButtonID id)
{ {
log((CLOG_DEBUG1 "onMouseUp id=%d", id)); log((CLOG_DEBUG1 "onMouseUp id=%d", id));
CLock lock(&m_mutex); CLock lock(&m_mutex);
@ -554,9 +515,7 @@ CServer::onMouseUp(
} }
bool bool
CServer::onMouseMovePrimary( CServer::onMouseMovePrimary(SInt32 x, SInt32 y)
SInt32 x,
SInt32 y)
{ {
log((CLOG_DEBUG2 "onMouseMovePrimary %d,%d", x, y)); log((CLOG_DEBUG2 "onMouseMovePrimary %d,%d", x, y));
CLock lock(&m_mutex); CLock lock(&m_mutex);
@ -564,9 +523,7 @@ CServer::onMouseMovePrimary(
} }
bool bool
CServer::onMouseMovePrimaryNoLock( CServer::onMouseMovePrimaryNoLock(SInt32 x, SInt32 y)
SInt32 x,
SInt32 y)
{ {
// mouse move on primary (server's) screen // mouse move on primary (server's) screen
assert(m_active != NULL); assert(m_active != NULL);
@ -621,9 +578,7 @@ CServer::onMouseMovePrimaryNoLock(
} }
void void
CServer::onMouseMoveSecondary( CServer::onMouseMoveSecondary(SInt32 dx, SInt32 dy)
SInt32 dx,
SInt32 dy)
{ {
log((CLOG_DEBUG2 "onMouseMoveSecondary %+d,%+d", dx, dy)); log((CLOG_DEBUG2 "onMouseMoveSecondary %+d,%+d", dx, dy));
CLock lock(&m_mutex); CLock lock(&m_mutex);
@ -631,9 +586,7 @@ CServer::onMouseMoveSecondary(
} }
void void
CServer::onMouseMoveSecondaryNoLock( CServer::onMouseMoveSecondaryNoLock(SInt32 dx, SInt32 dy)
SInt32 dx,
SInt32 dy)
{ {
// mouse move on secondary (client's) screen // mouse move on secondary (client's) screen
assert(m_active != NULL); assert(m_active != NULL);
@ -736,8 +689,7 @@ CServer::onMouseMoveSecondaryNoLock(
} }
void void
CServer::onMouseWheel( CServer::onMouseWheel(SInt32 delta)
SInt32 delta)
{ {
log((CLOG_DEBUG1 "onMouseWheel %+d", delta)); log((CLOG_DEBUG1 "onMouseWheel %+d", delta));
CLock lock(&m_mutex); CLock lock(&m_mutex);
@ -774,10 +726,7 @@ CServer::isLockedToScreenNoLock() const
} }
void void
CServer::switchScreen( CServer::switchScreen(CScreenInfo* dst, SInt32 x, SInt32 y)
CScreenInfo* dst,
SInt32 x,
SInt32 y)
{ {
assert(dst != NULL); assert(dst != NULL);
assert(x >= 0 && y >= 0 && x < dst->m_width && y < dst->m_height); assert(x >= 0 && y >= 0 && x < dst->m_width && y < dst->m_height);
@ -845,9 +794,7 @@ CServer::switchScreen(
} }
CServer::CScreenInfo* CServer::CScreenInfo*
CServer::getNeighbor( CServer::getNeighbor(CScreenInfo* src, CConfig::EDirection dir) const
CScreenInfo* src,
CConfig::EDirection dir) const
{ {
assert(src != NULL); assert(src != NULL);
@ -879,11 +826,8 @@ CServer::getNeighbor(
} }
CServer::CScreenInfo* CServer::CScreenInfo*
CServer::getNeighbor( CServer::getNeighbor(CScreenInfo* src,
CScreenInfo* src, CConfig::EDirection srcSide, SInt32& x, SInt32& y) const
CConfig::EDirection srcSide,
SInt32& x,
SInt32& y) const
{ {
assert(src != NULL); assert(src != NULL);
@ -1000,12 +944,8 @@ CServer::getNeighbor(
} }
void void
CServer::mapPosition( CServer::mapPosition(CScreenInfo* src, CConfig::EDirection srcSide,
CScreenInfo* src, CScreenInfo* dst, SInt32& x, SInt32& y) const
CConfig::EDirection srcSide,
CScreenInfo* dst,
SInt32& x,
SInt32& y) const
{ {
assert(src != NULL); assert(src != NULL);
assert(dst != NULL); assert(dst != NULL);
@ -1104,8 +1044,7 @@ CServer::acceptClients(void*)
} }
void void
CServer::handshakeClient( CServer::handshakeClient(void* vsocket)
void* vsocket)
{ {
log((CLOG_DEBUG1 "negotiating with new client")); log((CLOG_DEBUG1 "negotiating with new client"));
@ -1306,8 +1245,7 @@ CServer::acceptHTTPClients(void*)
} }
void void
CServer::processHTTPRequest( CServer::processHTTPRequest(void* vsocket)
void* vsocket)
{ {
// add this thread to the list of threads to cancel. remove from // add this thread to the list of threads to cancel. remove from
// list in d'tor. // list in d'tor.
@ -1345,8 +1283,7 @@ CServer::processHTTPRequest(
} }
void void
CServer::clearGotClipboard( CServer::clearGotClipboard(ClipboardID id)
ClipboardID id)
{ {
for (CScreenList::const_iterator index = m_screens.begin(); for (CScreenList::const_iterator index = m_screens.begin();
index != m_screens.end(); ++index) { index != m_screens.end(); ++index) {
@ -1355,8 +1292,7 @@ CServer::clearGotClipboard(
} }
void void
CServer::sendClipboard( CServer::sendClipboard(ClipboardID id)
ClipboardID id)
{ {
// do nothing if clipboard was already sent // do nothing if clipboard was already sent
if (!m_active->m_gotClipboard[id]) { if (!m_active->m_gotClipboard[id]) {
@ -1378,8 +1314,7 @@ CServer::sendClipboard(
} }
void void
CServer::updatePrimaryClipboard( CServer::updatePrimaryClipboard(ClipboardID id)
ClipboardID id)
{ {
CClipboardInfo& clipboard = m_clipboards[id]; CClipboardInfo& clipboard = m_clipboards[id];
@ -1497,8 +1432,7 @@ CServer::closePrimaryScreen()
} }
void void
CServer::addCleanupThread( CServer::addCleanupThread(const CThread& thread)
const CThread& thread)
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);
m_cleanupList.insert(m_cleanupList.begin(), new CThread(thread)); m_cleanupList.insert(m_cleanupList.begin(), new CThread(thread));
@ -1506,8 +1440,7 @@ CServer::addCleanupThread(
} }
void void
CServer::removeCleanupThread( CServer::removeCleanupThread(const CThread& thread)
const CThread& thread)
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);
for (CThreadList::iterator index = m_cleanupList.begin(); for (CThreadList::iterator index = m_cleanupList.begin();
@ -1526,8 +1459,7 @@ CServer::removeCleanupThread(
} }
void void
CServer::cleanupThreads( CServer::cleanupThreads(double timeout)
double timeout)
{ {
log((CLOG_DEBUG1 "cleaning up threads")); log((CLOG_DEBUG1 "cleaning up threads"));
@ -1567,9 +1499,7 @@ CServer::cleanupThreads(
} }
CServer::CScreenInfo* CServer::CScreenInfo*
CServer::addConnection( CServer::addConnection(const CString& name, IServerProtocol* protocol)
const CString& name,
IServerProtocol* protocol)
{ {
log((CLOG_DEBUG "adding connection \"%s\"", name.c_str())); log((CLOG_DEBUG "adding connection \"%s\"", name.c_str()));
@ -1594,8 +1524,7 @@ CServer::addConnection(
} }
void void
CServer::removeConnection( CServer::removeConnection(const CString& name)
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); CLock lock(&m_mutex);
@ -1630,8 +1559,7 @@ CServer::removeConnection(
// CServer::CCleanupNote // CServer::CCleanupNote
// //
CServer::CCleanupNote::CCleanupNote( CServer::CCleanupNote::CCleanupNote(CServer* server) :
CServer* server) :
m_server(server) m_server(server)
{ {
assert(m_server != NULL); assert(m_server != NULL);
@ -1648,10 +1576,8 @@ CServer::CCleanupNote::~CCleanupNote()
// CServer::CConnectionNote // CServer::CConnectionNote
// //
CServer::CConnectionNote::CConnectionNote( CServer::CConnectionNote::CConnectionNote(CServer* server,
CServer* server, const CString& name, IServerProtocol* protocol) :
const CString& name,
IServerProtocol* protocol) :
m_server(server), m_server(server),
m_name(name) m_name(name)
{ {
@ -1669,8 +1595,7 @@ CServer::CConnectionNote::~CConnectionNote()
// CServer::CScreenInfo // CServer::CScreenInfo
// //
CServer::CScreenInfo::CScreenInfo( CServer::CScreenInfo::CScreenInfo(const CString& name,
const CString& name,
IServerProtocol* protocol) : IServerProtocol* protocol) :
m_thread(CThread::getCurrentThread()), m_thread(CThread::getCurrentThread()),
m_name(name), m_name(name),

View File

@ -9,11 +9,8 @@
// CServerProtocol // CServerProtocol
// //
CServerProtocol::CServerProtocol( CServerProtocol::CServerProtocol(CServer* server, const CString& client,
CServer* server, IInputStream* input, IOutputStream* output) :
const CString& client,
IInputStream* input,
IOutputStream* output) :
m_server(server), m_server(server),
m_client(client), m_client(client),
m_input(input), m_input(input),
@ -54,13 +51,9 @@ CServerProtocol::getOutputStream() const
} }
IServerProtocol* IServerProtocol*
CServerProtocol::create( CServerProtocol::create(SInt32 major, SInt32 minor,
SInt32 major, CServer* server, const CString& client,
SInt32 minor, IInputStream* input, IOutputStream* output)
CServer* server,
const CString& client,
IInputStream* input,
IOutputStream* output)
{ {
// disallow invalid version numbers // disallow invalid version numbers
if (major < 0 || minor < 0) { if (major < 0 || minor < 0) {

View File

@ -14,11 +14,8 @@
// CServerProtocol1_0 // CServerProtocol1_0
// //
CServerProtocol1_0::CServerProtocol1_0( CServerProtocol1_0::CServerProtocol1_0(CServer* server, const CString& client,
CServer* server, IInputStream* input, IOutputStream* output) :
const CString& client,
IInputStream* input,
IOutputStream* output) :
CServerProtocol(server, client, input, output) CServerProtocol(server, client, input, output)
{ {
// do nothing // do nothing
@ -106,11 +103,8 @@ CServerProtocol1_0::sendClose()
} }
void void
CServerProtocol1_0::sendEnter( CServerProtocol1_0::sendEnter(SInt32 xAbs, SInt32 yAbs,
SInt32 xAbs, UInt32 seqNum, KeyModifierMask mask)
SInt32 yAbs,
UInt32 seqNum,
KeyModifierMask mask)
{ {
log((CLOG_DEBUG1 "send enter to \"%s\", %d,%d %d %04x", getClient().c_str(), xAbs, yAbs, seqNum, mask)); log((CLOG_DEBUG1 "send enter to \"%s\", %d,%d %d %04x", getClient().c_str(), xAbs, yAbs, seqNum, mask));
CProtocolUtil::writef(getOutputStream(), kMsgCEnter, CProtocolUtil::writef(getOutputStream(), kMsgCEnter,
@ -125,25 +119,21 @@ CServerProtocol1_0::sendLeave()
} }
void void
CServerProtocol1_0::sendClipboard( CServerProtocol1_0::sendClipboard(ClipboardID id, const CString& data)
ClipboardID id,
const CString& data)
{ {
log((CLOG_DEBUG "send clipboard %d to \"%s\" size=%d", id, getClient().c_str(), data.size())); log((CLOG_DEBUG "send clipboard %d to \"%s\" size=%d", id, getClient().c_str(), data.size()));
CProtocolUtil::writef(getOutputStream(), kMsgDClipboard, id, 0, &data); CProtocolUtil::writef(getOutputStream(), kMsgDClipboard, id, 0, &data);
} }
void void
CServerProtocol1_0::sendGrabClipboard( CServerProtocol1_0::sendGrabClipboard(ClipboardID id)
ClipboardID id)
{ {
log((CLOG_DEBUG "send grab clipboard %d to \"%s\"", id, getClient().c_str())); log((CLOG_DEBUG "send grab clipboard %d to \"%s\"", id, getClient().c_str()));
CProtocolUtil::writef(getOutputStream(), kMsgCClipboard, id, 0); CProtocolUtil::writef(getOutputStream(), kMsgCClipboard, id, 0);
} }
void void
CServerProtocol1_0::sendScreenSaver( CServerProtocol1_0::sendScreenSaver(bool on)
bool on)
{ {
log((CLOG_DEBUG1 "send screen saver to \"%s\" on=%d", getClient().c_str(), on ? 1 : 0)); log((CLOG_DEBUG1 "send screen saver to \"%s\" on=%d", getClient().c_str(), on ? 1 : 0));
CProtocolUtil::writef(getOutputStream(), kMsgCScreenSaver, on ? 1 : 0); CProtocolUtil::writef(getOutputStream(), kMsgCScreenSaver, on ? 1 : 0);
@ -157,61 +147,49 @@ CServerProtocol1_0::sendInfoAcknowledgment()
} }
void void
CServerProtocol1_0::sendKeyDown( CServerProtocol1_0::sendKeyDown(KeyID key, KeyModifierMask mask)
KeyID key,
KeyModifierMask mask)
{ {
log((CLOG_DEBUG1 "send key down to \"%s\" id=%d, mask=0x%04x", getClient().c_str(), key, mask)); log((CLOG_DEBUG1 "send key down to \"%s\" id=%d, mask=0x%04x", getClient().c_str(), key, mask));
CProtocolUtil::writef(getOutputStream(), kMsgDKeyDown, key, mask); CProtocolUtil::writef(getOutputStream(), kMsgDKeyDown, key, mask);
} }
void void
CServerProtocol1_0::sendKeyRepeat( CServerProtocol1_0::sendKeyRepeat(KeyID key, KeyModifierMask mask, SInt32 count)
KeyID key,
KeyModifierMask mask,
SInt32 count)
{ {
log((CLOG_DEBUG1 "send key repeat to \"%s\" id=%d, mask=0x%04x, count=%d", getClient().c_str(), key, mask, count)); log((CLOG_DEBUG1 "send key repeat to \"%s\" id=%d, mask=0x%04x, count=%d", getClient().c_str(), key, mask, count));
CProtocolUtil::writef(getOutputStream(), kMsgDKeyRepeat, key, mask, count); CProtocolUtil::writef(getOutputStream(), kMsgDKeyRepeat, key, mask, count);
} }
void void
CServerProtocol1_0::sendKeyUp( CServerProtocol1_0::sendKeyUp(KeyID key, KeyModifierMask mask)
KeyID key,
KeyModifierMask mask)
{ {
log((CLOG_DEBUG1 "send key up to \"%s\" id=%d, mask=0x%04x", getClient().c_str(), key, mask)); log((CLOG_DEBUG1 "send key up to \"%s\" id=%d, mask=0x%04x", getClient().c_str(), key, mask));
CProtocolUtil::writef(getOutputStream(), kMsgDKeyUp, key, mask); CProtocolUtil::writef(getOutputStream(), kMsgDKeyUp, key, mask);
} }
void void
CServerProtocol1_0::sendMouseDown( CServerProtocol1_0::sendMouseDown(ButtonID button)
ButtonID button)
{ {
log((CLOG_DEBUG1 "send mouse down to \"%s\" id=%d", getClient().c_str(), button)); log((CLOG_DEBUG1 "send mouse down to \"%s\" id=%d", getClient().c_str(), button));
CProtocolUtil::writef(getOutputStream(), kMsgDMouseDown, button); CProtocolUtil::writef(getOutputStream(), kMsgDMouseDown, button);
} }
void void
CServerProtocol1_0::sendMouseUp( CServerProtocol1_0::sendMouseUp(ButtonID button)
ButtonID button)
{ {
log((CLOG_DEBUG1 "send mouse up to \"%s\" id=%d", getClient().c_str(), button)); log((CLOG_DEBUG1 "send mouse up to \"%s\" id=%d", getClient().c_str(), button));
CProtocolUtil::writef(getOutputStream(), kMsgDMouseUp, button); CProtocolUtil::writef(getOutputStream(), kMsgDMouseUp, button);
} }
void void
CServerProtocol1_0::sendMouseMove( CServerProtocol1_0::sendMouseMove(SInt32 xAbs, SInt32 yAbs)
SInt32 xAbs,
SInt32 yAbs)
{ {
log((CLOG_DEBUG2 "send mouse move to \"%s\" %d,%d", getClient().c_str(), xAbs, yAbs)); log((CLOG_DEBUG2 "send mouse move to \"%s\" %d,%d", getClient().c_str(), xAbs, yAbs));
CProtocolUtil::writef(getOutputStream(), kMsgDMouseMove, xAbs, yAbs); CProtocolUtil::writef(getOutputStream(), kMsgDMouseMove, xAbs, yAbs);
} }
void void
CServerProtocol1_0::sendMouseWheel( CServerProtocol1_0::sendMouseWheel(SInt32 delta)
SInt32 delta)
{ {
log((CLOG_DEBUG2 "send mouse wheel to \"%s\" %+d", getClient().c_str(), delta)); log((CLOG_DEBUG2 "send mouse wheel to \"%s\" %+d", getClient().c_str(), delta));
CProtocolUtil::writef(getOutputStream(), kMsgDMouseWheel, delta); CProtocolUtil::writef(getOutputStream(), kMsgDMouseWheel, delta);

View File

@ -89,10 +89,7 @@ restoreCursor()
static static
LRESULT CALLBACK LRESULT CALLBACK
keyboardHook( keyboardHook(int code, WPARAM wParam, LPARAM lParam)
int code,
WPARAM wParam,
LPARAM lParam)
{ {
if (code >= 0) { if (code >= 0) {
if (g_relay) { if (g_relay) {
@ -121,10 +118,7 @@ keyboardHook(
static static
LRESULT CALLBACK LRESULT CALLBACK
mouseHook( mouseHook(int code, WPARAM wParam, LPARAM lParam)
int code,
WPARAM wParam,
LPARAM lParam)
{ {
if (code >= 0) { if (code >= 0) {
if (g_relay) { if (g_relay) {
@ -228,10 +222,7 @@ mouseHook(
static static
LRESULT CALLBACK LRESULT CALLBACK
cbtHook( cbtHook(int code, WPARAM wParam, LPARAM lParam)
int code,
WPARAM wParam,
LPARAM lParam)
{ {
if (code >= 0) { if (code >= 0) {
if (g_relay) { if (g_relay) {
@ -244,10 +235,7 @@ cbtHook(
static static
LRESULT CALLBACK LRESULT CALLBACK
getMessageHook( getMessageHook(int code, WPARAM wParam, LPARAM lParam)
int code,
WPARAM wParam,
LPARAM lParam)
{ {
if (code >= 0) { if (code >= 0) {
if (g_relay) { if (g_relay) {
@ -277,10 +265,7 @@ getMessageHook(
static static
LRESULT CALLBACK LRESULT CALLBACK
keyboardLLHook( keyboardLLHook(int code, WPARAM wParam, LPARAM lParam)
int code,
WPARAM wParam,
LPARAM lParam)
{ {
if (code >= 0) { if (code >= 0) {
if (g_relay) { if (g_relay) {
@ -326,8 +311,7 @@ keyboardLLHook(
static static
DWORD WINAPI DWORD WINAPI
getKeyboardLLProc( getKeyboardLLProc(void*)
void*)
{ {
// thread proc for low-level keyboard hook. this does nothing but // thread proc for low-level keyboard hook. this does nothing but
// install the hook, process events, and uninstall the hook. // install the hook, process events, and uninstall the hook.
@ -382,8 +366,7 @@ getKeyboardLLProc(
static static
DWORD WINAPI DWORD WINAPI
getKeyboardLLProc( getKeyboardLLProc(void*)
void*)
{ {
g_keyHookThreadID = 0; g_keyHookThreadID = 0;
SetEvent(g_keyHookEvent); SetEvent(g_keyHookEvent);
@ -441,10 +424,7 @@ getWheelSupport()
// //
BOOL WINAPI BOOL WINAPI
DllMain( DllMain(HINSTANCE instance, DWORD reason, LPVOID)
HINSTANCE instance,
DWORD reason,
LPVOID)
{ {
if (reason == DLL_PROCESS_ATTACH) { if (reason == DLL_PROCESS_ATTACH) {
if (g_hinstance == NULL) { if (g_hinstance == NULL) {
@ -466,8 +446,7 @@ DllMain(
extern "C" { extern "C" {
int int
install( install(DWORD threadID)
DWORD threadID)
{ {
assert(g_threadID == 0); assert(g_threadID == 0);
assert(g_hinstance != NULL); assert(g_hinstance != NULL);
@ -571,8 +550,7 @@ install(
} }
int int
uninstall( uninstall(void)
void)
{ {
assert(g_keyboard != NULL); assert(g_keyboard != NULL);
assert(g_mouse != NULL); assert(g_mouse != NULL);
@ -607,11 +585,7 @@ uninstall(
} }
void void
setZone( setZone(UInt32 sides, SInt32 w, SInt32 h, SInt32 jumpZoneSize)
UInt32 sides,
SInt32 w,
SInt32 h,
SInt32 jumpZoneSize)
{ {
g_zoneSize = jumpZoneSize; g_zoneSize = jumpZoneSize;
g_zoneSides = sides; g_zoneSides = sides;
@ -622,8 +596,7 @@ setZone(
} }
void void
setRelay( setRelay(void)
void)
{ {
g_relay = true; g_relay = true;
g_zoneSize = 0; g_zoneSize = 0;

View File

@ -194,8 +194,7 @@ CXWindowsPrimaryScreen::stop()
} }
void void
CXWindowsPrimaryScreen::open( CXWindowsPrimaryScreen::open(CServer* server)
CServer* server)
{ {
assert(m_server == NULL); assert(m_server == NULL);
assert(server != NULL); assert(server != NULL);
@ -252,9 +251,7 @@ CXWindowsPrimaryScreen::close()
} }
void void
CXWindowsPrimaryScreen::enter( CXWindowsPrimaryScreen::enter(SInt32 x, SInt32 y)
SInt32 x,
SInt32 y)
{ {
log((CLOG_INFO "entering primary at %d,%d", x, y)); log((CLOG_INFO "entering primary at %d,%d", x, y));
assert(m_active == true); assert(m_active == true);
@ -356,19 +353,14 @@ CXWindowsPrimaryScreen::onConfigure()
} }
void void
CXWindowsPrimaryScreen::warpCursor( CXWindowsPrimaryScreen::warpCursor(SInt32 x, SInt32 y)
SInt32 x,
SInt32 y)
{ {
CDisplayLock display(this); CDisplayLock display(this);
warpCursorNoLock(display, x, y); warpCursorNoLock(display, x, y);
} }
void void
CXWindowsPrimaryScreen::warpCursorNoLock( CXWindowsPrimaryScreen::warpCursorNoLock(Display* display, SInt32 x, SInt32 y)
Display* display,
SInt32 x,
SInt32 y)
{ {
assert(display != NULL); assert(display != NULL);
assert(m_window != None); assert(m_window != None);
@ -387,24 +379,20 @@ CXWindowsPrimaryScreen::warpCursorNoLock(
} }
void void
CXWindowsPrimaryScreen::setClipboard( CXWindowsPrimaryScreen::setClipboard(ClipboardID id,
ClipboardID id,
const IClipboard* clipboard) const IClipboard* clipboard)
{ {
setDisplayClipboard(id, clipboard); setDisplayClipboard(id, clipboard);
} }
void void
CXWindowsPrimaryScreen::grabClipboard( CXWindowsPrimaryScreen::grabClipboard(ClipboardID id)
ClipboardID id)
{ {
setDisplayClipboard(id, NULL); setDisplayClipboard(id, NULL);
} }
void void
CXWindowsPrimaryScreen::getSize( CXWindowsPrimaryScreen::getSize(SInt32* width, SInt32* height) const
SInt32* width,
SInt32* height) const
{ {
getScreenSize(width, height); getScreenSize(width, height);
} }
@ -416,8 +404,7 @@ CXWindowsPrimaryScreen::getJumpZoneSize() const
} }
void void
CXWindowsPrimaryScreen::getClipboard( CXWindowsPrimaryScreen::getClipboard(ClipboardID id,
ClipboardID id,
IClipboard* clipboard) const IClipboard* clipboard) const
{ {
getDisplayClipboard(id, clipboard); getDisplayClipboard(id, clipboard);
@ -484,8 +471,7 @@ CXWindowsPrimaryScreen::isLockedToScreen() const
} }
void void
CXWindowsPrimaryScreen::onOpenDisplay( CXWindowsPrimaryScreen::onOpenDisplay(Display* display)
Display* display)
{ {
assert(m_window == None); assert(m_window == None);
@ -516,16 +502,14 @@ CXWindowsPrimaryScreen::onOpenDisplay(
} }
CXWindowsClipboard* CXWindowsClipboard*
CXWindowsPrimaryScreen::createClipboard( CXWindowsPrimaryScreen::createClipboard(ClipboardID id)
ClipboardID id)
{ {
CDisplayLock display(this); CDisplayLock display(this);
return new CXWindowsClipboard(display, m_window, id); return new CXWindowsClipboard(display, m_window, id);
} }
void void
CXWindowsPrimaryScreen::onCloseDisplay( CXWindowsPrimaryScreen::onCloseDisplay(Display* display)
Display* display)
{ {
assert(m_window != None); assert(m_window != None);
@ -546,17 +530,14 @@ CXWindowsPrimaryScreen::onUnexpectedClose()
} }
void void
CXWindowsPrimaryScreen::onLostClipboard( CXWindowsPrimaryScreen::onLostClipboard(ClipboardID id)
ClipboardID id)
{ {
// tell server that the clipboard was grabbed locally // tell server that the clipboard was grabbed locally
m_server->grabClipboard(id); m_server->grabClipboard(id);
} }
void void
CXWindowsPrimaryScreen::selectEvents( CXWindowsPrimaryScreen::selectEvents(Display* display, Window w) const
Display* display,
Window w) const
{ {
// ignore errors while we adjust event masks // ignore errors while we adjust event masks
CXWindowsUtil::CErrorLock lock; CXWindowsUtil::CErrorLock lock;
@ -566,9 +547,7 @@ CXWindowsPrimaryScreen::selectEvents(
} }
void void
CXWindowsPrimaryScreen::doSelectEvents( CXWindowsPrimaryScreen::doSelectEvents(Display* display, Window w) const
Display* display,
Window w) const
{ {
// we want to track the mouse everywhere on the display. to achieve // we want to track the mouse everywhere on the display. to achieve
// that we select PointerMotionMask on every window. we also select // that we select PointerMotionMask on every window. we also select
@ -595,8 +574,7 @@ CXWindowsPrimaryScreen::doSelectEvents(
} }
KeyModifierMask KeyModifierMask
CXWindowsPrimaryScreen::mapModifier( CXWindowsPrimaryScreen::mapModifier(unsigned int state) const
unsigned int state) const
{ {
// FIXME -- should be configurable // FIXME -- should be configurable
KeyModifierMask mask = 0; KeyModifierMask mask = 0;
@ -618,8 +596,7 @@ CXWindowsPrimaryScreen::mapModifier(
} }
KeyID KeyID
CXWindowsPrimaryScreen::mapKey( CXWindowsPrimaryScreen::mapKey(XKeyEvent* event) const
XKeyEvent* event) const
{ {
KeySym keysym; KeySym keysym;
char dummy[1]; char dummy[1];
@ -630,8 +607,7 @@ CXWindowsPrimaryScreen::mapKey(
} }
ButtonID ButtonID
CXWindowsPrimaryScreen::mapButton( CXWindowsPrimaryScreen::mapButton(unsigned int button) const
unsigned int button) const
{ {
// FIXME -- should use button mapping? // FIXME -- should use button mapping?
if (button >= 1 && button <= 3) { if (button >= 1 && button <= 3) {
@ -643,8 +619,7 @@ CXWindowsPrimaryScreen::mapButton(
} }
void void
CXWindowsPrimaryScreen::updateModifierMap( CXWindowsPrimaryScreen::updateModifierMap(Display* display)
Display* display)
{ {
// get modifier map from server // get modifier map from server
XModifierKeymap* keymap = XGetModifierMapping(display); XModifierKeymap* keymap = XGetModifierMapping(display);
@ -679,10 +654,7 @@ CXWindowsPrimaryScreen::updateModifierMap(
} }
Bool Bool
CXWindowsPrimaryScreen::findKeyEvent( CXWindowsPrimaryScreen::findKeyEvent(Display*, XEvent* xevent, XPointer arg)
Display*,
XEvent* xevent,
XPointer arg)
{ {
CKeyEventInfo* filter = reinterpret_cast<CKeyEventInfo*>(arg); CKeyEventInfo* filter = reinterpret_cast<CKeyEventInfo*>(arg);
return (xevent->type == filter->m_event && return (xevent->type == filter->m_event &&

View File

@ -54,8 +54,7 @@ static CMutex* s_logMutex = NULL;
static static
void void
logLock( logLock(bool lock)
bool lock)
{ {
assert(s_logMutex != NULL); assert(s_logMutex != NULL);
@ -76,8 +75,7 @@ static CServer* s_server = NULL;
static static
int int
realMain( realMain(CMutex* mutex)
CMutex* mutex)
{ {
// s_serverLock should have mutex locked on entry // s_serverLock should have mutex locked on entry
@ -293,11 +291,8 @@ PLATFORM_EXTRA
static static
bool bool
isArg(int argi, isArg(int argi, int argc, const char** argv,
int argc, const char* name1, const char* name2,
const char** argv,
const char* name1,
const char* name2,
int minRequiredParameters = 0) int minRequiredParameters = 0)
{ {
if ((name1 != NULL && strcmp(argv[argi], name1) == 0) || if ((name1 != NULL && strcmp(argv[argi], name1) == 0) ||
@ -317,9 +312,7 @@ isArg(int argi,
static static
void void
parse( parse(int argc, const char** argv)
int argc,
const char** argv)
{ {
assert(pname != NULL); assert(pname != NULL);
assert(argv != NULL); assert(argv != NULL);
@ -480,9 +473,7 @@ parse(
static static
bool bool
loadConfig( loadConfig(const char* pathname, bool require)
const char* pathname,
bool require)
{ {
assert(pathname != NULL); assert(pathname != NULL);
@ -556,9 +547,7 @@ loadConfig()
static static
bool bool
logMessageBox( logMessageBox(int priority, const char* msg)
int priority,
const char* msg)
{ {
if (priority <= CLog::kFATAL) { if (priority <= CLog::kFATAL) {
MessageBox(NULL, msg, pname, MB_OK | MB_ICONWARNING); MessageBox(NULL, msg, pname, MB_OK | MB_ICONWARNING);
@ -585,10 +574,7 @@ daemonStop(void)
static static
int int
daemonStartup( daemonStartup(IPlatform* iplatform, int argc, const char** argv)
IPlatform* iplatform,
int argc,
const char** argv)
{ {
// get platform pointer // get platform pointer
CWin32Platform* platform = static_cast<CWin32Platform*>(iplatform); CWin32Platform* platform = static_cast<CWin32Platform*>(iplatform);
@ -614,9 +600,7 @@ daemonStartup(
static static
bool bool
logDiscard( logDiscard(int, const char*)
int,
const char*)
{ {
return true; return true;
} }
@ -636,11 +620,7 @@ checkParse(int e)
} }
int WINAPI int WINAPI
WinMain( WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
HINSTANCE instance,
HINSTANCE,
LPSTR,
int)
{ {
CPlatform platform; CPlatform platform;
@ -779,18 +759,13 @@ WinMain(
static static
int int
daemonStartup( daemonStartup(IPlatform*, int, const char**)
IPlatform*,
int,
const char**)
{ {
return restartableMain(); return restartableMain();
} }
int int
main( main(int argc, char** argv)
int argc,
char** argv)
{ {
CPlatform platform; CPlatform platform;

View File

@ -39,9 +39,7 @@ CClipboard::empty()
} }
void void
CClipboard::add( CClipboard::add(EFormat format, const CString& data)
EFormat format,
const CString& data)
{ {
assert(m_open); assert(m_open);
assert(m_owner); assert(m_owner);
@ -51,8 +49,7 @@ CClipboard::add(
} }
bool bool
CClipboard::open( CClipboard::open(Time time) const
Time time) const
{ {
assert(!m_open); assert(!m_open);
@ -77,25 +74,21 @@ CClipboard::getTime() const
} }
bool bool
CClipboard::has( CClipboard::has(EFormat format) const
EFormat format) const
{ {
assert(m_open); assert(m_open);
return m_added[format]; return m_added[format];
} }
CString CString
CClipboard::get( CClipboard::get(EFormat format) const
EFormat format) const
{ {
assert(m_open); assert(m_open);
return m_data[format]; return m_data[format];
} }
bool bool
CClipboard::copy( CClipboard::copy(IClipboard* dst, const IClipboard* src)
IClipboard* dst,
const IClipboard* src)
{ {
assert(dst != NULL); assert(dst != NULL);
assert(src != NULL); assert(src != NULL);
@ -104,10 +97,7 @@ CClipboard::copy(
} }
bool bool
CClipboard::copy( CClipboard::copy(IClipboard* dst, const IClipboard* src, Time time)
IClipboard* dst,
const IClipboard* src,
Time time)
{ {
assert(dst != NULL); assert(dst != NULL);
assert(src != NULL); assert(src != NULL);
@ -134,9 +124,7 @@ CClipboard::copy(
} }
void void
CClipboard::unmarshall( CClipboard::unmarshall(const CString& data, Time time)
const CString& data,
Time time)
{ {
const char* index = data.data(); const char* index = data.data();
@ -201,8 +189,7 @@ CClipboard::marshall() const
} }
UInt32 UInt32
CClipboard::readUInt32( CClipboard::readUInt32(const char* buf) const
const char* buf) const
{ {
const unsigned char* ubuf = reinterpret_cast<const unsigned char*>(buf); const unsigned char* ubuf = reinterpret_cast<const unsigned char*>(buf);
return (static_cast<UInt32>(ubuf[0]) << 24) | return (static_cast<UInt32>(ubuf[0]) << 24) |
@ -212,9 +199,7 @@ CClipboard::readUInt32(
} }
void void
CClipboard::writeUInt32( CClipboard::writeUInt32(CString* buf, UInt32 v) const
CString* buf,
UInt32 v) const
{ {
*buf += static_cast<UInt8>((v >> 24) & 0xff); *buf += static_cast<UInt8>((v >> 24) & 0xff);
*buf += static_cast<UInt8>((v >> 16) & 0xff); *buf += static_cast<UInt8>((v >> 16) & 0xff);

View File

@ -5,9 +5,7 @@
// CInputPacketStream // CInputPacketStream
// //
CInputPacketStream::CInputPacketStream( CInputPacketStream::CInputPacketStream(IInputStream* stream, bool adopt) :
IInputStream* stream,
bool adopt) :
CInputStreamFilter(stream, adopt), CInputStreamFilter(stream, adopt),
m_mutex(), m_mutex(),
m_size(0), m_size(0),
@ -28,9 +26,7 @@ CInputPacketStream::close()
} }
UInt32 UInt32
CInputPacketStream::read( CInputPacketStream::read(void* buffer, UInt32 n)
void* buffer,
UInt32 n)
{ {
CLock lock(&m_mutex); CLock lock(&m_mutex);

View File

@ -4,9 +4,7 @@
// COuputPacketStream // COuputPacketStream
// //
COutputPacketStream::COutputPacketStream( COutputPacketStream::COutputPacketStream(IOutputStream* stream, bool adopt) :
IOutputStream* stream,
bool adopt) :
COutputStreamFilter(stream, adopt) COutputStreamFilter(stream, adopt)
{ {
// do nothing // do nothing
@ -24,9 +22,7 @@ COutputPacketStream::close()
} }
UInt32 UInt32
COutputPacketStream::write( COutputPacketStream::write(const void* buffer, UInt32 count)
const void* buffer,
UInt32 count)
{ {
// write the length of the payload // write the length of the payload
UInt8 length[4]; UInt8 length[4];

View File

@ -10,10 +10,7 @@
// //
void void
CProtocolUtil::writef( CProtocolUtil::writef(IOutputStream* stream, const char* fmt, ...)
IOutputStream* stream,
const char* fmt,
...)
{ {
assert(stream != NULL); assert(stream != NULL);
assert(fmt != NULL); assert(fmt != NULL);
@ -50,10 +47,7 @@ CProtocolUtil::writef(
} }
void void
CProtocolUtil::readf( CProtocolUtil::readf(IInputStream* stream, const char* fmt, ...)
IInputStream* stream,
const char* fmt,
...)
{ {
assert(stream != NULL); assert(stream != NULL);
assert(fmt != NULL); assert(fmt != NULL);
@ -185,9 +179,7 @@ CProtocolUtil::readf(
} }
UInt32 UInt32
CProtocolUtil::getLength( CProtocolUtil::getLength(const char* fmt, va_list args)
const char* fmt,
va_list args)
{ {
UInt32 n = 0; UInt32 n = 0;
while (*fmt) { while (*fmt) {
@ -236,10 +228,7 @@ CProtocolUtil::getLength(
} }
void void
CProtocolUtil::writef( CProtocolUtil::writef(void* buffer, const char* fmt, va_list args)
void* buffer,
const char* fmt,
va_list args)
{ {
UInt8* dst = reinterpret_cast<UInt8*>(buffer); UInt8* dst = reinterpret_cast<UInt8*>(buffer);
@ -326,8 +315,7 @@ CProtocolUtil::writef(
} }
UInt32 UInt32
CProtocolUtil::eatLength( CProtocolUtil::eatLength(const char** pfmt)
const char** pfmt)
{ {
const char* fmt = *pfmt; const char* fmt = *pfmt;
UInt32 n = 0; UInt32 n = 0;
@ -352,10 +340,7 @@ CProtocolUtil::eatLength(
} }
void void
CProtocolUtil::read( CProtocolUtil::read(IInputStream* stream, void* vbuffer, UInt32 count)
IInputStream* stream,
void* vbuffer,
UInt32 count)
{ {
assert(stream != NULL); assert(stream != NULL);
assert(vbuffer != NULL); assert(vbuffer != NULL);

View File

@ -15,9 +15,7 @@ XBadClient::getWhat() const throw()
// XIncompatibleClient // XIncompatibleClient
// //
XIncompatibleClient::XIncompatibleClient( XIncompatibleClient::XIncompatibleClient(int major, int minor) :
int major,
int minor) :
m_major(major), m_major(major),
m_minor(minor) m_minor(minor)
{ {
@ -47,8 +45,7 @@ XIncompatibleClient::getWhat() const throw()
// XDuplicateClient // XDuplicateClient
// //
XDuplicateClient::XDuplicateClient( XDuplicateClient::XDuplicateClient(const CString& name) :
const CString& name) :
m_name(name) m_name(name)
{ {
// do nothing // do nothing
@ -71,8 +68,7 @@ XDuplicateClient::getWhat() const throw()
// XUnknownClient // XUnknownClient
// //
XUnknownClient::XUnknownClient( XUnknownClient::XUnknownClient(const CString& name) :
const CString& name) :
m_name(name) m_name(name)
{ {
// do nothing // do nothing