Fixed "c" prefix compile error on Windows

This commit is contained in:
Xinyu Hou 2014-11-11 14:50:09 +00:00
parent 34d8de4c3b
commit 1aaa55163c
20 changed files with 104 additions and 104 deletions

View File

@ -181,17 +181,17 @@ CMSWindowsPortableTaskBarReceiver::runMenu(int x, int y)
break;
case IDC_RELOAD_CONFIG:
m_events->addEvent(Event(m_events->forCServerApp().reloadConfig(),
m_events->addEvent(Event(m_events->forServerApp().reloadConfig(),
m_events->getSystemTarget()));
break;
case IDC_FORCE_RECONNECT:
m_events->addEvent(Event(m_events->forCServerApp().forceReconnect(),
m_events->addEvent(Event(m_events->forServerApp().forceReconnect(),
m_events->getSystemTarget()));
break;
case ID_SYNERGY_RESETSERVER:
m_events->addEvent(Event(m_events->forCServerApp().resetServer(),
m_events->addEvent(Event(m_events->forServerApp().resetServer(),
m_events->getSystemTarget()));
break;

View File

@ -195,17 +195,17 @@ CMSWindowsServerTaskBarReceiver::runMenu(int x, int y)
break;
case IDC_RELOAD_CONFIG:
m_events->addEvent(Event(m_events->forCServerApp().reloadConfig(),
m_events->addEvent(Event(m_events->forServerApp().reloadConfig(),
m_events->getSystemTarget()));
break;
case IDC_FORCE_RECONNECT:
m_events->addEvent(Event(m_events->forCServerApp().forceReconnect(),
m_events->addEvent(Event(m_events->forServerApp().forceReconnect(),
m_events->getSystemTarget()));
break;
case ID_SYNERGY_RESETSERVER:
m_events->addEvent(Event(m_events->forCServerApp().resetServer(),
m_events->addEvent(Event(m_events->forServerApp().resetServer(),
m_events->getSystemTarget()));
break;

View File

@ -243,7 +243,7 @@ FileLogOutputter::~FileLogOutputter()
}
void
CFileLogOutputter::setLogFilename(const char* logFile)
FileLogOutputter::setLogFilename(const char* logFile)
{
assert(logFile != NULL);
m_fileName = logFile;

View File

@ -73,7 +73,7 @@ private:
private:
typedef std::list<IpcClientProxy*> ClientList;
CTCPListenSocket m_socket;
TCPListenSocket m_socket;
NetworkAddress m_address;
ClientList m_clients;
ArchMutex m_clientsMutex;

View File

@ -31,10 +31,10 @@
#include "base/IEventQueue.h"
//
// CTCPListenSocket
// TCPListenSocket
//
CTCPListenSocket::CTCPListenSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer) :
TCPListenSocket::TCPListenSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer) :
m_events(events),
m_socketMultiplexer(socketMultiplexer)
{
@ -47,7 +47,7 @@ CTCPListenSocket::CTCPListenSocket(IEventQueue* events, SocketMultiplexer* socke
}
}
CTCPListenSocket::~CTCPListenSocket()
TCPListenSocket::~TCPListenSocket()
{
try {
if (m_socket != NULL) {
@ -62,7 +62,7 @@ CTCPListenSocket::~CTCPListenSocket()
}
void
CTCPListenSocket::bind(const NetworkAddress& addr)
TCPListenSocket::bind(const NetworkAddress& addr)
{
try {
Lock lock(m_mutex);
@ -70,8 +70,8 @@ CTCPListenSocket::bind(const NetworkAddress& addr)
ARCH->bindSocket(m_socket, addr.getAddress());
ARCH->listenOnSocket(m_socket);
m_socketMultiplexer->addSocket(this,
new TSocketMultiplexerMethodJob<CTCPListenSocket>(
this, &CTCPListenSocket::serviceListening,
new TSocketMultiplexerMethodJob<TCPListenSocket>(
this, &TCPListenSocket::serviceListening,
m_socket, true, false));
}
catch (XArchNetworkAddressInUse& e) {
@ -83,7 +83,7 @@ CTCPListenSocket::bind(const NetworkAddress& addr)
}
void
CTCPListenSocket::close()
TCPListenSocket::close()
{
Lock lock(m_mutex);
if (m_socket == NULL) {
@ -100,21 +100,21 @@ CTCPListenSocket::close()
}
void*
CTCPListenSocket::getEventTarget() const
TCPListenSocket::getEventTarget() const
{
return const_cast<void*>(reinterpret_cast<const void*>(this));
}
IDataSocket*
CTCPListenSocket::accept()
TCPListenSocket::accept()
{
IDataSocket* socket = NULL;
try {
socket = new CTCPSocket(m_events, m_socketMultiplexer, ARCH->acceptSocket(m_socket, NULL));
if (socket != NULL) {
m_socketMultiplexer->addSocket(this,
new TSocketMultiplexerMethodJob<CTCPListenSocket>(
this, &CTCPListenSocket::serviceListening,
new TSocketMultiplexerMethodJob<TCPListenSocket>(
this, &TCPListenSocket::serviceListening,
m_socket, true, false));
}
return socket;
@ -134,7 +134,7 @@ CTCPListenSocket::accept()
}
ISocketMultiplexerJob*
CTCPListenSocket::serviceListening(ISocketMultiplexerJob* job,
TCPListenSocket::serviceListening(ISocketMultiplexerJob* job,
bool read, bool, bool error)
{
if (error) {

View File

@ -30,10 +30,10 @@ class SocketMultiplexer;
/*!
A listen socket using TCP.
*/
class CTCPListenSocket : public IListenSocket {
class TCPListenSocket : public IListenSocket {
public:
CTCPListenSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer);
~CTCPListenSocket();
TCPListenSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer);
~TCPListenSocket();
// ISocket overrides
virtual void bind(const NetworkAddress&);

View File

@ -46,5 +46,5 @@ CTCPSocketFactory::create() const
IListenSocket*
CTCPSocketFactory::createListen() const
{
return new CTCPListenSocket(m_events, m_socketMultiplexer);
return new TCPListenSocket(m_events, m_socketMultiplexer);
}

View File

@ -172,10 +172,10 @@ CMSWindowsSession::nextProcessEntry(HANDLE snapshot, LPPROCESSENTRY32 entry)
return gotEntry;
}
CString
String
CMSWindowsSession::getActiveDesktopName()
{
CString result;
String result;
HDESK hd = OpenInputDesktop(0, TRUE, GENERIC_READ);
if (hd != NULL) {

View File

@ -42,7 +42,7 @@ public:
void updateActiveSession();
CString getActiveDesktopName();
String getActiveDesktopName();
private:
BOOL nextProcessEntry(HANDLE snapshot, LPPROCESSENTRY32 entry);

View File

@ -45,7 +45,7 @@ typedef VOID (WINAPI *SendSas)(BOOL asUser);
const char g_activeDesktop[] = {"activeDesktop:"};
CMSWindowsWatchdog::CMSWindowsWatchdog(
MSWindowsWatchdog::MSWindowsWatchdog(
bool autoDetectCommand,
IpcServer& ipcServer,
IpcLogOutputter& ipcLogOutputter) :
@ -68,7 +68,7 @@ CMSWindowsWatchdog::CMSWindowsWatchdog(
m_condVar = ARCH->newCondVar();
}
CMSWindowsWatchdog::~CMSWindowsWatchdog()
MSWindowsWatchdog::~MSWindowsWatchdog()
{
if (m_condVar != NULL) {
ARCH->closeCondVar(m_condVar);
@ -80,17 +80,17 @@ CMSWindowsWatchdog::~CMSWindowsWatchdog()
}
void
CMSWindowsWatchdog::startAsync()
MSWindowsWatchdog::startAsync()
{
m_thread = new Thread(new TMethodJob<CMSWindowsWatchdog>(
this, &CMSWindowsWatchdog::mainLoop, nullptr));
m_thread = new Thread(new TMethodJob<MSWindowsWatchdog>(
this, &MSWindowsWatchdog::mainLoop, nullptr));
m_outputThread = new Thread(new TMethodJob<CMSWindowsWatchdog>(
this, &CMSWindowsWatchdog::outputLoop, nullptr));
m_outputThread = new Thread(new TMethodJob<MSWindowsWatchdog>(
this, &MSWindowsWatchdog::outputLoop, nullptr));
}
void
CMSWindowsWatchdog::stop()
MSWindowsWatchdog::stop()
{
m_monitoring = false;
@ -102,7 +102,7 @@ CMSWindowsWatchdog::stop()
}
HANDLE
CMSWindowsWatchdog::duplicateProcessToken(HANDLE process, LPSECURITY_ATTRIBUTES security)
MSWindowsWatchdog::duplicateProcessToken(HANDLE process, LPSECURITY_ATTRIBUTES security)
{
HANDLE sourceToken;
@ -133,7 +133,7 @@ CMSWindowsWatchdog::duplicateProcessToken(HANDLE process, LPSECURITY_ATTRIBUTES
}
HANDLE
CMSWindowsWatchdog::getUserToken(LPSECURITY_ATTRIBUTES security)
MSWindowsWatchdog::getUserToken(LPSECURITY_ATTRIBUTES security)
{
// always elevate if we are at the vista/7 login screen. we could also
// elevate for the uac dialog (consent.exe) but this would be pointless,
@ -160,7 +160,7 @@ CMSWindowsWatchdog::getUserToken(LPSECURITY_ATTRIBUTES security)
}
void
CMSWindowsWatchdog::mainLoop(void*)
MSWindowsWatchdog::mainLoop(void*)
{
shutdownExistingProcesses();
@ -255,7 +255,7 @@ CMSWindowsWatchdog::mainLoop(void*)
}
bool
CMSWindowsWatchdog::isProcessActive()
MSWindowsWatchdog::isProcessActive()
{
DWORD exitCode;
GetExitCodeProcess(m_processInfo.hProcess, &exitCode);
@ -263,13 +263,13 @@ CMSWindowsWatchdog::isProcessActive()
}
void
CMSWindowsWatchdog::setFileLogOutputter(CFileLogOutputter* outputter)
MSWindowsWatchdog::setFileLogOutputter(FileLogOutputter* outputter)
{
m_fileLogOutputter = outputter;
}
void
CMSWindowsWatchdog::startProcess()
MSWindowsWatchdog::startProcess()
{
if (m_command.empty()) {
throw XMSWindowsWatchdogError("cannot start process, command is empty");
@ -325,7 +325,7 @@ CMSWindowsWatchdog::startProcess()
}
BOOL
CMSWindowsWatchdog::doStartProcess(CString& command, HANDLE userToken, LPSECURITY_ATTRIBUTES sa)
MSWindowsWatchdog::doStartProcess(String& command, HANDLE userToken, LPSECURITY_ATTRIBUTES sa)
{
// clear, as we're reusing process info struct
ZeroMemory(&m_processInfo, sizeof(PROCESS_INFORMATION));
@ -364,7 +364,7 @@ CMSWindowsWatchdog::doStartProcess(CString& command, HANDLE userToken, LPSECURIT
}
void
CMSWindowsWatchdog::setCommand(const std::string& command, bool elevate)
MSWindowsWatchdog::setCommand(const std::string& command, bool elevate)
{
LOG((CLOG_INFO "service command updated"));
m_command = command;
@ -374,7 +374,7 @@ CMSWindowsWatchdog::setCommand(const std::string& command, bool elevate)
}
std::string
CMSWindowsWatchdog::getCommand() const
MSWindowsWatchdog::getCommand() const
{
if (!m_autoDetectCommand) {
return m_command;
@ -400,7 +400,7 @@ CMSWindowsWatchdog::getCommand() const
}
void
CMSWindowsWatchdog::outputLoop(void*)
MSWindowsWatchdog::outputLoop(void*)
{
// +1 char for \0
CHAR buffer[kOutputBufferSize + 1];
@ -432,7 +432,7 @@ CMSWindowsWatchdog::outputLoop(void*)
}
void
CMSWindowsWatchdog::shutdownProcess(HANDLE handle, DWORD pid, int timeout)
MSWindowsWatchdog::shutdownProcess(HANDLE handle, DWORD pid, int timeout)
{
DWORD exitCode;
GetExitCodeProcess(handle, &exitCode);
@ -472,7 +472,7 @@ CMSWindowsWatchdog::shutdownProcess(HANDLE handle, DWORD pid, int timeout)
}
void
CMSWindowsWatchdog::shutdownExistingProcesses()
MSWindowsWatchdog::shutdownExistingProcesses()
{
// first we need to take a snapshot of the running processes
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
@ -526,11 +526,11 @@ CMSWindowsWatchdog::shutdownExistingProcesses()
}
void
CMSWindowsWatchdog::getActiveDesktop(LPSECURITY_ATTRIBUTES security)
MSWindowsWatchdog::getActiveDesktop(LPSECURITY_ATTRIBUTES security)
{
CString installedDir = ARCH->getInstalledDirectory();
String installedDir = ARCH->getInstalledDirectory();
if (!installedDir.empty()) {
CString syntoolCommand;
String syntoolCommand;
syntoolCommand.append("\"").append(installedDir).append("\\").append("syntool").append("\"");
syntoolCommand.append(" --get-active-desktop");
@ -560,14 +560,14 @@ CMSWindowsWatchdog::getActiveDesktop(LPSECURITY_ATTRIBUTES security)
}
void
CMSWindowsWatchdog::testOutput(CString buffer)
MSWindowsWatchdog::testOutput(String buffer)
{
// HACK: check standard output seems hacky.
size_t i = buffer.find(g_activeDesktop);
if (i != CString::npos) {
if (i != String::npos) {
size_t s = sizeof(g_activeDesktop);
CString defaultDesktop("Default");
CString sub = buffer.substr(s - 1, defaultDesktop.size());
String defaultDesktop("Default");
String sub = buffer.substr(s - 1, defaultDesktop.size());
if (sub != defaultDesktop) {
m_autoElevated = true;
}

View File

@ -32,20 +32,20 @@ class IpcLogOutputter;
class IpcServer;
class FileLogOutputter;
class CMSWindowsWatchdog {
class MSWindowsWatchdog {
public:
CMSWindowsWatchdog(
MSWindowsWatchdog(
bool autoDetectCommand,
IpcServer& ipcServer,
IpcLogOutputter& ipcLogOutputter);
virtual ~CMSWindowsWatchdog();
virtual ~MSWindowsWatchdog();
void startAsync();
std::string getCommand() const;
void setCommand(const std::string& command, bool elevate);
void stop();
bool isProcessActive();
void setFileLogOutputter(CFileLogOutputter* outputter);
void setFileLogOutputter(FileLogOutputter* outputter);
private:
void mainLoop(void*);
@ -55,20 +55,20 @@ private:
HANDLE duplicateProcessToken(HANDLE process, LPSECURITY_ATTRIBUTES security);
HANDLE getUserToken(LPSECURITY_ATTRIBUTES security);
void startProcess();
BOOL doStartProcess(CString& command, HANDLE userToken, LPSECURITY_ATTRIBUTES sa);
BOOL doStartProcess(String& command, HANDLE userToken, LPSECURITY_ATTRIBUTES sa);
void sendSas();
void getActiveDesktop(LPSECURITY_ATTRIBUTES security);
void testOutput(CString buffer);
void testOutput(String buffer);
private:
Thread* m_thread;
Thread* m_thread;
bool m_autoDetectCommand;
std::string m_command;
bool m_monitoring;
bool m_commandChanged;
HANDLE m_stdOutWrite;
HANDLE m_stdOutRead;
Thread* m_outputThread;
Thread* m_outputThread;
IpcServer& m_ipcServer;
IpcLogOutputter& m_ipcLogOutputter;
bool m_elevateProcess;
@ -76,10 +76,10 @@ private:
PROCESS_INFORMATION m_processInfo;
int m_processFailures;
bool m_processRunning;
CFileLogOutputter* m_fileLogOutputter;
FileLogOutputter* m_fileLogOutputter;
bool m_autoElevated;
CArchMutex m_mutex;
CArchCond m_condVar;
ArchMutex m_mutex;
ArchCond m_condVar;
bool m_ready;
};

View File

@ -246,78 +246,78 @@ App::runEventsLoop(void*)
}
//
// CMinimalApp
// MinimalApp
//
CMinimalApp::CMinimalApp() :
CApp(NULL, NULL, new CArgsBase())
MinimalApp::MinimalApp() :
App(NULL, NULL, new ArgsBase())
{
setEvents(m_events);
}
CMinimalApp::~CMinimalApp()
MinimalApp::~MinimalApp()
{
}
int
CMinimalApp::standardStartup(int argc, char** argv)
MinimalApp::standardStartup(int argc, char** argv)
{
return 0;
}
int
CMinimalApp::runInner(int argc, char** argv, ILogOutputter* outputter, StartupFunc startup)
MinimalApp::runInner(int argc, char** argv, ILogOutputter* outputter, StartupFunc startup)
{
return 0;
}
void
CMinimalApp::startNode()
MinimalApp::startNode()
{
}
int
CMinimalApp::mainLoop()
MinimalApp::mainLoop()
{
return 0;
}
int
CMinimalApp::foregroundStartup(int argc, char** argv)
MinimalApp::foregroundStartup(int argc, char** argv)
{
return 0;
}
CScreen*
CMinimalApp::createScreen()
Screen*
MinimalApp::createScreen()
{
return NULL;
}
void
CMinimalApp::loadConfig()
MinimalApp::loadConfig()
{
}
bool
CMinimalApp::loadConfig(const CString& pathname)
MinimalApp::loadConfig(const String& pathname)
{
return false;
}
const char*
CMinimalApp::daemonInfo() const
MinimalApp::daemonInfo() const
{
return "";
}
const char*
CMinimalApp::daemonName() const
MinimalApp::daemonName() const
{
return "";
}
void
CMinimalApp::parseArgs(int argc, const char* const* argv)
MinimalApp::parseArgs(int argc, const char* const* argv)
{
}

View File

@ -98,7 +98,7 @@ public:
void setSocketMultiplexer(SocketMultiplexer* sm) { m_socketMultiplexer = sm; }
SocketMultiplexer* getSocketMultiplexer() const { return m_socketMultiplexer; }
void setEvents(CEventQueue& events) { m_events = &events; }
void setEvents(EventQueue& events) { m_events = &events; }
private:
void handleIpcMessage(const Event&, void*);
@ -122,10 +122,10 @@ private:
SocketMultiplexer* m_socketMultiplexer;
};
class CMinimalApp : public CApp {
class MinimalApp : public App {
public:
CMinimalApp();
virtual ~CMinimalApp();
MinimalApp();
virtual ~MinimalApp();
// IApp overrides
virtual int standardStartup(int argc, char** argv);
@ -133,17 +133,17 @@ public:
virtual void startNode();
virtual int mainLoop();
virtual int foregroundStartup(int argc, char** argv);
virtual CScreen* createScreen();
virtual Screen* createScreen();
virtual void loadConfig();
virtual bool loadConfig(const CString& pathname);
virtual bool loadConfig(const String& pathname);
virtual const char* daemonInfo() const;
virtual const char* daemonName() const;
virtual void parseArgs(int argc, const char* const* argv);
private:
CArch m_arch;
CLog m_log;
CEventQueue m_events;
Arch m_arch;
Log m_log;
EventQueue m_events;
};
#if WINAPI_MSWINDOWS

View File

@ -158,7 +158,7 @@ ArgParser::parsePlatformArg(ArgsBase& argsBase, const int& argc, const char* con
bool
CArgParser::parseToolArgs(CToolArgs& args, int argc, const char* const* argv)
ArgParser::parseToolArgs(ToolArgs& args, int argc, const char* const* argv)
{
for (int i = 1; i < argc; ++i) {
if (isArg(i, argc, argv, NULL, "--get-active-desktop", 0)) {

View File

@ -199,7 +199,7 @@ DaemonApp::mainLoop(bool logToFile)
DAEMON_RUNNING(true);
if (logToFile) {
m_fileLogOutputter = new CFileLogOutputter(logFilename().c_str());
m_fileLogOutputter = new FileLogOutputter(logFilename().c_str());
CLOG->insert(m_fileLogOutputter);
}
@ -215,7 +215,7 @@ DaemonApp::mainLoop(bool logToFile)
CLOG->insert(m_ipcLogOutputter);
#if SYSAPI_WIN32
m_watchdog = new CMSWindowsWatchdog(false, *m_ipcServer, *m_ipcLogOutputter);
m_watchdog = new MSWindowsWatchdog(false, *m_ipcServer, *m_ipcLogOutputter);
m_watchdog->setFileLogOutputter(m_fileLogOutputter);
#endif
@ -339,12 +339,12 @@ DaemonApp::handleIpcMessage(const Event& e, void*)
}
#if SYSAPI_WIN32
CString logFilename;
String logFilename;
if (argBase->m_logFile != NULL) {
logFilename = CString(argBase->m_logFile);
logFilename = String(argBase->m_logFile);
ARCH->setting("LogFilename", logFilename);
m_watchdog->setFileLogOutputter(m_fileLogOutputter);
command = CArgParser::assembleCommand(argsArray, "--log", 1);
command = ArgParser::assembleCommand(argsArray, "--log", 1);
LOG((CLOG_DEBUG "removed log file argument and filename %s from command ", logFilename.c_str()));
LOG((CLOG_DEBUG "new command, elevate=%d command=%s", cm->elevate(), command.c_str()));
}

View File

@ -28,7 +28,7 @@ class IpcLogOutputter;
class FileLogOutputter;
#if SYSAPI_WIN32
class CMSWindowsWatchdog;
class MSWindowsWatchdog;
#endif
class DaemonApp {

View File

@ -45,7 +45,7 @@ ToolApp::run(int argc, char** argv)
}
try {
CArgParser argParser(this);
ArgParser argParser(this);
bool result = argParser.parseToolArgs(m_args, argc, argv);
if (!result) {
@ -55,7 +55,7 @@ ToolApp::run(int argc, char** argv)
if (m_args.m_printActiveDesktopName) {
#if SYSAPI_WIN32
CMSWindowsSession session;
CString name = session.getActiveDesktopName();
String name = session.getActiveDesktopName();
if (name.empty()) {
LOG((CLOG_CRIT "failed to get active desktop name"));
return kExitFailed;
@ -82,6 +82,6 @@ ToolApp::run(int argc, char** argv)
}
void
CToolApp::help()
ToolApp::help()
{
}

View File

@ -27,5 +27,5 @@ public:
UInt32 run(int argc, char** argv);
void help();
private:
CToolArgs m_args;
ToolArgs m_args;
};

View File

@ -17,7 +17,7 @@
#include "synergy/ToolArgs.h"
CToolArgs::CToolArgs() :
ToolArgs::ToolArgs() :
m_printActiveDesktopName(false)
{
}

View File

@ -19,9 +19,9 @@
#include "base/String.h"
class CToolArgs {
class ToolArgs {
public:
CToolArgs();
ToolArgs();
public:
bool m_printActiveDesktopName;