removed unnecessary global scoping operators.

This commit is contained in:
crs 2001-10-25 22:17:17 +00:00
parent dbdf20e804
commit ef3149cead
8 changed files with 71 additions and 70 deletions

View File

@ -61,7 +61,7 @@ UInt32 CBufferedInputStream::readNoLock(
}
if (n > 0) {
if (dst != NULL) {
::memcpy(dst, m_buffer.peek(n), n);
memcpy(dst, m_buffer.peek(n), n);
}
m_buffer.pop(n);
}

View File

@ -262,11 +262,11 @@ bool CCondVarBase::wait(
m_mutex->unlock();
// wait for a signal or broadcast
DWORD result = ::WaitForMultipleObjects(n, handles, FALSE, winTimeout);
DWORD result = WaitForMultipleObjects(n, handles, FALSE, winTimeout);
// cancel takes priority
if (n == 3 && result != WAIT_OBJECT_0 + 2 &&
::WaitForSingleObject(handles[2], 0) == WAIT_OBJECT_0)
WaitForSingleObject(handles[2], 0) == WAIT_OBJECT_0)
result = WAIT_OBJECT_0 + 2;
// update the waiter count and check if we're the last waiter

View File

@ -107,25 +107,25 @@ void CMutex::unlock() const
void CMutex::init()
{
CRITICAL_SECTION* mutex = new CRITICAL_SECTION;
::InitializeCriticalSection(mutex);
InitializeCriticalSection(mutex);
m_mutex = reinterpret_cast<void*>(mutex);
}
void CMutex::fini()
{
CRITICAL_SECTION* mutex = reinterpret_cast<CRITICAL_SECTION*>(m_mutex);
::DeleteCriticalSection(mutex);
DeleteCriticalSection(mutex);
delete mutex;
}
void CMutex::lock() const
{
::EnterCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(m_mutex));
EnterCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(m_mutex));
}
void CMutex::unlock() const
{
::LeaveCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(m_mutex));
LeaveCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(m_mutex));
}
#endif // CONFIG_PLATFORM_WIN32

View File

@ -449,7 +449,7 @@ void CThreadRep::sleep(double timeout)
if (isCancellable())
WaitForSingleObject(m_cancel, (DWORD)(1000.0 * timeout));
else
::Sleep((DWORD)(1000.0 * timeout));
Sleep((DWORD)(1000.0 * timeout));
}
void CThreadRep::cancel()
@ -461,7 +461,7 @@ void CThreadRep::cancel()
void CThreadRep::testCancel()
{
// poll cancel event. return if not set.
const DWORD result = ::WaitForSingleObject(getCancelEvent(), 0);
const DWORD result = WaitForSingleObject(getCancelEvent(), 0);
if (result != WAIT_OBJECT_0)
return;
@ -504,11 +504,11 @@ bool CThreadRep::wait(CThreadRep* target, double timeout)
HANDLE handles[2];
handles[0] = target->getExitEvent();
handles[1] = m_cancel;
DWORD result = ::WaitForMultipleObjects(n, handles, FALSE, t);
DWORD result = WaitForMultipleObjects(n, handles, FALSE, t);
// cancel takes priority
if (n == 2 && result != WAIT_OBJECT_0 + 1 &&
::WaitForSingleObject(handles[1], 0) == WAIT_OBJECT_0)
WaitForSingleObject(handles[1], 0) == WAIT_OBJECT_0)
result = WAIT_OBJECT_0 + 1;
// handle result
@ -563,7 +563,7 @@ unsigned int __stdcall CThreadRep::threadFunc(void* arg)
CThreadRep* rep = (CThreadRep*)arg;
// initialize OLE
const HRESULT hr = ::OleInitialize(NULL);
const HRESULT hr = OleInitialize(NULL);
// run thread
rep->doThreadFunc();

View File

