equal
deleted
inserted
replaced
394 TUint32 CFat16FixedCache::ReadEntryL(TUint32 aIndex) |
394 TUint32 CFat16FixedCache::ReadEntryL(TUint32 aIndex) |
395 { |
395 { |
396 //__PRINT1(_L("#-CFat16FixedCache::ReadEntryL() FAT idx:%d"), aIndex); |
396 //__PRINT1(_L("#-CFat16FixedCache::ReadEntryL() FAT idx:%d"), aIndex); |
397 ASSERT(aIndex >= KFatFirstSearchCluster && aIndex < (FatSize() >> KFat16EntrySzLog2)); |
397 ASSERT(aIndex >= KFatFirstSearchCluster && aIndex < (FatSize() >> KFat16EntrySzLog2)); |
398 |
398 |
399 //-- calculate page index in the array |
399 //-- calculate page index in the array. Theoretically, aIndex can't be wrong because it is checked by the caller; |
400 const TInt pgIdx = aIndex >> (PageSizeLog2()-KFat16EntrySzLog2); |
400 //-- but in some strange situations (malformed volume ?) aIndex might get bigger than number of usable clusters. |
|
401 const TUint pgIdx = aIndex >> (PageSizeLog2()-KFat16EntrySzLog2); |
|
402 |
|
403 if(pgIdx >= (TUint)iPages.Count()) |
|
404 { |
|
405 __PRINT1(_L("#-CFat16FixedCache::ReadEntryL() FAT idx:%d #1"), aIndex); |
|
406 ASSERT(0); |
|
407 User::Leave(KErrCorrupt); |
|
408 } |
|
409 |
401 CFat16FixedCachePage *pPage = iPages[pgIdx]; |
410 CFat16FixedCachePage *pPage = iPages[pgIdx]; |
402 |
411 |
403 TUint32 entry = KMaxTUint; |
412 TUint32 entry = KMaxTUint; |
404 |
413 |
405 if(!pPage) |
414 if(!pPage) |
434 |
443 |
435 ASSERT(aIndex >= KFatFirstSearchCluster && aIndex < (FatSize() >> KFat16EntrySzLog2)); |
444 ASSERT(aIndex >= KFatFirstSearchCluster && aIndex < (FatSize() >> KFat16EntrySzLog2)); |
436 |
445 |
437 SetDirty(ETrue); |
446 SetDirty(ETrue); |
438 |
447 |
439 //-- calculate page index in the array |
448 //-- calculate page index in the array. Theoretically, aIndex can't be wrong because it is checked by the caller; |
440 const TInt pgIdx = aIndex >> (PageSizeLog2()-KFat16EntrySzLog2); |
449 //-- but in some strange situations (malformed volume ?) aIndex might get bigger than number of usable clusters. |
|
450 const TUint pgIdx = aIndex >> (PageSizeLog2()-KFat16EntrySzLog2); |
|
451 |
|
452 if(pgIdx >= (TUint)iPages.Count()) |
|
453 { |
|
454 __PRINT2(_L("#-CFat16FixedCache::WriteEntryL() FAT idx:%d, val:%d #1"), aIndex, aEntry); |
|
455 ASSERT(0); |
|
456 User::Leave(KErrCorrupt); |
|
457 } |
|
458 |
441 CFat16FixedCachePage *pPage = iPages[pgIdx]; |
459 CFat16FixedCachePage *pPage = iPages[pgIdx]; |
442 |
460 |
443 if(!pPage) |
461 if(!pPage) |
444 {//-- page at this position isn't allocated yet |
462 {//-- page at this position isn't allocated yet |
445 pPage = CFat16FixedCachePage::NewL(*this); |
463 pPage = CFat16FixedCachePage::NewL(*this); |