equal
deleted
inserted
replaced
101 __ASSERT_DEBUG(seekPos<KSeekIndexSize,Fault(EFatFileSeekIndexTooSmall)); |
101 __ASSERT_DEBUG(seekPos<KSeekIndexSize,Fault(EFatFileSeekIndexTooSmall)); |
102 __ASSERT_DEBUG(seekPos>=0,Fault(EFatFileSeekIndexTooSmall2)); |
102 __ASSERT_DEBUG(seekPos>=0,Fault(EFatFileSeekIndexTooSmall2)); |
103 iSeekIndex[seekPos] = aStoredCluster; |
103 iSeekIndex[seekPos] = aStoredCluster; |
104 } |
104 } |
105 |
105 |
106 TBool CFatFileCB::IsSeekBackwards(TUint aPos) |
|
107 // |
|
108 // Return true if aPos<currentPos |
|
109 // |
|
110 { |
|
111 |
|
112 TUint cluster=iCurrentPos.iCluster<<ClusterSizeLog2(); |
|
113 TInt offset=ClusterRelativePos(iCurrentPos.iPos); |
|
114 TUint currentPos=cluster+offset; |
|
115 return(aPos<currentPos); |
|
116 } |
|
117 |
|
118 void CFatFileCB::CheckPosL(TUint aPos) |
106 void CFatFileCB::CheckPosL(TUint aPos) |
119 // |
107 // |
120 // Check that the file is positioned correctly. |
108 // Check that the file is positioned correctly. |
121 // If aPos<currentPos attempt to guess the new position. |
109 // If aPos<currentPos attempt to guess the new position. |
122 // |
110 // |
124 __PRINT1(_L("CFatFileCB::CheckPosL(%d)"), aPos); |
112 __PRINT1(_L("CFatFileCB::CheckPosL(%d)"), aPos); |
125 if (aPos==iCurrentPos.iPos) |
113 if (aPos==iCurrentPos.iPos) |
126 return; |
114 return; |
127 __ASSERT_DEBUG(aPos <= FCB_FileSize(), Fault(EFatFilePosBeyondEnd)); |
115 __ASSERT_DEBUG(aPos <= FCB_FileSize(), Fault(EFatFilePosBeyondEnd)); |
128 |
116 |
129 if (FileSizeModified() && IsSeekBackwards(aPos)) |
|
130 FlushDataL(); |
|
131 |
|
132 TUint newRelCluster=aPos>>ClusterSizeLog2(); |
117 TUint newRelCluster=aPos>>ClusterSizeLog2(); |
133 if ( aPos && (aPos==(newRelCluster<<ClusterSizeLog2())) ) |
118 if ( aPos && (aPos==(newRelCluster<<ClusterSizeLog2())) ) |
134 newRelCluster--; |
119 newRelCluster--; |
135 TUint oldRelCluster=iCurrentPos.iPos>>ClusterSizeLog2(); |
120 TUint oldRelCluster=iCurrentPos.iPos>>ClusterSizeLog2(); |
136 |
121 |