@ -17,7 +17,7 @@ CNetworkAddress::CNetworkAddress(UInt16 port)
inetAddress->sin_family = AF_INET;
inetAddress->sin_port = htons(port);
inetAddress->sin_addr.s_addr = INADDR_ANY;
::memset(inetAddress->sin_zero, 0, sizeof(inetAddress->sin_zero));
memset(inetAddress->sin_zero, 0, sizeof(inetAddress->sin_zero));
}
CNetworkAddress::CNetworkAddress(const CString& hostname, UInt16 port)
@ -44,8 +44,8 @@ CNetworkAddress::CNetworkAddress(const CString& hostname, UInt16 port)
struct sockaddr_in* inetAddress = reinterpret_cast<struct sockaddr_in*>(&m_address);
inetAddress->sin_family = hent->h_addrtype;
inetAddress->sin_port = htons(port);
::memcpy(&inetAddress->sin_addr, hent->h_addr_list[0], hent->h_length);
::memset(inetAddress->sin_zero, 0, sizeof(inetAddress->sin_zero));
memcpy(&inetAddress->sin_addr, hent->h_addr_list[0], hent->h_length);
memset(inetAddress->sin_zero, 0, sizeof(inetAddress->sin_zero));
}
CNetworkAddress::~CNetworkAddress()

View File

@ -74,7 +74,7 @@ UInt32 CSocketInputStream::read(
n = count;
}
if (n > 0) {
::memcpy(dst, m_buffer.peek(n), n);
memcpy(dst, m_buffer.peek(n), n);
m_buffer.pop(n);
}

View File

