Fix several comments broken by clang-format

This commit is contained in:
Alexey Sokolov
2015-12-06 23:29:43 +00:00
parent 33b0627d75
commit 3861b6a583
20 changed files with 130 additions and 146 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ class CIRCSock : public CIRCSocket {
typedef enum {
// These values must line up with their position in the CHANMODE
// argument to raw 005
// argument to raw 005
ListArg = 0,
HasArg = 1,
ArgWhenSet = 2,
+3 -2
View File
@@ -270,8 +270,9 @@ class TCacheMap {
* @param uTTL the time-to-live for this specific item
*/
void AddItem(const K& Item, const V& Val, unsigned int uTTL) {
if (!uTTL) { // If time-to-live is zero we don't want to waste our time
// adding it
if (!uTTL) {
// If time-to-live is zero we don't want to waste our time adding
// it
RemItem(Item); // Remove the item incase it already exists
return;
}
+1 -1
View File
@@ -127,7 +127,7 @@ class CWebSock : public CHTTPSock {
PAGE_NOTFOUND, // print 404 and Close()
PAGE_PRINT, // print page contents and Close()
PAGE_DEFERRED, // async processing, Close() will be called from a
// different place
// different place
PAGE_DONE // all stuff has been done
};
+19 -19
View File
@@ -111,11 +111,14 @@ class CAlias {
{
while (alias_data.length() > index && alias_data[index] >= '0' &&
alias_data[index] <= '9')
++index; // skip any numeric digits in string
} // (supposed to fail if whitespace precedes integer)
else
return; // token was malformed. leave caret unchanged, and flag
// first character for skipping
++index;
// skip any numeric digits in string (supposed to fail if
// whitespace precedes integer)
} else {
// token was malformed. leave caret unchanged, and flag first
// character for skipping
return;
}
if (alias_data.length() > index && alias_data[index] == '+') {
subsequent = true;
++index;
@@ -126,11 +129,10 @@ class CAlias {
else
return;
CString stok = line.Token(token, subsequent, " "); // if we get here,
// we're definitely
// dealing with a
// token, so get the
// token's value
// if we get here, we're definitely dealing with a token, so get the
// token's value
CString stok = line.Token(token, subsequent, " ");
if (stok.empty() && !optional)
throw std::invalid_argument(
CString("missing required parameter: ") +
@@ -162,17 +164,15 @@ class CAlias {
// adding + makes the substitution contain all tokens from the nth to
// the end of the line
while (true) {
// if (found >= (int) alias_data.length()) break; // shouldn't be
// possible.
// if (found >= (int) alias_data.length()) break;
// ^ shouldn't be possible.
size_t found = alias_data.find("%", lastfound + skip);
if (found == CString::npos) break; // if we found nothing, break
output.append(alias_data.substr(
lastfound, found - lastfound)); // capture everything between
// the last stopping point and
// here
ParseToken(alias_data, line, output, found,
skip); // attempt to read a token, updates indices based
// on success/failure
// capture everything between the last stopping point and here
output.append(alias_data.substr(lastfound, found - lastfound));
// attempt to read a token, updates indices based on
// success/failure
ParseToken(alias_data, line, output, found, skip);
lastfound = found;
}
+6 -4
View File
@@ -296,11 +296,13 @@ class CAway : public CModule {
}
void OnIRCConnected() override {
if (m_bIsAway)
if (m_bIsAway) {
Away(true); // reset away if we are reconnected
else
Back(); // ircd seems to remember your away if you killed the
// client and came back
} else {
// ircd seems to remember your away if you killed the client and
// came back
Back();
}
}
bool BootStrap() {
+10 -16
View File
@@ -234,11 +234,8 @@ class CAdminMod : public CModule {
PutModule("QueryBufferSize = " +
CString(pUser->GetQueryBufferSize()));
else if (sVar == "keepbuffer")
PutModule("KeepBuffer = " +
CString(!pUser->AutoClearChanBuffer())); // XXX
// compatibility
// crap, added
// in 0.207
// XXX compatibility crap, added in 0.207
PutModule("KeepBuffer = " + CString(!pUser->AutoClearChanBuffer()));
else if (sVar == "autoclearchanbuffer")
PutModule("AutoClearChanBuffer = " +
CString(pUser->AutoClearChanBuffer()));
@@ -358,8 +355,8 @@ class CAdminMod : public CModule {
PutModule("Setting failed, limit is " +
CString(CZNC::Get().GetMaxBufferSize()));
}
} else if (sVar ==
"keepbuffer") { // XXX compatibility crap, added in 0.207
} else if (sVar == "keepbuffer") {
// XXX compatibility crap, added in 0.207
bool b = !sValue.ToBool();
pUser->SetAutoClearChanBuffer(b);
PutModule("AutoClearChanBuffer = " + CString(b));
@@ -701,12 +698,9 @@ class CAdminMod : public CModule {
PutModule(pChan->GetName() + ": InConfig = " +
CString(pChan->InConfig()));
} else if (sVar == "keepbuffer") {
PutModule(
pChan->GetName() + ": KeepBuffer = " +
CString(!pChan->AutoClearChanBuffer())); // XXX
// compatibility
// crap, added in
// 0.207
// XXX compatibility crap, added in 0.207
PutModule(pChan->GetName() + ": KeepBuffer = " +
CString(!pChan->AutoClearChanBuffer()));
} else if (sVar == "autoclearchanbuffer") {
CString sValue(pChan->AutoClearChanBuffer());
if (!pChan->HasAutoClearChanBufferSet()) {
@@ -764,8 +758,8 @@ class CAdminMod : public CModule {
pChan->ResetBufferCount();
PutModule(pChan->GetName() + ": BufferSize = " +
CString(pChan->GetBufferCount()));
// Admins don't have to honour the buffer limit
} else if (pChan->SetBufferCount(i, GetUser()->IsAdmin())) {
// Admins don't have to honour the buffer limit
PutModule(pChan->GetName() + ": BufferSize = " + sValue);
} else {
PutModule("Setting failed, limit is " +
@@ -776,8 +770,8 @@ class CAdminMod : public CModule {
bool b = sValue.ToBool();
pChan->SetInConfig(b);
PutModule(pChan->GetName() + ": InConfig = " + CString(b));
} else if (sVar == "keepbuffer") { // XXX compatibility crap, added
// in 0.207
} else if (sVar == "keepbuffer") {
// XXX compatibility crap, added in 0.207
bool b = !sValue.ToBool();
pChan->SetAutoClearChanBuffer(b);
PutModule(pChan->GetName() + ": AutoClearChanBuffer = " +
+6 -6
View File
@@ -86,8 +86,9 @@ class CIMAPAuthMod : public CModule {
EModRet OnLoginAttempt(std::shared_ptr<CAuthBase> Auth) override {
CUser* pUser = CZNC::Get().FindUser(Auth->GetUsername());
if (!pUser) { // @todo Will want to do some sort of && !m_bAllowCreate
// in the future
if (!pUser) {
// @todo Will want to do some sort of && !m_bAllowCreate in the
// future
Auth->RefuseLogin("Invalid User - Halting IMAP Lookup");
return HALT;
}
@@ -146,10 +147,9 @@ void CIMAPSock::ReadLine(const CString& sLine) {
if (pUser && sLine.StartsWith("AUTH OK")) {
m_spAuth->AcceptLogin(*pUser);
m_pIMAPMod->CacheLogin(
CString(m_spAuth->GetUsername() + ":" + m_spAuth->GetPassword())
.MD5()); // Use MD5 so passes don't sit in memory in plain
// text
// Use MD5 so passes don't sit in memory in plain text
m_pIMAPMod->CacheLogin(CString(m_spAuth->GetUsername() + ":" +
m_spAuth->GetPassword()).MD5());
DEBUG("+++ Successful IMAP lookup");
} else {
m_spAuth->RefuseLogin("Invalid Password");
+4 -3
View File
@@ -144,7 +144,7 @@ class CStickyChan : public CModule {
WebSock.GetParam("stick_" + sChan).ToBool();
if (bNewStick && !bStick)
SetNV(sChan, ""); // no password support for now unless
// chansaver is active too
// chansaver is active too
else if (!bNewStick && bStick) {
MCString::iterator it = FindNV(sChan);
if (it != EndNV()) DelNV(it);
@@ -179,8 +179,9 @@ class CStickyChan : public CModule {
bool bNewStick =
WebSock.GetParam("embed_stickychan_sticky").ToBool();
if (bNewStick && !bStick) {
SetNV(sChan, ""); // no password support for now unless
// chansaver is active too
// no password support for now unless chansaver is active
// too
SetNV(sChan, "");
WebSock.GetSession()->AddSuccess("Channel become sticky!");
} else if (!bNewStick && bStick) {
DelNV(sChan);
+7 -9
View File
@@ -63,8 +63,8 @@ CChan::CChan(const CString& sName, CIRCNetwork* pNetwork, bool bInConfig,
if (pConfig->FindStringEntry("autoclearchanbuffer", sValue))
SetAutoClearChanBuffer(sValue.ToBool());
if (pConfig->FindStringEntry("keepbuffer", sValue))
SetAutoClearChanBuffer(
!sValue.ToBool()); // XXX Compatibility crap, added in 0.207
// XXX Compatibility crap, added in 0.207
SetAutoClearChanBuffer(!sValue.ToBool());
if (pConfig->FindStringEntry("detached", sValue))
SetDetached(sValue.ToBool());
if (pConfig->FindStringEntry("disabled", sValue))
@@ -606,10 +606,8 @@ void CChan::SendBuffer(CClient* pClient) {
void CChan::SendBuffer(CClient* pClient, const CBuffer& Buffer) {
if (m_pNetwork && m_pNetwork->IsUserAttached()) {
// in the event that pClient is nullptr, need to send this to all
// clients for the user
// I'm presuming here that pClient is listed inside vClients thus
// vClients at this
// point can't be empty.
// clients for the user I'm presuming here that pClient is listed
// inside vClients thus vClients at this point can't be empty.
//
// This loop has to be cycled twice to maintain the existing behavior
// which is
@@ -618,9 +616,9 @@ void CChan::SendBuffer(CClient* pClient, const CBuffer& Buffer) {
// 3. ClearBuffer() if not keeping the buffer
// 4. OnChanBufferEnding
//
// With the exception of ClearBuffer(), this needs to happen per client,
// and
// if pClient is not nullptr, the loops break after the first iteration.
// With the exception of ClearBuffer(), this needs to happen per
// client, and if pClient is not nullptr, the loops break after the
// first iteration.
//
// Rework this if you like ...
if (!Buffer.IsEmpty()) {
+10 -7
View File
@@ -129,8 +129,8 @@ void CClient::ReadLine(const CString& sData) {
CString sCommand = Message.GetCommand();
if (!IsAttached()) { // The following commands happen before authentication
// with ZNC
if (!IsAttached()) {
// The following commands happen before authentication with ZNC
if (sCommand.Equals("PASS")) {
m_bGotPass = true;
@@ -138,7 +138,8 @@ void CClient::ReadLine(const CString& sData) {
ParsePass(sAuthLine);
AuthUser();
return; // Don't forward this msg. ZNC has already registered us.
// Don't forward this msg. ZNC has already registered us.
return;
} else if (sCommand.Equals("NICK")) {
CString sNick = Message.GetParam(0);
@@ -146,8 +147,9 @@ void CClient::ReadLine(const CString& sData) {
m_bGotNick = true;
AuthUser();
return; // Don't forward this msg. ZNC will handle nick changes
// until auth is complete
// Don't forward this msg. ZNC will handle nick changes until auth
// is complete
return;
} else if (sCommand.Equals("USER")) {
CString sAuthLine = Message.GetParam(0);
@@ -162,7 +164,8 @@ void CClient::ReadLine(const CString& sData) {
SendRequiredPasswordNotice();
}
return; // Don't forward this msg. ZNC has already registered us.
// Don't forward this msg. ZNC has already registered us.
return;
}
}
@@ -961,7 +964,7 @@ bool CClient::OnCTCPMessage(CCTCPMessage& Message) {
// b) CTCP reply for VERSION is set.
// 1. ZNC receives CTCP VERSION from someone
// 2. ZNC replies with the configured reply (or just drops it if
// empty), without forwarding anything to client
// empty), without forwarding anything to client
// 3. Client does not see any CTCP request, and does not reply
//
// So, if user doesn't want "via ZNC" in CTCP VERSION reply, they
+2 -2
View File
@@ -1718,8 +1718,8 @@ void CClient::HelpUser(const CString& sFilter) {
AddCommandHelp(Table, "ListMods", "", "List all loaded modules", sFilter);
AddCommandHelp(Table, "ListAvailMods", "", "List all available modules",
sFilter);
if (!m_pUser->IsAdmin()) { // If they are an admin we will add this command
// below with an argument
if (!m_pUser->IsAdmin()) {
// If they are an admin we will add this command below with an argument
AddCommandHelp(Table, "ListChans", "", "List all channels", sFilter);
}
AddCommandHelp(Table, "ListNicks", "<#chan>", "List all nicks on a channel",
+3 -5
View File
@@ -178,8 +178,7 @@ void CHTTPSock::ReadLine(const CString& sData) {
}
// either sIP is not trusted proxy, or it's in the beginning of the
// X-Forwarded-For list
// in both cases use it as the endpoind
// X-Forwarded-For list in both cases use it as the endpoind
m_sForwardedIP = sIP;
}
} else if (sName.Equals("If-None-Match:")) {
@@ -195,9 +194,8 @@ void CHTTPSock::ReadLine(const CString& sData) {
if (m_bBasicAuth && !m_bLoggedIn) {
m_bLoggedIn = OnLogin(m_sUser, m_sPass, true);
// After successful login ReadLine("") will be called again to
// trigger "else" block
// Failed login sends error and closes socket, so no infinite loop
// here
// trigger "else" block Failed login sends error and closes socket,
// so no infinite loop here
} else {
m_bGotHeader = true;
+5 -5
View File
@@ -157,11 +157,11 @@ CIRCNetwork::CIRCNetwork(CUser* pUser, const CString& sName)
m_uBytesWritten(0) {
SetUser(pUser);
m_RawBuffer.SetLineCount(100, true); // This should be more than enough
// raws, especially since we are
// buffering the MOTD separately
m_MotdBuffer.SetLineCount(
200, true); // This should be more than enough motd lines
// This should be more than enough raws, especially since we are buffering
// the MOTD separately
m_RawBuffer.SetLineCount(100, true);
// This should be more than enough motd lines
m_MotdBuffer.SetLineCount(200, true);
m_NoticeBuffer.SetLineCount(250, true);
m_pPingTimer = new CIRCNetworkPingTimer(this);
+12 -21
View File
@@ -675,7 +675,6 @@ bool CIRCSock::OnNumericMessage(CNumericMessage& Message) {
switch (uRaw) {
case 1: { // :irc.server.com 001 nick :Welcome to the Internet Relay
// Network nick
if (m_bAuthed && sServer == "irc.znc.in") {
// m_bAuthed == true => we already received another 001 => we
// might be in a traffic loop
@@ -686,9 +685,8 @@ bool CIRCSock::OnNumericMessage(CNumericMessage& Message) {
}
m_pNetwork->SetIRCServer(sServer);
SetTimeout(CIRCNetwork::NO_TRAFFIC_TIMEOUT,
TMO_READ); // Now that we are connected, let nature take
// its course
// Now that we are connected, let nature take its course
SetTimeout(CIRCNetwork::NO_TRAFFIC_TIMEOUT, TMO_READ);
PutIRC("WHO " + sNick);
m_bAuthed = true;
@@ -840,8 +838,7 @@ bool CIRCSock::OnNumericMessage(CNumericMessage& Message) {
break;
}
case 352: { // WHO
// :irc.yourserver.com 352 yournick #chan ident theirhost.com
// irc.theirserver.com theirnick H :0 Real Name
// :irc.yourserver.com 352 yournick #chan ident theirhost.com irc.theirserver.com theirnick H :0 Real Name
sNick = Message.GetParam(5);
CString sChan = Message.GetParam(1);
CString sIdent = Message.GetParam(2);
@@ -924,15 +921,12 @@ bool CIRCSock::OnNumericMessage(CNumericMessage& Message) {
}
break;
case 437:
// :irc.server.net 437 * badnick :Nick/channel is temporarily
// unavailable
// :irc.server.net 437 mynick badnick :Nick/channel is temporarily
// unavailable
// :irc.server.net 437 mynick badnick :Cannot change nickname while
// banned on channel
// :irc.server.net 437 * badnick :Nick/channel is temporarily unavailable
// :irc.server.net 437 mynick badnick :Nick/channel is temporarily unavailable
// :irc.server.net 437 mynick badnick :Cannot change nickname while banned on channel
if (m_pNetwork->IsChan(Message.GetParam(1)) || sNick != "*") break;
case 432: // :irc.server.com 432 * nick :Erroneous Nickname: Illegal
// characters
case 432:
// :irc.server.com 432 * nick :Erroneous Nickname: Illegal chars
case 433: {
CString sBadNick = Message.GetParam(1);
@@ -948,10 +942,8 @@ bool CIRCSock::OnNumericMessage(CNumericMessage& Message) {
// it to the client
if (sNick.Equals("CAP")) return true;
case 470: {
// :irc.unreal.net 470 mynick [Link] #chan1 has become full, so you
// are automatically being transferred to the linked channel #chan2
// :mccaffrey.freenode.net 470 mynick #electronics ##electronics
// :Forwarding to another channel
// :irc.unreal.net 470 mynick [Link] #chan1 has become full, so you are automatically being transferred to the linked channel #chan2
// :mccaffrey.freenode.net 470 mynick #electronics ##electronics :Forwarding to another channel
// freenode style numeric
CChan* pChan = m_pNetwork->FindChan(Message.GetParam(1));
@@ -968,11 +960,10 @@ bool CIRCSock::OnNumericMessage(CNumericMessage& Message) {
break;
}
case 670:
// :hydra.sector5d.org 670 kylef :STARTTLS successful, go ahead with
// TLS handshake
// :hydra.sector5d.org 670 kylef :STARTTLS successful, go ahead with TLS handshake
//
// 670 is a response to `STARTTLS` telling the client to switch to
// TLS
if (!GetSSL()) {
StartTLS();
m_pNetwork->PutStatus("Switched to SSL (STARTTLS)");
+10 -11
View File
@@ -1663,8 +1663,9 @@ bool CModules::UnloadModule(const CString& sModule) {
}
bool CModules::UnloadModule(const CString& sModule, CString& sRetMsg) {
CString sMod = sModule; // Make a copy incase the reference passed in is
// from CModule::GetModName()
// Make a copy incase the reference passed in is from CModule::GetModName()
CString sMod = sModule;
CModule* pModule = FindModule(sMod);
sRetMsg = "";
@@ -1705,8 +1706,9 @@ bool CModules::UnloadModule(const CString& sModule, CString& sRetMsg) {
bool CModules::ReloadModule(const CString& sModule, const CString& sArgs,
CUser* pUser, CIRCNetwork* pNetwork,
CString& sRetMsg) {
CString sMod = sModule; // Make a copy incase the reference passed in is
// from CModule::GetModName()
// Make a copy incase the reference passed in is from CModule::GetModName()
CString sMod = sModule;
CModule* pModule = FindModule(sMod);
if (!pModule) {
@@ -1894,17 +1896,14 @@ ModHandle CModules::OpenModule(const CString& sModule, const CString& sModPath,
// performance impact.
//
// RTLD_GLOBAL vs. RTLD_LOCAL: If perl is loaded with RTLD_LOCAL and later
// on
// loads own modules (which it apparently does with RTLD_LAZY), we will die
// in a
// name lookup since one of perl's symbols isn't found. That's worse
// than any theoretical issue with RTLD_GLOBAL.
// on loads own modules (which it apparently does with RTLD_LAZY), we will
// die in a name lookup since one of perl's symbols isn't found. That's
// worse than any theoretical issue with RTLD_GLOBAL.
ModHandle p = dlopen((sModPath).c_str(), RTLD_NOW | RTLD_GLOBAL);
if (!p) {
// dlerror() returns pointer to static buffer, which may be overwritten
// very soon with another dl call
// also it may just return null.
// very soon with another dl call also it may just return null.
const char* cDlError = dlerror();
CString sDlError = cDlError ? cDlError : "Unknown error";
sRetMsg = "Unable to open module [" + sModule + "] [" + sDlError + "]";
+12 -14
View File
@@ -33,18 +33,16 @@
// at 22 Dec 2014
static CString ZNC_DefaultCipher() {
return "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-"
"RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:"
"DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:"
"ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:"
"ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-"
"SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:"
"ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:"
"DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:"
"DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-"
"SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:"
"AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!"
"RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!"
"KRB5-DES-CBC3-SHA";
"RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-"
"GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-"
"SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-"
"AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-"
"RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-"
"RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-"
"AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:"
"AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-"
"CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-"
"DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA";
}
#endif
@@ -221,8 +219,8 @@ void CSockManager::CDNSJob::runMain() {
if (this->aiResult) {
DEBUG("And aiResult is not nullptr...");
}
this->aiResult =
nullptr; // just for case. Maybe to call freeaddrinfo()?
// just for case. Maybe to call freeaddrinfo()?
this->aiResult = nullptr;
}
pManager->SetTDNSThreadFinished(this->task, this->bBind, this->aiResult);
}
+5 -5
View File
@@ -520,8 +520,9 @@ bool CTemplate::Print(const CString& sFileName, ostream& oOut) {
new CTemplateLoopContext(uAfterLoopTag,
sLoopName,
bReverse, pvLoop));
} else { // If we don't have data, just skip this
// loop and everything inside
} else {
// If we don't have data, just skip this loop
// and everything inside
uSkip++;
}
}
@@ -622,9 +623,8 @@ bool CTemplate::Print(const CString& sFileName, ostream& oOut) {
vector<std::shared_ptr<CTemplateTagHandler>>&
vspTagHandlers = GetTagHandlers();
if (!vspTagHandlers.empty()) { // @todo this should go up
// to the top to grab
// handlers
if (!vspTagHandlers.empty()) {
// @todo this should go up to the top to grab handlers
CTemplate* pTmpl = GetCurTemplate();
CString sCustomOutput;
+3 -3
View File
@@ -488,9 +488,9 @@ CString CUtils::FormatServerTime(const timeval& tv) {
// TODO support message-tags properly
struct tm stm;
memset(&stm, 0, sizeof(stm));
const time_t secs = tv.tv_sec; // OpenBSD has tv_sec as int, so explicitly
// convert it to time_t to make gmtime_r()
// happy
// OpenBSD has tv_sec as int, so explicitly convert it to time_t to make
// gmtime_r() happy
const time_t secs = tv.tv_sec;
gmtime_r(&secs, &stm);
char sTime[20] = {};
strftime(sTime, sizeof(sTime), "%Y-%m-%dT%H:%M:%S", &stm);
+3 -2
View File
@@ -458,8 +458,9 @@ bool CWebSock::AddModLoop(const CString& sLoopName, CModule& Module,
m_sPage == SubPage->GetName() && bActiveModule);
if (SubPage->RequiresAdmin() && !GetSession()->IsAdmin()) {
continue; // Don't add admin-only subpages to requests from
// non-admin users
// Don't add admin-only subpages to requests from non-admin
// users
continue;
}
CTemplate& SubRow = Row.AddRow("SubPageLoop");
+8 -10
View File
@@ -152,10 +152,9 @@ bool CString::Equals(const CString& s, bool bCaseSensitive,
bool CString::WildCmp(const CString& sWild, const CString& sString,
CaseSensitivity cs) {
// avoid a copy when cs == CaseSensitive (C++ deliberately specifies that
// binding
// a temporary object to a reference to const on the stack lengthens the
// lifetime
// of the temporary to the lifetime of the reference itself)
// binding a temporary object to a reference to const on the stack
// lengthens the lifetime of the temporary to the lifetime of the reference
// itself)
const CString& sWld = (cs == CaseSensitive ? sWild : sWild.AsLower());
const CString& sStr = (cs == CaseSensitive ? sString : sString.AsLower());
@@ -286,9 +285,8 @@ CString CString::Escape_n(EEscape eFrom, EEscape eTo) const {
strtol((const char*)(pTmp + 2 + (base == 16)),
&endptr, base);
if ((*endptr == ';') && (b <= 255)) { // incase they do
// something like
// &#7777777777;
if ((*endptr == ';') && (b <= 255)) {
// incase they do something like &#7777777777;
ch = (unsigned char)b;
a += iCounted;
break;
@@ -1423,9 +1421,9 @@ CString CString::StripControls_n() const {
colorCode = false;
if (digits == 0 && comma) { // There was a ',' which wasn't
// followed by digits, we should print
// it.
if (digits == 0 && comma) {
// There was a ',' which wasn't followed by digits, we should
// print it.
sRet += ',';
}
}