diff options
author | George Hazan <george.hazan@gmail.com> | 2013-08-19 19:04:33 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-08-19 19:04:33 +0000 |
commit | 664200e644b45e52c70affa1c036d7366474ae9d (patch) | |
tree | d05be80055dae5be865e2a56c14d7f6d0ad0fa06 /src/core/stdchat | |
parent | 857add6ec30c59d98482c21c60e13f8c3adb89e9 (diff) |
core *printf patch
git-svn-id: http://svn.miranda-ng.org/main/trunk@5750 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/core/stdchat')
-rw-r--r-- | src/core/stdchat/src/clist.cpp | 2 | ||||
-rw-r--r-- | src/core/stdchat/src/log.cpp | 13 | ||||
-rw-r--r-- | src/core/stdchat/src/main.cpp | 2 | ||||
-rw-r--r-- | src/core/stdchat/src/options.cpp | 12 | ||||
-rw-r--r-- | src/core/stdchat/src/tools.cpp | 2 | ||||
-rw-r--r-- | src/core/stdchat/src/window.cpp | 8 |
6 files changed, 20 insertions, 19 deletions
diff --git a/src/core/stdchat/src/clist.cpp b/src/core/stdchat/src/clist.cpp index a4fac02a9d..8ddc8c40d8 100644 --- a/src/core/stdchat/src/clist.cpp +++ b/src/core/stdchat/src/clist.cpp @@ -259,7 +259,7 @@ BOOL CList_AddEvent(HANDLE hContact, HICON hIcon, HANDLE hEvent, int type, TCHAR return FALSE;
va_start(marker, fmt);
- _vsntprintf(szBuf, SIZEOF(szBuf), fmt, marker);
+ mir_vsntprintf(szBuf, SIZEOF(szBuf), fmt, marker);
va_end(marker);
cle.cbSize = sizeof(cle);
diff --git a/src/core/stdchat/src/log.cpp b/src/core/stdchat/src/log.cpp index 85b52d5262..0a465fa7dd 100644 --- a/src/core/stdchat/src/log.cpp +++ b/src/core/stdchat/src/log.cpp @@ -114,7 +114,7 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff char* d;
va_start(va, fmt);
- lineLen = _vsntprintf( line, 8000, fmt, va);
+ lineLen = mir_vsntprintf( line, 8000, fmt, va);
if (lineLen < 0) lineLen = 8000;
line[lineLen] = 0;
va_end(va);
@@ -216,7 +216,7 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff else if (*line > 0 && *line < 128) {
*d++ = (char) *line;
}
- else d += sprintf(d, "\\u%u ?", (WORD)*line);
+ else d += sprintf(d, "\\u%u ?", (WORD)*line); //!!!!!!!!!!!
}
*cbBufferEnd = (int) (d - *buffer);
@@ -681,8 +681,9 @@ void LoadMsgLogBitmaps(void) pBmpBits = (PBYTE) mir_alloc(widthBytes * bih.biHeight);
for (i = 0; i < SIZEOF(pLogIconBmpBits); i++) {
hIcon = hIcons[i];
- pLogIconBmpBits[i] = (PBYTE) mir_alloc(RTFPICTHEADERMAXSIZE + (bih.biSize + widthBytes * bih.biHeight) * 2);
- rtfHeaderSize = sprintf((char *)pLogIconBmpBits[i], "{\\pict\\dibitmap0\\wbmbitspixel%u\\wbmplanes1\\wbmwidthbytes%u\\picw%u\\pich%u ", bih.biBitCount, widthBytes, bih.biWidth, bih.biHeight);
+ size_t size = RTFPICTHEADERMAXSIZE + (bih.biSize + widthBytes * bih.biHeight) * 2;
+ pLogIconBmpBits[i] = (PBYTE) mir_alloc(size);
+ rtfHeaderSize = mir_snprintf((char *)pLogIconBmpBits[i], size, "{\\pict\\dibitmap0\\wbmbitspixel%u\\wbmplanes1\\wbmwidthbytes%u\\picw%u\\pich%u ", bih.biBitCount, widthBytes, bih.biWidth, bih.biHeight);
hoBmp = (HBITMAP) SelectObject(hdcMem, hBmp);
FillRect(hdcMem, &rc, hBkgBrush);
DrawIconEx(hdcMem, 0, 0, hIcon, bih.biWidth, bih.biHeight, 0, NULL, DI_NORMAL);
@@ -691,9 +692,9 @@ void LoadMsgLogBitmaps(void) {
int n;
for (n = 0; n < sizeof(BITMAPINFOHEADER); n++)
- sprintf((char *)pLogIconBmpBits[i] + rtfHeaderSize + n * 2, "%02X", ((PBYTE) & bih)[n]);
+ sprintf((char *)pLogIconBmpBits[i] + rtfHeaderSize + n * 2, "%02X", ((PBYTE) & bih)[n]); //!!!!!!!!!!!!!
for (n = 0; n < widthBytes * bih.biHeight; n += 4)
- sprintf((char *)pLogIconBmpBits[i] + rtfHeaderSize + (bih.biSize + n) * 2, "%02X%02X%02X%02X", pBmpBits[n], pBmpBits[n + 1], pBmpBits[n + 2], pBmpBits[n + 3]);
+ sprintf((char *)pLogIconBmpBits[i] + rtfHeaderSize + (bih.biSize + n) * 2, "%02X%02X%02X%02X", pBmpBits[n], pBmpBits[n + 1], pBmpBits[n + 2], pBmpBits[n + 3]); //!!!!!!!!!!!!!
}
logIconBmpSize[i] = rtfHeaderSize + (bih.biSize + widthBytes * bih.biHeight) * 2 + 1;
pLogIconBmpBits[i][logIconBmpSize[i] - 1] = '}';
diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index b2985d4098..edb254145a 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -258,7 +258,7 @@ STDMETHODIMP CREOleCallback::GetNewStorage(LPSTORAGE * lplpstg) {
WCHAR szwName[64];
char szName[64];
- wsprintfA(szName, "s%u", nextStgId++);
+ mir_snprintf(szName, SIZEOF(szName), "s%u", nextStgId++);
MultiByteToWideChar(CP_ACP, 0, szName, -1, szwName, SIZEOF(szwName));
if (pictStg == NULL)
return STG_E_MEDIUMFULL;
diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index b49684e9a5..96dc9f1cf3 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -326,28 +326,28 @@ void LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF* colour) DBVARIANT dbv;
if (colour) {
- wsprintfA(str, "Font%dCol", i);
+ mir_snprintf(str, SIZEOF(str), "Font%dCol", i);
*colour = db_get_dw(NULL, "ChatFonts", str, fontOptionsList[i].defColour);
}
if (lf) {
- wsprintfA(str, "Font%dSize", i);
+ mir_snprintf(str, SIZEOF(str), "Font%dSize", i);
lf->lfHeight = (char) db_get_b(NULL, "ChatFonts", str, fontOptionsList[i].defSize);
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
- wsprintfA(str, "Font%dSty", i);
+ mir_snprintf(str, SIZEOF(str), "Font%dSty", i);
style = db_get_b(NULL, "ChatFonts", str, fontOptionsList[i].defStyle);
lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
lf->lfUnderline = 0;
lf->lfStrikeOut = 0;
- wsprintfA(str, "Font%dSet", i);
+ mir_snprintf(str, SIZEOF(str), "Font%dSet", i);
lf->lfCharSet = db_get_b(NULL, "ChatFonts", str, fontOptionsList[i].defCharset);
lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf->lfQuality = DEFAULT_QUALITY;
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
- wsprintfA(str, "Font%d", i);
+ mir_snprintf(str, SIZEOF(str), "Font%d", i);
if (db_get_ts(NULL, "ChatFonts", str, &dbv))
lstrcpy(lf->lfFaceName, fontOptionsList[i].szDefFace);
else {
@@ -368,7 +368,7 @@ void RegisterFonts( void ) strncpy(fontid.dbSettingsGroup, "ChatFonts", sizeof(fontid.dbSettingsGroup));
_tcsncpy(fontid.group, _T("Chat Module"), SIZEOF(fontid.group));
_tcsncpy(fontid.name, fontOptionsList[i].szDescr, SIZEOF(fontid.name));
- sprintf(idstr, "Font%d", index);
+ mir_snprintf(idstr, SIZEOF(idstr), "Font%d", index);
strncpy(fontid.prefix, idstr, sizeof(fontid.prefix));
fontid.order = index;
diff --git a/src/core/stdchat/src/tools.cpp b/src/core/stdchat/src/tools.cpp index b72ee32fac..ce06d7e015 100644 --- a/src/core/stdchat/src/tools.cpp +++ b/src/core/stdchat/src/tools.cpp @@ -133,7 +133,7 @@ static int ShowPopup (HANDLE hContact, SESSION_INFO* si, HICON hIcon, char* psz return 0;
va_start(marker, fmt);
- _vsntprintf(szBuf, 4096, fmt, marker);
+ mir_vsntprintf(szBuf, 4096, fmt, marker);
va_end(marker);
pd.lchContact = hContact;
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index c56f80b6c7..3308ceb167 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -1111,13 +1111,13 @@ static int RestoreWindowPosition(HWND hwnd, HANDLE hContact, char * szModule, ch wp.length=sizeof(wp);
GetWindowPlacement(hwnd,&wp);
- wsprintfA(szSettingName,"%sx",szNamePrefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sx", szNamePrefix);
x=db_get_dw(hContact,szModule,szSettingName,-1);
- wsprintfA(szSettingName,"%sy",szNamePrefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sy", szNamePrefix);
y=(int)db_get_dw(hContact,szModule,szSettingName,-1);
- wsprintfA(szSettingName,"%swidth",szNamePrefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%swidth", szNamePrefix);
width=db_get_dw(hContact,szModule,szSettingName,-1);
- wsprintfA(szSettingName,"%sheight",szNamePrefix);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sheight", szNamePrefix);
height=db_get_dw(hContact,szModule,szSettingName,-1);
if (x==-1)
|