Skip to content

Commit

Permalink
- core & mt : some code cleanups
Browse files Browse the repository at this point in the history
- FilePusher: fix end of collection iterator issue
  • Loading branch information
LiberatorUSA committed Oct 4, 2024
1 parent 6411961 commit be7e0b7
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion platform/gucefCORE/src/dvcppstringutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ RelativePath( const CString& relpath ,
if ( upDirIdx > 0 )
{
// Split the relative path into segments
CString::StringVector relSegments( relpath.ParseElements( GUCEF_DIRSEPCHAR, true ) );
CString::StringVector relSegments( resultStr.ParseElements( GUCEF_DIRSEPCHAR, true ) );
CString::StringVector resolvedSegments;

// Process the relative path segments
Expand Down
4 changes: 2 additions & 2 deletions platform/gucefCORE/src/gucefCORE_CLoggingTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ CLoggingTask::OnTaskCycle( CICloneable* taskdata )
TMailVector::iterator i = m_mailList.begin();
while ( i != m_mailList.end() )
{
TLoggingMailBox::TMailElement& mailEntry = (*i);
TLoggingMailBox::Mail& mailEntry = (*i);
loggingMail = static_cast< CLoggingMail* >( mailEntry.data );

switch ( mailEntry.eventid )
Expand Down Expand Up @@ -338,7 +338,7 @@ CLoggingTask::OnTaskEnded( CICloneable* taskdata ,
bool wasForced )
{GUCEF_TRACE;

TLoggingMailBox::TMailElement* entry = GUCEF_NULL;
TLoggingMailBox::Mail* entry = GUCEF_NULL;
TMailVector::iterator i( m_mailList.begin() );
while ( i != m_mailList.end() )
{
Expand Down
2 changes: 1 addition & 1 deletion platform/gucefCORE/src/gucefCORE_CThreadPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ CThreadPool::RemoveConsumer( const UInt32 taskID )
TTaskMailbox::iterator i = m_taskQueue.begin( writer );
while ( i != m_taskQueue.end() )
{
TTaskMailbox::TMailElement& mailElement = (*i);
TTaskMailbox::Mail& mailElement = (*i);
CTaskQueueItem* queueItem = static_cast< CTaskQueueItem* >( mailElement.data );

CTaskConsumerPtr& consumer = queueItem->GetTaskConsumer();
Expand Down
28 changes: 17 additions & 11 deletions platform/gucefMT/include/gucefMT_CTMailBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,24 @@ class CTMailBox : public virtual MT::CILockable
{
public:

struct SMailElement
class Mail
{
public:

T eventid;
CICloneable* data;

Mail( void )
: eventid()
, data( GUCEF_NULL )
{GUCEF_TRACE;}
};
typedef struct SMailElement TMailElement;

typedef T value_type;
typedef std::vector< TMailElement, gucef_allocator< TMailElement > > TMailVector;
typedef std::deque< TMailElement, gucef_allocator< TMailElement > > TMailQueue;
typedef typename std::deque< TMailElement >::iterator iterator;
typedef typename std::deque< TMailElement >::const_iterator const_iterator;
typedef T value_type;
typedef std::vector< Mail, gucef_allocator< Mail > > TMailVector;
typedef std::deque< Mail, gucef_allocator< Mail > > TMailQueue;
typedef typename std::deque< Mail >::iterator iterator;
typedef typename std::deque< Mail >::const_iterator const_iterator;

CTMailBox( void );

Expand Down Expand Up @@ -256,7 +262,7 @@ CTMailBox< T >::AddMail( const T& eventid ,

if ( m_acceptsNewMail )
{
TMailElement entry;
Mail entry;
entry.eventid = eventid;
if ( GUCEF_NULL != data )
{
Expand Down Expand Up @@ -296,7 +302,7 @@ CTMailBox< T >::GetMail( T& eventid ,

if ( !m_mailQueue.empty() )
{
TMailElement& entry = m_mailQueue.front();
Mail& entry = m_mailQueue.front();
eventid = entry.eventid;

if ( GUCEF_NULL != data )
Expand Down Expand Up @@ -328,7 +334,7 @@ CTMailBox< T >::PeekMail( CScopeMutex& lock ,

if ( !m_mailQueue.empty() )
{
TMailElement& entry = m_mailQueue.front();
Mail& entry = m_mailQueue.front();
eventid = entry.eventid;
if ( GUCEF_NULL != data )
*data = entry.data;
Expand All @@ -353,7 +359,7 @@ CTMailBox< T >::PopMail( CScopeMutex& lock )

if ( !m_mailQueue.empty() )
{
TMailElement& entry = m_mailQueue.front();
Mail& entry = m_mailQueue.front();
GUCEF_DELETE entry.data;
m_mailQueue.pop_front();
return true;
Expand Down
2 changes: 1 addition & 1 deletion tests/gucefCORE_TestApp/src/TestDateTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ static const std::vector< StringParseTestCase > stringParseTestCases = {
{ testDateTimeString24, testDateTimeString24Result, testDateTimeString24TzOffsetResult },
{ testDateTimeString25, testDateTimeString25Result, testDateTimeString25TzOffsetResult },
{ testDateTimeString26, testDateTimeString26Result, testDateTimeString26TzOffsetResult },
{ testDateTimeString27, testDateTimeString26Result, testDateTimeString26TzOffsetResult },
{ testDateTimeString27, testDateTimeString27Result, testDateTimeString27TzOffsetResult },
{ testDateTimeString28, testDateTimeString28Result, testDateTimeString28TzOffsetResult }

};
Expand Down
2 changes: 2 additions & 0 deletions tools/FilePusher/src/FilePusher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1824,6 +1824,7 @@ FilePushDestination::OnFilePushTimerCycle( CORE::CNotifier* notifier ,
return;
}
}
continue;
}
if ( 0 == m_settings.filePushDestinationUri.HasSubstr( "vfs://", true ) )
{
Expand All @@ -1835,6 +1836,7 @@ FilePushDestination::OnFilePushTimerCycle( CORE::CNotifier* notifier ,
m_pushTimer.RequestImmediateTrigger();
return;
}
continue;
}
else
{
Expand Down

0 comments on commit be7e0b7

Please sign in to comment.