mirror of https://github.com/FDOS/kernel.git
Divide optimisation (ceiling) + some small cleanups
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@717 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
61d87d82bb
commit
dd9df1f3a6
|
@ -286,12 +286,14 @@ UBYTE FcbReadWrite(xfcb FAR * lpXfcb, UCOUNT recno, int mode)
|
|||
UBYTE FcbGetFileSize(xfcb FAR * lpXfcb)
|
||||
{
|
||||
int FcbDrive, sft_idx;
|
||||
unsigned recsiz;
|
||||
|
||||
/* Build a traditional DOS file name */
|
||||
fcb FAR *lpFcb = CommonFcbInit(lpXfcb, SecPathName, &FcbDrive);
|
||||
recsiz = lpFcb->fcb_recsiz;
|
||||
|
||||
/* check for a device */
|
||||
if (!lpFcb || IsDevice(SecPathName) || (lpFcb->fcb_recsiz == 0))
|
||||
if (!lpFcb || IsDevice(SecPathName) || (recsiz == 0))
|
||||
return FCB_ERROR;
|
||||
|
||||
sft_idx = (short)DosOpenSft(SecPathName, O_LEGACY | O_RDONLY | O_OPEN, 0);
|
||||
|
@ -303,9 +305,7 @@ UBYTE FcbGetFileSize(xfcb FAR * lpXfcb)
|
|||
fsize = SftGetFsize(sft_idx);
|
||||
|
||||
/* compute the size and update the fcb */
|
||||
lpFcb->fcb_rndm = fsize / lpFcb->fcb_recsiz;
|
||||
if ((fsize % lpFcb->fcb_recsiz) != 0)
|
||||
++lpFcb->fcb_rndm;
|
||||
lpFcb->fcb_rndm = (fsize + (recsiz - 1)) / recsiz;
|
||||
|
||||
/* close the file and leave */
|
||||
if ((CritErrCode = -DosCloseSft(sft_idx, FALSE)) == SUCCESS)
|
||||
|
|
Loading…
Reference in New Issue