diff options
Diffstat (limited to 'protocols/MRA/src/Sdk')
-rw-r--r-- | protocols/MRA/src/Sdk/FIFOMT.h | 7 | ||||
-rw-r--r-- | protocols/MRA/src/Sdk/InternetTime.h | 2 | ||||
-rw-r--r-- | protocols/MRA/src/Sdk/ListMT.h | 47 | ||||
-rw-r--r-- | protocols/MRA/src/Sdk/timefuncs.h | 14 |
4 files changed, 11 insertions, 59 deletions
diff --git a/protocols/MRA/src/Sdk/FIFOMT.h b/protocols/MRA/src/Sdk/FIFOMT.h index 3c6c250d87..0cff1914d5 100644 --- a/protocols/MRA/src/Sdk/FIFOMT.h +++ b/protocols/MRA/src/Sdk/FIFOMT.h @@ -44,13 +44,10 @@ typedef PCLIST_MT_ITEM PCFIFO_MT_ITEM, LPCFIFO_MT_ITEM; typedef LIST_MT_ITERATOR FIFO_MT_ITERATOR, *PFIFO_MT_ITERATOR, *LPFIFO_MT_ITERATOR;
typedef PCLIST_MT_ITERATOR PCFIFO_MT_ITERATOR, LPCFIFO_MT_ITERATOR;
-#define FifoMTInitialize(pcpmtFifoMT,dwSpinCount) ListMTInitialize(pcpmtFifoMT,dwSpinCount)
-#define FifoMTDestroy(pcpmtFifoMT) ListMTDestroy(pcpmtFifoMT)
-
__inline size_t FifoMTItemPush(PCFIFO_MT pcpmtFifoMT,PCFIFO_MT_ITEM pcffmtiFifoItem,LPVOID lpData)
{
- mt_lock l(pcpmtFifoMT);
+ mir_cslock l(pcpmtFifoMT->cs);
return ListMTItemAdd(pcpmtFifoMT,pcffmtiFifoItem,lpData);
}
@@ -60,7 +57,7 @@ __inline DWORD FifoMTItemPop(PCFIFO_MT pcpmtFifoMT,PFIFO_MT_ITEM *ppffmtiFifoIte DWORD dwRetErrorCode;
PLIST_MT_ITEM plmtiItem;
- mt_lock l(pcpmtFifoMT);
+ mir_cslock l(pcpmtFifoMT->cs);
if ((dwRetErrorCode=ListMTItemGetFirst(pcpmtFifoMT,&plmtiItem,plpData))==NO_ERROR)
{
if (ppffmtiFifoItem) (*ppffmtiFifoItem)=plmtiItem;
diff --git a/protocols/MRA/src/Sdk/InternetTime.h b/protocols/MRA/src/Sdk/InternetTime.h index fbb1233e8e..8052bb9ea6 100644 --- a/protocols/MRA/src/Sdk/InternetTime.h +++ b/protocols/MRA/src/Sdk/InternetTime.h @@ -127,8 +127,6 @@ __inline void InternetTimeGetCurrentTime(INTERNET_TIME *pitTime) // Переводит время из MAILTIME в строковое
__inline CMStringA InternetTimeGetString(INTERNET_TIME *pitTime)
{
- DWORD dwRet=NO_ERROR;
-
char lpszBuff[100];
LPSTR lpszCurPos = lpszBuff;
size_t dwTimeLen=0,dwtm;
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));
diff --git a/protocols/MRA/src/Sdk/timefuncs.h b/protocols/MRA/src/Sdk/timefuncs.h index 8ac5a80edf..eaee4a7e80 100644 --- a/protocols/MRA/src/Sdk/timefuncs.h +++ b/protocols/MRA/src/Sdk/timefuncs.h @@ -51,20 +51,6 @@ typedef union { } FT;
-static inline __time32_t __cdecl _time32(__time32_t *timeptr)
-{
- __time64_t tim;
- FT nt_time;
-
- GetSystemTimeAsFileTime(&(nt_time.ft_struct));
- tim=(__time64_t)((nt_time.ft_scalar-EPOCH_BIAS)/10000000i64);
- if (tim > (__time64_t)(_MAX__TIME32_T)) tim=(__time64_t)(-1);
- if (timeptr) *timeptr = (__time32_t)(tim);// store time if requested
-
-return(__time32_t)(tim);
-}
-
-
inline __time32_t MakeTime32FromLocalSystemTime(CONST PSYSTEMTIME pcstSystemTime)
{
__time64_t tim=0;
|