summaryrefslogtreecommitdiff
path: root/plugins/SMS/src/AdditionalFunctions/MemoryFindByte.h
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-01-05 13:38:59 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-01-05 13:38:59 +0000
commit3cd763c7a9c62bfb1c1dc43246b2199ee9427e92 (patch)
treecc8edc9da30eeda76be402bd940f35acbd0e1c97 /plugins/SMS/src/AdditionalFunctions/MemoryFindByte.h
parent8860a0297c57d8c5fe3e6ddaef64ee6780ea116b (diff)
64-bit compatibility fixes for the SMS plugin
git-svn-id: http://svn.miranda-ng.org/main/trunk@2979 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SMS/src/AdditionalFunctions/MemoryFindByte.h')
-rw-r--r--plugins/SMS/src/AdditionalFunctions/MemoryFindByte.h60
1 files changed, 3 insertions, 57 deletions
diff --git a/plugins/SMS/src/AdditionalFunctions/MemoryFindByte.h b/plugins/SMS/src/AdditionalFunctions/MemoryFindByte.h
index 002f76e44c..83ca9c5468 100644
--- a/plugins/SMS/src/AdditionalFunctions/MemoryFindByte.h
+++ b/plugins/SMS/src/AdditionalFunctions/MemoryFindByte.h
@@ -5,67 +5,13 @@
#pragma once
#endif // _MSC_VER > 1000
-
-
__inline LPVOID MemoryFindByte(SIZE_T dwFrom,LPCVOID lpcSource,SIZE_T dwSourceSize,unsigned char chWhatFind)
{
- LPVOID lpRet=NULL;
-
if (lpcSource && dwSourceSize)
- {
- if (dwFrom<dwSourceSize)
- {
- lpRet=(LPVOID)memchr((LPCVOID)(((SIZE_T)lpcSource)+dwFrom),chWhatFind,(dwSourceSize-dwFrom));
- }
- }
-return(lpRet);
-}
-
-
-
-__inline LPVOID MemoryFindByteReverse(SIZE_T dwFrom,LPCVOID lpcSource,SIZE_T dwSourceSize,unsigned char chWhatFind)
-{
- LPVOID lpRet=NULL;
+ if (dwFrom < dwSourceSize)
+ return memchr((BYTE*)lpcSource + dwFrom, chWhatFind, dwSourceSize-dwFrom);
- __asm
- {
- push ebx // сохраняем регистр
- push edi // сохраняем регистр
- push esi // сохраняем регистр
-
- mov ecx,dwSourceSize
- test ecx,ecx //; проверка входного параметра, он !=0
- je short end_func
-
- mov edi,lpcSource //; di = string
- test edi,edi //; проверка входного параметра, он !=0
- jz short end_func
-
- mov eax,dwFrom
-
-/////////////////////////////////////////////
- cmp eax,ecx //; проверка ecx(=len)=>dwFrom
- jae short end_func
-
- std //; count 'up' on string this time
- sub ecx,eax //; уменьшаем длинну на dwFrom(нач смещен)
- add edi,ecx //; сдвигаем начало на dwSourceSize(на конец)
- mov al,chWhatFind //; al=search byte
- repne scasb //; find that byte
- inc edi //; di points to byte which stopped scan
- cmp [edi],al //; see if we have a hit
- jne short end_func //; yes, point to byte
- mov lpRet,edi //; ax=pointer to byte
- end_func:
-
- cld
- pop esi // восстанавливаем содержимое регистра
- pop edi // восстанавливаем содержимое регистра
- pop ebx // восстанавливаем содержимое регистра
- }
-return(lpRet);
+ return NULL;
}
-
-
#endif // !defined(AFX_MEMORYFINDBYTE__H__INCLUDED_)