MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / Util_ProDOS_IsFileBlockSparse

Function Util_ProDOS_IsFileBlockSparse

source/ProDOS_Utils.cpp:141–157  ·  view source on GitHub ↗

See: https://prodos8.com/docs/technote/30/ 2.2.3 Sparse Files https://prodos8.com/docs/techref/file-use/ B.3.6 - Sparse Files https://prodos8.com/docs/techref/file-organization/ ===========================================================================

Source from the content-addressed store, hash-verified

139 // https://prodos8.com/docs/techref/file-organization/
140 //===========================================================================
141 bool Util_ProDOS_IsFileBlockSparse( int nOffset, const uint8_t* pFileData, const size_t nFileSize )
142 {
143 if ((size_t)nOffset >= nFileSize)
144 return false;
145
146 const int nEnd = (nOffset + PRODOS_BLOCK_SIZE ) > nFileSize
147 ? nOffset + (nFileSize % PRODOS_BLOCK_SIZE)
148 : nOffset + PRODOS_BLOCK_SIZE;
149 for (int iOffset = nOffset ; iOffset < nEnd; iOffset++ )
150 {
151 if (pFileData[ iOffset ])
152 {
153 return false;
154 }
155 }
156 return true;
157 }
158
159 // Swizzles sectors in ProDOS order to DOS33 order in-place
160 //===========================================================================

Callers 1

Util_ProDOS_AddFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected