summaryrefslogtreecommitdiff
path: root/plugins/Scriver/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-06-21 17:05:33 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-06-21 17:05:33 +0000
commit6ba9043d83f28cf2b6c7d10c5d5495d15de344c1 (patch)
tree40aeea3b7d6a1198647b4d896b41f725ee85c98b /plugins/Scriver/src
parent2072201029bdd799396b37de23410bab71cc653e (diff)
own a2t/t2a conversion routines removed from Scriver
git-svn-id: http://svn.miranda-ng.org/main/trunk@5084 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Scriver/src')
-rw-r--r--plugins/Scriver/src/chat/log.cpp8
-rw-r--r--plugins/Scriver/src/chat/tools.cpp18
-rw-r--r--plugins/Scriver/src/chat/window.cpp2
-rw-r--r--plugins/Scriver/src/globals.cpp2
-rw-r--r--plugins/Scriver/src/msglog.cpp4
-rw-r--r--plugins/Scriver/src/utils.cpp14
-rw-r--r--plugins/Scriver/src/utils.h48
7 files changed, 52 insertions, 44 deletions
diff --git a/plugins/Scriver/src/chat/log.cpp b/plugins/Scriver/src/chat/log.cpp
index 27696f1a01..a06be991bb 100644
--- a/plugins/Scriver/src/chat/log.cpp
+++ b/plugins/Scriver/src/chat/log.cpp
@@ -315,8 +315,8 @@ static void AddEventToBuffer(char **buffer, int *bufferEnd, int *bufferAlloced,
TCHAR *ptszTemp = NULL;
TCHAR *ptszText = streamData->lin->ptszText;
if (streamData->si->windowData.codePage != CP_ACP) {
- char *aText = t2acp(streamData->lin->ptszText, CP_ACP);
- ptszText = ptszTemp = a2tcp(aText, streamData->si->windowData.codePage);
+ char *aText = mir_t2a_cp(streamData->lin->ptszText, CP_ACP);
+ ptszText = ptszTemp = mir_a2t_cp(aText, streamData->si->windowData.codePage);
mir_free(aText);
}
@@ -407,8 +407,8 @@ static void AddEventToBufferIEView(TCHAR **buffer, int *bufferEnd, int *bufferAl
TCHAR *ptszTemp = NULL;
TCHAR *ptszText = streamData->lin->ptszText;
if (streamData->si->windowData.codePage != CP_ACP) {
- char *aText = t2acp(streamData->lin->ptszText, CP_ACP);
- ptszText = ptszTemp = a2tcp(aText, streamData->si->windowData.codePage);
+ char *aText = mir_t2a_cp(streamData->lin->ptszText, CP_ACP);
+ ptszText = ptszTemp = mir_a2t_cp(aText, streamData->si->windowData.codePage);
mir_free(aText);
}
diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp
index b8edb1d1c5..804c347768 100644
--- a/plugins/Scriver/src/chat/tools.cpp
+++ b/plugins/Scriver/src/chat/tools.cpp
@@ -768,14 +768,14 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int
return FALSE;
if ( !( si->dwFlags & GC_UNICODE )) {
- gcd->pszID = t2a( pszID );
- gch->pszUID = t2a( pszUID );
- gch->pszText = t2a( pszText );
+ gcd->pszID = mir_t2a(pszID);
+ gch->pszUID = mir_t2a(pszUID);
+ gch->pszText = mir_t2a(pszText);
}
else {
- replaceStr( &gcd->ptszID, pszID );
- replaceStr( &gch->ptszUID, pszUID);
- replaceStr( &gch->ptszText, pszText);
+ replaceStr(&gcd->ptszID, pszID);
+ replaceStr(&gch->ptszUID, pszUID);
+ replaceStr(&gch->ptszText, pszText);
}
gcd->iType = iType;
@@ -796,9 +796,9 @@ BOOL DoEventHook(const TCHAR* pszID, const char* pszModule, int iType, const TCH
return FALSE;
if ( !(si->dwFlags & GC_UNICODE)) {
- gcd.pszID = t2a(pszID);
- gch.pszUID = t2a(pszUID);
- gch.pszText = t2a(pszText);
+ gcd.pszID = mir_t2a(pszID);
+ gch.pszUID = mir_t2a(pszUID);
+ gch.pszText = mir_t2a(pszText);
}
else {
gcd.ptszID = mir_tstrdup(pszID);
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index 25a9d74adb..488fbc5366 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -1006,7 +1006,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
* iterate over the (sorted) list of nicknames and search for the
* string we have
*/
- char *str = t2a(si->szSearch);
+ char *str = mir_t2a(si->szSearch);
mir_free(str);
for (i = 0; i < iItems; i++) {
ui = UM_FindUserFromIndex(si->pUsers, i);
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp
index cb9feb1564..74bbf8e09d 100644
--- a/plugins/Scriver/src/globals.cpp
+++ b/plugins/Scriver/src/globals.cpp
@@ -428,7 +428,7 @@ static int ackevent(WPARAM wParam, LPARAM lParam)
if (hwndSender != NULL) {
ErrorWindowData *ewd = (ErrorWindowData *) mir_alloc(sizeof(ErrorWindowData));
ewd->szName = GetNickname(item->hContact, item->proto);
- ewd->szDescription = a2t((char*) ack->lParam);
+ ewd->szDescription = mir_a2t((char*) ack->lParam);
ewd->szText = GetSendBufferMsg(item);
ewd->hwndParent = hwndSender;
ewd->queueItem = item;
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp
index 92f7f0c85b..e6b86353a0 100644
--- a/plugins/Scriver/src/msglog.cpp
+++ b/plugins/Scriver/src/msglog.cpp
@@ -102,11 +102,11 @@ TCHAR *GetNickname(HANDLE hContact, const char* szProto)
if (!_tcscmp((TCHAR *)ci.pszVal, TranslateW(_T("'(Unknown Contact)'")))) {
ci.dwFlag &= ~CNF_UNICODE;
if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)& ci))
- szName = a2t((char*)ci.pszVal);
+ szName = mir_a2t((char*)ci.pszVal);
}
else szName = mir_tstrdup((TCHAR *)ci.pszVal);
}
- else szName = a2t((char*)ci.pszVal);
+ else szName = mir_a2t((char*)ci.pszVal);
mir_free(ci.pszVal);
if (szName != NULL)
diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp
index 4e07d78598..5d92d914f6 100644
--- a/plugins/Scriver/src/utils.cpp
+++ b/plugins/Scriver/src/utils.cpp
@@ -36,6 +36,20 @@ int safe_wcslen(wchar_t *msg, int maxLen) {
return 0;
}
+wchar_t *a2w(const char *src, int len) {
+ wchar_t *wline;
+ int i;
+ if (len <0) {
+ len = (int)strlen(src);
+ }
+ wline = (wchar_t*)mir_alloc(2 * (len + 1));
+ for (i = 0; i < len; i ++) {
+ wline[i] = src[i];
+ }
+ wline[i] = 0;
+ return wline;
+}
+
static int mimFlags = 0;
enum MIMFLAGS {
diff --git a/plugins/Scriver/src/utils.h b/plugins/Scriver/src/utils.h
index 3387b0559b..d9cb24d4be 100644
--- a/plugins/Scriver/src/utils.h
+++ b/plugins/Scriver/src/utils.h
@@ -34,33 +34,27 @@ enum SEARCHENGINES {
SEARCHENGINE_FOODNETWORK = 8
};
-extern int IsUnicodeMIM();
-extern int safe_wcslen(wchar_t *msg, int maxLen) ;
-extern TCHAR *a2t(const char *text);
-extern TCHAR *a2tcp(const char *text, int cp);
-extern char* t2a(const TCHAR* src);
-extern char* t2acp(const TCHAR* src, int cp);
-extern char* u2a( const wchar_t* src, int codepage );
-extern wchar_t* a2u( const char* src, int codepage );
-extern wchar_t *a2w(const char *src, int len);
-extern TCHAR *limitText(TCHAR *text, int limit);
-extern void logInfo(const char *fmt, ...);
-extern int GetRichTextLength(HWND hwnd, int codepage, BOOL inBytes);
-extern TCHAR* GetRichText(HWND hwnd, int codepage);
-extern TCHAR *GetRichEditSelection(HWND hwnd);
-extern char* GetRichTextRTF(HWND hwnd);
-extern char* GetRichTextEncoded(HWND hwnd, int codepage);
-extern TCHAR *GetRichTextWord(HWND hwnd, POINTL *pt);
-extern int SetRichTextRTF(HWND hwnd, const char *text);
-extern int SetRichTextEncoded(HWND hwnd, const char *text, int codepage);
-extern void SearchWord(TCHAR * word, int engine);
-extern HDWP ResizeToolbar(HWND hwnd, HDWP hdwp, int width, int vPos, int height, int cControls, const ToolbarButton * buttons, int controlVisibility);
-extern void ShowToolbarControls(HWND hwndDlg, int cControls, const ToolbarButton * buttons, int controlVisibility, int state);
-extern void AppendToBuffer(char **buffer, int *cbBufferEnd, int *cbBufferAlloced, const char *fmt, ...);
-extern int MeasureMenuItem(WPARAM wParam, LPARAM lParam);
-extern int DrawMenuItem(WPARAM wParam, LPARAM lParam);
-extern void SetSearchEngineIcons(HMENU hMenu, HIMAGELIST hImageList);
-extern void GetContactUniqueId(struct SrmmWindowData *dat, char *buf, int maxlen);
+int IsUnicodeMIM();
+wchar_t *a2w(const char *src, int len);
+int safe_wcslen(wchar_t *msg, int maxLen) ;
+TCHAR *limitText(TCHAR *text, int limit);
+void logInfo(const char *fmt, ...);
+int GetRichTextLength(HWND hwnd, int codepage, BOOL inBytes);
+TCHAR* GetRichText(HWND hwnd, int codepage);
+TCHAR *GetRichEditSelection(HWND hwnd);
+char* GetRichTextRTF(HWND hwnd);
+char* GetRichTextEncoded(HWND hwnd, int codepage);
+TCHAR *GetRichTextWord(HWND hwnd, POINTL *pt);
+int SetRichTextRTF(HWND hwnd, const char *text);
+int SetRichTextEncoded(HWND hwnd, const char *text, int codepage);
+void SearchWord(TCHAR * word, int engine);
+HDWP ResizeToolbar(HWND hwnd, HDWP hdwp, int width, int vPos, int height, int cControls, const ToolbarButton * buttons, int controlVisibility);
+void ShowToolbarControls(HWND hwndDlg, int cControls, const ToolbarButton * buttons, int controlVisibility, int state);
+void AppendToBuffer(char **buffer, int *cbBufferEnd, int *cbBufferAlloced, const char *fmt, ...);
+int MeasureMenuItem(WPARAM wParam, LPARAM lParam);
+int DrawMenuItem(WPARAM wParam, LPARAM lParam);
+void SetSearchEngineIcons(HMENU hMenu, HIMAGELIST hImageList);
+void GetContactUniqueId(struct SrmmWindowData *dat, char *buf, int maxlen);
HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle, RECT *rect);
void SetToolTipText(HWND hwndParent, HWND hwndTT, LPTSTR ptszText, LPTSTR ptszTitle);
void SetToolTipRect(HWND hwndParent, HWND hwndTT, RECT* rect);