Changeset 8973acd in buchla-68k for libcio/filesys.c


Ignore:
Timestamp:
07/15/2017 03:12:10 PM (7 years ago)
Author:
Thomas Lopatic <thomas@…>
Branches:
master
Children:
ea232f9
Parents:
7d0d347
Message:

No more warnings in libcio.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcio/filesys.c

    r7d0d347 r8973acd  
    3030struct  dirent  *_dptr;                 /* internal directory pointer */
    3131
    32 uint16_t _thefat[MAXFAT * WDPSEC];      /* file allocation table */
     32uint8_t _thefat[MAXFAT * BPSEC];        /* file allocation table */
    3333
    3434int16_t _fatin;                         /* FAT has been read */
     
    4747*/
    4848
    49 uint16_t _cl2lsn(struct bpb *bpp, uint16_t clnum)
     49int16_t _cl2lsn(struct bpb *bpp, int16_t clnum)
    5050{
    5151        return(bpp->datrec + (bpp->clsiz * (clnum - 2)) );
     
    5959*/
    6060
    61 uint16_t _gtcl12(int8_t *fat, uint16_t cl)
    62 {
    63         register uint16_t cla, clt;
     61int16_t _gtcl12(uint8_t *fat, int16_t cl)
     62{
     63        int16_t cla;
     64        uint16_t clt;
    6465
    6566        cla = cl + (cl >> 1);
    66         clt = ((uint16_t)0xFF00 & (fat[cla+1] << 8))
    67                 | ((uint16_t)0x00FF & fat[cla]);
     67        clt = (0xFF00u & ((uint16_t)fat[cla + 1] << 8))
     68                | (0x00FFu & fat[cla]);
    6869
    6970        if (cl & 1)
    7071                clt >>= 4;
    7172
    72         clt &= (uint16_t)0x0FFF;
    73         return(clt);
     73        clt &= 0x0FFFu;
     74        return((int16_t)clt);
    7475}
    7576
     
    8182*/
    8283
    83 uint16_t _getfat(uint16_t *bufad, struct bpb *bpp, uint16_t nfat)
    84 {
    85         uint16_t fatsec;
     84int32_t _getfat(uint8_t *bufad, struct bpb *bpp, int16_t nfat)
     85{
     86        int16_t fatsec;
    8687
    8788        fatsec = nfat ? bpp->fatrec : (bpp->fatrec - bpp->fsiz);
    88         return(BIOS(B_RDWR, 0, (int8_t *)bufad, bpp->fsiz, fatsec, 0));
     89        return(BIOS(B_RDWR, 0, bufad, bpp->fsiz, fatsec, 0));
    8990}
    9091
     
    9697*/
    9798
    98 int16_t _rdfat(uint16_t *bufad, struct bpb *bpp)
     99int16_t _rdfat(uint8_t *bufad, struct bpb *bpp)
    99100{
    100101        if (_getfat(bufad, bpp, 0)) {
     
    116117*/
    117118
    118 int16_t _rdroot(uint16_t *buf, struct bpb *bpp)
    119 {
    120         return(BIOS(B_RDWR, 0, (int8_t *)buf, bpp->rdlen,
     119int32_t _rdroot(struct dirent *buf, struct bpb *bpp)
     120{
     121        return(BIOS(B_RDWR, 0, buf, bpp->rdlen,
    121122                (bpp->fatrec + bpp->fsiz), 0));
    122123}
     
    131132*/
    132133
    133 int16_t _nsic(struct fcb *fcp, struct bpb *bpp, int8_t *fp)
    134 {
    135         register uint16_t tfe;
     134int16_t _nsic(struct fcb *fcp, struct bpb *bpp, uint8_t *fp)
     135{
     136        register int16_t tfe;
    136137
    137138        /* check the FCB flags */
     
    220221struct dirent *_dsrch(struct dirent *de)
    221222{
    222         uint16_t i, dl;
     223        int16_t i, dl;
    223224        register struct dirent *dp;
    224225
    225226        dp = _thedir;
    226         dl = _thebpb->rdlen * (_thebpb->recsiz / DENTSIZE);
     227        dl = _thebpb->rdlen * (_thebpb->recsiz / (int16_t)DENTSIZE);
    227228
    228229        for (i = 0; i < dl; i++) {              /* check each entry */
     
    253254struct dirent *_dsnew(void)
    254255{
    255         uint16_t i, dl;
     256        int16_t i, dl;
    256257        register struct dirent *dp;
    257258
    258259        dp = _thedir;
    259         dl = _thebpb->rdlen * (_thebpb->recsiz / DENTSIZE);
     260        dl = _thebpb->rdlen * (_thebpb->recsiz / (int16_t)DENTSIZE);
    260261
    261262        for (i = 0; i < dl; i++) {              /* check each entry */
     
    304305int16_t _seek(struct fcb *fcp)
    305306{
    306         register uint16_t acls, rcls, nc;
    307         uint16_t sic, spc;
     307        register int16_t acls, rcls, nc;
     308        int16_t sic, spc;
    308309
    309310        if (!(fcp->modefl & FC_OPN)) {          /* file must be open */
     
    328329        rcls = fcp->curlsn / spc;               /* calculate relative cluster */
    329330        sic = fcp->curlsn - (rcls * spc);       /* calculate sector in cluster */
    330         acls = micons(fcp->de.bclust);          /* get first cluster */
     331        acls = (int16_t)micon16(fcp->de.bclust);        /* get first cluster */
    331332        fcp->modefl &= ~FC_EOF;                 /* turn off the EOF flag */
    332333
     
    400401int16_t _ftrnc(struct dirent *dp)
    401402{
    402         register uint16_t acls, ncls;
     403        register int16_t acls, ncls;
    403404
    404405#if     DEBUGIT
     
    408409#endif
    409410
    410         acls = micons(dp->bclust);              /* get first cluster number */
     411        acls = (int16_t)micon16(dp->bclust);    /* get first cluster number */
    411412
    412413        /* zap entries until EOF or bad cluster */
     
    481482#endif
    482483
    483         if (nc = _newcls()) {                   /* get a new cluster */
     484        if ((nc = _newcls())) {                 /* get a new cluster */
    484485
    485486#if     DEBUGIT
     
    488489
    489490                _ptcl12(_thefat, nc, FAT_EOF);  /* mark new cluster as EOF */
    490                 pc = micons(fcp->de.bclust);    /* get first cluster */
     491                pc = (int16_t)micon16(fcp->de.bclust);  /* get first cluster */
    491492
    492493#if     DEBUGIT
     
    689690                /* create the file */
    690691
    691                 if(rc = _fmake(fcp)) {
     692                if ((rc = _fmake(fcp))) {
    692693
    693694                        _deadio(fcp, EIO);      /* couldn't create the file */
     
    758759        memcpy(&fcp->de, _dptr, DENTSIZE);
    759760        fcp->clsec = 0;
    760         fcp->curcls = micons(fcp->de.bclust);
     761        fcp->curcls = (int16_t)micon16(fcp->de.bclust);
    761762        fcp->offset = 0;
    762763        fcp->curlsn = 0L;
    763764        fcp->curdsn = fcp->de.bclust ? _cl2lsn(_thebpb, fcp->curcls) : 0;
    764         fcp->curlen = miconl(fcp->de.flen);
    765 
    766         fcp->asects = ((fcp->curlen / _thebpb->clsizb)
     765        fcp->curlen = (int32_t)micon32(fcp->de.flen);
     766
     767        fcp->asects = ((int16_t)(fcp->curlen / _thebpb->clsizb)
    767768                + ((fcp->curlen & (_thebpb->clsizb - 1)) ? 1 : 0))
    768769                * _thebpb->clsiz;
     
    787788*/
    788789
    789 int16_t _inifcb(struct fcb *fcp, int8_t *name, int8_t *ext, int16_t mode)
     790int16_t _inifcb(struct fcb *fcp, int8_t *name, int8_t *ext, uint16_t mode)
    790791{
    791792        int16_t fl;
     
    923924                if (fcp->modefl & (FC_CR | FC_AP | FC_WR)) {    /* writing ? */
    924925
    925                         if (dp = _dsrch(&fcp->de)) {    /* locate the dirent */
     926                        if ((dp = _dsrch(&fcp->de))) {  /* locate the dirent */
    926927
    927928                                /* update the directory entry if it changed */
     
    10501051                return(FAILURE);
    10511052
    1052         _dptr->fname[0] = 0xE5;         /* mark directory entry as free */
     1053        _dptr->fname[0] = (int8_t)0xE5; /* mark directory entry as free */
    10531054
    10541055#if     DEBUGIT
Note: See TracChangeset for help on using the changeset viewer.