equal
deleted
inserted
replaced
327 if ( item ) |
327 if ( item ) |
328 { |
328 { |
329 // the original item has been changed |
329 // the original item has been changed |
330 item->SetInvalid(); |
330 item->SetInvalid(); |
331 } |
331 } |
332 |
|
333 CleanupStack::Pop( name );//ownership of name is transferred in the call to DoInsertL |
|
334 |
332 |
335 // add new item for this ID |
333 CleanupStack::Pop( name );//ownership of name is transferred in the call to DoInsertL |
|
334 |
|
335 // add new item for this ID |
336 // here comparison must be done using collation |
336 // here comparison must be done using collation |
337 CIndexItem* newItem = DoInsertL( id, name ); // takes onwership of name |
337 CIndexItem* newItem = DoInsertL( id, name ); // takes onwership of name |
338 newItem->SetValid(); |
338 newItem->SetValid(); |
339 |
339 |
340 TLinearOrder<CIndexItem> order( CIndexItem::CompareById ); |
340 TLinearOrder<CIndexItem> order( CIndexItem::CompareById ); |
440 //-------------------------------------------------------------------- |
440 //-------------------------------------------------------------------- |
441 // |
441 // |
442 void CPosLmNameIndex::InsertL( TPosLmItemId aLmid, const TDesC& aName ) |
442 void CPosLmNameIndex::InsertL( TPosLmItemId aLmid, const TDesC& aName ) |
443 { |
443 { |
444 HBufC* name = aName.AllocLC(); |
444 HBufC* name = aName.AllocLC(); |
445 CleanupStack::Pop( name );//ownership of name is transferred in the call to UpdateL/InsertL |
445 CleanupStack::Pop( name ); |
446 InsertL( aLmid, name ); |
446 InsertL( aLmid, name ); |
447 } |
447 } |
448 |
448 |
449 //-------------------------------------------------------------------- |
449 //-------------------------------------------------------------------- |
450 //-------------------------------------------------------------------- |
450 //-------------------------------------------------------------------- |
459 //-------------------------------------------------------------------- |
459 //-------------------------------------------------------------------- |
460 //-------------------------------------------------------------------- |
460 //-------------------------------------------------------------------- |
461 // |
461 // |
462 CPosLmNameIndex::CIndexItem* CPosLmNameIndex::DoInsertL( TPosLmItemId aLmid, HBufC* aName ) |
462 CPosLmNameIndex::CIndexItem* CPosLmNameIndex::DoInsertL( TPosLmItemId aLmid, HBufC* aName ) |
463 { |
463 { |
464 CleanupStack::PushL( aName );//ownership of aName is transferred to this class |
464 CleanupStack::PushL( aName );//ownership of aName is transferred to this class |
465 if ( Find( aLmid ) >= 0 ) // finds valid item |
465 if ( Find( aLmid ) >= 0 ) // finds valid item |
466 { |
466 { |
467 User::Leave( KErrAlreadyExists ); // duplicate ID found |
467 User::Leave( KErrAlreadyExists ); // duplicate ID found |
468 } |
468 } |
469 |
469 |
470 CIndexItem* landmark = new (ELeave) CIndexItem( aLmid, aName ); // takes ownership of aName |
470 CIndexItem* landmark = new (ELeave) CIndexItem( aLmid, aName ); // takes ownership of aName |
471 |
471 CleanupStack::Pop( aName ); |
472 CleanupStack::Pop( aName ); |
|
473 CleanupStack::PushL( landmark ); |
472 CleanupStack::PushL( landmark ); |
474 |
473 |
475 TLmIndexNameKey key; |
474 TLmIndexNameKey key; |
476 iArray->InsertIsqAllowDuplicatesL( landmark, key ); |
475 iArray->InsertIsqAllowDuplicatesL( landmark, key ); |
477 |
476 |
494 { |
493 { |
495 //Ownership of aName is transferred in this call |
494 //Ownership of aName is transferred in this call |
496 CleanupStack::PushL( aName ); |
495 CleanupStack::PushL( aName ); |
497 CIndexItem* landmark = new (ELeave) CIndexItem( aLmid, aName ); |
496 CIndexItem* landmark = new (ELeave) CIndexItem( aLmid, aName ); |
498 CleanupStack::Pop( aName ); |
497 CleanupStack::Pop( aName ); |
499 |
498 |
500 CleanupStack::PushL( landmark ); |
499 CleanupStack::PushL( landmark ); |
501 AppendL( landmark ); |
500 AppendL( landmark ); |
502 CleanupStack::Pop( landmark ); |
501 CleanupStack::Pop( landmark ); |
503 } |
502 } |
504 |
503 |
505 //-------------------------------------------------------------------- |
504 //-------------------------------------------------------------------- |
549 //-------------------------------------------------------------------- |
548 //-------------------------------------------------------------------- |
550 // |
549 // |
551 void CPosLmNameIndex::UpdateL( TPosLmItemId aId, const TDesC& aName ) |
550 void CPosLmNameIndex::UpdateL( TPosLmItemId aId, const TDesC& aName ) |
552 { |
551 { |
553 HBufC* name = aName.AllocLC(); |
552 HBufC* name = aName.AllocLC(); |
554 CleanupStack::Pop( name );//ownership of name is transferred in the call to UpdateL |
553 CleanupStack::Pop( name );//ownership of name is transferred in the call to UpdateL |
555 //coverity[freed_arg : FALSE] |
554 //coverity[freed_arg : FALSE] |
556 UpdateL( aId, name ); |
555 UpdateL( aId, name ); |
557 //coverity[pass_freed_arg : FALSE] |
556 //coverity[pass_freed_arg : FALSE] |
558 } |
557 } |
559 |
558 |