summaryrefslogtreecommitdiff
path: root/plugins/MirFox
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-08-31 15:56:55 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-08-31 15:56:55 +0000
commit622986e86b7cae1dcc4ce42cecf679f1c48c2d25 (patch)
treecd1179813de5c710fdd210aebbfe18ac791068e3 /plugins/MirFox
parent937bfcdd9f5922b4043e4ed648d7877c541d54cb (diff)
MirFox:
- Use delete[] instead of delete git-svn-id: http://svn.miranda-ng.org/main/trunk@15128 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirFox')
-rw-r--r--plugins/MirFox/src/MirFoxCommons/MirFoxCommons_logger.cpp57
1 files changed, 12 insertions, 45 deletions
diff --git a/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_logger.cpp b/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_logger.cpp
index c9c50a4b8a..eec0c8b196 100644
--- a/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_logger.cpp
+++ b/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_logger.cpp
@@ -1,58 +1,40 @@
#include "MirFoxCommons_pch.h"
#include "MirFoxCommons_logger.h"
-
/*static*/ MFLogger * MFLogger::m_pOnlyOneInstance;
-
MFLogger::MFLogger()
{
logFunction = NULL;
memcpy(m_prefix, L" ", PREFIX_SIZE * sizeof(m_prefix[0]));
}
-
-void
-MFLogger::initLogger(LogFunction logFunction_p){
-
+void MFLogger::initLogger(LogFunction logFunction_p){
logFunction = logFunction_p;
InitializeCriticalSection(&logCs);
-
}
-void
-MFLogger::set6CharsPrefix(const wchar_t* prefix){
+void MFLogger::set6CharsPrefix(const wchar_t* prefix){
size_t len = wcslen(prefix);
memcpy(m_prefix, L" ", PREFIX_SIZE * sizeof(m_prefix[0]));
memcpy(m_prefix, prefix, len * sizeof(wchar_t));
}
-
-void
-MFLogger::releaseLogger(){
-
+void MFLogger::releaseLogger(){
logFunction = NULL;
DeleteCriticalSection(&logCs);
-
}
-
-void
-MFLogger::log(const wchar_t* szText){
-
+void MFLogger::log(const wchar_t* szText){
size_t len = wcslen(szText) + 1;
wchar_t* buffer = new wchar_t[(PREFIX_SIZE + len) * sizeof(wchar_t)];
memcpy(buffer, m_prefix, PREFIX_SIZE * sizeof(m_prefix[0]));
memcpy(buffer + PREFIX_SIZE , szText, len * sizeof(wchar_t));
log_int(buffer);
- delete buffer;
-
+ delete[] buffer;
}
-
-void
-MFLogger::log_p(const wchar_t* szText, ...){
-
+void MFLogger::log_p(const wchar_t* szText, ...){
va_list args;
va_start(args, szText);
int len = (PREFIX_SIZE + _vscwprintf(szText, args ) + 1); // _vscprintf doesn't count terminating '\0'
@@ -61,29 +43,21 @@ MFLogger::log_p(const wchar_t* szText, ...){
va_end(args);
memcpy(buffer, m_prefix, PREFIX_SIZE * sizeof(m_prefix[0]));
log_int(buffer);
- delete buffer;
-
+ delete[] buffer;
}
-
-void
-MFLogger::log_d(const wchar_t* szText){
-
+void MFLogger::log_d(const wchar_t* szText){
#ifdef _DEBUG
size_t len = wcslen(szText) + 1;
wchar_t* buffer = new wchar_t[(PREFIX_SIZE + len) * sizeof(wchar_t)];
memcpy(buffer, m_prefix, PREFIX_SIZE * sizeof(m_prefix[0]));
memcpy(buffer + PREFIX_SIZE , szText, len * sizeof(wchar_t));
log_int(buffer);
- delete buffer;
+ delete[] buffer;
#endif //_DEBUG
-
}
-
-void
-MFLogger::log_dp(const wchar_t* szText, ...){
-
+void MFLogger::log_dp(const wchar_t* szText, ...){
#ifdef _DEBUG
va_list args;
va_start(args, szText);
@@ -93,15 +67,11 @@ MFLogger::log_dp(const wchar_t* szText, ...){
va_end(args);
memcpy(buffer, m_prefix, PREFIX_SIZE * sizeof(m_prefix[0]));
log_int(buffer);
- delete buffer;
+ delete[] buffer;
#endif //_DEBUG
-
}
-
-void
-MFLogger::log_int(const wchar_t* szText){
-
+void MFLogger::log_int(const wchar_t* szText){
if (!logFunction){
return;
}
@@ -109,7 +79,4 @@ MFLogger::log_int(const wchar_t* szText){
EnterCriticalSection(&logCs);
(*logFunction)(szText);
LeaveCriticalSection(&logCs);
-
}
-
-