MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / adfFileRealSize

Function adfFileRealSize

dep/adflib/src/adf_file.c:173–196  ·  view source on GitHub ↗

* adfFileRealSize * * Compute and return real number of block used by one file * Compute number of datablocks and file extension blocks * */

Source from the content-addressed store, hash-verified

171 *
172 */
173int32_t adfFileRealSize(uint32_t size, int blockSize, int32_t *dataN, int32_t *extN)
174{
175 int32_t data, ext;
176
177 /*--- number of data blocks ---*/
178 data = size / blockSize;
179 if ( size % blockSize )
180 data++;
181
182 /*--- number of header extension blocks ---*/
183 ext = 0;
184 if (data>MAX_DATABLK) {
185 ext = (data-MAX_DATABLK) / MAX_DATABLK;
186 if ( (data-MAX_DATABLK) % MAX_DATABLK )
187 ext++;
188 }
189
190 if (dataN)
191 *dataN = data;
192 if (extN)
193 *extN = ext;
194
195 return(ext+data+1);
196}
197
198
199/*

Callers 1

adfGetFileBlocksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected