diff options
author | George Hazan <george.hazan@gmail.com> | 2013-05-16 15:08:49 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-05-16 15:08:49 +0000 |
commit | 2e4abd268c71f15bcf73c49a5005f128ffd8ee96 (patch) | |
tree | 92624c24bafa4a02eb7e7fd2501a988e385ffab3 | |
parent | 769714b0aa9606e0d94a9d88c7c3ee3064792e4a (diff) |
shortened typedefs for string buffers:
MCBuf -> mir_ptr<char>
MTBuf -> mir_ptr<TCHAR>
MWBuf -> mir_ptr<WCHAR>
git-svn-id: http://svn.miranda-ng.org/main/trunk@4680 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
69 files changed, 157 insertions, 154 deletions
diff --git a/include/m_system_cpp.h b/include/m_system_cpp.h index 600eefe01f..933b416e85 100644 --- a/include/m_system_cpp.h +++ b/include/m_system_cpp.h @@ -53,6 +53,10 @@ public: __inline operator INT_PTR() const { return (INT_PTR)data; }
};
+typedef mir_ptr<char> MCBuf;
+typedef mir_ptr<TCHAR> MTBuf;
+typedef mir_ptr<WCHAR> MWBuf;
+
///////////////////////////////////////////////////////////////////////////////
// mir_cslock - simple locker for the critical sections
diff --git a/include/m_utils.h b/include/m_utils.h index 6e418fdc6c..c738cb924e 100644 --- a/include/m_utils.h +++ b/include/m_utils.h @@ -428,17 +428,17 @@ __forceinline TCHAR* Utils_ReplaceVarsT(const TCHAR *szData) { #include "m_system_cpp.h"
#endif
- struct VARS : public mir_ptr<char>
+ struct VARS : public MCBuf
{
__forceinline VARS(const char *str) :
- mir_ptr<char>( Utils_ReplaceVars(str))
+ MCBuf( Utils_ReplaceVars(str))
{}
};
- struct VARST : public mir_ptr<TCHAR>
+ struct VARST : public MTBuf
{
__forceinline VARST(const TCHAR *str) :
- mir_ptr<TCHAR>( Utils_ReplaceVarsT(str))
+ MTBuf( Utils_ReplaceVarsT(str))
{}
};
#endif
diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index 6bf53acbf1..561f5801be 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -450,7 +450,7 @@ int FillAvatarListFromDB(HWND list, HANDLE hContact) // Get file in disk
TCHAR path[MAX_PATH];
- mir_ptr<TCHAR> tszStoredPath(mir_utf8decodeT((char*)dbei.pBlob));
+ MTBuf tszStoredPath(mir_utf8decodeT((char*)dbei.pBlob));
PathToAbsoluteT(tszStoredPath, path);
// Add to list
diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index eb77df785a..a11448d4c4 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -218,7 +218,7 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam) if (ContactEnabled(hContact, "LogToHistory", AVH_DEF_LOGTOHISTORY)) {
TCHAR rel_path[MAX_PATH];
PathToRelativeT(history_filename, rel_path);
- mir_ptr<char> blob( mir_utf8encodeT(rel_path));
+ MCBuf blob( mir_utf8encodeT(rel_path));
DBEVENTINFO dbei = { sizeof(dbei) };
dbei.szModule = GetContactProto(hContact);
diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp index 3b5e0c3836..f892ae1ef1 100644 --- a/plugins/BuddyPounce/src/main.cpp +++ b/plugins/BuddyPounce/src/main.cpp @@ -70,7 +70,7 @@ int MsgAck(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
int reuse = db_get_b(ack->hContact,modname, "Reuse", 0);
if ( !db_get_ts(ack->hContact, modname, "PounceMsg", &dbv) && (dbv.ptszVal[0] != '\0')) {
- mir_ptr<char> pszUtf( mir_utf8encodeT(dbv.ptszVal));
+ MCBuf pszUtf( mir_utf8encodeT(dbv.ptszVal));
dbei.cbSize = sizeof(dbei);
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_UTF | DBEF_SENT;
diff --git a/plugins/Clist_modern/src/modern_skinopt.cpp b/plugins/Clist_modern/src/modern_skinopt.cpp index 70c9495c82..d2077ff74b 100644 --- a/plugins/Clist_modern/src/modern_skinopt.cpp +++ b/plugins/Clist_modern/src/modern_skinopt.cpp @@ -412,7 +412,7 @@ HTREEITEM FillAvailableSkinList(HWND hwndDlg) SearchSkinFiles(hwndDlg, SkinsFolder);
{
TCHAR skinfull[MAX_PATH];
- mir_ptr<TCHAR> skinfile( db_get_tsa( NULL, SKIN, "SkinFile"));
+ MTBuf skinfile( db_get_tsa( NULL, SKIN, "SkinFile"));
if (skinfile) {
PathToAbsoluteT(skinfile, skinfull);
res = AddSkinToListFullName(hwndDlg, skinfull);
@@ -518,7 +518,7 @@ HTREEITEM AddItemToTree(HWND hTree, TCHAR *folder, TCHAR *itemName, void *data) INT_PTR SvcActiveSkin(WPARAM wParam, LPARAM lParam)
{
- mir_ptr<TCHAR> skinfile( db_get_tsa(NULL, SKIN, "SkinFile"));
+ MTBuf skinfile( db_get_tsa(NULL, SKIN, "SkinFile"));
if (skinfile) {
TCHAR skinfull[MAX_PATH];
PathToAbsoluteT(skinfile, skinfull);
diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index 3539d7a30e..6f01f7408d 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -453,7 +453,7 @@ void SaveState() if (szTempModeName) {
SendDlgItemMessage(clvmHwnd, IDC_VIEWMODES, LB_GETTEXT, clvm_curItem, (LPARAM)szTempModeName);
- mir_ptr<char> szModeName( mir_utf8encodeT(szTempModeName));
+ MCBuf szModeName( mir_utf8encodeT(szTempModeName));
DWORD dwGlobalMask = GetMaskForItem(hInfoItem);
for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp index bd14dfc47b..b9c5f01355 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp @@ -530,7 +530,7 @@ int LocateStorePosition(int Frameid, int maxstored) for (int i = 0;i < maxstored;i++) {
char settingname[255];
mir_snprintf(settingname, sizeof(settingname), "Name%d", i);
- mir_ptr<TCHAR> frmname( db_get_tsa(0, CLUIFrameModule, settingname));
+ MTBuf frmname( db_get_tsa(0, CLUIFrameModule, settingname));
if (frmname == NULL) continue;
if (lstrcmpi(frmname, Frames[Frameid].name) == 0)
return i;
diff --git a/plugins/CrashDumper/src/upload.cpp b/plugins/CrashDumper/src/upload.cpp index 7dd74d65c4..8ce0252826 100644 --- a/plugins/CrashDumper/src/upload.cpp +++ b/plugins/CrashDumper/src/upload.cpp @@ -75,7 +75,7 @@ void OpenAuthUrl(const char* url) if (user[0] && pass[0]) {
char str[256];
mir_snprintf(str, sizeof(str), url, user);
- mir_snprintf(str, sizeof(str), "http://www.miranda-vi.org/cdlogin?name=%s&pass=%s&redir=%s", user, pass, mir_ptr<char>( mir_urlEncode(str)));
+ mir_snprintf(str, sizeof(str), "http://www.miranda-vi.org/cdlogin?name=%s&pass=%s&redir=%s", user, pass, MCBuf( mir_urlEncode(str)));
CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)str);
}
else CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://www.miranda-vi.org/");
diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index 7f2ef7631c..8c57c2885c 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -1095,7 +1095,7 @@ static int OnContactSettingChanged(WPARAM wParam, LPARAM lParam) if (cws && cws->szSetting && !strcmp(cws->szSetting, "MirVer")) {
switch (cws->value.type) {
case DBVT_UTF8:
- ApplyFingerprintImage(hContact, mir_ptr<TCHAR>(mir_utf8decodeT(cws->value.pszVal)));
+ ApplyFingerprintImage(hContact, MTBuf(mir_utf8decodeT(cws->value.pszVal)));
break;
case DBVT_ASCIIZ:
ApplyFingerprintImage(hContact, _A2T(cws->value.pszVal));
@@ -1125,7 +1125,7 @@ static int OnSrmmWindowEvent(WPARAM wParam, LPARAM lParam) return 0;
if (event->uType == MSG_WINDOW_EVT_OPEN) {
- mir_ptr<TCHAR> ptszMirVer;
+ MTBuf ptszMirVer;
char *szProto = GetContactProto(event->hContact);
if (szProto != NULL)
ptszMirVer = db_get_tsa(event->hContact, szProto, "MirVer");
diff --git a/plugins/IEView/src/ChatHTMLBuilder.cpp b/plugins/IEView/src/ChatHTMLBuilder.cpp index 774f766a0a..90d3e72ac1 100644 --- a/plugins/IEView/src/ChatHTMLBuilder.cpp +++ b/plugins/IEView/src/ChatHTMLBuilder.cpp @@ -87,7 +87,7 @@ char *ChatHTMLBuilder::timestampToString(time_t time) char *pszStamp = "[%H:%M]";
//InitSetting( &g_Settings.pszTimeStamp, "HeaderTime", _T("[%H:%M]"));
strftime(str, 79, pszStamp, localtime(&time));
- lstrcpynA(szResult, mir_ptr<char>(mir_utf8encode(str)), 500);
+ lstrcpynA(szResult, MCBuf(mir_utf8encode(str)), 500);
return szResult;
}
@@ -171,7 +171,7 @@ void ChatHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) const char *className = "";
bool showIcon = false;
- mir_ptr<char> szName, szText;
+ MCBuf szName, szText;
if (eventData->dwFlags & IEEDF_UNICODE_TEXT)
szText = encodeUTF8(NULL, event->pszProto, eventData->pszTextW, ENF_ALL | ENF_CHAT_FORMATTING, isSent);
else
diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp index 6fad7a6fd5..e284aafe02 100644 --- a/plugins/IEView/src/HTMLBuilder.cpp +++ b/plugins/IEView/src/HTMLBuilder.cpp @@ -312,7 +312,7 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) HANDLE hDbEvent = event->hDbEventFirst;
event->hDbEventFirst = NULL;
- mir_ptr<char> szProto;
+ MCBuf szProto;
if (event->cbSize >= IEVIEWEVENT_SIZE_V3 && event->pszProto != NULL)
szProto = mir_strdup(event->pszProto);
else
@@ -435,7 +435,7 @@ ProtocolSettings* HTMLBuilder::getSRMMProtocolSettings(const char *protocolName) ProtocolSettings* HTMLBuilder::getSRMMProtocolSettings(HANDLE hContact)
{
- return getSRMMProtocolSettings( mir_ptr<char>(getRealProto(hContact)));
+ return getSRMMProtocolSettings( MCBuf(getRealProto(hContact)));
}
ProtocolSettings* HTMLBuilder::getHistoryProtocolSettings(const char *protocolName)
@@ -450,7 +450,7 @@ ProtocolSettings* HTMLBuilder::getHistoryProtocolSettings(const char *protocolNa ProtocolSettings* HTMLBuilder::getHistoryProtocolSettings(HANDLE hContact)
{
if (hContact != NULL)
- return getHistoryProtocolSettings( mir_ptr<char>(getRealProto(hContact)));
+ return getHistoryProtocolSettings( MCBuf(getRealProto(hContact)));
return Options::getProtocolSettings();
}
@@ -466,7 +466,7 @@ ProtocolSettings* HTMLBuilder::getChatProtocolSettings(const char *protocolName) ProtocolSettings* HTMLBuilder::getChatProtocolSettings(HANDLE hContact)
{
- return getChatProtocolSettings( mir_ptr<char>(getRealProto(hContact)));
+ return getChatProtocolSettings( MCBuf(getRealProto(hContact)));
}
void HTMLBuilder::setLastIEViewEvent(IEVIEWEVENT *event)
diff --git a/plugins/IEView/src/HistoryHTMLBuilder.cpp b/plugins/IEView/src/HistoryHTMLBuilder.cpp index c5ccebfa6a..decd8bc6a9 100644 --- a/plugins/IEView/src/HistoryHTMLBuilder.cpp +++ b/plugins/IEView/src/HistoryHTMLBuilder.cpp @@ -89,7 +89,7 @@ char *HistoryHTMLBuilder::timestampToString(DWORD dwFlags, time_t check) { dbtts.szFormat = (char *)"d t";
CallService(MS_DB_TIME_TIMESTAMPTOSTRING, check, (LPARAM) & dbtts);
strncat(szResult, str, 500);
- lstrcpynA(szResult, mir_ptr<char>(mir_utf8encode(szResult)), 500);
+ lstrcpynA(szResult, MCBuf(mir_utf8encode(szResult)), 500);
return szResult;
}
@@ -221,7 +221,7 @@ void HistoryHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) { void HistoryHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event)
{
DWORD dwFlags = db_get_b(NULL, HPPMOD, SRMSGSET_SHOWICONS, 0) ? SMF_LOG_SHOWICONS : 0;
- mir_ptr<char> szRealProto( getRealProto(event->hContact));
+ MCBuf szRealProto( getRealProto(event->hContact));
IEVIEWEVENTDATA* eventData = event->eventData;
for (int eventIdx = 0; eventData!=NULL && (eventIdx < event->count || event->count==-1); eventData = eventData->next, eventIdx++) {
int outputSize;
@@ -231,7 +231,7 @@ void HistoryHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event if (eventData->iType == IEED_EVENT_MESSAGE || eventData->iType == IEED_EVENT_STATUSCHANGE ||
eventData->iType == IEED_EVENT_URL || eventData->iType == IEED_EVENT_FILE)
{
- mir_ptr<char> szName, szText;
+ MCBuf szName, szText;
if (eventData->dwFlags & IEEDF_UNICODE_NICK)
szName = encodeUTF8(event->hContact, szRealProto, eventData->pszNickW, ENF_NAMESMILEYS, true);
else
diff --git a/plugins/IEView/src/MUCCHTMLBuilder.cpp b/plugins/IEView/src/MUCCHTMLBuilder.cpp index e8d5b30c19..e7dcbb916c 100644 --- a/plugins/IEView/src/MUCCHTMLBuilder.cpp +++ b/plugins/IEView/src/MUCCHTMLBuilder.cpp @@ -109,7 +109,7 @@ char *MUCCHTMLBuilder::timestampToString(DWORD dwData, time_t check) }
CallService(MS_DB_TIME_TIMESTAMPTOSTRING, check, (LPARAM) & dbtts);
strncat(szResult, str, 500);
- lstrcpynA(szResult, mir_ptr<char>(mir_utf8encode(szResult)), 500);
+ lstrcpynA(szResult, MCBuf(mir_utf8encode(szResult)), 500);
return szResult;
}
@@ -190,7 +190,7 @@ void MUCCHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) { bool isSent = eventData->bIsMe != 0;
int outputSize;
char *output = NULL;
- mir_ptr<char> szName, szText;
+ MCBuf szName, szText;
if (eventData->iType == IEED_MUCC_EVENT_MESSAGE) {
if (eventData->dwFlags & IEEDF_UNICODE_TEXT)
szText = encodeUTF8(NULL, event->pszProto, eventData->pszTextW, ENF_ALL, isSent);
diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp index a3752d753c..c55a60f154 100644 --- a/plugins/IEView/src/ScriverHTMLBuilder.cpp +++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp @@ -171,7 +171,7 @@ char *ScriverHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mod //_tcsncat(szResult, str, 500);
strncat(szResult, str, 500);
}
- lstrcpynA(szResult, mir_ptr<char>(mir_utf8encode(szResult)), 500);
+ lstrcpynA(szResult, MCBuf(mir_utf8encode(szResult)), 500);
return szResult;
}
@@ -280,7 +280,7 @@ void ScriverHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_MESSAGEONNEWLINE, 0) ? SMF_LOG_MSGONNEWLINE : 0;
dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_DRAWLINES, 0) ? SMF_LOG_DRAWLINES : 0;
- mir_ptr<char> szRealProto( getRealProto(event->hContact));
+ MCBuf szRealProto( getRealProto(event->hContact));
IEVIEWEVENTDATA* eventData = event->eventData;
for (int eventIdx = 0; eventData!=NULL && (eventIdx < event->count || event->count==-1); eventData = eventData->next, eventIdx++) {
const char *className = "";
@@ -300,7 +300,7 @@ void ScriverHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event (((eventData->time < startedTime) == (getLastEventTime() < startedTime)) || !(eventData->dwFlags & IEEDF_READ))) {
isGroupBreak = FALSE;
}
- mir_ptr<char> szName, szText;
+ MCBuf szName, szText;
if (eventData->dwFlags & IEEDF_UNICODE_NICK)
szName = encodeUTF8(event->hContact, szRealProto, eventData->pszNickW, ENF_NAMESMILEYS, true);
else
diff --git a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp index c589a520ca..bb87bdac92 100644 --- a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp +++ b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp @@ -197,7 +197,7 @@ char *TabSRMMHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int isG }
CallService(MS_DB_TIME_TIMESTAMPTOSTRING, check, (LPARAM) & dbtts);
strncat(szResult, str, 500);
- lstrcpynA(szResult, mir_ptr<char>(mir_utf8encode(szResult)), 500);
+ lstrcpynA(szResult, MCBuf(mir_utf8encode(szResult)), 500);
return szResult;
}
@@ -327,7 +327,7 @@ void TabSRMMHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event isGroupBreak = FALSE;
}
- mir_ptr<char> szName, szText;
+ MCBuf szName, szText;
if (eventData->dwFlags & IEEDF_UNICODE_NICK)
szName = encodeUTF8(event->hContact, szRealProto, eventData->pszNickW, ENF_NAMESMILEYS, true);
else
diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp index 05d7faf1d6..ecdf765f1d 100644 --- a/plugins/IEView/src/TemplateHTMLBuilder.cpp +++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp @@ -151,7 +151,7 @@ char *TemplateHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mo }
}
- lstrcpynA(szResult, mir_ptr<char>(mir_utf8encodeT(str)), 500);
+ lstrcpynA(szResult, MCBuf(mir_utf8encodeT(str)), 500);
return szResult;
}
@@ -297,7 +297,7 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr }
if (tokenVal != NULL) {
if (token->getEscape())
- Utils::appendText(&output, &outputSize, "%s", mir_ptr<char>(Utils::escapeString(tokenVal)));
+ Utils::appendText(&output, &outputSize, "%s", MCBuf(Utils::escapeString(tokenVal)));
else
Utils::appendText(&output, &outputSize, "%s", tokenVal);
}
@@ -606,7 +606,7 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, }
if (tokenVal != NULL) {
if (token->getEscape())
- Utils::appendText(&output, &outputSize, "%s", mir_ptr<char>(Utils::escapeString(tokenVal)));
+ Utils::appendText(&output, &outputSize, "%s", MCBuf(Utils::escapeString(tokenVal)));
else
Utils::appendText(&output, &outputSize, "%s", tokenVal);
}
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index 6d2d16215e..84e01231a9 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -84,7 +84,7 @@ static HANDLE HContactFromID(char* szProto, char* pszSetting, TCHAR* pwszID) while (hContact != NULL) {
char* szProto = GetContactProto(hContact);
if ( !lstrcmpA(szProto, szProto)) {
- mir_ptr<WCHAR> id( db_get_tsa(hContact, szProto, pszSetting));
+ MWBuf id( db_get_tsa(hContact, szProto, pszSetting));
if ( !lstrcmp(pwszID, id))
return hContact;
}
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index 97888172ce..a1cd406030 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -452,11 +452,11 @@ static bool bWriteTextToFile(HANDLE hFile, const TCHAR *pszSrc, bool bUtf8File, if ( !bUtf8File) {
// We need to downgrade text to ansi
- mir_ptr<char> pszAstr( mir_t2a(pszSrc));
+ MCBuf pszAstr( mir_t2a(pszSrc));
return bWriteToFile(hFile, pszAstr, -1);
}
- mir_ptr<char> pszUtf8( mir_utf8encodeT(pszSrc));
+ MCBuf pszUtf8( mir_utf8encodeT(pszSrc));
return bWriteToFile(hFile, pszUtf8, -1);
}
@@ -473,7 +473,7 @@ static bool bWriteTextToFile( HANDLE hFile, const char *pszSrc, bool bUtf8File, pszSrc = tmp;
}
- mir_ptr<char> pszUtf8( mir_utf8encode(pszSrc));
+ MCBuf pszUtf8( mir_utf8encode(pszSrc));
return bWriteToFile(hFile, pszUtf8, -1);
}
diff --git a/plugins/MyDetails/src/data.cpp b/plugins/MyDetails/src/data.cpp index f88fb35acf..a952f56017 100644 --- a/plugins/MyDetails/src/data.cpp +++ b/plugins/MyDetails/src/data.cpp @@ -241,11 +241,11 @@ void Protocol::GetStatusMsg(int aStatus, TCHAR *msg, size_t msg_size) if ( !CanGetStatusMsg())
lcopystr(msg, _T(""), msg_size);
else if (aStatus == status && ProtoServiceExists(name, PS_GETMYAWAYMSG)) {
- mir_ptr<TCHAR> tmp((TCHAR*)CallProtoService(name, PS_GETMYAWAYMSG, 0, SGMA_TCHAR));
+ MTBuf tmp((TCHAR*)CallProtoService(name, PS_GETMYAWAYMSG, 0, SGMA_TCHAR));
lcopystr(msg, tmp == NULL ? _T("") : tmp, msg_size);
}
else if (ServiceExists(MS_AWAYMSG_GETSTATUSMSG)) {
- mir_ptr<TCHAR> tmp((TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGT, (WPARAM)aStatus, 0));
+ MTBuf tmp((TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGT, (WPARAM)aStatus, 0));
lcopystr(msg, tmp == NULL ? _T("") : tmp, msg_size);
}
}
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index ab2636c8a2..d93addd369 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -462,11 +462,11 @@ int ProcessStatus(DBCONTACTWRITESETTING *cws, HANDLE hContact) if (_stricmp(smi.proto, "mRadio") == 0 && !cws->value.type == DBVT_DELETED) {
TCHAR buf[MAX_PATH];
mir_sntprintf(buf, SIZEOF(buf), _T(" (%s)"), TranslateT("connecting"));
- mir_ptr<char> pszUtf( mir_utf8encodeT(buf));
+ MCBuf pszUtf( mir_utf8encodeT(buf));
mir_sntprintf(buf, SIZEOF(buf), _T(" (%s)"), TranslateT("aborting"));
- mir_ptr<char> pszUtf2( mir_utf8encodeT(buf));
+ MCBuf pszUtf2( mir_utf8encodeT(buf));
mir_sntprintf(buf, SIZEOF(buf), _T(" (%s)"), TranslateT("playing"));
- mir_ptr<char> pszUtf3( mir_utf8encodeT(buf));
+ MCBuf pszUtf3( mir_utf8encodeT(buf));
if (_stricmp(cws->value.pszVal, pszUtf) == 0 || _stricmp(cws->value.pszVal, pszUtf2) == 0 || _stricmp(cws->value.pszVal, pszUtf3) == 0)
return 0;
}
diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp index 76a774f567..deac669fdd 100644 --- a/plugins/Non-IM Contact/src/contactinfo.cpp +++ b/plugins/Non-IM Contact/src/contactinfo.cpp @@ -111,7 +111,7 @@ int BrowseForFolder(HWND hwnd,char *szPath) if (SUCCEEDED(OleInitialize(NULL))) {
LPMALLOC pMalloc;
if (SUCCEEDED(CoGetMalloc(1,&pMalloc))) {
- mir_ptr<TCHAR> tszPath( mir_a2t(szPath));
+ MTBuf tszPath( mir_a2t(szPath));
BROWSEINFO bi={0};
bi.hwndOwner = hwnd;
bi.pszDisplayName = tszPath;
diff --git a/plugins/PluginUpdater/src/Common.h b/plugins/PluginUpdater/src/Common.h index 4e8e121451..96627ee013 100644 --- a/plugins/PluginUpdater/src/Common.h +++ b/plugins/PluginUpdater/src/Common.h @@ -189,10 +189,10 @@ public: __inline operator INT_PTR() const { return (INT_PTR)data; }
};
-struct VARST : public mir_ptr<TCHAR>
+struct VARST : public MTBuf
{
__forceinline VARST(const TCHAR *str) :
- mir_ptr<TCHAR>( Utils_ReplaceVarsT(str))
+ MTBuf( Utils_ReplaceVarsT(str))
{}
};
diff --git a/plugins/PluginUpdater/src/Scanner.cpp b/plugins/PluginUpdater/src/Scanner.cpp index 0f2cf1c8fb..d198419df7 100644 --- a/plugins/PluginUpdater/src/Scanner.cpp +++ b/plugins/PluginUpdater/src/Scanner.cpp @@ -289,7 +289,7 @@ static void CheckUpdates(void *) REPLACEVARSDATA dat = { sizeof(REPLACEVARSDATA) };
dat.dwFlags = RVF_TCHAR;
dat.variables = vars;
- mir_ptr<TCHAR> tszBaseUrl((TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)dbVar.ptszVal, (LPARAM)&dat));
+ MTBuf tszBaseUrl((TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)dbVar.ptszVal, (LPARAM)&dat));
db_free(&dbVar);
// Download version info
diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp index 09f8b3d6fd..f157d7ebab 100644 --- a/plugins/Popup/src/actions.cpp +++ b/plugins/Popup/src/actions.cpp @@ -261,7 +261,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM LVITEM item = {0};
item.mask = LVIF_IMAGE|LVIF_PARAM|LVIF_TEXT|LVIF_STATE|LVIF_INDENT;
item.iItem = i;
- mir_ptr<TCHAR> tszName( mir_a2t(szName));
+ MTBuf tszName( mir_a2t(szName));
item.pszText = TranslateTS(tszName);
item.iImage = ImageList_AddIcon(hImgList, gActions[i]->lchIcon);
item.lParam = i;
diff --git a/plugins/Quotes/src/QuotesProviderBase.cpp b/plugins/Quotes/src/QuotesProviderBase.cpp Binary files differindex 84698140b1..fbf62e66fe 100644 --- a/plugins/Quotes/src/QuotesProviderBase.cpp +++ b/plugins/Quotes/src/QuotesProviderBase.cpp diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index aa665e5a85..b49ded9c7f 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -355,7 +355,7 @@ static LRESULT CALLBACK LogEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, POINTL ptl = { (LONG)pt.x, (LONG)pt.y };
ScreenToClient(hwnd, (LPPOINT)&ptl);
- mir_ptr<TCHAR> pszWord( GetRichTextWord(hwnd, &ptl));
+ MTBuf pszWord( GetRichTextWord(hwnd, &ptl));
if ( pszWord && pszWord[0] ) {
TCHAR szMenuText[4096];
mir_sntprintf( szMenuText, 4096, TranslateT("Look up \'%s\':"), pszWord );
@@ -1109,8 +1109,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP wStatus = db_get_w( dat->windowData.hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
// log status change - should be moved to a separate place
if (dat->wStatus != wStatus && db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, SRMSGDEFSET_SHOWSTATUSCH)) {
- mir_ptr<TCHAR> szOldStatus( mir_tstrdup((TCHAR *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM) dat->wStatus, GSMDF_TCHAR)));
- mir_ptr<TCHAR> szNewStatus( mir_tstrdup((TCHAR *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM) wStatus, GSMDF_TCHAR)));
+ MTBuf szOldStatus( mir_tstrdup((TCHAR *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM) dat->wStatus, GSMDF_TCHAR)));
+ MTBuf szNewStatus( mir_tstrdup((TCHAR *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM) wStatus, GSMDF_TCHAR)));
int iLen;
TCHAR buffer[512];
diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp index 0c90618d10..7460d211b4 100644 --- a/plugins/Scriver/src/utils.cpp +++ b/plugins/Scriver/src/utils.cpp @@ -431,8 +431,8 @@ void SearchWord(TCHAR * word, int engine) {
char szURL[4096];
if (word && word[0]) {
- mir_ptr<char> wordUTF( mir_utf8encodeT(word));
- mir_ptr<char> wordURL( mir_urlEncode(wordUTF));
+ MCBuf wordUTF( mir_utf8encodeT(word));
+ MCBuf wordURL( mir_urlEncode(wordUTF));
switch (engine) {
case SEARCHENGINE_WIKIPEDIA:
mir_snprintf(szURL, SIZEOF(szURL), "http://en.wikipedia.org/wiki/%s", wordURL);
diff --git a/plugins/SecureIM/src/svcs_proto.cpp b/plugins/SecureIM/src/svcs_proto.cpp index 21a228b041..55ee58c017 100644 --- a/plugins/SecureIM/src/svcs_proto.cpp +++ b/plugins/SecureIM/src/svcs_proto.cpp @@ -104,7 +104,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) if (ssig == SiG_NONE && !ptr->msgSplitted) {
Sent_NetLog("onRecvMsg: non-secure message");
- mir_ptr<char> szPlainMsg((ppre->flags & PREF_UNICODE) ? m_awstrcat(Translate(sim402),szEncMsg) : m_aastrcat(Translate(sim402),szEncMsg));
+ MCBuf szPlainMsg((ppre->flags & PREF_UNICODE) ? m_awstrcat(Translate(sim402),szEncMsg) : m_aastrcat(Translate(sim402),szEncMsg));
ppre->szMessage = szPlainMsg;
pccsd->wParam |= PREF_SIMNOMETA;
return CallService(MS_PROTO_CHAINRECV, wParam, lParam);
@@ -189,7 +189,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) szNewMsg = m_ustrcat(Translate(sim403), szOldMsg);
szOldMsg = szNewMsg;
}
- mir_ptr<char> szMsgUtf( utf8_to_miranda(szOldMsg, ppre->flags));
+ MCBuf szMsgUtf( utf8_to_miranda(szOldMsg, ppre->flags));
pccsd->wParam = ppre->flags;
ppre->szMessage = szMsgUtf;
@@ -224,7 +224,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) if (!szOldMsg)
return 1; // don't display it ...
- mir_ptr<char> szNewMsg( utf8_to_miranda(szOldMsg, ppre->flags));
+ MCBuf szNewMsg( utf8_to_miranda(szOldMsg, ppre->flags));
pccsd->wParam = ppre->flags;
ppre->szMessage = szNewMsg;
@@ -252,7 +252,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) // reinit key exchange user has send an encrypted message and i have no key
cpp_reset_context(ptr->cntx);
- mir_ptr<char> reSend((LPSTR)mir_alloc(strlen(szEncMsg)+LEN_RSND));
+ MCBuf reSend((LPSTR)mir_alloc(strlen(szEncMsg)+LEN_RSND));
strcpy(reSend,SIG_RSND); // copy resend sig
strcat(reSend,szEncMsg); // add mess
@@ -261,7 +261,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) pccsd->szProtoService = PSS_MESSAGE;
CallService(MS_PROTO_CHAINSEND, wParam, lParam); // send back cipher message
- mir_ptr<char> keyToSend( InitKeyA(ptr, 0)); // calculate public and private key
+ MCBuf keyToSend( InitKeyA(ptr, 0)); // calculate public and private key
pccsd->lParam = (LPARAM)(char*)keyToSend;
CallService(MS_PROTO_CHAINSEND, wParam, lParam); // send new key
@@ -301,7 +301,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) if (cpp_keyx(ptr->cntx)) {
// decrypt sended back message and save message for future sending with a new secret key
- addMsg2Queue(ptr, pccsd->wParam, mir_ptr<char>(decodeMsg(ptr,(LPARAM)pccsd,szEncMsg)));
+ addMsg2Queue(ptr, pccsd->wParam, MCBuf(decodeMsg(ptr,(LPARAM)pccsd,szEncMsg)));
showPopUpRM(ptr->hContact);
showPopUp(sim004,NULL,g_hPOP[POP_PU_DIS],0);
}
@@ -373,7 +373,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) if (ptr->features & CPP_FEATURES_NEWPG) {
cpp_reset_context(ptr->cntx);
- mir_ptr<char> keyToSend( InitKeyA(ptr,CPP_FEATURES_NEWPG|KEY_A_SIG)); // calculate NEW public and private key
+ MCBuf keyToSend( InitKeyA(ptr,CPP_FEATURES_NEWPG|KEY_A_SIG)); // calculate NEW public and private key
Sent_NetLog("onRecvMsg: Sending KEYA %s", keyToSend);
pccsd->wParam |= PREF_METANODB;
@@ -388,7 +388,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) // auto send my public key to keyB user if not done before
if (!cpp_keya(ptr->cntx)) {
- mir_ptr<char> keyToSend( InitKeyA(ptr,0)); // calculate public and private key
+ MCBuf keyToSend( InitKeyA(ptr,0)); // calculate public and private key
Sent_NetLog("onRecvMsg: Sending KEYA %s", keyToSend);
pccsd->wParam |= PREF_METANODB;
@@ -418,7 +418,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) return 1;
}
else {
- mir_ptr<char> keyToSend( InitKeyA(ptr, CPP_FEATURES_NEWPG | KEY_B_SIG)); // calculate NEW public and private key
+ MCBuf keyToSend( InitKeyA(ptr, CPP_FEATURES_NEWPG | KEY_B_SIG)); // calculate NEW public and private key
Sent_NetLog("onRecvMsg: Sending KEYB %s", keyToSend);
pccsd->wParam |= PREF_METANODB;
@@ -511,7 +511,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) if (!ptr->keyLoaded ) return returnError(pccsd->hContact,Translate(sim108));
LPSTR szNewMsg = NULL;
- mir_ptr<char> szUtfMsg( miranda_to_utf8((LPCSTR)pccsd->lParam,pccsd->wParam));
+ MCBuf szUtfMsg( miranda_to_utf8((LPCSTR)pccsd->lParam,pccsd->wParam));
if (ptr->keyLoaded == 1) // PGP
szNewMsg = pgp_encode(ptr->cntx,szUtfMsg);
else if (ptr->keyLoaded == 2) // GPG
@@ -559,7 +559,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) }
// øëåì øèôðîâàííîå â îôôëàéí
- exp->rsa_send(ptr->cntx, mir_ptr<char>( miranda_to_utf8((LPCSTR)pccsd->lParam,pccsd->wParam)));
+ exp->rsa_send(ptr->cntx, MCBuf( miranda_to_utf8((LPCSTR)pccsd->lParam,pccsd->wParam)));
showPopUpSM(ptr->hContact);
return returnNoError(pccsd->hContact);
}
@@ -591,7 +591,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) // ñîåäèíåíèå óñòàíîâëåíî
if (ptr->cntx && exp->rsa_get_state(ptr->cntx) == 7) {
- exp->rsa_send(ptr->cntx, mir_ptr<char>(miranda_to_utf8((LPCSTR)pccsd->lParam,pccsd->wParam)));
+ exp->rsa_send(ptr->cntx, MCBuf(miranda_to_utf8((LPCSTR)pccsd->lParam,pccsd->wParam)));
ShowStatusIconNotify(ptr->hContact);
showPopUpSM(ptr->hContact);
return returnNoError(pccsd->hContact);
@@ -738,7 +738,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) if (cpp_keyx(ptr->cntx)) {
Sent_NetLog("onSendMsg: cryptokey exist");
- mir_ptr<char> szNewMsg( encodeMsg(ptr,(LPARAM)pccsd));
+ MCBuf szNewMsg( encodeMsg(ptr,(LPARAM)pccsd));
Sent_NetLog("onSend: encrypted msg '%s'",szNewMsg);
pccsd->wParam |= PREF_METANODB;
@@ -759,7 +759,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) if (!ptr->waitForExchange) {
// init || always_try || always_if_possible
- mir_ptr<char> keyToSend( InitKeyA(ptr,0)); // calculate public and private key & fill KeyA
+ MCBuf keyToSend( InitKeyA(ptr,0)); // calculate public and private key & fill KeyA
Sent_NetLog("Sending KEY3: %s", keyToSend);
pccsd->wParam &= ~PREF_UNICODE;
diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 3ead9ab314..87ae2c4e03 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -503,7 +503,7 @@ INT_PTR OpenSessionsManagerWindow(WPARAM wparam,LPARAM lparam) return 0;
}
- mir_ptr<TCHAR>
+ MTBuf
tszSession(db_get_tsa(NULL, MODNAME, "SessionDate_0")),
tszUserSession(db_get_tsa(NULL, MODNAME, "UserSessionDsc_0"));
if (g_bIncompletedSave || tszSession || tszUserSession) {
diff --git a/plugins/SimpleStatusMsg/src/options.cpp b/plugins/SimpleStatusMsg/src/options.cpp index ad6e704b52..8ced5bc7d3 100644 --- a/plugins/SimpleStatusMsg/src/options.cpp +++ b/plugins/SimpleStatusMsg/src/options.cpp @@ -137,7 +137,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L val = db_get_b(NULL, "SimpleStatusMsg", (char *)StatusModeToDbSetting(i, "Flags"), STATUS_DEFAULT);
data->status_msg[0].flags[i - ID_STATUS_ONLINE] = val;
- mir_ptr<TCHAR> text = db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(i, "Default"));
+ MTBuf text = db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(i, "Default"));
lstrcpyn(data->status_msg[0].msg[i - ID_STATUS_ONLINE], (text == NULL) ? GetDefaultMessage(i) : text, 1024);
for (j = 0; j < accounts->count; j++)
diff --git a/plugins/SkypeStatusChange/src/stdafx.h b/plugins/SkypeStatusChange/src/stdafx.h index f6c0589707..a74bf594f8 100644 --- a/plugins/SkypeStatusChange/src/stdafx.h +++ b/plugins/SkypeStatusChange/src/stdafx.h @@ -64,7 +64,7 @@ class COptions iStatus(_status)
{}
- mir_ptr<char> szProto;
+ MCBuf szProto;
int iStatus;
};
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 82f8b00e77..23bb20b231 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -3113,10 +3113,10 @@ LABEL_SHOWWINDOW: if (GetSendButtonState(hwndDlg) != PBS_DISABLED) {
MODULEINFO *mi = MM_FindModule(si->pszModule);
- mir_ptr<char> pszRtf( Chat_Message_GetFromStream(hwndDlg, si));
+ MCBuf pszRtf( Chat_Message_GetFromStream(hwndDlg, si));
SM_AddCommand(si->ptszID, si->pszModule, pszRtf);
- mir_ptr<TCHAR> ptszText( Chat_DoRtfToTags(pszRtf, si));
+ MTBuf ptszText( Chat_DoRtfToTags(pszRtf, si));
if ((TCHAR*)ptszText == NULL)
break;
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 014f41ba20..3951c4efb1 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -554,11 +554,11 @@ static TCHAR *GetPreviewT(WORD eventType, DBEVENTINFO* dbe) if (dbe->cbBlob > (sizeof(DWORD) + namelength + 1))
szDescr = szFileName + namelength + 1;
- mir_ptr<TCHAR> tszFileName( DbGetEventStringT(dbe, szFileName));
+ MTBuf tszFileName( DbGetEventStringT(dbe, szFileName));
TCHAR buf[1024];
if (szDescr && Utils::safe_strlen(szDescr, dbe->cbBlob - sizeof(DWORD) - namelength - 1) > 0) {
- mir_ptr<TCHAR> tszDescr( DbGetEventStringT(dbe, szDescr));
+ MTBuf tszDescr( DbGetEventStringT(dbe, szDescr));
if (tszFileName && tszDescr) {
mir_sntprintf(buf, SIZEOF(buf), _T("%s: %s (%s)"), TranslateT("Incoming file"), tszFileName, tszDescr);
return mir_tstrdup(buf);
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 16a804abf8..40bbbeaeb8 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -712,7 +712,7 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c) mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("changed status from %s to %s."), szOldStatus, szNewStatus);
}
- mir_ptr<char> szMsg( mir_utf8encodeT(buffer));
+ MCBuf szMsg( mir_utf8encodeT(buffer));
DBEVENTINFO dbei = { sizeof(dbei) };
dbei.pBlob = (PBYTE)(char*)szMsg;
dbei.cbBlob = lstrlenA(szMsg) + 1;
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index 634f26042e..f4bcfabd11 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -901,7 +901,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM job->writeFlags();
break;
case ID_QUEUEMANAGER_COPYMESSAGETOCLIPBOARD:
- Utils::CopyToClipBoard((TCHAR*)mir_ptr<TCHAR>( mir_utf8decodeT(job->sendBuffer)), m_hwndDlg);
+ Utils::CopyToClipBoard((TCHAR*)MTBuf( mir_utf8decodeT(job->sendBuffer)), m_hwndDlg);
break;
case ID_QUEUEMANAGER_RESETSELECTED:
if (job->bCode == CSendLaterJob::JOB_DEFERRED) {
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index 7807a4d193..0367e22dcb 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -136,7 +136,7 @@ static int SendChunkW(WCHAR *chunk, HANDLE hContact, DWORD dwFlags) int mbcsSize = WideCharToMultiByte(codePage, 0, chunk, -1, NULL, 0, 0, 0);
memRequired += mbcsSize;
- mir_ptr<char> pBuf((char*)mir_alloc(memRequired));
+ MCBuf pBuf((char*)mir_alloc(memRequired));
WideCharToMultiByte(codePage, 0, chunk, -1, pBuf, mbcsSize, 0, 0);
CopyMemory(&pBuf[mbcsSize], chunk, (wLen+1) * sizeof(WCHAR));
return CallContactService(hContact, PSS_MESSAGE, dwFlags, (LPARAM)pBuf);
diff --git a/plugins/Variables/src/variables.cpp b/plugins/Variables/src/variables.cpp index 4758f9f167..d42d8f55db 100644 --- a/plugins/Variables/src/variables.cpp +++ b/plugins/Variables/src/variables.cpp @@ -502,7 +502,7 @@ TCHAR *formatString(FORMATINFO *fi) if ((fi == NULL) || (fi->tszFormat == NULL))
return NULL;
- mir_ptr<TCHAR> string( mir_tstrdup(fi->tszFormat));
+ MTBuf string( mir_tstrdup(fi->tszFormat));
if (string == NULL)
return NULL;
diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp index 08ee90d862..1e7491249a 100644 --- a/plugins/Weather/src/weather_addstn.cpp +++ b/plugins/Weather/src/weather_addstn.cpp @@ -308,8 +308,8 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR * // replace spaces with %20
char loc[256];
- mir_ptr<char> szSearchName( mir_utf8encodeT(name));
- wsprintfA(loc, sData->SearchURL, mir_ptr<char>( mir_urlEncode(szSearchName)));
+ MCBuf szSearchName( mir_utf8encodeT(name));
+ wsprintfA(loc, sData->SearchURL, MCBuf( mir_urlEncode(szSearchName)));
if (InternetDownloadFile(loc, NULL, &szData) == 0) {
TCHAR* szInfo = szData;
search = _tcsstr(szInfo, sData->NotFoundStr); // determine if data is available
diff --git a/plugins/XSoundNotify/src/xsn_main.cpp b/plugins/XSoundNotify/src/xsn_main.cpp index f1e338daa3..1954c84f15 100644 --- a/plugins/XSoundNotify/src/xsn_main.cpp +++ b/plugins/XSoundNotify/src/xsn_main.cpp @@ -137,7 +137,7 @@ INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) break;
case DBVT_UTF8:
- _tcscpy(uid, mir_ptr<TCHAR>(mir_utf8decodeT(dbvuid.pszVal)));
+ _tcscpy(uid, MTBuf(mir_utf8decodeT(dbvuid.pszVal)));
break;
}
@@ -344,7 +344,7 @@ INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wParam, L break;
case DBVT_UTF8:
- _tcscpy(uid, mir_ptr<TCHAR>( mir_utf8decodeT(dbvuid.pszVal)));
+ _tcscpy(uid, MTBuf( mir_utf8decodeT(dbvuid.pszVal)));
break;
}
diff --git a/plugins/YARelay/src/main.cpp b/plugins/YARelay/src/main.cpp index 8613d49304..2a37b58c81 100644 --- a/plugins/YARelay/src/main.cpp +++ b/plugins/YARelay/src/main.cpp @@ -135,7 +135,7 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) // build a message
Buffer<char> szUtfMsg;
- mir_ptr<char> szTemplate( mir_utf8encodeT(tszForwardTemplate));
+ MCBuf szTemplate( mir_utf8encodeT(tszForwardTemplate));
for (char *p = szTemplate; *p; p++) {
if (*p != '%') {
szUtfMsg.append(*p);
@@ -146,7 +146,7 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) switch(*++p) {
case 'u':
case 'U':
- szUtfMsg.append( mir_ptr<char>(mir_utf8encodeT(pcli->pfnGetContactDisplayName(hContact, 0))));
+ szUtfMsg.append( MCBuf(mir_utf8encodeT(pcli->pfnGetContactDisplayName(hContact, 0))));
break;
case 'i':
@@ -167,19 +167,19 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) }
else mir_sntprintf(buf, SIZEOF(buf), _T("%p"), hContact);
}
- szUtfMsg.append( mir_ptr<char>(mir_utf8encodeT(buf)));
+ szUtfMsg.append( MCBuf(mir_utf8encodeT(buf)));
break;
case 't':
case 'T':
_tcsftime(buf, 10, _T("%H:%M"), tm_time);
- szUtfMsg.append( mir_ptr<char>(mir_utf8encodeT(buf)));
+ szUtfMsg.append( MCBuf(mir_utf8encodeT(buf)));
break;
case 'd':
case 'D':
_tcsftime(buf, 12, _T("%d/%m/%Y"), tm_time);
- szUtfMsg.append( mir_ptr<char>(mir_utf8encodeT(buf)));
+ szUtfMsg.append( MCBuf(mir_utf8encodeT(buf)));
break;
case 'm':
@@ -187,7 +187,7 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) if (dbei.flags & DBEF_UTF)
szUtfMsg.append((char*)dbei.pBlob, dbei.cbBlob);
else
- szUtfMsg.append( mir_ptr<char>(mir_utf8encode((char*)dbei.pBlob)));
+ szUtfMsg.append( MCBuf(mir_utf8encode((char*)dbei.pBlob)));
break;
case '%':
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index e2ba0bc4f1..5e08f8f91a 100644 --- a/protocols/AimOscar/src/utility.cpp +++ b/protocols/AimOscar/src/utility.cpp @@ -182,7 +182,7 @@ HANDLE CAimProto::find_chat_contact(const char* room) HANDLE CAimProto::contact_from_sn(const char* sn, bool addIfNeeded, bool temporary)
{
- mir_ptr<char> norm_sn( normalize_name(sn));
+ MCBuf norm_sn( normalize_name(sn));
for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
DBVARIANT dbv;
diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp index 653557e160..a3141fd2bf 100644 --- a/protocols/EmLanProto/src/mlan.cpp +++ b/protocols/EmLanProto/src/mlan.cpp @@ -1006,7 +1006,7 @@ int CMLan::TFileConnection::Recv(bool halt) EMLOGERR();
return FCS_TERMINATE;
}
- if (len >= min(size,FILE_MIN_BLOCK));
+ if (len >= min(size,FILE_MIN_BLOCK))
break;
Sleep(10);
if (m_state == FCS_TERMINATE) {
@@ -1018,7 +1018,7 @@ int CMLan::TFileConnection::Recv(bool halt) Lock();
res = recv(m_socket, (char*)m_buf+csize, size-csize, 0);
Unlock();
- EMLOGERR(res == SOCKET_ERROR);
+ EMLOGERR();
EMLOGIF("Connection was gracefully closed", res==0);
if (res==0 || res==SOCKET_ERROR)
return FCS_TERMINATE;
@@ -1153,7 +1153,6 @@ void CMLan::OnInTCPConnection(u_long addr, SOCKET in_sock) EMLOG("File added to connectionn list");
FileAddToList(conn);
- CCSDATA ccs;
PROTORECVEVENT pre;
int rcTotalSize = *((int*)(conn->m_buf+1));
@@ -1351,7 +1350,7 @@ void CMLan::OnInTCPConnection(u_long addr, SOCKET in_sock) while (fts.currentFileProgress<fts.currentFileSize)
{
EMLOG("Waiting for data");
- bool isErr = conn->Recv();
+ BOOL isErr = conn->Recv();
if (isErr || conn->m_recSize==0 || conn->m_buf[0]!=FCODE_SND_FILEDATA)
{
EMLOGIF("Error conn->Recv()", isErr);
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 59c4261bc9..757ef80093 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -459,7 +459,7 @@ int FacebookProto::VisitProfile(WPARAM wParam,LPARAM lParam) std::string url = FACEBOOK_URL_PROFILE;
- mir_ptr<char> val = db_get_sa(hContact, m_szModuleName, "Homepage");
+ MCBuf val = db_get_sa(hContact, m_szModuleName, "Homepage");
if (val != NULL) {
// Homepage link already present, get it
url = val;
@@ -481,7 +481,7 @@ int FacebookProto::VisitFriendship(WPARAM wParam,LPARAM lParam) if (wParam == 0 || !IsMyContact(hContact))
return 1;
- mir_ptr<char> id = db_get_sa(hContact, m_szModuleName, FACEBOOK_KEY_ID);
+ MCBuf id = db_get_sa(hContact, m_szModuleName, FACEBOOK_KEY_ID);
std::string url = FACEBOOK_URL_PROFILE;
url += facy.self_.user_id;
@@ -520,14 +520,14 @@ int FacebookProto::CancelFriendship(WPARAM wParam,LPARAM lParam) || (deleting && db_get_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) != FACEBOOK_CONTACT_FRIEND))
return 0;
- mir_ptr<TCHAR> tname = db_get_tsa(hContact, m_szModuleName, FACEBOOK_KEY_NAME);
+ MTBuf tname = db_get_tsa(hContact, m_szModuleName, FACEBOOK_KEY_NAME);
if (tname == NULL)
tname = db_get_tsa(hContact, m_szModuleName, FACEBOOK_KEY_ID);
TCHAR tstr[256];
if (MessageBox(0, tstr, m_tszUserName, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2) == IDYES) {
- mir_ptr<char> id = db_get_sa(hContact, m_szModuleName, FACEBOOK_KEY_ID);
+ MCBuf id = db_get_sa(hContact, m_szModuleName, FACEBOOK_KEY_ID);
if (id == NULL)
return 1;
@@ -552,7 +552,7 @@ int FacebookProto::RequestFriendship(WPARAM wParam,LPARAM lParam) HANDLE hContact = reinterpret_cast<HANDLE>(wParam);
- mir_ptr<char> id = db_get_sa(hContact, m_szModuleName, FACEBOOK_KEY_ID);
+ MCBuf id = db_get_sa(hContact, m_szModuleName, FACEBOOK_KEY_ID);
if (id == NULL)
return 1;
diff --git a/protocols/FacebookRM/src/utils.cpp b/protocols/FacebookRM/src/utils.cpp index 46c56cafd1..f3b5c62640 100644 --- a/protocols/FacebookRM/src/utils.cpp +++ b/protocols/FacebookRM/src/utils.cpp @@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. std::string utils::url::encode(const std::string &s)
{
- return (char*)mir_ptr<char>(mir_urlEncode(s.c_str()));
+ return (char*)MCBuf(mir_urlEncode(s.c_str()));
}
std::string utils::url::decode(std::string data)
diff --git a/protocols/GTalkExt/src/handlers.cpp b/protocols/GTalkExt/src/handlers.cpp index fecfe82523..cc54281dc4 100644 --- a/protocols/GTalkExt/src/handlers.cpp +++ b/protocols/GTalkExt/src/handlers.cpp @@ -214,10 +214,10 @@ void RequestMail(LPCTSTR jidWithRes, IJabberInterface *ji) xi.addAttr(node, ATTRNAME_FROM, jidWithRes);
UINT uID = ji->Net()->SerialNext();
- mir_ptr<TCHAR> jid( ExtractJid(jidWithRes));
+ MTBuf jid( ExtractJid(jidWithRes));
xi.addAttr(node, ATTRNAME_TO, jid);
- mir_ptr<TCHAR>
+ MTBuf
lastMailTime( ReadJidSetting(LAST_MAIL_TIME_FROM_JID, jid)),
lastThreadId( ReadJidSetting(LAST_THREAD_ID_FROM_JID, jid));
@@ -280,7 +280,7 @@ void SetNotificationSetting(LPCTSTR jidWithResource, IJabberInterface *ji) xi.addAttr(node, ATTRNAME_TYPE, IQTYPE_SET);
xi.addAttr(node, ATTRNAME_FROM, jidWithResource);
- mir_ptr<TCHAR> jid( ExtractJid(jidWithResource));
+ MTBuf jid( ExtractJid(jidWithResource));
xi.addAttr(node, ATTRNAME_TO, jid);
TCHAR id[30];
diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp index d325a90819..60f8896f23 100644 --- a/protocols/GTalkExt/src/inbox.cpp +++ b/protocols/GTalkExt/src/inbox.cpp @@ -91,7 +91,7 @@ LPSTR HttpPost(HANDLE hUser, LPSTR reqUrl, LPSTR reqParams) LPSTR MakeRequest(HANDLE hUser, LPSTR reqUrl, LPSTR reqParamsFormat, LPSTR p1, LPSTR p2)
{
- mir_ptr<char> encodedP1( mir_urlEncode(p1)), encodedP2( mir_urlEncode(p2));
+ MCBuf encodedP1( mir_urlEncode(p1)), encodedP2( mir_urlEncode(p2));
LPSTR reqParams = (LPSTR)alloca(lstrlenA(reqParamsFormat) + 1 + lstrlenA(encodedP1) + lstrlenA(encodedP2));
sprintf(reqParams, reqParamsFormat, encodedP1, encodedP2);
return HttpPost(hUser, reqUrl, reqParams);
@@ -119,7 +119,7 @@ LPSTR FindSid(LPSTR resp, LPSTR *LSID) void DoOpenUrl(LPSTR tokenResp, LPSTR url)
{
- mir_ptr<char> encodedUrl( mir_urlEncode(url)), encodedToken( mir_urlEncode(tokenResp));
+ MCBuf encodedUrl( mir_urlEncode(url)), encodedToken( mir_urlEncode(tokenResp));
LPSTR composedUrl = (LPSTR)alloca(lstrlenA(TOKEN_AUTH_URL) + 1 + lstrlenA(encodedToken) + lstrlenA(encodedUrl));
sprintf(composedUrl, TOKEN_AUTH_URL, encodedToken, encodedUrl);
CallService(MS_UTILS_OPENURL, 0, (LPARAM)composedUrl);
@@ -127,13 +127,13 @@ void DoOpenUrl(LPSTR tokenResp, LPSTR url) BOOL AuthAndOpen(HANDLE hUser, LPSTR url, LPSTR mailbox, LPSTR pwd)
{
- mir_ptr<char> authResp( MakeRequest(hUser, AUTH_REQUEST_URL, AUTH_REQUEST_PARAMS, mailbox, pwd));
+ MCBuf authResp( MakeRequest(hUser, AUTH_REQUEST_URL, AUTH_REQUEST_PARAMS, mailbox, pwd));
if (!authResp)
return FALSE;
LPSTR LSID;
LPSTR SID = FindSid(authResp, &LSID);
- mir_ptr<char> tokenResp( MakeRequest(hUser, ISSUE_TOKEN_REQUEST_URL, ISSUE_TOKEN_REQUEST_PARAMS, SID, LSID));
+ MCBuf tokenResp( MakeRequest(hUser, ISSUE_TOKEN_REQUEST_URL, ISSUE_TOKEN_REQUEST_PARAMS, SID, LSID));
if (!tokenResp)
return FALSE;
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index 1fb4216fc4..c9bbcac8b4 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -158,7 +158,7 @@ void GGPROTO::cleanuplastplugin(DWORD version) TCHAR avatarsPath[MAX_PATH];
if (hAvatarsFolder == NULL || FoldersGetCustomPathT(hAvatarsFolder, avatarsPath, MAX_PATH, _T(""))) {
- mir_ptr<TCHAR> tmpPath( Utils_ReplaceVarsT( _T("%miranda_avatarcache%")));
+ MTBuf tmpPath( Utils_ReplaceVarsT( _T("%miranda_avatarcache%")));
mir_sntprintf(avatarsPath, MAX_PATH, _T("%s\\%s"), (TCHAR*)tmpPath, m_tszUserName);
}
netlog("cleanuplastplugin() 1: miranda_avatarcache = %S", avatarsPath);
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index 52e915c845..cb851cab0b 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -1029,7 +1029,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, TCHAR *szFileName) dat->lpData = (char*)malloc(dat->nSize);
memcpy(dat->lpData, e->event.image_reply.image, dat->nSize);
- mir_ptr<TCHAR> tmpFileName( mir_a2t(e->event.image_reply.filename));
+ MTBuf tmpFileName( mir_a2t(e->event.image_reply.filename));
if (!gg_img_hasextension(tmpFileName)) {
// Add missing file extension
const TCHAR *szImgType = gg_img_guessfileextension(dat->lpData);
diff --git a/protocols/JabberG/src/jabber_archive.cpp b/protocols/JabberG/src/jabber_archive.cpp index 5cfb124a34..9c09b1a1fb 100644 --- a/protocols/JabberG/src/jabber_archive.cpp +++ b/protocols/JabberG/src/jabber_archive.cpp @@ -292,7 +292,7 @@ void CJabberProto::OnIqResultGetCollection(HXML iqNode) if (!tszBody || !tszSecs)
continue;
- mir_ptr<char> szEventText( mir_utf8encodeT(tszBody));
+ MCBuf szEventText( mir_utf8encodeT(tszBody));
DBEVENTINFO dbei = { sizeof(DBEVENTINFO) };
dbei.eventType = EVENTTYPE_MESSAGE;
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 1e423ad091..83ed88f04b 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -1346,7 +1346,7 @@ static void sttLogListHook(CJabberProto* ppro, JABBER_LIST_ITEM* item, GCHOOK* g mir_sntprintf(szCaption, SIZEOF(szCaption), _T("%s %s"), TranslateT("Set topic for"), gch->pDest->ptszID);
{
size_t cbLen = 2048 + lstrlen(item->itemResource.statusMessage)*2;
- mir_ptr<TCHAR> ptszBuf((TCHAR*)mir_alloc( sizeof(TCHAR) * cbLen));
+ MTBuf ptszBuf((TCHAR*)mir_alloc( sizeof(TCHAR) * cbLen));
if (item->itemResource.statusMessage) {
TCHAR *d = ptszBuf;
for (int i = 0; i < (int)cbLen; i++) {
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 535af67828..049c110f05 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -1150,7 +1150,7 @@ static char PGP_EPILOG[] = "\r\n-----END PGP MESSAGE-----\r\n"; int __cdecl CJabberProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc)
{
- mir_ptr<TCHAR> ptszJid( db_get_tsa(hContact, m_szModuleName, "jid"));
+ MTBuf ptszJid( db_get_tsa(hContact, m_szModuleName, "jid"));
if ( !m_bJabberOnline || ptszJid == NULL) {
TFakeAckParams *param = new TFakeAckParams(hContact, Translate("Protocol is offline or no jid"));
JForkThread(&CJabberProto::SendMessageAckThread, param);
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 05f4dc05d1..d21cba9719 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -1383,12 +1383,12 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM wParam, LPARAM lParam) else {
*pData->ptszName = 0;
if (pData->flags & CSSF_UNICODE) {
- mir_ptr<TCHAR> title( ReadAdvStatusT(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TITLE));
+ MTBuf title( ReadAdvStatusT(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TITLE));
if (title)
_tcsncpy(pData->ptszName, title, STATUS_TITLE_MAX);
}
else {
- mir_ptr<char> title( ReadAdvStatusA(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TITLE));
+ MCBuf title( ReadAdvStatusA(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TITLE));
if (title)
strncpy(pData->pszName, title, STATUS_TITLE_MAX);
}
@@ -1399,12 +1399,12 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM wParam, LPARAM lParam) if (pData->flags & CSSF_MASK_MESSAGE) {
*pData->pszMessage = 0;
if (pData->flags & CSSF_UNICODE) {
- mir_ptr<TCHAR> title( ReadAdvStatusT(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TEXT));
+ MTBuf title( ReadAdvStatusT(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TEXT));
if (title)
_tcsncpy(pData->ptszMessage, title, STATUS_TITLE_MAX);
}
else {
- mir_ptr<char> title( ReadAdvStatusA(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TEXT));
+ MCBuf title( ReadAdvStatusA(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TEXT));
if (title)
strncpy(pData->pszMessage, title, STATUS_TITLE_MAX);
}
diff --git a/protocols/MRA/src/MraSendCommand.cpp b/protocols/MRA/src/MraSendCommand.cpp index cd38d07c03..1eb45085be 100644 --- a/protocols/MRA/src/MraSendCommand.cpp +++ b/protocols/MRA/src/MraSendCommand.cpp @@ -105,7 +105,7 @@ DWORD CMraProto::MraMessageW(BOOL bAddToQueue, HANDLE hContact, DWORD dwAckType, dwFlags |= MESSAGE_FLAG_RTF;
lpszMessageRTF = (LPSTR)mir_calloc(dwRFTBuffSize);
- mir_ptr<char> lpbRTFData((char*)mir_calloc(dwRFTBuffSize));
+ MCBuf lpbRTFData((char*)mir_calloc(dwRFTBuffSize));
if (lpszMessageRTF && lpbRTFData) {
DWORD dwBackColour = mraGetDword(NULL, "RTFBackgroundColour", MRA_DEFAULT_RTF_BACKGROUND_COLOUR);
lpbDataCurrent = (LPBYTE)lpszMessageRTF;
@@ -130,7 +130,7 @@ DWORD CMraProto::MraMessageW(BOOL bAddToQueue, HANDLE hContact, DWORD dwAckType, size_t dwRFTBuffSize = (((dwMessageSize*sizeof(WCHAR))*16)+8192), dwRTFDataSize;
lpszMessageRTF = (LPSTR)mir_calloc(dwRFTBuffSize);
- mir_ptr<char> lpbRTFData((char*)mir_calloc(dwRFTBuffSize));
+ MCBuf lpbRTFData((char*)mir_calloc(dwRFTBuffSize));
if (lpszMessageRTF && lpbRTFData) {
if ( !MraConvertToRTFW(lpwszMessage, dwMessageSize, (LPSTR)lpbRTFData, dwRFTBuffSize, &dwRTFDataSize)) {
DWORD dwBackColour = mraGetDword(NULL, "RTFBackgroundColour", MRA_DEFAULT_RTF_BACKGROUND_COLOUR);
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index 075fd72040..0852b973cc 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -186,7 +186,7 @@ INT_PTR CMraProto::MraSendSMS(WPARAM wParam, LPARAM lParam) if (!m_bLoggedIn || !wParam || !lParam)
return 0;
- mir_ptr<WCHAR> lpwszMessageXMLEncoded( mir_utf8decodeW((LPSTR)lParam));
+ MWBuf lpwszMessageXMLEncoded( mir_utf8decodeW((LPSTR)lParam));
size_t dwBuffLen = lstrlenA((LPSTR)lParam) + MAX_PATH;
LPWSTR lpwszMessageXMLDecoded = (LPWSTR)mir_calloc((dwBuffLen*sizeof(WCHAR)));
if (lpwszMessageXMLEncoded && lpwszMessageXMLDecoded) {
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 0d161f53cb..49a10ef339 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -827,7 +827,7 @@ void CMsnProto::sttProcessStatusMessage(char* buf, unsigned len, const char* wli else db_unset(hContact, "CList", "StatusMsg");
{
- mir_ptr<TCHAR> tszStatus( mir_utf8decodeT(szStatMsg));
+ MTBuf tszStatus( mir_utf8decodeT(szStatMsg));
SendBroadcast(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, tszStatus);
}
diff --git a/protocols/Omegle/src/utils.cpp b/protocols/Omegle/src/utils.cpp index b259fa5933..b530ee84c3 100644 --- a/protocols/Omegle/src/utils.cpp +++ b/protocols/Omegle/src/utils.cpp @@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. std::string utils::url::encode(const std::string &s)
{
- return (char*)mir_ptr<char>( mir_urlEncode( s.c_str()));
+ return (char*)MCBuf( mir_urlEncode( s.c_str()));
}
void utils::text::replace_first( std::string* data, std::string from, std::string to )
diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp index 2f2baf6649..c9a7f319ee 100644 --- a/protocols/Twitter/src/chat.cpp +++ b/protocols/Twitter/src/chat.cpp @@ -69,7 +69,7 @@ int TwitterProto::OnChatOutgoing(WPARAM wParam,LPARAM lParam) case GC_USER_MESSAGE:
LOG ( _T("**Chat - Outgoing message: %s"), hook->ptszText);
{
- mir_ptr<char> text( mir_utf8encodeT(hook->ptszText));
+ MCBuf text( mir_utf8encodeT(hook->ptszText));
std::string tweet(text);
replaceAll(tweet, "%%", "%"); // the chat plugin will turn "%" into "%%", so we have to change it back :/
@@ -81,7 +81,7 @@ int TwitterProto::OnChatOutgoing(WPARAM wParam,LPARAM lParam) case GC_USER_PRIVMESS:
{
- mir_ptr<char> text( mir_t2a(hook->ptszUID));
+ MCBuf text( mir_t2a(hook->ptszUID));
CallService(MS_MSG_SENDMESSAGE, WPARAM(UsernameToHContact(text)), 0);
}
break;
diff --git a/protocols/Twitter/src/http.cpp b/protocols/Twitter/src/http.cpp index 71069d08a4..711aa321ee 100644 --- a/protocols/Twitter/src/http.cpp +++ b/protocols/Twitter/src/http.cpp @@ -23,5 +23,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. std::string http::url_encode(const std::string &s)
{
- return (char*)mir_ptr<char>( mir_urlEncode( s.c_str()));
+ return (char*)MCBuf( mir_urlEncode( s.c_str()));
}
diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp index a0c44aa7d3..30220bdffd 100644 --- a/protocols/Yahoo/src/im.cpp +++ b/protocols/Yahoo/src/im.cpp @@ -180,7 +180,7 @@ int __cdecl CYahooProto::SendMsg( HANDLE hContact, int flags, const char* pszSrc return 1;
}
- mir_ptr<char> msg;
+ MCBuf msg;
if (flags & PREF_UNICODE) /* convert to utf8 */
msg = mir_utf8encodeW(( wchar_t* )&pszSrc[ strlen(pszSrc)+1 ] );
else if ( flags & PREF_UTF )
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index da3c4751d0..f56efaba62 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -209,9 +209,9 @@ int CYahooProto::Authorize( HANDLE hdbe ) /* Need to remove the buddy from our Miranda Lists */
HANDLE hContact = DbGetAuthEventContact(&dbei);
if (hContact != NULL) {
- mir_ptr<char> who( db_get_sa(hContact, m_szModuleName, YAHOO_LOGINID));
+ MCBuf who( db_get_sa(hContact, m_szModuleName, YAHOO_LOGINID));
if (who) {
- mir_ptr<char> myid( db_get_sa(hContact, m_szModuleName, "MyIdentity"));
+ MCBuf myid( db_get_sa(hContact, m_szModuleName, "MyIdentity"));
DebugLog("Accepting buddy:%s", who);
accept(myid, who, GetWord(hContact, "yprotoid", 0));
}
@@ -254,10 +254,10 @@ int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason ) /* Need to remove the buddy from our Miranda Lists */
HANDLE hContact = DbGetAuthEventContact(&dbei);
if (hContact != NULL) {
- mir_ptr<char> who( db_get_sa(hContact, m_szModuleName, YAHOO_LOGINID));
+ MCBuf who( db_get_sa(hContact, m_szModuleName, YAHOO_LOGINID));
if (who) {
- mir_ptr<char> myid( db_get_sa(hContact, m_szModuleName, "MyIdentity"));
- mir_ptr<char> u_reason( mir_utf8encodeT(reason));
+ MCBuf myid( db_get_sa(hContact, m_szModuleName, "MyIdentity"));
+ MCBuf u_reason( mir_utf8encodeT(reason));
DebugLog("Rejecting buddy:%s msg: %s", who, u_reason);
reject(myid, who, GetWord(hContact, "yprotoid", 0), u_reason);
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index cfbff5ebfd..f3b8d6a438 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -586,7 +586,7 @@ void CYahooProto::ext_got_calendar(const char *url, int type, const char *msg, i {
LOG(("[ext_got_calendar] URL:%s type: %d msg: %s svc: %d", url, type, msg, svc));
- mir_ptr<TCHAR> tszMsg(mir_utf8decodeT(msg));
+ MTBuf tszMsg(mir_utf8decodeT(msg));
if (!ShowPopup( TranslateT("Calendar Reminder"), tszMsg, url))
ShowNotification(TranslateT("Calendar Reminder"), tszMsg, NIIF_INFO);
}
@@ -731,8 +731,8 @@ void CYahooProto::ext_rejected(const char *who, const char *msg) }
else LOG(("[ext_rejected] Buddy not on our buddy list"));
- mir_ptr<TCHAR> tszWho( mir_utf8decodeT(who));
- mir_ptr<TCHAR> tszMsg( mir_utf8decodeT(msg));
+ MTBuf tszWho( mir_utf8decodeT(who));
+ MTBuf tszMsg( mir_utf8decodeT(msg));
TCHAR buff[1024];
mir_sntprintf(buff, SIZEOF(buff), TranslateT("%s has rejected your request and sent the following message:"), (TCHAR*)tszWho);
@@ -991,8 +991,8 @@ void CYahooProto::ext_mail_notify(const char *from, const char *subj, int cnt) else {
mir_sntprintf(title, SIZEOF(title), TranslateT("New Mail (%i msgs)"), cnt);
- mir_ptr<TCHAR> tszFrom( mir_utf8decodeT(from));
- mir_ptr<TCHAR> tszSubj( mir_utf8decodeT(subj));
+ MTBuf tszFrom( mir_utf8decodeT(from));
+ MTBuf tszSubj( mir_utf8decodeT(subj));
mir_sntprintf(z, SIZEOF(z), TranslateT("From: %s\nSubject: %s"), (TCHAR*)tszFrom, (TCHAR*)tszSubj);
}
@@ -1009,8 +1009,8 @@ void CYahooProto::ext_system_message(const char *me, const char *who, const char {
LOG(("[ext_system_message] System Message to: %s from: %s msg: %s", me, who, msg));
- mir_ptr<TCHAR> tszWho( mir_utf8decodeT(who));
- mir_ptr<TCHAR> tszMsg( mir_utf8decodeT(msg));
+ MTBuf tszWho( mir_utf8decodeT(who));
+ MTBuf tszMsg( mir_utf8decodeT(msg));
ShowPopup((who != NULL) ? tszWho : TranslateT("Yahoo System Message"), tszMsg, NULL);
}
@@ -1069,7 +1069,7 @@ void CYahooProto::ext_got_ping(const char *errormsg) if (errormsg) {
LOG(("[ext_got_ping] Error msg: %s", errormsg));
- mir_ptr<TCHAR> tszMsg( mir_utf8decodeT(errormsg));
+ MTBuf tszMsg( mir_utf8decodeT(errormsg));
ShowError( TranslateT("Yahoo Ping Error"), tszMsg);
return;
}
@@ -1168,7 +1168,7 @@ void CYahooProto::ext_login_response(int succ, const char *url) void CYahooProto::ext_error(const char *err, int fatal, int num)
{
- mir_ptr<TCHAR> tszErr( mir_utf8decodeT(err));
+ MTBuf tszErr( mir_utf8decodeT(err));
TCHAR buff[1024];
LOG(("[ext_error] Error: fatal: %d, num: %d, err: %s", fatal, num, err));
diff --git a/src/core/stdauth/authdialogs.cpp b/src/core/stdauth/authdialogs.cpp index 23586bf564..72b8064114 100644 --- a/src/core/stdauth/authdialogs.cpp +++ b/src/core/stdauth/authdialogs.cpp @@ -179,11 +179,11 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP PROTOACCOUNT* acc = ProtoGetAccount(dbei.szModule);
- mir_ptr<TCHAR> lastT(dbei.flags & DBEF_UTF ? Utf8DecodeT(last) : mir_a2t(last));
- mir_ptr<TCHAR> firstT(dbei.flags & DBEF_UTF ? Utf8DecodeT(first) : mir_a2t(first));
- mir_ptr<TCHAR> nickT(dbei.flags & DBEF_UTF ? Utf8DecodeT(nick) : mir_a2t(nick));
- mir_ptr<TCHAR> emailT(dbei.flags & DBEF_UTF ? Utf8DecodeT(email) : mir_a2t(email));
- mir_ptr<TCHAR> reasonT(dbei.flags & DBEF_UTF ? Utf8DecodeT(reason) : mir_a2t(reason));
+ MTBuf lastT(dbei.flags & DBEF_UTF ? Utf8DecodeT(last) : mir_a2t(last));
+ MTBuf firstT(dbei.flags & DBEF_UTF ? Utf8DecodeT(first) : mir_a2t(first));
+ MTBuf nickT(dbei.flags & DBEF_UTF ? Utf8DecodeT(nick) : mir_a2t(nick));
+ MTBuf emailT(dbei.flags & DBEF_UTF ? Utf8DecodeT(email) : mir_a2t(email));
+ MTBuf reasonT(dbei.flags & DBEF_UTF ? Utf8DecodeT(reason) : mir_a2t(reason));
TCHAR name[128] = _T("");
int off = 0;
diff --git a/src/core/stdfile/filerecvdlg.cpp b/src/core/stdfile/filerecvdlg.cpp index 5633073ac4..ae42779071 100644 --- a/src/core/stdfile/filerecvdlg.cpp +++ b/src/core/stdfile/filerecvdlg.cpp @@ -258,13 +258,13 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l dat->fs = cle->lParam ? (HANDLE)cle->lParam : (HANDLE)*(PDWORD)dbei.pBlob;
char *str = (char*)dbei.pBlob + 4;
- mir_ptr<TCHAR> ptszFileName( DbGetEventStringT(&dbei, str));
+ MTBuf ptszFileName( DbGetEventStringT(&dbei, str));
SetDlgItemText(hwndDlg, IDC_FILENAMES, ptszFileName);
unsigned len = (unsigned)strlen(str) + 1;
if (len + 4 < dbei.cbBlob) {
str += len;
- mir_ptr<TCHAR> ptszDescription( DbGetEventStringT(&dbei, str));
+ MTBuf ptszDescription( DbGetEventStringT(&dbei, str));
SetDlgItemText(hwndDlg, IDC_MSG, ptszDescription);
}
}
diff --git a/src/modules/clist/movetogroup.cpp b/src/modules/clist/movetogroup.cpp index 97d8c745e9..d994e30592 100644 --- a/src/modules/clist/movetogroup.cpp +++ b/src/modules/clist/movetogroup.cpp @@ -100,7 +100,7 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM) CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)lphGroupsItems[i], 0);
lphGroupsItems.destroy();
- mir_ptr<TCHAR> szContactGroup( db_get_tsa((HANDLE)wParam, "CList", "Group"));
+ MTBuf szContactGroup( db_get_tsa((HANDLE)wParam, "CList", "Group"));
int pos = 1000;
diff --git a/src/modules/extraicons/extraicons.cpp b/src/modules/extraicons/extraicons.cpp index 79922167c4..fb06bb4ee4 100644 --- a/src/modules/extraicons/extraicons.cpp +++ b/src/modules/extraicons/extraicons.cpp @@ -363,7 +363,7 @@ INT_PTR ExtraIcon_Register(WPARAM wParam, LPARAM lParam) if (ei->type == EXTRAICON_TYPE_CALLBACK && (ei->ApplyIcon == NULL || ei->RebuildIcons == NULL))
return 0;
- mir_ptr<TCHAR> tszDesc( mir_a2t(ei->description));
+ MTBuf tszDesc( mir_a2t(ei->description));
TCHAR *desc = TranslateTH(lParam, tszDesc);
BaseExtraIcon *extra = GetExtraIconByName(ei->name);
diff --git a/src/modules/options/options.cpp b/src/modules/options/options.cpp index 9b0c4e0e11..d47ad558c0 100644 --- a/src/modules/options/options.cpp +++ b/src/modules/options/options.cpp @@ -1256,10 +1256,10 @@ static void OpenOptionsNow(int hLangpack, const char *pszGroup, const char *pszP ShowWindow(hwndOptions, SW_RESTORE);
SetForegroundWindow(hwndOptions);
if (pszPage != NULL) {
- mir_ptr<TCHAR> ptszPage( mir_a2t(pszPage));
+ MTBuf ptszPage( mir_a2t(pszPage));
HTREEITEM hItem = NULL;
if (pszGroup != NULL) {
- mir_ptr<TCHAR> ptszGroup( mir_a2t(pszGroup));
+ MTBuf ptszGroup( mir_a2t(pszGroup));
hItem = FindNamedTreeItemAtRoot( GetDlgItem(hwndOptions, IDC_PAGETREE), TranslateTH(hLangpack, ptszGroup));
if (hItem != NULL)
hItem = FindNamedTreeItemAtChildren( GetDlgItem(hwndOptions, IDC_PAGETREE), hItem, TranslateTH(hLangpack, ptszPage));
diff --git a/src/modules/plugins/pluginopts.cpp b/src/modules/plugins/pluginopts.cpp index 564413c489..a424516d5f 100644 --- a/src/modules/plugins/pluginopts.cpp +++ b/src/modules/plugins/pluginopts.cpp @@ -366,19 +366,19 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar ListView_GetItemText(hwndList, hdr->iItem, 1, buf, SIZEOF(buf));
SetWindowText( GetDlgItem(hwndDlg, IDC_PLUGININFOFRAME), sel ? buf : _T(""));
- mir_ptr<TCHAR> tszAuthor( latin2t(sel ? dat->author : NULL));
+ MTBuf tszAuthor( latin2t(sel ? dat->author : NULL));
SetWindowText( GetDlgItem(hwndDlg, IDC_PLUGINAUTHOR), tszAuthor);
- mir_ptr<TCHAR> tszEmail( latin2t(sel ? dat->authorEmail : NULL));
+ MTBuf tszEmail( latin2t(sel ? dat->authorEmail : NULL));
SetWindowText( GetDlgItem(hwndDlg, IDC_PLUGINEMAIL), tszEmail);
- mir_ptr<TCHAR> p( Langpack_PcharToTchar(dat->description));
+ MTBuf p( Langpack_PcharToTchar(dat->description));
SetWindowText( GetDlgItem(hwndDlg, IDC_PLUGINLONGINFO), sel ? (TCHAR*)p : _T(""));
- mir_ptr<TCHAR> tszCopyright( latin2t(sel ? dat->copyright : NULL));
+ MTBuf tszCopyright( latin2t(sel ? dat->copyright : NULL));
SetWindowText( GetDlgItem(hwndDlg, IDC_PLUGINCPYR), tszCopyright);
- mir_ptr<TCHAR> tszUrl( latin2t(sel ? dat->homepage : NULL));
+ MTBuf tszUrl( latin2t(sel ? dat->homepage : NULL));
SetWindowText( GetDlgItem(hwndDlg, IDC_PLUGINURL), tszUrl);
if ( !equalUUID(miid_last, dat->uuid)) {
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index ffc0247a12..9eba7673ee 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -165,7 +165,7 @@ static INT_PTR Proto_RecvMessage(WPARAM, LPARAM lParam) if (pre->szMessage == NULL)
return NULL;
- mir_ptr<char> pszTemp;
+ MCBuf pszTemp;
DBEVENTINFO dbei = { 0 };
dbei.cbSize = sizeof(dbei);
|