From 1ca35422a252e1b254d6a4823717d39f7988514f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 13 Aug 2015 20:12:02 +0000 Subject: fix for wrong CMString::Mid calls git-svn-id: http://svn.miranda-ng.org/main/trunk@14944 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IRCG/src/commandmonitor.cpp | 18 +++++++++--------- protocols/IRCG/src/irclib.cpp | 6 +++--- protocols/IRCG/src/ircproto.cpp | 6 +++--- protocols/IRCG/src/scripting.cpp | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) (limited to 'protocols/IRCG/src') 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); } -- cgit v1.2.3