diff options
author | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-06-15 18:52:16 +0000 |
---|---|---|
committer | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-06-15 18:52:16 +0000 |
commit | 58973a21a30bf95427fd43c456e41e35c386218c (patch) | |
tree | 1413fba069ecd351b2c99fa5a53e52c68d8a662c /plugins/Boltun | |
parent | 55b5cf8a5506f03350e5c80ac86f5717425e4d10 (diff) |
another portion of "#ifsef Unicode" removal
git-svn-id: http://svn.miranda-ng.org/main/trunk@434 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Boltun')
-rw-r--r-- | plugins/Boltun/Engine/Mind.cpp | 22 | ||||
-rw-r--r-- | plugins/Boltun/Engine/Mind.h | 3 | ||||
-rw-r--r-- | plugins/Boltun/Engine/MyCodeCvt.cpp | 4 | ||||
-rw-r--r-- | plugins/Boltun/actionQueue.cpp | 14 | ||||
-rw-r--r-- | plugins/Boltun/boltun.cpp | 6 | ||||
-rw-r--r-- | plugins/Boltun/boltun.h | 10 |
6 files changed, 21 insertions, 38 deletions
diff --git a/plugins/Boltun/Engine/Mind.cpp b/plugins/Boltun/Engine/Mind.cpp index 667e1faf1a..fc4520de55 100644 --- a/plugins/Boltun/Engine/Mind.cpp +++ b/plugins/Boltun/Engine/Mind.cpp @@ -26,9 +26,7 @@ #include <windows.h>
-#ifdef UNICODE
#include "MyCodeCvt.h"
-#endif
using namespace std;
@@ -108,19 +106,19 @@ void Mind::Load(tstring filename) {
basic_ifstream<TCHAR, char_traits<TCHAR> > file;
setlocale(LC_ALL, "");
-#ifdef UNICODE
+
locale ulocale(locale(), new MyCodeCvt);
file.imbue(ulocale);
-#endif
+
file.open(filename.c_str(), ios_base::in | ios_base::binary);
tstring s1, st;
TCHAR *c, *co;
size_t count;
int error = 0;
int line = 1;
-#ifdef UNICODE
+
bool start = true;
-#endif
+
try
{
while (file.good())
@@ -129,7 +127,7 @@ void Mind::Load(tstring filename) if (st.empty())
break;
line++;
-#ifdef UNICODE
+
if (start)
{
if (st[0] == 65279)
@@ -141,7 +139,7 @@ void Mind::Load(tstring filename) fileTypeMark = false;
start = false;
}
-#endif
+
format(st);
count = st.length();
c = co = new TCHAR[count+1];
@@ -317,15 +315,15 @@ void Mind::Load(tstring filename) void Mind::Save(tstring filename) const
{
basic_ofstream<TCHAR, char_traits<TCHAR> > file;
-#ifdef UNICODE
+
locale ulocale(locale(), new MyCodeCvt);
file.imbue(ulocale);
-#endif
+
file.open(filename.c_str(), ios_base::out | ios_base::binary);
-#ifdef UNICODE
+
if (fileTypeMark)
file << TCHAR(65279);
-#endif
+
for (string_mmap::iterator it = data->study.begin(); it != data->study.end(); it++)
{
file << (*it).first << _T('\r') << endl;
diff --git a/plugins/Boltun/Engine/Mind.h b/plugins/Boltun/Engine/Mind.h index ecf3f5d199..23e0a41bd3 100644 --- a/plugins/Boltun/Engine/Mind.h +++ b/plugins/Boltun/Engine/Mind.h @@ -59,9 +59,8 @@ class Mind {
private:
MindData *data;
-#ifdef UNICODE
bool fileTypeMark;
-#endif
+
std::vector<tstring> Parse(tstring s);
public:
Mind();
diff --git a/plugins/Boltun/Engine/MyCodeCvt.cpp b/plugins/Boltun/Engine/MyCodeCvt.cpp index 49722e6f7b..5d7baf4d88 100644 --- a/plugins/Boltun/Engine/MyCodeCvt.cpp +++ b/plugins/Boltun/Engine/MyCodeCvt.cpp @@ -18,8 +18,6 @@ //
//***********************************************************
-#ifdef UNICODE
-
#include "MyCodeCvt.h"
using namespace std;
@@ -81,5 +79,3 @@ int MyCodeCvt::do_encoding() const _THROW0() {
return 2;
}
-
-#endif
\ No newline at end of file diff --git a/plugins/Boltun/actionQueue.cpp b/plugins/Boltun/actionQueue.cpp index b627d8abc4..c464c92f39 100644 --- a/plugins/Boltun/actionQueue.cpp +++ b/plugins/Boltun/actionQueue.cpp @@ -95,7 +95,7 @@ static bool NotifyTyping(HANDLE hContact) static char *MsgServiceName(HANDLE hContact)
{
-#ifdef _UNICODE
+
char szServiceName[100];
char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
if (szProto == NULL)
@@ -104,7 +104,7 @@ static char *MsgServiceName(HANDLE hContact) mir_snprintf(szServiceName, sizeof(szServiceName), "%s%sW", szProto, PSS_MESSAGE);
if (ServiceExists(szServiceName))
return PSS_MESSAGE "W";
-#endif
+
return PSS_MESSAGE;
}
@@ -114,7 +114,7 @@ static void TimerAnswer(HANDLE hContact, const TalkBot::MessageInfo* info) int size = (int)info->Answer.length() + 1;
int bufsize = size;
char* msg;
-#ifdef UNICODE
+
bufsize *= sizeof(TCHAR) + 1;
msg = new char[bufsize];
//msg[size - 1] = '\0';
@@ -123,9 +123,7 @@ static void TimerAnswer(HANDLE hContact, const TalkBot::MessageInfo* info) NULL, NULL))
FillMemory(msg, size - 1, '-'); //In case of fault return "----" in ANSI part
CopyMemory(msg + size, info->Answer.c_str(), size * 2);
-#else
- msg = respItem->szMes;
-#endif
+
CallContactService(hContact, MsgServiceName(hContact), PREF_TCHAR, (LPARAM)msg);
@@ -142,9 +140,9 @@ static void TimerAnswer(HANDLE hContact, const TalkBot::MessageInfo* info) CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&ldbei);
bot->AnswerGiven(hContact, *info);
delete info;
-#ifdef UNICODE
+
delete msg;
-#endif
+
typingContactsLock.Enter();
typingContacts.erase(hContact);
typingContactsLock.Leave();
diff --git a/plugins/Boltun/boltun.cpp b/plugins/Boltun/boltun.cpp index a26b68c862..9d7d9b6fb5 100644 --- a/plugins/Boltun/boltun.cpp +++ b/plugins/Boltun/boltun.cpp @@ -81,11 +81,9 @@ static HANDLE hMenuItemAutoChat; static HANDLE hMenuItemNotToChat;
static HANDLE hMenuItemStartChatting;
-#ifdef UNICODE
+
#define MIND_DIALOG_FILTER _T("%s (*.mindw)\1*.mindw\1%s (*.*)\1*.*\1")
-#else
-#define MIND_DIALOG_FILTER "%s (*.mind)\1*.mind\1%s (*.*)\1*.*\1"
-#endif
+
#ifdef DEBUG_LOAD_TIME
#include <intrin.h>
diff --git a/plugins/Boltun/boltun.h b/plugins/Boltun/boltun.h index 6063dc2310..914869387c 100644 --- a/plugins/Boltun/boltun.h +++ b/plugins/Boltun/boltun.h @@ -23,11 +23,9 @@ //Should use different keys in UNICODE and ANSI builds, because usage of plugin
//with old (another) configs will cause crashes.
-#ifdef _UNICODE
-#define BOLTUN_KEY "BoltunW"
-#else
+
#define BOLTUN_KEY "Boltun"
-#endif
+
//Service names
#define SERV_CONTACT_AUTO_CHAT "Boltun/ContactAutoChat"
@@ -43,11 +41,7 @@ #define BOLTUN_GROUP "Message sessions"
//Filename depends on UNICODE
-#ifdef UNICODE
#define DEFAULT_MIND_FILE _T("boltun.mindw")
-#else
-#define DEFAULT_MIND_FILE _T("boltun.mind")
-#endif
//===============================================
// These are strings for translation:
|