diff options
author | George Hazan <george.hazan@gmail.com> | 2015-08-13 20:12:02 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-08-13 20:12:02 +0000 |
commit | 1ca35422a252e1b254d6a4823717d39f7988514f (patch) | |
tree | d2f6b3486d75cb83a506a27faf4d652cdd686037 | |
parent | e84bf4a5995b26423129b9339dd387e2a7431a0a (diff) |
fix for wrong CMString::Mid calls
git-svn-id: http://svn.miranda-ng.org/main/trunk@14944 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/Dropbox/src/dropbox.cpp | 17 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/smileys.cpp | 2 | ||||
-rw-r--r-- | protocols/IRCG/src/commandmonitor.cpp | 18 | ||||
-rw-r--r-- | protocols/IRCG/src/irclib.cpp | 6 | ||||
-rw-r--r-- | protocols/IRCG/src/ircproto.cpp | 6 | ||||
-rw-r--r-- | protocols/IRCG/src/scripting.cpp | 2 |
6 files changed, 25 insertions, 26 deletions
diff --git a/plugins/Dropbox/src/dropbox.cpp b/plugins/Dropbox/src/dropbox.cpp index 2aa36de2d7..6ac4ee8d1b 100644 --- a/plugins/Dropbox/src/dropbox.cpp +++ b/plugins/Dropbox/src/dropbox.cpp @@ -80,17 +80,16 @@ void CDropbox::RequestAccountInfo() JSONNode display_name = root.at("display_name");
if (!display_name.empty())
{
- ptrT display_name(mir_utf8decodeT(display_name.as_string().c_str()));
- TCHAR *sep = _tcsrchr(display_name, _T(' '));
- if (sep)
+ CMString tszDisplayName(display_name.as_mstring());
+ int pos = tszDisplayName.ReverseFind(' ');
+ if (pos != -1)
{
- db_set_ts(hContact, MODULE, "LastName", sep + 1);
- display_name[mir_tstrlen(display_name) - mir_tstrlen(sep)] = '\0';
- db_set_ts(hContact, MODULE, "FirstName", display_name);
+ db_set_ts(hContact, MODULE, "LastName", tszDisplayName.Mid(pos+1));
+ db_set_ts(hContact, MODULE, "FirstName", tszDisplayName.Left(pos));
}
else
{
- db_set_ts(hContact, MODULE, "FirstName", display_name);
+ db_set_ts(hContact, MODULE, "FirstName", tszDisplayName);
db_unset(hContact, MODULE, "LastName");
}
}
@@ -104,8 +103,8 @@ void CDropbox::RequestAccountInfo() db_unset(hContact, MODULE, "Country");
else
{
- char *country = (char *)CallService(MS_UTILS_GETCOUNTRYBYISOCODE, (WPARAM)isocode.c_str(), 0);
- db_set_s(hContact, MODULE, "Country", country);
+ char *szCountry = (char *)CallService(MS_UTILS_GETCOUNTRYBYISOCODE, (WPARAM)isocode.c_str(), 0);
+ db_set_s(hContact, MODULE, "Country", szCountry);
}
}
diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp index 2e3b7febcb..d373dc2190 100644 --- a/plugins/SmileyAdd/src/smileys.cpp +++ b/plugins/SmileyAdd/src/smileys.cpp @@ -1018,7 +1018,7 @@ void SmileyCategoryListType::AddAllProtocolsAsCategory(void) }
if (cppv != cats.GetLength()) {
- displayName = cats.Mid(cppv, cats.GetLength() - cppv);
+ displayName = cats.Mid(cppv);
AddCategory(displayName, displayName, smcCustom, defaultFile);
}
}
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index 90ccf333b0..e0f187a727 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -876,7 +876,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) begin = mess.Find(' ', end);
if (begin >= 0) {
- CMString rest = mess.Mid(begin, mess.GetLength());
+ CMString rest = mess.Mid(begin);
dwAdr = _tcstoul(GetWord(rest.c_str(), 0).c_str(), NULL, 10);
iPort = _ttoi(GetWord(rest.c_str(), 1).c_str());
dwSize = _ttoi64(GetWord(rest.c_str(), 2).c_str());
@@ -949,7 +949,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) begin = mess.Find(' ', end);
if (begin >= 0) {
- CMString rest = mess.Mid(begin, mess.GetLength());
+ CMString rest = mess.Mid(begin);
iPort = _ttoi(GetWord(rest.c_str(), 0).c_str());
dwSize = _ttoi(GetWord(rest.c_str(), 1).c_str());
sToken = GetWord(rest.c_str(), 2);
@@ -1034,7 +1034,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) CMString sFileCorrected = sFile;
int i = sFile.ReverseFind('\\');
if (i != -1)
- sFileCorrected = sFile.Mid(i + 1, sFile.GetLength());
+ sFileCorrected = sFile.Mid(i + 1);
sFile = sFileCorrected;
}
else if (type == _T("accept") || type == _T("resume")) {
@@ -1056,7 +1056,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) CMString sFileCorrected = sFile;
int i = sFile.ReverseFind('\\');
if (i != -1)
- sFileCorrected = sFile.Mid(i + 1, sFile.GetLength());
+ sFileCorrected = sFile.Mid(i + 1);
sFile = sFileCorrected;
}
@@ -1255,7 +1255,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) while (_tcschr(sUserModePrefixes.c_str(), name[index]))
index++;
- if (!mir_tstrcmpi(name.Mid(index, name.GetLength()).c_str(), m_info.sNick.c_str())) {
+ if (!mir_tstrcmpi(name.Mid(index).c_str(), m_info.sNick.c_str())) {
bFlag = true;
break;
}
@@ -1392,8 +1392,8 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg) command = GetWord(dbv.ptszVal, i);
i++;
if (!command.IsEmpty()) {
- CMString S = command.Mid(1, command.GetLength());
- if (!mir_tstrcmpi(sChanName, S.c_str()))
+ CMString S = command.Mid(1);
+ if (!mir_tstrcmpi(sChanName, S))
break;
save += command + _T(" ");
@@ -1839,7 +1839,7 @@ bool CIrcProto::OnIrc_JOINERROR(const CIrcMessage* pmsg) command = GetWord(dbv.ptszVal, i);
i++;
- if (!command.IsEmpty() && pmsg->parameters[0] == command.Mid(1, command.GetLength()))
+ if (!command.IsEmpty() && pmsg->parameters[0] == command.Mid(1))
save += command + _T(" ");
}
@@ -2336,7 +2336,7 @@ bool CIrcProto::DoOnConnect(const CIrcMessage*) ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)Temp, m_iStatus);
if (m_iDesiredStatus == ID_STATUS_AWAY)
- PostIrcMessage(_T("/AWAY %s"), m_statusMessage.Mid(0, 450).c_str());
+ PostIrcMessage(_T("/AWAY %s"), m_statusMessage.Mid(0, 450));
if (m_perform) {
DoPerform("ALL NETWORKS");
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index e9a8340119..5961bcf5f2 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -926,11 +926,11 @@ int CDccSession::SetupConnection() int i = di->sFileAndPath.ReverseFind('\\'); if (i != -1) { di->sPath = di->sFileAndPath.Mid(0, i + 1); - di->sFile = di->sFileAndPath.Mid(i + 1, di->sFileAndPath.GetLength()); + di->sFile = di->sFileAndPath.Mid(i + 1); } - pfts.tszCurrentFile = (TCHAR*)di->sFileAndPath.c_str(); - pfts.tszWorkingDir = (TCHAR*)di->sPath.c_str(); + pfts.tszCurrentFile = di->sFileAndPath.GetBuffer(); + pfts.tszWorkingDir = di->sPath.GetBuffer(); pfts.totalBytes = di->dwSize; pfts.currentFileSize = pfts.totalBytes; diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 9504b70bc9..da16702dbe 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -556,7 +556,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR** ppsz int i = dci->sFileAndPath.ReverseFind('\\');
if (i != -1) {
dci->sPath = dci->sFileAndPath.Mid(0, i + 1);
- dci->sFile = dci->sFileAndPath.Mid(i + 1, dci->sFileAndPath.GetLength());
+ dci->sFile = dci->sFileAndPath.Mid(i + 1);
}
CMString sFileWithQuotes = dci->sFile;
@@ -757,7 +757,7 @@ int CIrcProto::SetStatusInternal(int iNewStatus, bool bIsInternal) }
else if (iNewStatus == ID_STATUS_AWAY && IsConnected()) //go to away while connected
{
- PostIrcMessage(_T("/AWAY %s"), m_statusMessage.Mid(0, 450).c_str());
+ PostIrcMessage(_T("/AWAY %s"), m_statusMessage.Mid(0, 450));
return 0;
}
else if (iNewStatus == ID_STATUS_ONLINE && IsConnected()) //already online
@@ -815,7 +815,7 @@ int __cdecl CIrcProto::SetAwayMsg(int status, const TCHAR* msg) m_statusMessage = newStatus;
if (m_iStatus == ID_STATUS_AWAY)
- PostIrcMessage(_T("/AWAY %s"), m_statusMessage.Mid(0, 450).c_str());
+ PostIrcMessage(_T("/AWAY %s"), m_statusMessage.Mid(0, 450));
}
}
diff --git a/protocols/IRCG/src/scripting.cpp b/protocols/IRCG/src/scripting.cpp index 2082bad904..3fd4b420d2 100644 --- a/protocols/IRCG/src/scripting.cpp +++ b/protocols/IRCG/src/scripting.cpp @@ -116,7 +116,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) int i = sString.Find("|");
if (i != -1) {
sRequest = sString.Mid(0, i);
- TCHAR* p = mir_a2t((char*)sString.Mid(i + 1, sString.GetLength()).c_str());
+ TCHAR* p = mir_a2t(sString.Mid(i + 1));
sChannel = p;
mir_free(p);
}
|