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

Function adfReadDataBlock

dep/adflib/src/adf_file.c:654–684  ·  view source on GitHub ↗

* adfReadDataBlock * */

Source from the content-addressed store, hash-verified

652 *
653 */
654RETCODE adfReadDataBlock(struct Volume *vol, SECTNUM nSect, void *data)
655{
656 uint8_t buf[512];
657 struct bOFSDataBlock *dBlock;
658 RETCODE rc = RC_OK;
659
660 adfReadBlock(vol, nSect,buf);
661
662 memcpy(data,buf,512);
663
664 if (isOFS(vol->dosType)) {
665#ifdef LITT_ENDIAN
666 swapEndian(data, SWBL_DATA);
667#endif
668 dBlock = (struct bOFSDataBlock*)data;
669/*printf("adfReadDataBlock %ld\n",nSect);*/
670
671 if (dBlock->checkSum!=adfNormalSum(buf,20,sizeof(struct bOFSDataBlock)))
672 (*adfEnv.wFct)("adfReadDataBlock : invalid checksum");
673 if (dBlock->type!=T_DATA)
674 (*adfEnv.wFct)("adfReadDataBlock : id T_DATA not found");
675 if (dBlock->dataSize<0 || dBlock->dataSize>488)
676 (*adfEnv.wFct)("adfReadDataBlock : dataSize incorrect");
677 if ( !isSectNumValid(vol,dBlock->headerKey) )
678 (*adfEnv.wFct)("adfReadDataBlock : headerKey out of range");
679 if ( !isSectNumValid(vol,dBlock->nextData) )
680 (*adfEnv.wFct)("adfReadDataBlock : nextData out of range");
681 }
682
683 return rc;
684}
685
686
687/*

Callers 3

adfFileSeekFunction · 0.85
adfReadNextFileBlockFunction · 0.85
adfCheckFileFunction · 0.85

Calls 4

adfReadBlockFunction · 0.85
swapEndianFunction · 0.85
adfNormalSumFunction · 0.85
isSectNumValidFunction · 0.85

Tested by

no test coverage detected