From 461183308684de712dc674382a86f87707a19a2a Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Tue, 7 Sep 2010 15:08:02 +0300 Subject: modified: messages.cpp --- messages.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'messages.cpp') diff --git a/messages.cpp b/messages.cpp index 05b7862..27c31fb 100644 --- a/messages.cpp +++ b/messages.cpp @@ -298,25 +298,22 @@ int RecvMsgSvc(WPARAM w, LPARAM l) wstring path = tmp2; mir_free(tmp2); path += _T("\\decrypted_data"); - fstream f(path.c_str(), std::ios::in); - while(!f.eof() && f.is_open()) + fstream f(path.c_str(), std::ios::in | std::ios::binary); + while(f.is_open()) { char tmp[256]; - f.getline(tmp, 256); - TCHAR *tmp2; -// if(unicode) - tmp2 = mir_utf8decodeW(tmp); -// else -// tmp2 = mir_a2t(tmp); - if(!tmp2) + f.getline(tmp, 255); + if(strlen(tmp) == 0) break; + TCHAR *tmp2; + tmp2 = mir_utf8decodeW(tmp); str.append(tmp2).append(_T("\n")); mir_free(tmp2); } f.close(); DeleteFile(path.c_str()); str.erase(str.find_last_of(_T("\n")), 1); - if(!str.length()) + if(str.empty()) { string str = pre->szMessage; mir_free((void**)pre->szMessage); -- cgit v1.2.3