[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdepim/indexlib
From:       Luís Pedro Coelho <luis () luispedro ! org>
Date:       2005-09-20 0:14:12
Message-ID: 1127175252.914175.26795.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 462102 by luis_pedro:

Calculate the correct number of bytes to memmove()
Verify indices


 M  +2 -1      stringarray.cpp  


--- branches/KDE/3.5/kdepim/indexlib/stringarray.cpp #462101:462102
@@ -69,11 +69,12 @@
 }
 
 void stringarray::erase( index_type idx ) {
+	assert( idx < size() );
 	char* target = const_cast<char*>( get_cstr( idx ) );
 	if ( idx != size() - 1 ) {
 		const char* next = get_cstr( idx + 1 );
 		unsigned delta = strlen( target ) + 1;
-		std::memmove( target, next, reinterpret_cast<const unsigned char*>( next ) - \
data_->rw_base( data_->size() ) ); +		std::memmove( target, next, data_->size() - \
indeces_[ idx + 1 ] );  for ( memvector<uint32_t>::iterator first = indeces_.begin() \
                + idx, past = indeces_.end(); first != past; ++first ) {
 			*first -= delta;
 		}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic