diff options
author | George Hazan <george.hazan@gmail.com> | 2014-12-14 12:25:16 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-12-14 12:25:16 +0000 |
commit | 728f3b62ed973a920490111b692ecf0e365243a7 (patch) | |
tree | 6d14d7595380a2591b75a7b456cae6a33e26bc01 /protocols/MRA/src/Sdk/ListMT.h | |
parent | ec369d18d5aa7b55204fee8513609f6efed0d5a8 (diff) |
most evident warnings in MRA fixed
git-svn-id: http://svn.miranda-ng.org/main/trunk@11398 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MRA/src/Sdk/ListMT.h')
-rw-r--r-- | protocols/MRA/src/Sdk/ListMT.h | 47 |
1 files changed, 9 insertions, 38 deletions
diff --git a/protocols/MRA/src/Sdk/ListMT.h b/protocols/MRA/src/Sdk/ListMT.h index 63cd54b9fb..399765fba2 100644 --- a/protocols/MRA/src/Sdk/ListMT.h +++ b/protocols/MRA/src/Sdk/ListMT.h @@ -57,10 +57,10 @@ typedef CONST PLIST_MT_ITEM PCLIST_MT_ITEM, LPCLIST_MT_ITEM; // структура для работы со списком, заголовок списка
typedef struct _LIST_MT
{
- size_t nCount; // *колличество элементов в списке
- PLIST_MT_ITEM plmtiFirst; // *указывает на первый элемент в списке
- PLIST_MT_ITEM plmtiLast; // *указывает на последний элемент в списке
- CRITICAL_SECTION cs; // *section for exclysive access to List
+ size_t nCount; // *количество элементов в списке
+ PLIST_MT_ITEM plmtiFirst; // *указывает на первый элемент в списке
+ PLIST_MT_ITEM plmtiLast; // *указывает на последний элемент в списке
+ mir_cs cs; // *section for exclysive access to List
}LIST_MT, *PLIST_MT, *LPLIST_MT;
typedef CONST PLIST_MT PCLIST_MT, LPCLIST_MT;
@@ -76,25 +76,12 @@ typedef CONST PLIST_MT_ITERATOR PCLIST_MT_ITERATOR, LPCLIST_MT_ITERATOR; -__inline DWORD ListMTInitialize(PCLIST_MT pclmtListMT,DWORD dwSpinCount)
+__inline DWORD ListMTInitialize(PCLIST_MT pclmtListMT)
{
- DWORD dwRetErrorCode;
-
-#if (_WIN32_WINNT >= 0x0403)
- if (InitializeCriticalSectionAndSpinCount(&pclmtListMT->cs,((dwSpinCount)? (dwSpinCount | 0x80000000):0L)))
-#else
- InitializeCriticalSection(&pclmtListMT->cs);
- if (TRUE)
-#endif
- {
- InterlockedExchangePointer((volatile PVOID*)&pclmtListMT->nCount,NULL);
- pclmtListMT->plmtiFirst=NULL;
- pclmtListMT->plmtiLast=NULL;
- dwRetErrorCode=NO_ERROR;
- }else{
- dwRetErrorCode=GetLastError();
- }
-return(dwRetErrorCode);
+ InterlockedExchangePointer((volatile PVOID*)&pclmtListMT->nCount,NULL);
+ pclmtListMT->plmtiFirst=NULL;
+ pclmtListMT->plmtiLast=NULL;
+ return NO_ERROR;
}
@@ -103,26 +90,10 @@ __inline void ListMTDestroy(PCLIST_MT pclmtListMT) InterlockedExchangePointer((volatile PVOID*)&pclmtListMT->nCount,NULL);
pclmtListMT->plmtiFirst=NULL;
pclmtListMT->plmtiLast=NULL;
- DeleteCriticalSection(&pclmtListMT->cs);
SecureZeroMemory(&pclmtListMT->cs,sizeof(CRITICAL_SECTION));
}
-class mt_lock
-{
- PCLIST_MT m_list;
-
-public:
- __forceinline mt_lock(PCLIST_MT _pList) :
- m_list( _pList )
- { EnterCriticalSection(&_pList->cs);
- }
-
- __forceinline ~mt_lock()
- { LeaveCriticalSection(&m_list->cs);
- }
-};
-
__inline size_t ListMTGetCount(PCLIST_MT pclmtListMT)
{
return((size_t)InterlockedCompareExchangePointer((LPVOID*)&pclmtListMT->nCount,NULL,NULL));
|