* adfFileFlush * */
| 51 | * |
| 52 | */ |
| 53 | void adfFlushFile(struct File *file) |
| 54 | { |
| 55 | struct bEntryBlock parent; |
| 56 | struct bOFSDataBlock *data; |
| 57 | |
| 58 | if (file->currentExt) { |
| 59 | if (file->writeMode) |
| 60 | adfWriteFileExtBlock(file->volume, file->currentExt->headerKey, |
| 61 | file->currentExt); |
| 62 | } |
| 63 | if (file->currentData) { |
| 64 | if (file->writeMode) { |
| 65 | file->fileHdr->byteSize = file->pos; |
| 66 | if (isOFS(file->volume->dosType)) { |
| 67 | data = (struct bOFSDataBlock *)file->currentData; |
| 68 | data->dataSize = file->posInDataBlk; |
| 69 | } |
| 70 | if (file->fileHdr->byteSize>0) |
| 71 | adfWriteDataBlock(file->volume, file->curDataPtr, |
| 72 | file->currentData); |
| 73 | } |
| 74 | } |
| 75 | if (file->writeMode) { |
| 76 | file->fileHdr->byteSize = file->pos; |
| 77 | /*printf("pos=%ld\n",file->pos);*/ |
| 78 | adfTime2AmigaTime(adfGiveCurrentTime(), |
| 79 | &(file->fileHdr->days),&(file->fileHdr->mins),&(file->fileHdr->ticks) ); |
| 80 | adfWriteFileHdrBlock(file->volume, file->fileHdr->headerKey, file->fileHdr); |
| 81 | |
| 82 | if (isDIRCACHE(file->volume->dosType)) { |
| 83 | /*printf("parent=%ld\n",file->fileHdr->parent);*/ |
| 84 | adfReadEntryBlock(file->volume, file->fileHdr->parent, &parent); |
| 85 | adfUpdateCache(file->volume, &parent, (struct bEntryBlock*)file->fileHdr,FALSE); |
| 86 | } |
| 87 | adfUpdateBitmap(file->volume); |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | |
| 92 | /* |
no test coverage detected