diff options
Diffstat (limited to 'plugins/Dbx_tree/src')
-rw-r--r-- | plugins/Dbx_tree/src/Events.cpp | 8 | ||||
-rw-r--r-- | plugins/Dbx_tree/src/Logger.cpp | 6 | ||||
-rw-r--r-- | plugins/Dbx_tree/src/Settings.cpp | 12 | ||||
-rw-r--r-- | plugins/Dbx_tree/src/savestrings_gcc.h | 31 |
4 files changed, 14 insertions, 43 deletions
diff --git a/plugins/Dbx_tree/src/Events.cpp b/plugins/Dbx_tree/src/Events.cpp index 41228b69ce..ee3254ad44 100644 --- a/plugins/Dbx_tree/src/Events.cpp +++ b/plugins/Dbx_tree/src/Events.cpp @@ -89,12 +89,12 @@ bool CEventsTypeManager::GetType(uint32_t GlobalID, char * & Module, uint32_t & sname.Descriptor = &d;
sname.Type = DBT_ST_ANSI;
- sprintf_s(n, "$EventTypes/%08x/ModuleID", GlobalID);
+ mir_snprintf(n, SIZEOF(n), "$EventTypes/%08x/ModuleID", GlobalID);
TDBTSettingHandle h = m_Settings.ReadSetting(sid);
if ((h != DBT_INVALIDPARAM) && (h != 0))
{
- sprintf_s(n, "$EventTypes/%08x/ModuleName", GlobalID);
+ mir_snprintf(n, SIZEOF(n), "$EventTypes/%08x/ModuleName", GlobalID);
d.Flags = 0;
h = m_Settings.ReadSetting(sname);
@@ -145,12 +145,12 @@ uint32_t CEventsTypeManager::EnsureIDExists(char* Module, uint32_t EventType) s.cbSize = sizeof(s);
s.Descriptor = &d;
- sprintf_s(n, "$EventTypes/%08x/ModuleID", res);
+ mir_snprintf(n, SIZEOF(n), "$EventTypes/%08x/ModuleID", res);
s.Type = DBT_ST_INT;
s.Value.Int = EventType;
m_Settings.WriteSetting(s);
- sprintf_s(n, "$EventTypes/%08x/ModuleName", res);
+ mir_snprintf(n, SIZEOF(n), "$EventTypes/%08x/ModuleName", res);
d.Flags = 0;
s.Type = DBT_ST_ANSI;
s.Value.Length = static_cast<uint32_t>(strlen(Module) + 1);
diff --git a/plugins/Dbx_tree/src/Logger.cpp b/plugins/Dbx_tree/src/Logger.cpp index 7ca9452460..7b732b6cfd 100644 --- a/plugins/Dbx_tree/src/Logger.cpp +++ b/plugins/Dbx_tree/src/Logger.cpp @@ -53,7 +53,7 @@ void CLogger::Append(const TCHAR * File, const TCHAR * Function, const int Line, TCHAR msgbuf[4096];
va_list va;
va_start(va, Message);
- len += _vstprintf_s(msgbuf, Message, va);
+ len += mir_vsntprintf(msgbuf, SIZEOF(msgbuf), Message, va);
va_end(va);
TCHAR * message;
@@ -65,12 +65,12 @@ void CLogger::Append(const TCHAR * File, const TCHAR * Function, const int Line, len += /*_tcslen(File) + 10 +*/ _tcslen(Function) + 32 + 12 + 1;
message = new TCHAR[len];
- m_Length += _stprintf_s(message, len, _T("[%s - %s]\n%s\n\nSystem Error Code: %d\n%s\n\n"), timebuf, /*File, Line, */ Function, msgbuf, SysState, syserror) + 1;
+ m_Length += mir_sntprintf(message, len, _T("[%s - %s]\n%s\n\nSystem Error Code: %d\n%s\n\n"), timebuf, /*File, Line, */ Function, msgbuf, SysState, syserror) + 1;
} else {
len += /*_tcslen(File) + 10 +*/ _tcslen(Function) + 12 + 1;
message = new TCHAR[len];
- m_Length += _stprintf_s(message, len, _T("[%s - %s]\n%s\n\n"), timebuf, /*File, Line, */Function, msgbuf) + 1;
+ m_Length += mir_sntprintf(message, len, _T("[%s - %s]\n%s\n\n"), timebuf, /*File, Line, */Function, msgbuf) + 1;
}
m_Messages.push_back(message);
}
diff --git a/plugins/Dbx_tree/src/Settings.cpp b/plugins/Dbx_tree/src/Settings.cpp index 54c0f03b6b..814086a432 100644 --- a/plugins/Dbx_tree/src/Settings.cpp +++ b/plugins/Dbx_tree/src/Settings.cpp @@ -808,7 +808,7 @@ unsigned int CSettings::ReadSetting(TDBTSetting & Setting, TDBTSettingHandle hSe {
char buffer[24];
buffer[0] = 0;
- Setting.Value.Length = 1 + sprintf_s(buffer, "%llu", setting->Value.QWord);
+ Setting.Value.Length = 1 + mir_snprintf(buffer, SIZEOF(buffer), "%llu", setting->Value.QWord);
Setting.Value.pAnsi = (char *) mir_realloc(Setting.Value.pAnsi, Setting.Value.Length);
memcpy(Setting.Value.pAnsi, buffer, Setting.Value.Length);
@@ -817,7 +817,7 @@ unsigned int CSettings::ReadSetting(TDBTSetting & Setting, TDBTSettingHandle hSe {
wchar_t buffer[24];
buffer[0] = 0;
- Setting.Value.Length = 1 + swprintf_s(buffer, L"%llu", setting->Value.QWord);
+ Setting.Value.Length = 1 + mir_snwprintf(buffer, SIZEOF(buffer), L"%llu", setting->Value.QWord);
Setting.Value.pWide = (wchar_t *) mir_realloc(Setting.Value.pWide, Setting.Value.Length * sizeof(wchar_t));
memcpy(Setting.Value.pWide, buffer, Setting.Value.Length * sizeof(wchar_t));
@@ -867,7 +867,7 @@ unsigned int CSettings::ReadSetting(TDBTSetting & Setting, TDBTSettingHandle hSe {
char buffer[24];
buffer[0] = 0;
- Setting.Value.Length = 1 + sprintf_s(buffer, "%lli", val);
+ Setting.Value.Length = 1 + mir_snprintf(buffer, SIZEOF(buffer), "%lli", val);
Setting.Value.pAnsi = (char *) mir_realloc(Setting.Value.pAnsi, Setting.Value.Length);
memcpy(Setting.Value.pAnsi, buffer, Setting.Value.Length);
@@ -876,7 +876,7 @@ unsigned int CSettings::ReadSetting(TDBTSetting & Setting, TDBTSettingHandle hSe {
wchar_t buffer[24];
buffer[0] = 0;
- Setting.Value.Length = 1 + swprintf_s(buffer, L"%lli", val);
+ Setting.Value.Length = 1 + mir_snwprintf(buffer, SIZEOF(buffer), L"%lli", val);
Setting.Value.pWide = (wchar_t *) mir_realloc(Setting.Value.pWide, Setting.Value.Length * sizeof(wchar_t));
memcpy(Setting.Value.pWide, buffer, Setting.Value.Length * sizeof(wchar_t));
@@ -923,7 +923,7 @@ unsigned int CSettings::ReadSetting(TDBTSetting & Setting, TDBTSettingHandle hSe {
char buffer[128];
buffer[0] = 0;
- Setting.Value.Length = 1 + sprintf_s(buffer, "%lf", setting->Value.QWord);
+ Setting.Value.Length = 1 + mir_snprintf(buffer, SIZEOF(buffer), "%lf", setting->Value.QWord);
Setting.Value.pAnsi = (char *) mir_realloc(Setting.Value.pAnsi, Setting.Value.Length);
memcpy(Setting.Value.pAnsi, buffer, Setting.Value.Length);
} break;
@@ -931,7 +931,7 @@ unsigned int CSettings::ReadSetting(TDBTSetting & Setting, TDBTSettingHandle hSe {
wchar_t buffer[128];
buffer[0] = 0;
- Setting.Value.Length = 1 + swprintf_s(buffer, L"%lf", setting->Value.QWord);
+ Setting.Value.Length = 1 + mir_snwprintf(buffer, SIZEOF(buffer), L"%lf", setting->Value.QWord);
Setting.Value.pWide = (wchar_t *) mir_realloc(Setting.Value.pWide, Setting.Value.Length * sizeof(wchar_t));
memcpy(Setting.Value.pWide, buffer, Setting.Value.Length * sizeof(wchar_t));
} break;
diff --git a/plugins/Dbx_tree/src/savestrings_gcc.h b/plugins/Dbx_tree/src/savestrings_gcc.h index 9da680874d..2fa60f071a 100644 --- a/plugins/Dbx_tree/src/savestrings_gcc.h +++ b/plugins/Dbx_tree/src/savestrings_gcc.h @@ -95,33 +95,4 @@ inline int strncpy_s( return strcpy_s(strDest, numberOfElements, strSource);
else
return strcpy_s(strDest, count + 1, strSource);
-}
-
-
-template <size_t size>
-inline int sprintf_s(
- char (&buffer)[size],
- const char *format,
- ...
-)
-{
- va_list va;
- va_start(va, format);
- vsnprintf(buffer, size, format, va);
- va_end(va);
-}
-
-template <size_t size>
-inline int swprintf_s(
- wchar_t (&buffer)[size],
- const wchar_t *format,
- ...
-)
-{
- va_list va;
- va_start(va, format);
- vsnwprintf(buffer, size, format, va);
- va_end(va);
-}
-
-#define vsprintf_s vsnprintf
+}
\ No newline at end of file |