Skip to content

Commit c4eba2d

Browse files
author
liangdc
committed
20151201
1 parent ded870d commit c4eba2d

File tree

93 files changed

+71
-52
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+71
-52
lines changed

Common/Src/STLHelper.h

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,9 @@ template<class Set> struct Set_Cleaner
208208
**********************************/
209209
template<class PtrSet> void ClearPtrSet(PtrSet& v)
210210
{
211-
for(PtrSet::iterator it = v.begin();
212-
it != v.end();
211+
for(PtrSet::iterator it = v.begin(),
212+
end = v.end();
213+
it != end;
213214
++it)
214215
delete (*it);
215216

@@ -230,8 +231,9 @@ template<class PtrSet> struct PtrSet_Cleaner
230231
**********************************/
231232
template<class PtrArraySet> void ClearPtrArraySet(PtrArraySet& v)
232233
{
233-
for(PtrArraySet::iterator it = v.begin();
234-
it != v.end();
234+
for(PtrArraySet::iterator it = v.begin(),
235+
end = v.end();
236+
it != end;
235237
++it)
236238
delete[] (*it);
237239

@@ -269,8 +271,9 @@ template<class Map> struct Map_Cleaner
269271
**********************************/
270272
template<class PtrMap> void ClearPtrMap(PtrMap& v)
271273
{
272-
for(PtrMap::iterator it = v.begin();
273-
it != v.end();
274+
for(PtrMap::iterator it = v.begin(),
275+
end = v.end();
276+
it != end;
274277
++it)
275278
delete it->second;
276279

@@ -291,8 +294,9 @@ template<class PtrMap> struct PtrMap_Cleaner
291294
**********************************/
292295
template<class PtrArrayMap> void ClearPtrArrayMap(PtrArrayMap& v)
293296
{
294-
for(PtrArrayMap::iterator it = v.begin();
295-
it != v.end();
297+
for(PtrArrayMap::iterator it = v.begin(),
298+
end = v.end();
299+
it != end;
296300
++it)
297301
delete[] it->second;
298302

@@ -313,8 +317,9 @@ template<class PtrArrayMap> struct PtrArrayMap_Cleaner
313317
**********************************/
314318
template<class SetSet> void ClearSetSet(SetSet& v)
315319
{
316-
for(SetSet::iterator it = v.begin();
317-
it != v.end();
320+
for(SetSet::iterator it = v.begin(),
321+
end = v.end();
322+
it != end;
318323
++it)
319324
{
320325
(*it)->clear();
@@ -338,8 +343,9 @@ template<class SetSet> struct SetSet_Cleaner
338343
**********************************/
339344
template<class PtrSetSet> void ClearPtrSetSet(PtrSetSet& v)
340345
{
341-
for(PtrSetSet::iterator it = v.begin();
342-
it != v.end();
346+
for(PtrSetSet::iterator it = v.begin(),
347+
end = v.end();
348+
it != end;
343349
++it)
344350
{
345351
ClearPtrSet(**it);
@@ -363,8 +369,9 @@ template<class PtrSetSet> struct PtrSetSet_Cleaner
363369
**********************************/
364370
template<class PtrArraySetSet> void ClearPtrArraySetSet(PtrArraySetSet& v)
365371
{
366-
for(PtrArraySetSet::iterator it = v.begin();
367-
it != v.end();
372+
for(PtrArraySetSet::iterator it = v.begin(),
373+
end = v.end();
374+
it != end;
368375
++it)
369376
{
370377
ClearPtrArraySet(**it);
@@ -388,8 +395,9 @@ template<class PtrArraySetSet> struct PtrArraySetSet_Cleaner
388395
**********************************/
389396
template<class SetMap> void ClearSetMap(SetMap& v)
390397
{
391-
for(SetMap::iterator it = v.begin();
392-
it != v.end();
398+
for(SetMap::iterator it = v.begin(),
399+
end = v.end();
400+
it != end;
393401
++it)
394402
{
395403
it->second->clear();
@@ -413,8 +421,9 @@ template<class SetMap> struct SetMap_Cleaner
413421
**********************************/
414422
template<class PtrSetMap> void ClearPtrSetMap(PtrSetMap& v)
415423
{
416-
for(PtrSetMap::iterator it = v.begin();
417-
it != v.end();
424+
for(PtrSetMap::iterator it = v.begin(),
425+
end = v.end();
426+
it != end;
418427
++it)
419428
{
420429
ClearPtrSet(*(it->second));
@@ -438,8 +447,9 @@ template<class PtrSetMap> struct PtrSetMap_Cleaner
438447
**********************************/
439448
template<class PtrArraySetMap> void ClearPtrArraySetMap(PtrArraySetMap& v)
440449
{
441-
for(PtrArraySetMap::iterator it = v.begin();
442-
it != v.end();
450+
for(PtrArraySetMap::iterator it = v.begin(),
451+
end = v.end();
452+
it != end;
443453
++it)
444454
{
445455
ClearPtrArraySet(*(it->second));
@@ -463,8 +473,9 @@ v : map
463473
**********************************/
464474
template<class MapMap> void ClearMapMap(MapMap& v)
465475
{
466-
for(MapMap::iterator it = v.begin();
467-
it != v.end();
476+
for(MapMap::iterator it = v.begin(),
477+
end = v.end();
478+
it != end;
468479
++it)
469480
{
470481
it->second->clear();
@@ -488,8 +499,9 @@ template<class MapMap> struct MapMap_Cleaner
488499
**********************************/
489500
template<class PtrMapMap> void ClearPtrMapMap(PtrMapMap& v)
490501
{
491-
for(PtrMapMap::iterator it = v.begin();
492-
it != v.end();
502+
for(PtrMapMap::iterator it = v.begin(),
503+
end = v.end();
504+
it != end;
493505
++it)
494506
{
495507
ClearPtrMap(*(it->second));
@@ -513,8 +525,9 @@ template<class PtrMapMap> struct PtrMapMap_Cleaner
513525
**********************************/
514526
template<class PtrArrayMapMap> void ClearPtrArrayMapMap(PtrArrayMapMap& v)
515527
{
516-
for(PtrArrayMapMap::iterator it = v.begin();
517-
it != v.end();
528+
for(PtrArrayMapMap::iterator it = v.begin(),
529+
end = v.end();
530+
it != end;
518531
++it)
519532
{
520533
ClearPtrArrayMap(*(it->second));

Common/Src/bufferpool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ void CBufferPool::Clear()
497497
{
498498
CReentrantWriteLock locallock(m_csBufferMap);
499499

500-
for(TBufferPtrMapCI it = m_mpBuffer.begin(); it != m_mpBuffer.end(); ++it)
500+
for(TBufferPtrMapCI it = m_mpBuffer.begin(), end = m_mpBuffer.end(); it != end; ++it)
501501
TBuffer::Destruct(it->second);
502502

503503
m_mpBuffer.clear();
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
4 KB
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
1.5 KB
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
1 KB
Binary file not shown.
0 Bytes
Binary file not shown.
-512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
3.5 KB
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
1.5 KB
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
512 Bytes
Binary file not shown.
4.5 KB
Binary file not shown.
512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
512 Bytes
Binary file not shown.

HP-Socket/Demo/TestEcho/TestEcho.suo

512 Bytes
Binary file not shown.
512 Bytes
Binary file not shown.

HP-Socket/Src/TcpAgent.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -280,15 +280,15 @@ void CTcpAgent::DisconnectClientSocket()
280280
{
281281
CReentrantReadLock locallock(m_csClientSocket);
282282

283-
for(TSocketObjPtrMapI it = m_mpClientSocket.begin(); it != m_mpClientSocket.end(); ++it)
283+
for(TSocketObjPtrMapI it = m_mpClientSocket.begin(), end = m_mpClientSocket.end(); it != end; ++it)
284284
Disconnect(it->first);
285285
}
286286

287287
void CTcpAgent::ReleaseClientSocket()
288288
{
289289
CReentrantWriteLock locallock(m_csClientSocket);
290290

291-
for(TSocketObjPtrMapI it = m_mpClientSocket.begin(); it != m_mpClientSocket.end(); ++it)
291+
for(TSocketObjPtrMapI it = m_mpClientSocket.begin(), end = m_mpClientSocket.end(); it != end; ++it)
292292
{
293293
TSocketObj* pSocketObj = it->second;
294294

@@ -622,8 +622,10 @@ BOOL CTcpAgent::GetAllConnectionIDs(CONNID pIDs[], DWORD& dwCount)
622622

623623
if(pIDs != nullptr && dwSize <= dwCount)
624624
{
625-
TSocketObjPtrMapCI it = m_mpClientSocket.begin();
626-
for(int i = 0; it != m_mpClientSocket.end(); ++it, ++i)
625+
TSocketObjPtrMapCI it = m_mpClientSocket.begin();
626+
TSocketObjPtrMapCI end = m_mpClientSocket.end();
627+
628+
for(int i = 0; it != end; ++it, ++i)
627629
pIDs[i] = it->first;
628630

629631
isOK = TRUE;
@@ -688,14 +690,14 @@ BOOL CTcpAgent::DisconnectLongConnections(DWORD dwPeriod, BOOL bForce)
688690

689691
DWORD now = ::TimeGetTime();
690692

691-
for(TSocketObjPtrMapCI it = m_mpClientSocket.begin(); it != m_mpClientSocket.end(); ++it)
693+
for(TSocketObjPtrMapCI it = m_mpClientSocket.begin(), end = m_mpClientSocket.end(); it != end; ++it)
692694
{
693695
if(now - it->second->connTime >= dwPeriod)
694696
ls.push_back(it->first);
695697
}
696698
}
697699

698-
for(ulong_ptr_deque::const_iterator it = ls.begin(); it != ls.end(); ++it)
700+
for(ulong_ptr_deque::const_iterator it = ls.begin(), end = ls.end(); it != end; ++it)
699701
Disconnect(*it, bForce);
700702

701703
return ls.size() > 0;
@@ -713,14 +715,14 @@ BOOL CTcpAgent::DisconnectSilenceConnections(DWORD dwPeriod, BOOL bForce)
713715

714716
DWORD now = ::TimeGetTime();
715717

716-
for(TSocketObjPtrMapCI it = m_mpClientSocket.begin(); it != m_mpClientSocket.end(); ++it)
718+
for(TSocketObjPtrMapCI it = m_mpClientSocket.begin(), end = m_mpClientSocket.end(); it != end; ++it)
717719
{
718720
if(now - it->second->activeTime >= dwPeriod)
719721
ls.push_back(it->first);
720722
}
721723
}
722724

723-
for(ulong_ptr_deque::const_iterator it = ls.begin(); it != ls.end(); ++it)
725+
for(ulong_ptr_deque::const_iterator it = ls.begin(), end = ls.end(); it != end; ++it)
724726
Disconnect(*it, bForce);
725727

726728
return ls.size() > 0;

HP-Socket/Src/TcpServer.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -322,15 +322,15 @@ void CTcpServer::DisconnectClientSocket()
322322
{
323323
CReentrantReadLock locallock(m_csClientSocket);
324324

325-
for(TSocketObjPtrMapI it = m_mpClientSocket.begin(); it != m_mpClientSocket.end(); ++it)
325+
for(TSocketObjPtrMapI it = m_mpClientSocket.begin(), end = m_mpClientSocket.end(); it != end; ++it)
326326
Disconnect(it->first);
327327
}
328328

329329
void CTcpServer::ReleaseClientSocket()
330330
{
331331
CReentrantWriteLock locallock(m_csClientSocket);
332332

333-
for(TSocketObjPtrMapI it = m_mpClientSocket.begin(); it != m_mpClientSocket.end(); ++it)
333+
for(TSocketObjPtrMapI it = m_mpClientSocket.begin(), end = m_mpClientSocket.end(); it != end; ++it)
334334
{
335335
TSocketObj* pSocketObj = it->second;
336336

@@ -659,8 +659,10 @@ BOOL CTcpServer::GetAllConnectionIDs(CONNID pIDs[], DWORD& dwCount)
659659

660660
if(pIDs != nullptr && dwSize <= dwCount)
661661
{
662-
TSocketObjPtrMapCI it = m_mpClientSocket.begin();
663-
for(int i = 0; it != m_mpClientSocket.end(); ++it, ++i)
662+
TSocketObjPtrMapCI it = m_mpClientSocket.begin();
663+
TSocketObjPtrMapCI end = m_mpClientSocket.end();
664+
665+
for(int i = 0; it != end; ++it, ++i)
664666
pIDs[i] = it->first;
665667

666668
isOK = TRUE;
@@ -725,14 +727,14 @@ BOOL CTcpServer::DisconnectLongConnections(DWORD dwPeriod, BOOL bForce)
725727

726728
DWORD now = ::TimeGetTime();
727729

728-
for(TSocketObjPtrMapCI it = m_mpClientSocket.begin(); it != m_mpClientSocket.end(); ++it)
730+
for(TSocketObjPtrMapCI it = m_mpClientSocket.begin(), end = m_mpClientSocket.end(); it != end; ++it)
729731
{
730732
if(now - it->second->connTime >= dwPeriod)
731733
ls.push_back(it->first);
732734
}
733735
}
734736

735-
for(ulong_ptr_deque::const_iterator it = ls.begin(); it != ls.end(); ++it)
737+
for(ulong_ptr_deque::const_iterator it = ls.begin(), end = ls.end(); it != end; ++it)
736738
Disconnect(*it, bForce);
737739

738740
return ls.size() > 0;
@@ -750,14 +752,14 @@ BOOL CTcpServer::DisconnectSilenceConnections(DWORD dwPeriod, BOOL bForce)
750752

751753
DWORD now = ::TimeGetTime();
752754

753-
for(TSocketObjPtrMapCI it = m_mpClientSocket.begin(); it != m_mpClientSocket.end(); ++it)
755+
for(TSocketObjPtrMapCI it = m_mpClientSocket.begin(), end = m_mpClientSocket.end(); it != end; ++it)
754756
{
755757
if(now - it->second->activeTime >= dwPeriod)
756758
ls.push_back(it->first);
757759
}
758760
}
759761

760-
for(ulong_ptr_deque::const_iterator it = ls.begin(); it != ls.end(); ++it)
762+
for(ulong_ptr_deque::const_iterator it = ls.begin(), end = ls.end(); it != end; ++it)
761763
Disconnect(*it, bForce);
762764

763765
return ls.size() > 0;

HP-Socket/Src/UdpServer.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -299,15 +299,15 @@ void CUdpServer::DisconnectClientSocket()
299299
{
300300
CReentrantReadLock locallock(m_csClientSocket);
301301

302-
for(TUdpSocketObjPtrMapI it = m_mpClientSocket.begin(); it != m_mpClientSocket.end(); ++it)
302+
for(TUdpSocketObjPtrMapI it = m_mpClientSocket.begin(), end = m_mpClientSocket.end(); it != end; ++it)
303303
Disconnect(it->first);
304304
}
305305

306306
void CUdpServer::ReleaseClientSocket()
307307
{
308308
CReentrantWriteLock locallock(m_csClientSocket);
309309

310-
for(TUdpSocketObjPtrMapI it = m_mpClientSocket.begin(); it != m_mpClientSocket.end(); ++it)
310+
for(TUdpSocketObjPtrMapI it = m_mpClientSocket.begin(), end = m_mpClientSocket.end(); it != end; ++it)
311311
{
312312
TUdpSocketObj* pSocketObj = it->second;
313313
DeleteSocketObj(pSocketObj);
@@ -653,8 +653,10 @@ BOOL CUdpServer::GetAllConnectionIDs(CONNID pIDs[], DWORD& dwCount)
653653

654654
if(pIDs != nullptr && dwSize <= dwCount)
655655
{
656-
TUdpSocketObjPtrMapCI it = m_mpClientSocket.begin();
657-
for(int i = 0; it != m_mpClientSocket.end(); ++it, ++i)
656+
TUdpSocketObjPtrMapCI it = m_mpClientSocket.begin();
657+
TUdpSocketObjPtrMapCI end = m_mpClientSocket.end();
658+
659+
for(int i = 0; it != end; ++it, ++i)
658660
pIDs[i] = it->first;
659661

660662
isOK = TRUE;
@@ -714,14 +716,14 @@ BOOL CUdpServer::DisconnectLongConnections(DWORD dwPeriod, BOOL bForce)
714716

715717
DWORD now = ::TimeGetTime();
716718

717-
for(TUdpSocketObjPtrMapCI it = m_mpClientSocket.begin(); it != m_mpClientSocket.end(); ++it)
719+
for(TUdpSocketObjPtrMapCI it = m_mpClientSocket.begin(), end = m_mpClientSocket.end(); it != end; ++it)
718720
{
719721
if(now - it->second->connTime >= dwPeriod)
720722
ls.push_back(it->first);
721723
}
722724
}
723725

724-
for(ulong_ptr_deque::const_iterator it = ls.begin(); it != ls.end(); ++it)
726+
for(ulong_ptr_deque::const_iterator it = ls.begin(), end = ls.end(); it != end; ++it)
725727
Disconnect(*it, bForce);
726728

727729
return ls.size() > 0;
@@ -739,14 +741,14 @@ BOOL CUdpServer::DisconnectSilenceConnections(DWORD dwPeriod, BOOL bForce)
739741

740742
DWORD now = ::TimeGetTime();
741743

742-
for(TUdpSocketObjPtrMapCI it = m_mpClientSocket.begin(); it != m_mpClientSocket.end(); ++it)
744+
for(TUdpSocketObjPtrMapCI it = m_mpClientSocket.begin(), end = m_mpClientSocket.end(); it != end; ++it)
743745
{
744746
if(now - it->second->activeTime >= dwPeriod)
745747
ls.push_back(it->first);
746748
}
747749
}
748750

749-
for(ulong_ptr_deque::const_iterator it = ls.begin(); it != ls.end(); ++it)
751+
for(ulong_ptr_deque::const_iterator it = ls.begin(), end = ls.end(); it != end; ++it)
750752
Disconnect(*it, bForce);
751753

752754
return ls.size() > 0;
@@ -1424,7 +1426,7 @@ void CUdpServer::DetectConnections()
14241426
{
14251427
CReentrantReadLock locallock(m_csClientSocket);
14261428

1427-
for(TUdpSocketObjPtrMapCI it = m_mpClientSocket.begin(); it != m_mpClientSocket.end(); ++it)
1429+
for(TUdpSocketObjPtrMapCI it = m_mpClientSocket.begin(), end = m_mpClientSocket.end(); it != end; ++it)
14281430
{
14291431
if(it->second->detectFails >= m_dwDetectAttempts)
14301432
::PostIocpDisconnect(m_hCompletePort, it->first);

0 commit comments

Comments
 (0)