summaryrefslogtreecommitdiff
path: root/messages.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'messages.cpp')
-rw-r--r--messages.cpp17
1 files changed, 7 insertions, 10 deletions
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);