diff options
author | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-05-14 20:52:17 +0000 |
---|---|---|
committer | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-05-14 20:52:17 +0000 |
commit | 5993a65b87ecf794158dca1ac2602c1755c2a27e (patch) | |
tree | acc99878b60d229d65e2daa24c39879900476acb | |
parent | 116a4b2bea556911239f735c467c7b6f1415c0a7 (diff) |
Fixed many windows problems in the debug build
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2960 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | src/core/db_plain.cpp | 28 | ||||
-rw-r--r-- | src/modules.c | 6 | ||||
-rw-r--r-- | src/nickcore.cpp | 1 | ||||
-rw-r--r-- | src/regchannel.cpp | 1 |
4 files changed, 23 insertions, 13 deletions
diff --git a/src/core/db_plain.cpp b/src/core/db_plain.cpp index eca3b3791..dc9733023 100644 --- a/src/core/db_plain.cpp +++ b/src/core/db_plain.cpp @@ -52,6 +52,11 @@ static void ReadDatabase(Module *m = NULL) return; } + NickCore *nc = NULL; + NickAlias *na = NULL; + BotInfo *bi = NULL; + ChannelInfo *ci = NULL; + while (std::getline(db, buf)) { if (buf.empty()) @@ -84,10 +89,6 @@ static void ReadDatabase(Module *m = NULL) continue; std::string mdbuf; - NickCore *nc; - NickAlias *na; - BotInfo *bi; - ChannelInfo *ci; if (!params.empty()) { if (params[0] == "NC") @@ -116,7 +117,7 @@ static void ReadDatabase(Module *m = NULL) params.erase(params.begin()); params.erase(params.begin()); - if (nc && Type == MD_NC) + if (Type == MD_NC && nc) { try { @@ -132,7 +133,7 @@ static void ReadDatabase(Module *m = NULL) Alog() << "[db_plain]: " << ex.GetReason(); } } - else if (na && Type == MD_NA) + else if (Type == MD_NA && na) { try { @@ -148,7 +149,7 @@ static void ReadDatabase(Module *m = NULL) Alog() << "[db_plain]: " << ex.GetReason(); } } - else if (bi && Type == MD_BI) + else if (Type == MD_BI && bi) { try { @@ -164,7 +165,7 @@ static void ReadDatabase(Module *m = NULL) Alog() << "[db_plain]: " << ex.GetReason(); } } - else if (ci && Type == MD_CH) + else if (Type == MD_CH && ci) { try { @@ -571,6 +572,15 @@ class DBPlain : public Module char *newname = new char[DatabaseFile.length() + 30]; snprintf(newname, DatabaseFile.length() + 30, "backups/%s.%d%d%d", DatabaseFile.c_str(), tm->tm_year, tm->tm_mon, tm->tm_mday); + /* Backup already exists */ + if (!stat(newname, &DBInfo)) + { + delete [] newname; + return; + } + Alog() << "it.. doesnt exist?"; + + Alog(LOG_DEBUG) << "db_plain: Attemping to rename " << DatabaseFile << " to " << newname; if (rename(DatabaseFile.c_str(), newname) != 0) { ircdproto->SendGlobops(findbot(Config.s_OperServ), "Unable to backup database!"); @@ -579,6 +589,8 @@ class DBPlain : public Module if (!Config.NoBackupOkay) quitting = 1; + delete [] newname; + return; } diff --git a/src/modules.c b/src/modules.c index d3453efad..55085ccd3 100644 --- a/src/modules.c +++ b/src/modules.c @@ -176,8 +176,8 @@ static int internal_addCommand(Module *m, CommandHash * cmdTable[], Command * c) if (!cmdTable || !c) { return MOD_ERR_PARAMS; } - - index = CMD_HASH(c->name); + + index = CMD_HASH(c->name.c_str()); for (current = cmdTable[index]; current; current = current->next) { if ((c->service) && (current->c) && (current->c->service) @@ -283,7 +283,7 @@ static int internal_delCommand(CommandHash * cmdTable[], Command * c, const char return MOD_ERR_PARAMS; } - index = CMD_HASH(c->name); + index = CMD_HASH(c->name.c_str()); for (current = cmdTable[index]; current; current = current->next) { if (stricmp(c->name.c_str(), current->name) == 0) { if (!lastHash) { diff --git a/src/nickcore.cpp b/src/nickcore.cpp index 84761ed79..1b01c3d54 100644 --- a/src/nickcore.cpp +++ b/src/nickcore.cpp @@ -14,7 +14,6 @@ NickCore::NickCore(const std::string &coredisplay) next = prev = NULL; display = email = greet = url = NULL; ot = NULL; - pass[0] = '\0'; icq = 0; language = channelcount = 0; lastmail = 0; diff --git a/src/regchannel.cpp b/src/regchannel.cpp index a205e7228..d53f496a2 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -25,7 +25,6 @@ ChannelInfo::ChannelInfo(const std::string &chname) throw CoreException("Empty channel passed to ChannelInfo constructor"); next = prev = NULL; - name[0] = last_topic_setter[0] = '\0'; founder = successor = NULL; desc = url = email = last_topic = forbidby = forbidreason = NULL; last_topic_time = 0; |