@ -36,7 +36,7 @@ void CXWindowsPrimaryScreen::open(CServer* server)
// open the display
log((CLOG_DEBUG "XOpenDisplay(%s)", "NULL"));
m_display = ::XOpenDisplay(NULL); // FIXME -- allow non-default
m_display = XOpenDisplay(NULL); // FIXME -- allow non-default
if (m_display == NULL)
throw int(5); // FIXME -- make exception for this
@ -63,7 +63,7 @@ void CXWindowsPrimaryScreen::open(CServer* server)
attr.do_not_propagate_mask = 0;
attr.override_redirect = True;
attr.cursor = createBlankCursor();
m_window = ::XCreateWindow(m_display, m_root, 0, 0, m_w, m_h, 0, 0,
m_window = XCreateWindow(m_display, m_root, 0, 0, m_w, m_h, 0, 0,
InputOnly, CopyFromParent,
CWDontPropagate | CWEventMask |
CWOverrideRedirect | CWCursor,
@ -92,11 +92,11 @@ void CXWindowsPrimaryScreen::close()
log((CLOG_DEBUG "stopped event thread"));
// destroy window
::XDestroyWindow(m_display, m_window);
XDestroyWindow(m_display, m_window);
m_window = None;
// close the display
::XCloseDisplay(m_display);
XCloseDisplay(m_display);
m_display = NULL;
log((CLOG_DEBUG "closed display"));
}
@ -111,14 +111,14 @@ void CXWindowsPrimaryScreen::enter(SInt32 x, SInt32 y)
CLock lock(&m_mutex);
// warp to requested location
::XWarpPointer(m_display, None, m_window, 0, 0, 0, 0, x, y);
XWarpPointer(m_display, None, m_window, 0, 0, 0, 0, x, y);
// unmap the grab window. this also ungrabs the mouse and keyboard.
::XUnmapWindow(m_display, m_window);
XUnmapWindow(m_display, m_window);
// remove all input events for grab window
XEvent event;
while (::XCheckWindowEvent(m_display, m_window,
while (XCheckWindowEvent(m_display, m_window,
PointerMotionMask |
ButtonPressMask | ButtonReleaseMask |
KeyPressMask | KeyReleaseMask |
@ -141,7 +141,7 @@ void CXWindowsPrimaryScreen::leave()
CLock lock(&m_mutex);
// raise and show the input window
::XMapRaised(m_display, m_window);
XMapRaised(m_display, m_window);
// grab the mouse and keyboard. keep trying until we get them.
// if we can't grab one after grabbing the other then ungrab
@ -150,7 +150,7 @@ void CXWindowsPrimaryScreen::leave()
do {
// mouse first
do {
result = ::XGrabPointer(m_display, m_window, True, 0,
result = XGrabPointer(m_display, m_window, True, 0,
GrabModeAsync, GrabModeAsync,
m_window, None, CurrentTime);
assert(result != GrabNotViewable);
@ -162,11 +162,11 @@ void CXWindowsPrimaryScreen::leave()
log((CLOG_DEBUG "grabbed pointer"));
// now the keyboard
result = ::XGrabKeyboard(m_display, m_window, True,
result = XGrabKeyboard(m_display, m_window, True,
GrabModeAsync, GrabModeAsync, CurrentTime);
assert(result != GrabNotViewable);
if (result != GrabSuccess) {
::XUngrabPointer(m_display, CurrentTime);
XUngrabPointer(m_display, CurrentTime);
log((CLOG_DEBUG "ungrabbed pointer, waiting to grab keyboard"));
CThread::sleep(0.25);
}
@ -190,13 +190,13 @@ void CXWindowsPrimaryScreen::warpCursorNoLock(
SInt32 x, SInt32 y)
{
// warp the mouse
::XWarpPointer(m_display, None, m_root, 0, 0, 0, 0, x, y);
::XSync(m_display, False);
XWarpPointer(m_display, None, m_root, 0, 0, 0, 0, x, y);
XSync(m_display, False);
log((CLOG_DEBUG "warped to %d,%d", x, y));
// discard mouse events since we just added one we don't want
XEvent xevent;
while (::XCheckWindowEvent(m_display, m_window,
while (XCheckWindowEvent(m_display, m_window,
PointerMotionMask, &xevent)) {
// do nothing
}
@ -231,15 +231,15 @@ void CXWindowsPrimaryScreen::selectEvents(Window w) const
return;
// select events of interest
::XSelectInput(m_display, w, PointerMotionMask | SubstructureNotifyMask);
XSelectInput(m_display, w, PointerMotionMask | SubstructureNotifyMask);
// recurse on child windows
Window rw, pw, *cw;
unsigned int nc;
if (::XQueryTree(m_display, w, &rw, &pw, &cw, &nc)) {
if (XQueryTree(m_display, w, &rw, &pw, &cw, &nc)) {
for (unsigned int i = 0; i < nc; ++i)
selectEvents(cw[i]);
::XFree(cw);
XFree(cw);
}
}
@ -249,7 +249,7 @@ Cursor CXWindowsPrimaryScreen::createBlankCursor()
// get the closet cursor size to 1x1
unsigned int w, h;
::XQueryBestCursor(m_display, m_root, 1, 1, &w, &h);
XQueryBestCursor(m_display, m_root, 1, 1, &w, &h);
// make bitmap data for cursor of closet size. since the cursor
// is blank we can use the same bitmap for shape and mask: all
@ -259,7 +259,7 @@ Cursor CXWindowsPrimaryScreen::createBlankCursor()
memset(data, 0, size);
// make bitmap
Pixmap bitmap = ::XCreateBitmapFromData(m_display, m_root, data, w, h);
Pixmap bitmap = XCreateBitmapFromData(m_display, m_root, data, w, h);
// need an arbitrary color for the cursor
XColor color;
@ -268,12 +268,12 @@ Cursor CXWindowsPrimaryScreen::createBlankCursor()
color.flags = DoRed | DoGreen | DoBlue;
// make cursor from bitmap
Cursor cursor = ::XCreatePixmapCursor(m_display, bitmap, bitmap,
Cursor cursor = XCreatePixmapCursor(m_display, bitmap, bitmap,
&color, &color, 0, 0);
// don't need bitmap or the data anymore
delete[] data;
::XFreePixmap(m_display, bitmap);
XFreePixmap(m_display, bitmap);
return cursor;
}
@ -359,7 +359,7 @@ void CXWindowsPrimaryScreen::eventThread(void*)
Window root, window;
int xRoot, yRoot, xWindow, yWindow;
unsigned int mask;
if (!::XQueryPointer(m_display, m_window, &root, &window,
if (!XQueryPointer(m_display, m_window, &root, &window,
&xRoot, &yRoot, &xWindow, &yWindow, &mask))
break;
@ -422,7 +422,7 @@ KeyID CXWindowsPrimaryScreen::mapKey(
index = 1;
else
index = 0;
return static_cast<KeyID>(::XKeycodeToKeysym(m_display, keycode, index));
return static_cast<KeyID>(XKeycodeToKeysym(m_display, keycode, index));
}
ButtonID CXWindowsPrimaryScreen::mapButton(

View File

@ -36,7 +36,7 @@ void CXWindowsSecondaryScreen::open(CClient* client)
// open the display
log((CLOG_DEBUG "XOpenDisplay(%s)", "NULL"));
m_display = ::XOpenDisplay(NULL); // FIXME -- allow non-default
m_display = XOpenDisplay(NULL); // FIXME -- allow non-default
if (m_display == NULL)
throw int(5); // FIXME -- make exception for this
@ -51,7 +51,7 @@ void CXWindowsSecondaryScreen::open(CClient* client)
// verify the availability of the XTest extension
int majorOpcode, firstEvent, firstError;
if (!::XQueryExtension(m_display, XTestExtensionName,
if (!XQueryExtension(m_display, XTestExtensionName,
&majorOpcode, &firstEvent, &firstError))
throw int(6); // FIXME -- make exception for this
@ -67,14 +67,14 @@ void CXWindowsSecondaryScreen::open(CClient* client)
attr.do_not_propagate_mask = 0;
attr.override_redirect = True;
attr.cursor = createBlankCursor();
m_window = ::XCreateWindow(m_display, m_root, 0, 0, 1, 1, 0, 0,
m_window = XCreateWindow(m_display, m_root, 0, 0, 1, 1, 0, 0,
InputOnly, CopyFromParent,
CWDontPropagate | CWEventMask |
CWOverrideRedirect | CWCursor,
&attr);
// become impervious to server grabs
::XTestGrabControl(m_display, True);
XTestGrabControl(m_display, True);
// hide the cursor
leave();
@ -96,14 +96,14 @@ void CXWindowsSecondaryScreen::close()
m_eventThread = NULL;
// no longer impervious to server grabs
::XTestGrabControl(m_display, False);
XTestGrabControl(m_display, False);
// destroy window
::XDestroyWindow(m_display, m_window);
XDestroyWindow(m_display, m_window);
m_window = None;
// close the display
::XCloseDisplay(m_display);
XCloseDisplay(m_display);
m_display = NULL;
}
@ -115,11 +115,11 @@ void CXWindowsSecondaryScreen::enter(SInt32 x, SInt32 y)
CLock lock(&m_mutex);
// warp to requested location
::XTestFakeMotionEvent(m_display, m_screen, x, y, CurrentTime);
::XSync(m_display, False);
XTestFakeMotionEvent(m_display, m_screen, x, y, CurrentTime);
XSync(m_display, False);
// show cursor
::XUnmapWindow(m_display, m_window);
XUnmapWindow(m_display, m_window);
}
void CXWindowsSecondaryScreen::leave()
@ -129,19 +129,20 @@ void CXWindowsSecondaryScreen::leave()
CLock lock(&m_mutex);
// move hider window under the mouse
// move hider window under the mouse (rather than moving the mouse
// somewhere else on the screen)
int x, y, dummy;
unsigned int dummyMask;
Window dummyWindow;
::XQueryPointer(m_display, m_root, &dummyWindow, &dummyWindow,
XQueryPointer(m_display, m_root, &dummyWindow, &dummyWindow,
&x, &y, &dummy, &dummy, &dummyMask);
::XMoveWindow(m_display, m_window, x, y);
XMoveWindow(m_display, m_window, x, y);
// raise and show the hider window
::XMapRaised(m_display, m_window);
XMapRaised(m_display, m_window);
// hide cursor by moving it into the hider window
::XWarpPointer(m_display, None, m_window, 0, 0, 0, 0, 0, 0);
XWarpPointer(m_display, None, m_window, 0, 0, 0, 0, 0, 0);
}
void CXWindowsSecondaryScreen::keyDown(
@ -151,8 +152,8 @@ void CXWindowsSecondaryScreen::keyDown(
CLock lock(&m_mutex);
::XTestFakeKeyEvent(m_display, mapKey(key, mask), True, CurrentTime);
::XSync(m_display, False);
XTestFakeKeyEvent(m_display, mapKey(key, mask), True, CurrentTime);
XSync(m_display, False);
}
void CXWindowsSecondaryScreen::keyRepeat(
@ -172,8 +173,8 @@ void CXWindowsSecondaryScreen::keyUp(
CLock lock(&m_mutex);
::XTestFakeKeyEvent(m_display, mapKey(key, mask), False, CurrentTime);
::XSync(m_display, False);
XTestFakeKeyEvent(m_display, mapKey(key, mask), False, CurrentTime);
XSync(m_display, False);
}
void CXWindowsSecondaryScreen::mouseDown(ButtonID button)
@ -182,8 +183,8 @@ void CXWindowsSecondaryScreen::mouseDown(ButtonID button)
CLock lock(&m_mutex);
::XTestFakeButtonEvent(m_display, mapButton(button), True, CurrentTime);
::XSync(m_display, False);
XTestFakeButtonEvent(m_display, mapButton(button), True, CurrentTime);
XSync(m_display, False);
}
void CXWindowsSecondaryScreen::mouseUp(ButtonID button)
@ -192,8 +193,8 @@ void CXWindowsSecondaryScreen::mouseUp(ButtonID button)
CLock lock(&m_mutex);
::XTestFakeButtonEvent(m_display, mapButton(button), False, CurrentTime);
::XSync(m_display, False);
XTestFakeButtonEvent(m_display, mapButton(button), False, CurrentTime);
XSync(m_display, False);
}
void CXWindowsSecondaryScreen::mouseMove(SInt32 x, SInt32 y)
@ -202,8 +203,8 @@ void CXWindowsSecondaryScreen::mouseMove(SInt32 x, SInt32 y)
CLock lock(&m_mutex);
::XTestFakeMotionEvent(m_display, m_screen, x, y, CurrentTime);
::XSync(m_display, False);
XTestFakeMotionEvent(m_display, m_screen, x, y, CurrentTime);
XSync(m_display, False);
}
void CXWindowsSecondaryScreen::mouseWheel(SInt32)
@ -238,7 +239,7 @@ Cursor CXWindowsSecondaryScreen::createBlankCursor()
// get the closet cursor size to 1x1
unsigned int w, h;
::XQueryBestCursor(m_display, m_root, 1, 1, &w, &h);
XQueryBestCursor(m_display, m_root, 1, 1, &w, &h);
// make bitmap data for cursor of closet size. since the cursor
// is blank we can use the same bitmap for shape and mask: all
@ -248,7 +249,7 @@ Cursor CXWindowsSecondaryScreen::createBlankCursor()
memset(data, 0, size);
// make bitmap
Pixmap bitmap = ::XCreateBitmapFromData(m_display, m_root, data, w, h);
Pixmap bitmap = XCreateBitmapFromData(m_display, m_root, data, w, h);
// need an arbitrary color for the cursor
XColor color;
@ -257,12 +258,12 @@ Cursor CXWindowsSecondaryScreen::createBlankCursor()
color.flags = DoRed | DoGreen | DoBlue;
// make cursor from bitmap
Cursor cursor = ::XCreatePixmapCursor(m_display, bitmap, bitmap,
Cursor cursor = XCreatePixmapCursor(m_display, bitmap, bitmap,
&color, &color, 0, 0);
// don't need bitmap or the data anymore
delete[] data;
::XFreePixmap(m_display, bitmap);
XFreePixmap(m_display, bitmap);
return cursor;
}
@ -289,7 +290,7 @@ void CXWindowsSecondaryScreen::eventThread(void*)
case LeaveNotify: {
// mouse moved out of hider window somehow. hide the window.
CLock lock(&m_mutex);
::XUnmapWindow(m_display, m_window);
XUnmapWindow(m_display, m_window);
break;
}
@ -316,7 +317,7 @@ KeyCode CXWindowsSecondaryScreen::mapKey(
KeyID id, KeyModifierMask /*mask*/) const
{
// FIXME -- use mask
return ::XKeysymToKeycode(m_display, static_cast<KeySym>(id));
return XKeysymToKeycode(m_display, static_cast<KeySym>(id));
}
unsigned int CXWindowsSecondaryScreen::mapButton(