indentation and other formatting changes. also cleaned up

#includes.
This commit is contained in:
crs
2002-06-10 22:06:45 +00:00
parent 68940e58f3
commit 62519b19fe
104 changed files with 3089 additions and 1815 deletions

View File

@@ -1,16 +1,17 @@
#include "CServer.h"
#include "CConfig.h"
#include "CLog.h"
#include "CLock.h"
#include "CMutex.h"
#include "CNetwork.h"
#include "CPlatform.h"
#include "CThread.h"
#include "XThread.h"
#include "ProtocolTypes.h"
#include "Version.h"
#include "CNetwork.h"
#include "XSocket.h"
#include "CLock.h"
#include "CMutex.h"
#include "CThread.h"
#include "XThread.h"
#include "CLog.h"
#include "stdfstream.h"
#include <assert.h>
#include <cstring>
// platform dependent name of a daemon
#if defined(CONFIG_PLATFORM_WIN32)
@@ -51,7 +52,10 @@ static CConfig s_config;
static CMutex* s_logMutex = NULL;
static void logLock(bool lock)
static
void
logLock(
bool lock)
{
assert(s_logMutex != NULL);
@@ -70,7 +74,10 @@ static void logLock(bool lock)
static CServer* s_server = NULL;
static int realMain(CMutex* mutex)
static
int
realMain(
CMutex* mutex)
{
// s_serverLock should have mutex locked on entry
@@ -153,14 +160,18 @@ static int realMain(CMutex* mutex)
return 0;
}
static int restartMain()
static
int
restartMain()
{
return realMain(NULL);
}
// invoke realMain and wait for it. if s_restartable then keep
// restarting realMain until it returns a terminate code.
static int restartableMain()
static
int
restartableMain()
{
if (s_restartable) {
CPlatform platform;
@@ -180,7 +191,9 @@ static int restartableMain()
static void (*bye)(int) = &exit;
static void version()
static
void
version()
{
log((CLOG_PRINT
"%s %d.%d.%d, protocol version %d.%d\n"
@@ -194,7 +207,9 @@ static void version()
kCopyright));
}
static void help()
static
void
help()
{
CPlatform platform;
@@ -256,11 +271,14 @@ static void help()
CONFIG_NAME).c_str()));
}
static bool isArg(int argi,
int argc, const char** argv,
const char* name1,
const char* name2,
int minRequiredParameters = 0)
static
bool
isArg(int argi,
int argc,
const char** argv,
const char* name1,
const char* name2,
int minRequiredParameters = 0)
{
if ((name1 != NULL && strcmp(argv[argi], name1) == 0) ||
(name2 != NULL && strcmp(argv[argi], name2) == 0)) {
@@ -277,7 +295,11 @@ static bool isArg(int argi,
return false;
}
static void parse(int argc, const char** argv)
static
void
parse(
int argc,
const char** argv)
{
assert(pname != NULL);
assert(argv != NULL);
@@ -442,7 +464,11 @@ static void parse(int argc, const char** argv)
}
}
static bool loadConfig(const char* pathname, bool require)
static
bool
loadConfig(
const char* pathname,
bool require)
{
assert(pathname != NULL);
@@ -471,7 +497,9 @@ static bool loadConfig(const char* pathname, bool require)
return false;
}
static void loadConfig()
static
void
loadConfig()
{
// load the config file, if specified
if (s_configFile != NULL) {
@@ -512,7 +540,11 @@ static void loadConfig()
#include "CMSWindowsScreen.h"
static bool logMessageBox(int priority, const char* msg)
static
bool
logMessageBox(
int priority,
const char* msg)
{
if (priority <= CLog::kFATAL) {
MessageBox(NULL, msg, pname, MB_OK | MB_ICONWARNING);
@@ -523,18 +555,26 @@ static bool logMessageBox(int priority, const char* msg)
}
}
static void byeThrow(int x)
static
void
byeThrow(int x)
{
throw CWin32Platform::CDaemonFailed(x);
}
static void daemonStop(void)
static
void
daemonStop(void)
{
s_server->quit();
}
static int daemonStartup(IPlatform* iplatform,
int argc, const char** argv)
static
int
daemonStartup(
IPlatform* iplatform,
int argc,
const char** argv)
{
// get platform pointer
CWin32Platform* platform = static_cast<CWin32Platform*>(iplatform);
@@ -558,19 +598,30 @@ static int daemonStartup(IPlatform* iplatform,
return platform->runDaemon(realMain, daemonStop);
}
static int daemonStartup95(IPlatform*, int, const char**)
static
int
daemonStartup95(
IPlatform*,
int,
const char**)
{
return realMain(NULL);
}
static bool logDiscard(int, const char*)
static
bool
logDiscard(
int,
const char*)
{
return true;
}
static bool s_die = false;
static void checkParse(int e)
static
void
checkParse(int e)
{
// anything over 1 means invalid args. 1 means missing args.
// 0 means graceful exit. we plan to exit for anything but
@@ -580,7 +631,12 @@ static void checkParse(int e)
throw s_die;
}
int WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
int WINAPI
WinMain(
HINSTANCE instance,
HINSTANCE,
LPSTR,
int)
{
CPlatform platform;
@@ -703,12 +759,20 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
#elif defined(CONFIG_PLATFORM_UNIX)
static int daemonStartup(IPlatform*, int, const char**)
static
int
daemonStartup(
IPlatform*,
int,
const char**)
{
return restartableMain();
}
int main(int argc, char** argv)
int
main(
int argc,
char** argv)
{
CPlatform platform;