mirror of
https://github.com/znc/znc.git
synced 2026-04-30 10:34:16 +02:00
Add CZNC::GetVersion()
CZNC::GetVersion() returns something like '0.057-r1234'. This also cleans up CZNC::GetTag() a little. A theoretical buffer overflow less and some higher speed is the result. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1097 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
15
znc.cpp
15
znc.cpp
@@ -71,14 +71,25 @@ CZNC::~CZNC() {
|
||||
DeletePidFile();
|
||||
}
|
||||
|
||||
CString CZNC::GetVersion() {
|
||||
char szBuf[128];
|
||||
|
||||
snprintf(szBuf, sizeof(szBuf), "%1.3f"VERSION_EXTRA, VERSION);
|
||||
// If snprintf overflows (which I doubt), we want to be on the safe side
|
||||
szBuf[sizeof(szBuf) - 1] = '\0';
|
||||
|
||||
return szBuf;
|
||||
}
|
||||
|
||||
CString CZNC::GetTag(bool bIncludeVersion) {
|
||||
if (!bIncludeVersion) {
|
||||
return "ZNC - http://znc.sourceforge.net";
|
||||
}
|
||||
|
||||
char szBuf[128];
|
||||
memset(szBuf, 0, 128);
|
||||
snprintf(szBuf, 127, "ZNC %1.3f"VERSION_EXTRA" - http://znc.sourceforge.net", VERSION);
|
||||
snprintf(szBuf, sizeof(szBuf), "ZNC %1.3f"VERSION_EXTRA" - http://znc.sourceforge.net", VERSION);
|
||||
// If snprintf overflows (which I doubt), we want to be on the safe side
|
||||
szBuf[sizeof(szBuf) - 1] = '\0';
|
||||
|
||||
return szBuf;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user