OpTimeWithHash BackgroundSync::_readLastAppliedOpTimeWithHash(OperationContext* opCtx) { BSONObj oplogEntry; try { bool success = writeConflictRetry( opCtx, "readLastAppliedHash", NamespaceString::kRsOplogNamespace.ns(), [&] { Lock::DBLock lk(opCtx, "local", MODE_X); return Helpers::getLast( opCtx, NamespaceString::kRsOplogNamespace.ns().c_str(), oplogEntry); }); if (!success) { // This can happen when we are to do an initial sync. lastHash will be set // after the initial sync is complete. return OpTimeWithHash(0); } } catch (const DBException& ex) { severe() << "Problem reading " << NamespaceString::kRsOplogNamespace.ns() << ": " << redact(ex); fassertFailed(18904); } long long hash; auto status = bsonExtractIntegerField(oplogEntry, kHashFieldName, &hash); if (!status.isOK()) { severe() << "Most recent entry in " << NamespaceString::kRsOplogNamespace.ns() << " is missing or has invalid \"" << kHashFieldName << "\" field. Oplog entry: " << redact(oplogEntry) << ": " << redact(status); fassertFailed(18902); } OplogEntry parsedEntry(oplogEntry); return OpTimeWithHash(hash, parsedEntry.getOpTime()); }
// ----------------------------------------------------------------------------- // CAknFileSelectionModel::MdcaPoint // // // ----------------------------------------------------------------------------- // TPtrC CAknFileSelectionModel::MdcaPoint( TInt aIndex ) const { TEntry entry = iEntryArray->At( aIndex ); // reference TParsePtrC parsedEntry( entry.iName ); TPtrC fileName( parsedEntry.NameAndExt() ); TInt entryType( iImageIndexArray[ aIndex ] ); TPtr itemWithImageIndex = iItemWithImageIndex->Des(); switch( entryType ) { case EThisFolderIcon: { if ( iDirectoryLevel == 0 ) { // Root folder fileName.Set( iRootFolderText->Des() ); } else { // Not the root folder iLocalizer->SetFullPath( iCurrentPath.DriveAndPath() ); if ( iLocalizer->IsLocalized() ) // Localized? { // Folder name is localized fileName.Set( iLocalizer->LocalizedName() ); } } break; } case EFolderIcon: // fall through case ESubFolderIcon: case EFolderEmptyIcon: { itemWithImageIndex = iCurrentPath.DriveAndPath(); itemWithImageIndex.Append( entry.iName ); // ignore error: AknCFDUtility::AddTrailingBackslash( itemWithImageIndex ); iLocalizer->SetFullPath( itemWithImageIndex ); if( iLocalizer->IsLocalized() ) { fileName.Set( iLocalizer->LocalizedName() ); } break; } default: // EFileIcon { break; } } _LIT( KImageHeader, "%d\t" ); itemWithImageIndex.Format( KImageHeader, entryType ); itemWithImageIndex.Append( fileName ); return itemWithImageIndex; }
TPtrC CAknFileSelectionModel::GetLocalizedName(const TDesC& aFileName) { TParsePtrC parsedEntry( aFileName ); TPtrC fileName( parsedEntry.NameAndExt() ); TPtr itemWithImageIndex = iItemWithImageIndex->Des(); itemWithImageIndex = iCurrentPath.DriveAndPath(); itemWithImageIndex.Append( aFileName); // ignore error: AknCFDUtility::AddTrailingBackslash( itemWithImageIndex ); iLocalizer->SetFullPath( itemWithImageIndex ); if( iLocalizer->IsLocalized() ) { fileName.Set( iLocalizer->LocalizedName() ); } return fileName; }