Tag: cws_src680_qiq User: fs Date: 2006/06/30 06:26:04 Modified: dba/dbaccess/source/core/api/RowSetBase.cxx dba/dbaccess/source/core/api/RowSetCache.cxx
Log: warning-free code File Changes: Directory: /dba/dbaccess/source/core/api/ ========================================= File [changed]: RowSetBase.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/RowSetBase.cxx?r1=1.86&r2=1.86.2.1 Delta lines: +24 -19 --------------------- --- RowSetBase.cxx 20 Jun 2006 02:36:00 -0000 1.86 +++ RowSetBase.cxx 30 Jun 2006 13:26:01 -0000 1.86.2.1 @@ -4,9 +4,9 @@ * * $RCSfile: RowSetBase.cxx,v $ * - * $Revision: 1.86 $ + * $Revision: 1.86.2.1 $ * - * last change: $Author: hr $ $Date: 2006/06/20 02:36:00 $ + * last change: $Author: fs $ $Date: 2006/06/30 13:26:01 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -468,8 +468,8 @@ checkCache(); - sal_Bool bRet; - if(bRet = notifyAllListenersCursorBeforeMove(aGuard)) + sal_Bool bRet( notifyAllListenersCursorBeforeMove( aGuard ) ); + if ( bRet ) { // check if we are inserting a row sal_Bool bWasNew = m_pCache->m_bNew || rowDeleted(); @@ -510,8 +510,8 @@ checkPositioningAllowed(); - sal_Bool bRet; - if(bRet = notifyAllListenersCursorBeforeMove(aGuard)) + sal_Bool bRet( notifyAllListenersCursorBeforeMove( aGuard ) ); + if ( bRet ) { // check if we are inserting a row sal_Bool bWasNew = m_pCache->m_bNew || rowDeleted(); @@ -613,8 +613,8 @@ ::osl::ResettableMutexGuard aGuard( *m_pMutex ); checkCache(); - sal_Bool bRet; - if(bRet = notifyAllListenersCursorBeforeMove(aGuard)) + sal_Bool bRet( notifyAllListenersCursorBeforeMove( aGuard ) ); + if ( bRet ) { // check if we are inserting a row sal_Bool bWasNew = m_pCache->m_bNew || rowDeleted(); @@ -819,8 +819,8 @@ ::osl::ResettableMutexGuard aGuard( *m_pMutex ); checkPositioningAllowed(); - sal_Bool bRet; - if(bRet = notifyAllListenersCursorBeforeMove(aGuard) ) + sal_Bool bRet( notifyAllListenersCursorBeforeMove( aGuard ) ); + if( bRet ) { // check if we are inserting a row sal_Bool bWasNew = m_pCache->m_bNew || rowDeleted(); @@ -913,8 +913,9 @@ ::osl::ResettableMutexGuard aGuard( *m_pMutex ); checkPositioningAllowed(); - sal_Bool bRet = row > 0; - if ( bRet && (bRet = notifyAllListenersCursorBeforeMove(aGuard)) ) + sal_Bool bRet = ( row > 0 ) + && notifyAllListenersCursorBeforeMove( aGuard ); + if ( bRet ) { // check if we are inserting a row sal_Bool bWasNew = m_pCache->m_bNew || rowDeleted(); @@ -962,10 +963,13 @@ checkPositioningAllowed(); - sal_Bool bRet =!((m_bAfterLast && rows > 0) || (m_bBeforeFirst && rows < 0)); // we are already behind the last row or before the first + sal_Bool bRet = + ( ( !m_bAfterLast || rows <= 0 ) + && ( !m_bBeforeFirst || rows >= 0 ) + && notifyAllListenersCursorBeforeMove( aGuard ) + ); - - if(bRet && (bRet = notifyAllListenersCursorBeforeMove(aGuard))) + if ( bRet ) { // check if we are inserting a row sal_Bool bWasNew = m_pCache->m_bNew || rowDeleted(); @@ -1010,9 +1014,10 @@ checkPositioningAllowed(); - sal_Bool bRet = !m_bBeforeFirst; + sal_Bool bRet = !m_bBeforeFirst + && notifyAllListenersCursorBeforeMove(aGuard); - if(bRet && (bRet = notifyAllListenersCursorBeforeMove(aGuard))) + if ( bRet ) { // check if we are inserting a row sal_Bool bWasNew = m_pCache->m_bNew || rowDeleted(); @@ -1209,7 +1214,7 @@ DBG_TRACE2("DBACCESS ORowSetBase::firePropertyChange() Clone = %i ID = %i\n",m_bClone,osl_getThreadIdentifier(NULL)); OSL_ENSURE(m_pColumns,"Columns can not be NULL here!"); #if OSL_DEBUG_LEVEL > 1 - sal_Bool bNull = m_aCurrentRow.isNull(); + sal_Bool bNull = m_aCurrentRow.isNull(); (void)bNull; ORowSetMatrix::iterator atest = m_aCurrentRow; #endif sal_Int32 i=0; File [changed]: RowSetCache.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/RowSetCache.cxx?r1=1.84.50.2&r2=1.84.50.3 Delta lines: +26 -20 --------------------- --- RowSetCache.cxx 27 Jun 2006 11:55:04 -0000 1.84.50.2 +++ RowSetCache.cxx 30 Jun 2006 13:26:01 -0000 1.84.50.3 @@ -4,9 +4,9 @@ * * $RCSfile: RowSetCache.cxx,v $ * - * $Revision: 1.84.50.2 $ + * $Revision: 1.84.50.3 $ * - * last change: $Author: fs $ $Date: 2006/06/27 11:55:04 $ + * last change: $Author: fs $ $Date: 2006/06/30 13:26:01 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -418,7 +418,7 @@ if ( !aCacheIter->second.pRowSet->isInsertRow() && aCacheIter->second.aIterator != m_pMatrix->end() && !m_bModified ) { - sal_Int16 nDist = (aCacheIter->second.aIterator - m_pMatrix->begin()); + ptrdiff_t nDist = (aCacheIter->second.aIterator - m_pMatrix->begin()); aPositions.push_back(nDist); aCacheIterToChange[aCacheIter->first] = sal_True; } @@ -513,8 +513,8 @@ sal_Bool ORowSetCache::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) { - sal_Bool bRet; - if(bRet = moveToBookmark(bookmark)) + sal_Bool bRet( moveToBookmark( bookmark ) ); + if ( bRet ) { m_nPosition = m_pCacheSet->getRow() + rows; absolute(m_nPosition); @@ -806,15 +806,15 @@ ::std::rotate(m_pMatrix->begin(),aEnd,m_pMatrix->end()); // now correct the iterator in our iterator vector // rotateCacheIterator(aEnd-m_pMatrix->begin()); //can't be used because they decrement and here we need to increment - sal_Int16 nNewDist = aEnd - m_pMatrix->begin(); - sal_Int16 nOffSet = m_pMatrix->end() - aEnd; + ptrdiff_t nNewDist = aEnd - m_pMatrix->begin(); + ptrdiff_t nOffSet = m_pMatrix->end() - aEnd; ORowSetCacheMap::iterator aCacheIter = m_aCacheIterators.begin(); for(;aCacheIter != m_aCacheIterators.end();++aCacheIter) { if ( !aCacheIter->second.pRowSet->isInsertRow() && aCacheIter->second.aIterator != m_pMatrix->end() && !m_bModified ) { - sal_Int16 nDist = (aCacheIter->second.aIterator - m_pMatrix->begin()); + ptrdiff_t nDist = (aCacheIter->second.aIterator - m_pMatrix->begin()); if ( nDist >= nNewDist ) { aCacheIter->second.aIterator = m_pMatrix->end(); @@ -854,7 +854,8 @@ ORowSetMatrix::iterator aIter = m_pMatrix->begin(); for(sal_Int32 i=0;i<m_nFetchSize;++i,++aIter) { - if(bCheck = m_pCacheSet->next()) + bCheck = m_pCacheSet->next(); + if ( bCheck ) { if(!aIter->isValid()) *aIter = new ORowSetValueVector(m_xMetaData->getColumnCount()); @@ -877,16 +878,20 @@ m_aMatrixIter = calcPosition(); if(!m_aMatrixIter->isValid()) { - sal_Bool bOk; - if(bOk = m_pCacheSet->absolute(m_nPosition)) + sal_Bool bOk( m_pCacheSet->absolute( m_nPosition ) ); + if ( bOk ) { *m_aMatrixIter = new ORowSetValueVector(m_xMetaData->getColumnCount()); m_pCacheSet->fillValueRow(*m_aMatrixIter,m_nPosition); // we have to read one row forward to enshure that we know when we are on last row // but only when we don't know it already - if(!m_bRowCountFinal && (bOk = m_pCacheSet->absolute(m_nPosition+1))) + if ( !m_bRowCountFinal ) + { + bOk = m_pCacheSet->absolute( m_nPosition + 1 ); + if ( bOk ) m_nRowCount = std::max(sal_Int32(m_nPosition+1),m_nRowCount); } + } if(!bOk) { if(!m_bRowCountFinal) @@ -923,7 +928,7 @@ { // rotate the end to the front ::std::rotate(m_pMatrix->begin(),aIter,m_pMatrix->end()); // now correct the iterator in our iterator vector - rotateCacheIterator(aIter - m_pMatrix->begin()); + rotateCacheIterator( (sal_Int16)( aIter - m_pMatrix->begin() ) ); m_nStartPos = nNewStartPos - 1; // must be -1 // now I can say how many rows we have if(!bOk) @@ -942,7 +947,7 @@ // m_nStartPos = (aIter - m_pMatrix->begin()); ::std::rotate(m_pMatrix->begin(),aIter,m_pMatrix->end()); // now correct the iterator in our iterator vector - rotateCacheIterator(aIter - m_pMatrix->begin()); + rotateCacheIterator( (sal_Int16)( aIter - m_pMatrix->begin() ) ); if ( !m_bRowCountFinal ) { @@ -965,7 +970,8 @@ bCheck = m_pCacheSet->absolute(m_nStartPos); for(; !aIter->isValid() && bCheck;++aIter) { - if(bCheck = m_pCacheSet->next()) // resultset stands on right position + bCheck = m_pCacheSet->next(); + if ( bCheck ) // resultset stands on right position { *aIter = new ORowSetValueVector(m_xMetaData->getColumnCount()); m_pCacheSet->fillValueRow(*aIter,++nPos); @@ -1194,10 +1200,10 @@ if ( !m_bNew || !m_aInsertRow->isValid() ) throw SQLException(DBACORE_RESSTRING(RID_STR_NO_MOVETOINSERTROW_CALLED),NULL,SQLSTATE_GENERAL,1000,Any() ); - sal_Bool bRet; m_pCacheSet->insertRow(*m_aInsertRow,m_aUpdateTable); - if ( bRet = rowInserted() ) + sal_Bool bRet( rowInserted() ); + if ( bRet ) { ++m_nRowCount; Any aBookmark = (*(*m_aInsertRow))[0].makeAny(); @@ -1341,7 +1347,7 @@ if ( !aCacheIter->second.pRowSet->isInsertRow() && aCacheIter->second.aIterator != m_pMatrix->end() && !m_bModified ) { - sal_Int16 nDist = (aCacheIter->second.aIterator - m_pMatrix->begin()); + ptrdiff_t nDist = (aCacheIter->second.aIterator - m_pMatrix->begin()); if(nDist < _nDist) { aCacheIter->second.aIterator = m_pMatrix->end(); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
