diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-07-25 20:15:05 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-07-25 20:15:05 +0000 |
commit | 9d32b9cd791fb5f51dad17567152c70a8511a500 (patch) | |
tree | fd7aa3250ed409e720f26c341c0a5d736ed8083c /plugins/CrashDumper/src | |
parent | 125a25c86eed41352d45eb8fb6f994f65700c3ec (diff) |
replace sprintf to mir_snprintf (part 6)
git-svn-id: http://svn.miranda-ng.org/main/trunk@5485 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/CrashDumper/src')
-rw-r--r-- | plugins/CrashDumper/src/crshdmp.cpp | 6 | ||||
-rw-r--r-- | plugins/CrashDumper/src/dumper.cpp | 12 | ||||
-rw-r--r-- | plugins/CrashDumper/src/exhndlr.cpp | 14 | ||||
-rw-r--r-- | plugins/CrashDumper/src/ui.cpp | 4 | ||||
-rw-r--r-- | plugins/CrashDumper/src/utils.cpp | 18 | ||||
-rw-r--r-- | plugins/CrashDumper/src/utils.h | 2 |
6 files changed, 21 insertions, 35 deletions
diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index 7bb5e53445..beccc35107 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -70,7 +70,7 @@ INT_PTR StoreVersionInfoToFile(WPARAM, LPARAM lParam) CreateDirectoryTree(VersionInfoFolder);
TCHAR path[MAX_PATH];
- crs_sntprintf(path, MAX_PATH, TEXT("%s\\VersionInfo.txt"), VersionInfoFolder);
+ mir_sntprintf(path, MAX_PATH, TEXT("%s\\VersionInfo.txt"), VersionInfoFolder);
HANDLE hDumpFile = CreateFile(path, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -235,8 +235,8 @@ static int ModulesLoaded(WPARAM, LPARAM) else
profpath = Utils_ReplaceVarsT(_T("%miranda_userdata%"));
- crs_sntprintf(CrashLogFolder, MAX_PATH, TEXT("%s\\CrashLog"), profpath);
- crs_sntprintf(VersionInfoFolder, MAX_PATH, TEXT("%s"), profpath);
+ mir_sntprintf(CrashLogFolder, MAX_PATH, TEXT("%s\\CrashLog"), profpath);
+ mir_sntprintf(VersionInfoFolder, MAX_PATH, TEXT("%s"), profpath);
SetExceptionHandler();
diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp index 3e9afe3d28..6aebac5e05 100644 --- a/plugins/CrashDumper/src/dumper.cpp +++ b/plugins/CrashDumper/src/dumper.cpp @@ -184,7 +184,7 @@ static void GetPluginsString(bkstring& buffer, unsigned& flags) LPTSTR fname = _tcsrchr(path, TEXT('\\'));
if (fname == NULL) fname = path;
- crs_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\plugins\\*.dll"));
+ mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\plugins\\*.dll"));
WIN32_FIND_DATA FindFileData;
HANDLE hFind = FindFirstFile(path, &FindFileData);
@@ -202,7 +202,7 @@ static void GetPluginsString(bkstring& buffer, unsigned& flags) do
{
bool loaded = false;
- crs_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\plugins\\%s"), FindFileData.cFileName);
+ mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\plugins\\%s"), FindFileData.cFileName);
HMODULE hModule = GetModuleHandle(path);
if (hModule == NULL && servicemode)
{
@@ -375,7 +375,7 @@ static void GetWeatherStrings(bkstring& buffer, unsigned flags) LPTSTR fname = _tcsrchr(path, TEXT('\\'));
if (fname == NULL) fname = path;
- crs_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\plugins\\weather\\*.ini"));
+ mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\plugins\\weather\\*.ini"));
WIN32_FIND_DATA FindFileData;
HANDLE hFind = FindFirstFile(path, &FindFileData);
@@ -385,7 +385,7 @@ static void GetWeatherStrings(bkstring& buffer, unsigned flags) {
if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue;
- crs_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\plugins\\weather\\%s"), FindFileData.cFileName);
+ mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\plugins\\weather\\%s"), FindFileData.cFileName);
HANDLE hDumpFile = CreateFile(path, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -449,7 +449,7 @@ static void GetIconStrings(bkstring& buffer) LPTSTR fname = _tcsrchr(path, TEXT('\\'));
if (fname == NULL) fname = path;
- crs_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\Icons\\*.*"));
+ mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\Icons\\*.*"));
WIN32_FIND_DATA FindFileData;
HANDLE hFind = FindFirstFile(path, &FindFileData);
@@ -506,7 +506,7 @@ void PrintVersionInfo(bkstring& buffer, unsigned flags) buffer.appendfmt(TEXT("Build time: %s\r\n"), mirtime);
TCHAR profpn[MAX_PATH];
- crs_sntprintf(profpn, SIZEOF(profpn), TEXT("%s\\%s"), profpathfull, profname);
+ mir_sntprintf(profpn, SIZEOF(profpn), TEXT("%s\\%s"), profpathfull, profname);
buffer.appendfmt(TEXT("Profile: %s\r\n"), profpn);
diff --git a/plugins/CrashDumper/src/exhndlr.cpp b/plugins/CrashDumper/src/exhndlr.cpp index 16320f2170..7876389280 100644 --- a/plugins/CrashDumper/src/exhndlr.cpp +++ b/plugins/CrashDumper/src/exhndlr.cpp @@ -73,14 +73,14 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) {
if (dtsubfldr)
{
- crs_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
+ mir_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
CreateDirectory(path, NULL);
- crs_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder,
+ mir_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder,
st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
}
else
{
- crs_sntprintf(path, MAX_PATH, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder,
+ mir_sntprintf(path, MAX_PATH, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder,
st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
}
hDumpFile = CreateFile(path, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -101,19 +101,19 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) {
if (dtsubfldr)
{
- crs_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
+ mir_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d"), CrashLogFolder, st.wYear, st.wMonth, st.wDay);
CreateDirectory(path, NULL);
- crs_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder,
+ mir_sntprintf(path, MAX_PATH, TEXT("%s\\%02d.%02d.%02d\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder,
st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
}
else
{
- crs_sntprintf(path, MAX_PATH, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder,
+ mir_sntprintf(path, MAX_PATH, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder,
st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
}
hDumpFile = CreateFile(path, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
- crs_sntprintf(path, MAX_PATH, TranslateT("Miranda crashed. Crash report stored in the folder:\n %s\n\n Would you like store it in the clipboard as well?"), CrashLogFolder);
+ mir_sntprintf(path, MAX_PATH, TranslateT("Miranda crashed. Crash report stored in the folder:\n %s\n\n Would you like store it in the clipboard as well?"), CrashLogFolder);
if (hDumpFile != INVALID_HANDLE_VALUE)
CreateCrashReport(hDumpFile, exc_ptr, notify ? path : NULL);
diff --git a/plugins/CrashDumper/src/ui.cpp b/plugins/CrashDumper/src/ui.cpp index e9563cd127..d2eb282b3f 100644 --- a/plugins/CrashDumper/src/ui.cpp +++ b/plugins/CrashDumper/src/ui.cpp @@ -287,7 +287,7 @@ LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) case 3:
TCHAR path[MAX_PATH];
- crs_sntprintf(path, MAX_PATH, TEXT("%s\\VersionInfo.txt"), VersionInfoFolder);
+ mir_sntprintf(path, MAX_PATH, TEXT("%s\\VersionInfo.txt"), VersionInfoFolder);
ShellExecute(NULL, TEXT("open"), path, NULL, NULL, SW_SHOW);
break;
@@ -310,7 +310,7 @@ void ShowMessage(int type, const TCHAR* format, ...) va_list va;
va_start(va, format);
- int len = _vsntprintf(pi.lptzText, SIZEOF(pi.lptzText)-1, format, va);
+ int len = mir_vsntprintf(pi.lptzText, SIZEOF(pi.lptzText)-1, format, va);
pi.lptzText[len] = 0;
va_end(va);
diff --git a/plugins/CrashDumper/src/utils.cpp b/plugins/CrashDumper/src/utils.cpp index 1bb3b770aa..f7d1e5d8a1 100644 --- a/plugins/CrashDumper/src/utils.cpp +++ b/plugins/CrashDumper/src/utils.cpp @@ -329,7 +329,7 @@ void GetISO8061Time(SYSTEMTIME* stLocal, LPTSTR lpszString, DWORD dwSize) int offset = GetTZOffset();
// Build a string showing the date and time.
- crs_sntprintf(lpszString, dwSize, TEXT("%d-%02d-%02d %02d:%02d:%02d%+03d%02d"),
+ mir_sntprintf(lpszString, dwSize, TEXT("%d-%02d-%02d %02d:%02d:%02d%+03d%02d"),
stLocal->wYear, stLocal->wMonth, stLocal->wDay,
stLocal->wHour, stLocal->wMinute, stLocal->wSecond,
offset / 60, offset % 60);
@@ -695,14 +695,14 @@ void GetLanguagePackString(bkstring& buffer) LPTSTR fname = _tcsrchr(path, TEXT('\\'));
if (fname == NULL) fname = path;
- crs_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\langpack_*.txt"));
+ mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\langpack_*.txt"));
WIN32_FIND_DATA FindFileData;
HANDLE hFind = FindFirstFile(path, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE) return;
FindClose(hFind);
- crs_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\%s"), FindFileData.cFileName);
+ mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\%s"), FindFileData.cFileName);
HANDLE hDumpFile = CreateFile(path, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -768,18 +768,6 @@ bool CreateDirectoryTree(LPTSTR szDir) return res;
}
-int crs_sntprintf(TCHAR *buffer, size_t count, const TCHAR* fmt, ...)
-{
- va_list va;
- va_start(va, fmt);
-
- int len = _vsntprintf(buffer, count-1, fmt, va);
- buffer[len] = 0;
-
- va_end(va);
- return len;
-}
-
void GetVersionInfo(HMODULE hLib, bkstring& buffer)
{
HRSRC hVersion = FindResource(hLib, MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION);
diff --git a/plugins/CrashDumper/src/utils.h b/plugins/CrashDumper/src/utils.h index 0399c28bb3..50ac39470f 100644 --- a/plugins/CrashDumper/src/utils.h +++ b/plugins/CrashDumper/src/utils.h @@ -46,8 +46,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define MS_PROTO_ENUMPROTOS "Proto/EnumProtos"
-int crs_sntprintf(TCHAR *buffer, size_t count, const TCHAR* fmt, ...);
-
#define crsi_u2a(dst, src) \
{ \
int cbLen = WideCharToMultiByte(CP_ACP, 0, src, -1, NULL, 0, NULL, NULL); \
|