iMaxElements is not required for function AddStringFiFoWithCompare
This commit is contained in:
parent
4bffd4edcd
commit
b83f14a2eb
|
@ -853,8 +853,7 @@ void CLlconClientDlg::ConnectDisconnect ( const bool bDoStart,
|
||||||
{
|
{
|
||||||
// store new address at the top of the list, if the list was already
|
// store new address at the top of the list, if the list was already
|
||||||
// full, the last element is thrown out
|
// full, the last element is thrown out
|
||||||
pClient->vstrIPAddress.AddStringFiFoWithCompare ( strSelectedAddress,
|
pClient->vstrIPAddress.AddStringFiFoWithCompare ( strSelectedAddress );
|
||||||
MAX_NUM_SERVER_ADDR_ITEMS );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// everything was ok with the connection dialog, set flag
|
// everything was ok with the connection dialog, set flag
|
||||||
|
|
12
src/util.h
12
src/util.h
|
@ -112,8 +112,7 @@ public:
|
||||||
void Enlarge ( const int iAddedSize );
|
void Enlarge ( const int iAddedSize );
|
||||||
void Add ( const TData& tI ) { Enlarge ( 1 ); pData[iVectorSize - 1] = tI; }
|
void Add ( const TData& tI ) { Enlarge ( 1 ); pData[iVectorSize - 1] = tI; }
|
||||||
|
|
||||||
void AddStringFiFoWithCompare ( const QString strNewValue,
|
void AddStringFiFoWithCompare ( const QString strNewValue );
|
||||||
const int iMaxElements );
|
|
||||||
|
|
||||||
inline int Size() const { return iVectorSize; }
|
inline int Size() const { return iVectorSize; }
|
||||||
|
|
||||||
|
@ -207,10 +206,9 @@ template<class TData> void CVector<TData>::Reset ( const TData tResetVal )
|
||||||
}
|
}
|
||||||
|
|
||||||
// note: this is only supported for string vectors
|
// note: this is only supported for string vectors
|
||||||
template<class TData> void CVector<TData>::AddStringFiFoWithCompare ( const QString strNewValue,
|
template<class TData> void CVector<TData>::AddStringFiFoWithCompare ( const QString strNewValue )
|
||||||
const int iMaxElements )
|
|
||||||
{
|
{
|
||||||
CVector<QString> vstrTempList ( iMaxElements, "" );
|
CVector<QString> vstrTempList ( iVectorSize, "" );
|
||||||
|
|
||||||
// store the new element in the current storage list at
|
// store the new element in the current storage list at
|
||||||
// the top, make sure we do not have more than allowed stored
|
// the top, make sure we do not have more than allowed stored
|
||||||
|
@ -218,12 +216,12 @@ template<class TData> void CVector<TData>::AddStringFiFoWithCompare ( const QStr
|
||||||
vstrTempList[0] = strNewValue;
|
vstrTempList[0] = strNewValue;
|
||||||
int iTempListCnt = 1;
|
int iTempListCnt = 1;
|
||||||
|
|
||||||
for ( int iIdx = 0; iIdx < iMaxElements; iIdx++ )
|
for ( int iIdx = 0; iIdx < iVectorSize; iIdx++ )
|
||||||
{
|
{
|
||||||
// only add old element if it is not the same as the
|
// only add old element if it is not the same as the
|
||||||
// selected one
|
// selected one
|
||||||
if ( ( pData[iIdx].compare ( strNewValue ) ) &&
|
if ( ( pData[iIdx].compare ( strNewValue ) ) &&
|
||||||
( iTempListCnt < iMaxElements ) )
|
( iTempListCnt < iVectorSize ) )
|
||||||
{
|
{
|
||||||
vstrTempList[iTempListCnt] = pData[iIdx];
|
vstrTempList[iTempListCnt] = pData[iIdx];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user