summaryrefslogtreecommitdiff
path: root/protocols/MRA
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-09-04 08:11:14 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-09-04 08:11:14 +0000
commit60404a7dc490b6f4a505ae23d23e277b49ad6d06 (patch)
tree288a5f2517bfe4fde82a548f36dbf42a1d0fe7e0 /protocols/MRA
parentd8acc357113997aed7eaffe627b341d9895893e1 (diff)
further MRA cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@5935 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MRA')
-rw-r--r--protocols/MRA/src/MraAvatars.cpp2
-rw-r--r--protocols/MRA/src/Mra_functions.cpp4
-rw-r--r--protocols/MRA/src/Mra_proto.cpp9
-rw-r--r--protocols/MRA/src/Sdk/InternetTime.h2
-rw-r--r--protocols/MRA/src/Sdk/StrToNum.h52
5 files changed, 9 insertions, 60 deletions
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp
index 47a78d0fc0..3a6e37800a 100644
--- a/protocols/MRA/src/MraAvatars.cpp
+++ b/protocols/MRA/src/MraAvatars.cpp
@@ -445,7 +445,7 @@ DWORD MraAvatarsHttpTransaction(HANDLE m_hConnection, DWORD dwRequestType, LPCST
}
else if ( !_strnicmp(pnlhr->headers[i].szName, "Content-Length", 14)) {
if (pdwAvatarSize)
- *pdwAvatarSize = StrToUNum(pnlhr->headers[i].szValue, lstrlenA(pnlhr->headers[i].szValue));
+ *pdwAvatarSize = atol(pnlhr->headers[i].szValue);
}
else if ( !_strnicmp(pnlhr->headers[i].szName, "Last-Modified", 13)) {
if (pitLastModifiedTime)
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp
index 079904ea72..b388e7af40 100644
--- a/protocols/MRA/src/Mra_functions.cpp
+++ b/protocols/MRA/src/Mra_functions.cpp
@@ -1379,10 +1379,10 @@ bool CMraProto::GetPassDB_v1(CMStringA &res)
RC4(btCryptedPass, sizeof(btCryptedPass), bthmacSHA1, MIR_SHA1_HASH_SIZE);
dwPassSize = (*btCryptedPass);
- btCryptedPass[dwPassSize] = 0;
+ btCryptedPass[dwPassSize+1+MIR_SHA1_HASH_SIZE] = 0;
unsigned dwDecodedSize;
- mir_ptr<BYTE> pDecoded((PBYTE)mir_base64_decode((LPCSTR)&btCryptedPass[(1+MIR_SHA1_HASH_SIZE)], &dwDecodedSize));
+ mir_ptr<BYTE> pDecoded((PBYTE)mir_base64_decode((LPCSTR)&btCryptedPass[1+MIR_SHA1_HASH_SIZE], &dwDecodedSize));
SHA1GetDigest(pDecoded, dwDecodedSize, btRandomData);
if ( !memcmp(&btCryptedPass[1], btRandomData, MIR_SHA1_HASH_SIZE)) {
res = CMStringA((LPSTR)(PBYTE)pDecoded, dwDecodedSize);
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp
index 7a3cadef80..73b9d683f2 100644
--- a/protocols/MRA/src/Mra_proto.cpp
+++ b/protocols/MRA/src/Mra_proto.cpp
@@ -527,7 +527,7 @@ bool CMraProto::CmdUserInfo(BinBuffer &buf)
}
else if ( !_strnicmp(szString, "micblog.status.id", 17)) {
buf >> szString;
- DWORDLONG dwBlogStatusID = StrToUNum64(szString, szString.GetLength());
+ DWORDLONG dwBlogStatusID = _atoi64(szString);
mraWriteContactSettingBlob(NULL, DBSETTING_BLOGSTATUSID, &dwBlogStatusID, sizeof(DWORDLONG));
}
else if ( !_strnicmp(szString, "micblog.status.time", 19)) {
@@ -540,31 +540,24 @@ bool CMraProto::CmdUserInfo(BinBuffer &buf)
}
else if ( !_strnicmp(szString, "HAS_MYMAIL", 10)) {
buf >> szString;
- //setDword(DBSETTING_BLOGSTATUSTIME, StrToUNum32(szString.lpszData, szString.dwSize));
}
else if ( !_strnicmp(szString, "mrim.status.open_search", 23)) {
buf >> szString;
- //setDword(DBSETTING_BLOGSTATUSTIME, StrToUNum32(szString.lpszData, szString.dwSize));
}
else if ( !_strnicmp(szString, "rb.target.cookie", 16)) {
buf >> szString;
- //setDword(DBSETTING_BLOGSTATUSTIME, StrToUNum32(szString.lpszData, szString.dwSize));
}
else if ( !_strnicmp(szString, "show_web_history_link", 21)) {
buf >> szString;
- //setDword(DBSETTING_BLOGSTATUSTIME, StrToUNum32(szString.lpszData, szString.dwSize));
}
else if ( !_strnicmp(szString, "friends_suggest", 15)) {
buf >> szString;
- //setDword(DBSETTING_BLOGSTATUSTIME, StrToUNum32(szString.lpszData, szString.dwSize));
}
else if ( !_strnicmp(szString, "timestamp", 9)) {
buf >> szString;
- //setDword(DBSETTING_BLOGSTATUSTIME, StrToUNum32(szString.lpszData, szString.dwSize));
}
else if ( !_strnicmp(szString, "trusted_update", 14)) {
buf >> szString;
- //setDword(DBSETTING_BLOGSTATUSTIME, StrToUNum32(szString.lpszData, szString.dwSize));
}
else {
#ifdef _DEBUG
diff --git a/protocols/MRA/src/Sdk/InternetTime.h b/protocols/MRA/src/Sdk/InternetTime.h
index c49333f98a..74986c124c 100644
--- a/protocols/MRA/src/Sdk/InternetTime.h
+++ b/protocols/MRA/src/Sdk/InternetTime.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- */
+ */
diff --git a/protocols/MRA/src/Sdk/StrToNum.h b/protocols/MRA/src/Sdk/StrToNum.h
index bb34aa31c2..72f926bd28 100644
--- a/protocols/MRA/src/Sdk/StrToNum.h
+++ b/protocols/MRA/src/Sdk/StrToNum.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- */
+ */
@@ -36,28 +36,6 @@
#pragma once
#endif // _MSC_VER > 1000
-
-__inline size_t StrToUNum(LPCSTR lpcszString,size_t dwStringLen)
-{
- size_t dwNum=0;
- BYTE bCurentFigure;
-
-
- while(dwStringLen)
- {
- if ((bCurentFigure=((*lpcszString)-48))<10)
- {
- dwNum*=10;// сдвигаем предыдущее число на один разряд чтоб добавить в младший разряд новую цифру
- dwNum+=bCurentFigure;// добавляем цифру в младший разряд
- }
- lpcszString++;// перемещаем указатель на следующую позицию
- dwStringLen--;// уменьшаем длинну
- }
-
-return(dwNum);
-}
-
-
__inline DWORD StrToUNum32(LPCSTR lpcszString,size_t dwStringLen)
{
DWORD dwNum=0;
@@ -75,36 +53,14 @@ __inline DWORD StrToUNum32(LPCSTR lpcszString,size_t dwStringLen)
dwStringLen--;// уменьшаем длинну
}
-return(dwNum);
+ return(dwNum);
}
-
-
-__inline DWORDLONG StrToUNum64(LPCSTR lpcszString,size_t dwStringLen)
-{
- DWORDLONG dwlNum=0;
- BYTE bCurentFigure;
-
-
- while(dwStringLen)
- {
- if ((bCurentFigure=((*lpcszString)-48))<10)
- {
- dwlNum*=10;// сдвигаем предыдущее число на один разряд чтоб добавить в младший разряд новую цифру
- dwlNum+=bCurentFigure;// добавляем цифру в младший разряд
- }
- lpcszString++;// перемещаем указатель на следующую позицию
- dwStringLen--;// уменьшаем длинну
- }
-
-return(dwlNum);
-}
-
+
__inline SSIZE_T StrToNum(LPCSTR lpcszString,size_t dwStringLen)
{
SSIZE_T lNum=0,lSingn=1;
BYTE bCurentFigure;
-
while(dwStringLen && ((bCurentFigure=((*lpcszString)-48))>9))
{
if (bCurentFigure=='-') lSingn=-1;
@@ -126,7 +82,7 @@ __inline SSIZE_T StrToNum(LPCSTR lpcszString,size_t dwStringLen)
}
lNum*=lSingn;
-return(lNum);
+ return(lNum);
}