Changeset 8973acd in buchla-68k for libcio


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.

Location:
libcio
Files:
48 edited

Legend:

Unmodified
Added
Removed
  • libcio/atoi.c

    r7d0d347 r8973acd  
    1010int16_t atoi(int8_t *cp)
    1111{
    12         register uint16_t i;
     12        register int16_t i;
    1313        register int16_t sign;
    1414
  • libcio/blkrd.c

    r7d0d347 r8973acd  
    7070        if ((track NE _b_trak) OR (side NE _b_side)) {  /* track in buffer ? */
    7171
    72                 if (brc = BIOS(B_RDWR, 0, &_b_tbuf, _thebpb->dspt, _b_tsec, 0)) {
     72                if ((brc = BIOS(B_RDWR, 0, &_b_tbuf, _thebpb->dspt, _b_tsec, 0))) {
    7373
    7474                        _b_trak = -1;
     
    111111
    112112#if     TBUFFER
    113                 if (brc = _secrd(buf, (int16_t)fcp->curdsn)) {
     113                if ((brc = _secrd(buf, (int16_t)fcp->curdsn))) {
    114114#else
    115115                if (brc = BIOS(B_RDWR, 0, buf, 1, (short)fcp->curdsn, 0)) {
     
    121121                }
    122122
    123                 if (rb = _nsic(fcp, _thebpb, _thefat)) {  /* find next sector */
     123                if ((rb = _nsic(fcp, _thebpb, _thefat))) {  /* find next sector */
    124124
    125125                        if (rb EQ -1)           /* see if we had an error */
  • libcio/blkwr.c

    r7d0d347 r8973acd  
    100100#endif
    101101
    102                                 if (rc = BIOS(B_RDWR, 1, buf, 1, (int16_t)fcp->curdsn, 0)) {
     102                                if ((rc = BIOS(B_RDWR, 1, buf, 1, (int16_t)fcp->curdsn, 0))) {
    103103
    104104#if     DEBUGIT
     
    150150#endif
    151151
    152                                 if (rc = BIOS(B_RDWR, 1, buf, 1, (int16_t)fcp->curdsn, 0)) {
     152                                if ((rc = BIOS(B_RDWR, 1, buf, 1, (int16_t)fcp->curdsn, 0))) {
    153153
    154154#if     DEBUGIT
     
    184184                        }
    185185
    186                         fcp->de.bclust = micons(clustr);
     186                        fcp->de.bclust = micon16((uint16_t)clustr);
    187187                        _ptcl12(_thefat, clustr, 0x0FF8);
    188188                        _fatmod = TRUE;
     
    201201#endif
    202202
    203                         if (rc = BIOS(B_RDWR, 1, buf, 1, (int16_t)fcp->curdsn, 0)) {
     203                        if ((rc = BIOS(B_RDWR, 1, buf, 1, (int16_t)fcp->curdsn, 0))) {
    204204
    205205#if     DEBUGIT
  • libcio/close.c

    r7d0d347 r8973acd  
    8787*/
    8888
    89 int16_t _filecl(struct fcb *fp)
     89int16_t _filecl(io_arg arg)
    9090{
     91        struct fcb *fp;
    9192        register int16_t rc;
     93
     94        fp = (struct fcb *)arg;
    9295
    9396        rc = ClsFile(fp);               /* close the FCB */
  • libcio/close.x

    r7d0d347 r8973acd  
    88
    99#include "biosdefs.h"
     10#include "fspars.h"
    1011#include "stdint.h"
    1112
     
    1920extern  void            _clsfat(void);
    2021extern  void            _fd_cls(void);
    21 extern  int16_t         _filecl(struct fcb *fp);
     22extern  int16_t         _filecl(io_arg arg);
    2223extern  int16_t         close(int16_t fd);
  • libcio/clusmap.c

    r7d0d347 r8973acd  
    7575
    7676        nc = 0;
    77         clus = micons(fcp->de.bclust);
     77        clus = (int16_t)micon16(fcp->de.bclust);
    7878
    7979        if (clus) {
     
    173173        printf("  modefl     0x%04x\n", fcp->modefl);
    174174
    175         printf("  crtime     0x%04x",   micons(fcp->de.crtime));
    176         printf("  crdate     0x%04x\n", micons(fcp->de.crdate));
     175        printf("  crtime     0x%04x",   micon16(fcp->de.crtime));
     176        printf("  crdate     0x%04x\n", micon16(fcp->de.crdate));
    177177
    178178        printf("  asects   %8ld",       fcp->asects);
    179         printf("  flen     %8ld",       miconl(fcp->de.flen));
     179        printf("  flen     %8ld",       micon32(fcp->de.flen));
    180180        printf("  curlen   %8ld\n",     fcp->curlen);
    181181
    182         printf("  bclust   %8d",        micons(fcp->de.bclust));
     182        printf("  bclust   %8d",        micon16(fcp->de.bclust));
    183183        printf("  curcls   %8d",        fcp->curcls);
    184184        printf("  clsec    %8d\n",      fcp->clsec);
     
    198198*/
    199199
    200 void MapFAT(int8_t *fat, int16_t ncl, int16_t stops)
     200void MapFAT(uint8_t *fat, int16_t ncl, int16_t stops)
    201201{
    202202        register int16_t i;
  • libcio/clusmap.x

    r7d0d347 r8973acd  
    2121extern  FILE            *FILEfl(FILE *fp);
    2222extern  void            FILEpr(FILE *fp);
    23 extern  void            MapFAT(int8_t *fat, int16_t ncl, int16_t stops);
     23extern  void            MapFAT(uint8_t *fat, int16_t ncl, int16_t stops);
    2424extern  struct  fcb     *SnapFCB(struct fcb *fcp);
    2525extern  struct  fcb     *fd2fcb(int16_t fd);
  • libcio/conin.c

    r7d0d347 r8973acd  
    88#include "ram.h"
    99
    10 int8_t _ConBuf[258];    /* console input buffer */
     10uint8_t _ConBuf[258];   /* console input buffer */
    1111int16_t _CBused;
    1212
    13 int16_t _conin(io_arg arg, int8_t *buff, int16_t len)
     13int16_t _conin(io_arg arg, void *buff, int16_t len)
    1414{
    1515        int16_t         nbp;
     
    2323                _ConBuf[1] = _ConBuf[2] = 0;
    2424
    25                 readbuf(CON_DEV, _ConBuf);
     25                readbuf(CON_DEV, (int8_t *)_ConBuf);
    2626                writeln(CON_DEV, "\r\n");
    2727
     
    4343        memcpy(buff, (_ConBuf + _CBused), l);
    4444        _CBused += l;
    45         _ConBuf[1] -= l;
     45        _ConBuf[1] = (uint8_t)(_ConBuf[1] - l);
    4646        return (l);
    4747}
  • libcio/conin.x

    r7d0d347 r8973acd  
    1717
    1818extern  int16_t         _CBused;
    19 extern  int8_t          _ConBuf[258];
     19extern  uint8_t         _ConBuf[258];
    2020
    2121/*
     
    2525*/
    2626
    27 extern  int16_t         _conin(io_arg arg, int8_t *buff, int16_t len);
     27extern  int16_t         _conin(io_arg arg, void *buff, int16_t len);
  • libcio/conwr.c

    r7d0d347 r8973acd  
    1616   ============================================================================
    1717*/
    18 int16_t _conwr(int16_t kind, int8_t *buff, int16_t len)
     18int16_t _conwr(io_arg arg, void *buff, int16_t len)
    1919{
     20        struct devtabl *dp;
     21        int8_t *buff8;
    2022        register int16_t count;
    2123
     24        dp = (struct devtabl *)arg;
     25        buff8 = buff;
     26
    2227        for (count = 0; count < len; ++count)
    23                 BIOS(B_PUTC, kind, *buff++);
     28                BIOS(B_PUTC, dp->d_kind, *buff8++);
    2429
    2530        return(count);
  • libcio/conwr.x

    r7d0d347 r8973acd  
    1515*/
    1616
    17 extern  int16_t         _conwr(int16_t kind, int8_t *buff, int16_t len);
     17extern  int16_t         _conwr(io_arg arg, void *buff, int16_t len);
  • libcio/dirfns.c

    r7d0d347 r8973acd  
    7272*/
    7373
    74 int8_t *dtunpk(int16_t din, int16_t tin, int8_t *s, int16_t fmt)
     74int8_t *dtunpk(uint16_t din, uint16_t tin, int8_t *s, int16_t fmt)
    7575{
    76         register int16_t        ftm, fdt;
     76        register uint16_t       ftm, fdt;
    7777
    78         ftm = ((tin << 8) & 0xFF00) | ((tin >> 8) & 0x00FF);
    79         fdt = ((din << 8) & 0xFF00) | ((din >> 8) & 0x00FF);
     78        ftm = micon16(tin);
     79        fdt = micon16(din);
    8080
    8181        switch (fmt) {
  • libcio/dirfns.x

    r7d0d347 r8973acd  
    1616
    1717extern  int8_t          *atrstr(int16_t atr, int8_t s[]);
    18 extern  int8_t          *dtunpk(int16_t din, int16_t tin, int8_t *s, int16_t fmt);
     18extern  int8_t          *dtunpk(uint16_t din, uint16_t tin, int8_t *s, int16_t fmt);
    1919extern  int8_t          *mname(int16_t n);
  • libcio/fgets.c

    r7d0d347 r8973acd  
    4040
    4141        while ((i = getchar()) NE EOF AND i NE '\n')
    42                 *cp++ = i;
     42                *cp++ = (int8_t)i;
    4343
    4444        *cp = 0;        /* terminate the line */
     
    5555        register int8_t *cp;
    5656
     57        c = 0;
    5758        cp = s;
    5859
    5960        while (--n > 0 AND (c = agetc(fp)) NE EOF) {
    6061
    61                 *cp++ = c;
     62                *cp++ = (int8_t)c;
    6263
    6364                if (c EQ '\n')
  • 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
  • libcio/filesys.x

    r7d0d347 r8973acd  
    2626extern  struct  bpb     *_thebpb;
    2727extern  struct  dirent  _thedir[MAXDIRNT];
    28 extern  uint16_t        _thefat[MAXFAT * WDPSEC];
     28extern  uint8_t         _thefat[MAXFAT * BPSEC];
    2929
    3030/*
     
    3737extern  int16_t         DelFile(struct fcb *fcp);
    3838extern  int16_t         _alcnew(struct fcb *fcp);
    39 extern  uint16_t        _cl2lsn(struct bpb *bpp, uint16_t clnum);
     39extern  int16_t         _cl2lsn(struct bpb *bpp, int16_t clnum);
    4040extern  void            _clsvol(void);
    4141extern  void            _deadio(struct fcb *fcp, int16_t err);
     
    4444extern  int16_t         _fmake(struct fcb *fcp);
    4545extern  int16_t         _ftrnc(struct dirent *dp);
    46 extern  uint16_t        _getfat(uint16_t *bufad, struct bpb *bpp, uint16_t nfat);
    47 extern  uint16_t        _gtcl12(int8_t *fat, uint16_t cl);
    48 extern  int16_t         _inifcb(struct fcb *fcp, int8_t *name, int8_t *ext, int16_t mode);
     46extern  int32_t         _getfat(uint8_t *bufad, struct bpb *bpp, int16_t nfat);
     47extern  int16_t         _gtcl12(uint8_t *fat, int16_t cl);
     48extern  int16_t         _inifcb(struct fcb *fcp, int8_t *name, int8_t *ext, uint16_t mode);
    4949extern  int16_t         _newcls(void);
    50 extern  int16_t         _nsic(struct fcb *fcp, struct bpb *bpp, int8_t *fp);
     50extern  int16_t         _nsic(struct fcb *fcp, struct bpb *bpp, uint8_t *fp);
    5151extern  int16_t         _opfcb(struct fcb *fcp);
    5252extern  int16_t         _opnvol(void);
    53 extern  int16_t         _rdfat(uint16_t *bufad, struct bpb *bpp);
    54 extern  int16_t         _rdroot(uint16_t *buf, struct bpb *bpp);
     53extern  int16_t         _rdfat(uint8_t *bufad, struct bpb *bpp);
     54extern  int32_t         _rdroot(struct dirent *buf, struct bpb *bpp);
    5555extern  int16_t         _seek(struct fcb *fcp);
    5656extern  int16_t         fcbinit(int8_t *name, struct fcb *fcp);
  • libcio/filname.c

    r7d0d347 r8973acd  
    6262        tp = p;
    6363
    64         while (c = *s) {                /* scan the string */
     64        while ((c = *s)) {              /* scan the string */
    6565
    6666                if (c EQ '.') {         /* ... until we hit the dot */
  • libcio/flread.c

    r7d0d347 r8973acd  
    3434                } else {
    3535
    36                         ilen = len;
     36                        ilen = (int16_t)len;
    3737
    3838                        if (1 NE fread(buff, ilen, 1, fp))
  • libcio/fopen.c

    r7d0d347 r8973acd  
    88#include "ram.h"
    99
    10 FILE *_opener(int8_t *name, int8_t *mode, int16_t aflag)
     10FILE *_opener(int8_t *name, int8_t *mode, uint16_t rawflg)
    1111{
    1212        register FILE *fp;
     
    2626
    2727        case 'r':       /* read mode */
    28                 if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_RDONLY), aflag)) EQ -1)
     28                if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_RDONLY) | rawflg)) EQ -1)
    2929                        return(NULL);
    3030                break;
    3131
    3232        case 'w':       /* write mode */
    33                 if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_WRONLY)|O_CREAT|O_TRUNC, aflag)) EQ -1)
     33                if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_WRONLY)|O_CREAT|O_TRUNC|rawflg)) EQ -1)
    3434                        return(NULL);
    3535
     
    3737       
    3838        case 'a':       /* append mode */
    39                 if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_WRONLY)|O_CREAT, aflag)) EQ -1)
     39                if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_WRONLY)|O_CREAT|rawflg)) EQ -1)
    4040                        return(NULL);
    4141
  • libcio/fopen.x

    r7d0d347 r8973acd  
    1616*/
    1717
    18 extern  FILE            *_opener(int8_t *name, int8_t *mode, int16_t aflag);
     18extern  FILE            *_opener(int8_t *name, int8_t *mode, uint16_t aflag);
    1919extern  FILE            *fopen(int8_t *name, int8_t *mode);
    2020extern  FILE            *fopena(int8_t *name, int8_t *mode);
  • libcio/fread.c

    r7d0d347 r8973acd  
    1515*/
    1616
    17 int16_t fread(int8_t *buffer, uint16_t size, int16_t number, FILE *stream)
     17int16_t fread(void *buffer, int16_t size, int16_t number, FILE *stream)
    1818{
     19        uint8_t *buffer8;
    1920        int16_t total;
    2021        register int16_t c,i;
     22
     23        buffer8 = buffer;
    2124
    2225        for (total = 0; total < number; ++total) {
     
    2730                                return(total);
    2831
    29                         *buffer++ = c;
     32                        *buffer8++ = (uint8_t)c;
    3033                }
    3134        }
  • libcio/fread.x

    r7d0d347 r8973acd  
    1616*/
    1717
    18 extern  int16_t         fread(int8_t *buffer, uint16_t size, int16_t number, FILE *stream);
     18extern  int16_t         fread(void *buffer, int16_t size, int16_t number, FILE *stream);
  • libcio/fseek.c

    r7d0d347 r8973acd  
    1616int16_t fseek(FILE *fp, int32_t pos, int16_t mode)
    1717{
    18         register int16_t lr;
     18        register int32_t lr;
    1919
    2020        if (fp->_flags & _DIRTY) {
     
    3030
    3131        fp->_bp = fp->_bend = NULL;
    32         fp->_flags &= ~_EOF;
     32        fp->_flags = (uint8_t)(fp->_flags & ~_EOF);
    3333
    3434        lr = lseek(fp->_unit, pos, mode);
  • libcio/fsinit.c

    r7d0d347 r8973acd  
    88#include "ram.h"
    99
    10 int8_t  *Stdbufs;                       /* buffer chain pointer */
     10int32_t *Stdbufs;                       /* buffer chain pointer */
    1111
    1212int8_t  Wrkbuf[BPSEC];                  /* sector work buffer */
     
    3939*/
    4040
    41 int16_t _badfio(io_arg arg, int8_t *buff, int16_t len)
     41int16_t _badfio(io_arg arg, void *buff, int16_t len)
    4242{
    4343        (void)arg;
     
    6969*/
    7070
    71 int16_t _nopo(int8_t *name, int16_t flag, int16_t mode, struct channel *chp, struct devtabl *dp)
     71int16_t _nopo(int8_t *name, uint16_t flag, struct channel *chp, struct devtabl *dp)
    7272{
    7373        (void)name;
    7474        (void)flag;
    75         (void)mode;
    7675        (void)chp;
    7776        (void)dp;
     
    9998*/
    10099
    101 void InitCH(struct channel *cp, int8_t rdi, int8_t wri, int8_t ioi, int8_t ski, chclo cfp, io_arg charg)
     100void InitCH(struct channel *cp, int16_t rdi, int16_t wri, int16_t ioi, int16_t ski, chclo cfp, io_arg charg)
    102101{
    103102        cp->c_read  = rdi;
     
    115114*/
    116115
    117 void Init_CB(FILE *fp, int8_t flags, int8_t unit, int32_t *bufad, int16_t bufsize)
     116void Init_CB(FILE *fp, uint8_t flags, int16_t unit, int32_t *bufad, int16_t bufsize)
    118117{
    119118        fp->_bp     = (int8_t *)0L;
     
    124123        fp->_bytbuf = 0;
    125124        fp->_buflen = bufsize;
    126 };
     125}
    127126
    128127/*
     
    139138        memsetw(Stdbuf, 0, sizeof Stdbuf / 2);          /* clear buffers */
    140139
    141         Init_CB(stdin,  _BUSY, 0, (int8_t *)0L, BUFSIZ);        /* stdin */
    142         Init_CB(stdout, _BUSY, 1, (int8_t *)0L, 1);     /* stdout */
    143         Init_CB(stderr, _BUSY, 2, (int8_t *)0L, 1);     /* stderr */
     140        Init_CB(stdin,  _BUSY, 0, NULL, BUFSIZ);        /* stdin */
     141        Init_CB(stdout, _BUSY, 1, NULL, 1);             /* stdout */
     142        Init_CB(stderr, _BUSY, 2, NULL, 1);             /* stderr */
    144143
    145144        for (i = 3; i < NSTREAMS; i++)
    146                 Init_CB(&Cbuffs[i], 0, 0, (int8_t *)0L, 0);
     145                Init_CB(&Cbuffs[i], 0, 0, NULL, 0);
    147146
    148147        Stdbuf[0][0] = 0L;              /* initialize the buffer list */
  • libcio/fsinit.x

    r7d0d347 r8973acd  
    2121extern  FILE            Cbuffs[NSTREAMS];
    2222extern  int32_t         Stdbuf[MAXDFILE][BUFSIZL];
    23 extern  int8_t          *Stdbufs;
     23extern  int32_t         *Stdbufs;
    2424extern  int8_t          Wrkbuf[BPSEC];
    2525extern  int16_t         _b_sect;
     
    3737*/
    3838
    39 extern  void            InitCH(struct channel *cp, int8_t rdi, int8_t wri, int8_t ioi, int8_t ski, chclo cfp, io_arg charg);
     39extern  void            InitCH(struct channel *cp, int16_t rdi, int16_t wri, int16_t ioi, int16_t ski, chclo cfp, io_arg charg);
    4040extern  void            InitFS(void);
    41 extern  void            Init_CB(FILE *fp, int8_t flags, int8_t unit, int32_t *bufad, int16_t bufsize);
     41extern  void            Init_CB(FILE *fp, uint8_t flags, int16_t unit, int32_t *bufad, int16_t bufsize);
    4242extern  int16_t         _badfd(void);
    4343extern  int16_t         _noper(void);
    4444
    4545extern  int16_t         _badfc(io_arg arg);
    46 extern  int16_t         _badfio(io_arg arg, int8_t *buff, int16_t len);
     46extern  int16_t         _badfio(io_arg arg, void *buff, int16_t len);
    4747extern  int16_t         _nopc(io_arg arg);
    48 extern  int16_t         _nopo(int8_t *name, int16_t flag, int16_t mode, struct channel *chp, struct devtabl *dp);
     48extern  int16_t         _nopo(int8_t *name, uint16_t flag, struct channel *chp, struct devtabl *dp);
  • libcio/ftell.c

    r7d0d347 r8973acd  
    5757        fcp = chp->c_arg;               /* point at the FCB */
    5858
    59         dpos = fcp->offset + (fcp->curlsn << FILESHFT);
     59        dpos = fcp->offset + ((int32_t)fcp->curlsn << FILESHFT);
    6060
    6161        if (fp->_flags & _DIRTY)        /* adjust for the buffering */
  • libcio/fwrite.c

    r7d0d347 r8973acd  
    1919*/
    2020
    21 int16_t fwrite(int8_t *buffer, int16_t size, int16_t number, FILE *stream)
     21int16_t fwrite(void *buffer, int16_t size, int16_t number, FILE *stream)
    2222{
     23        uint8_t *buffer8;
    2324        register int16_t i, j;
     25
     26        buffer8 = buffer;
    2427
    2528        if (size < 0)           /* check size for validity */
     
    3134        for (i = 0; i < number; ++i)
    3235                for (j = 0; j < size; ++j)
    33                         if (putc(*buffer++, stream) EQ EOF)
     36                        if (putc(*buffer8++, stream) EQ EOF)
    3437                                return(i);
    3538
  • libcio/fwrite.x

    r7d0d347 r8973acd  
    1616*/
    1717
    18 extern  int16_t         fwrite(int8_t *buffer, int16_t size, int16_t number, FILE *stream);
     18extern  int16_t         fwrite(void *buffer, int16_t size, int16_t number, FILE *stream);
  • libcio/getc.c

    r7d0d347 r8973acd  
    1717                        return(EOF);
    1818
    19                 ptr->_flags &= ~_DIRTY;         /* reset the dirty buffer bit */
     19                ptr->_flags = (uint8_t)(ptr->_flags & ~_DIRTY); /* reset the dirty buffer bit */
    2020
    2121                if (ptr->_buff EQ NULL)         /* get a buffer if none exists */
     
    2424                if ((len = read(ptr->_unit, ptr->_buff, ptr->_buflen)) LE 0) {
    2525
    26                         ptr->_flags |= ((len EQ 0) ? _EOF : _IOERR);
     26                        ptr->_flags = (uint8_t)(ptr->_flags | ((len EQ 0) ? _EOF : _IOERR));
    2727                        return(EOF);
    2828                }
  • libcio/getl.c

    r7d0d347 r8973acd  
    2222        register int8_t *t;
    2323
    24         t = &temp;
     24        t = (int8_t *)&temp;
    2525
    26         *t++ = fgetc(stream);
    27         *t++ = fgetc(stream);
    28         *t++ = fgetc(stream);
    29         *t = fgetc(stream);
     26        *t++ = (int8_t)fgetc(stream);
     27        *t++ = (int8_t)fgetc(stream);
     28        *t++ = (int8_t)fgetc(stream);
     29        *t = (int8_t)fgetc(stream);
    3030
    3131        return(temp);
  • libcio/getw.c

    r7d0d347 r8973acd  
    2222        register int8_t *t;
    2323
    24         t = &temp;
     24        t = (int8_t *)&temp;
    2525
    26         *t++ = fgetc(stream);
    27         *t = fgetc(stream);
     26        *t++ = (int8_t)fgetc(stream);
     27        *t = (int8_t)fgetc(stream);
    2828
    2929        return(temp);
  • libcio/lseek.c

    r7d0d347 r8973acd  
    4545
    4646        case 1:                         /* relative to current position */
    47                 pos += fp->offset + (fp->curlsn << FILESHFT);
     47                pos += fp->offset + ((int32_t)fp->curlsn << FILESHFT);
    4848
    4949        case 0:                         /* relative to start of file */
     
    7272
    7373                fp->offset = fp->curlen & (BPSEC -1);
    74                 fp->curlsn = fp->curlen >> FILESHFT;
     74                fp->curlsn = (int16_t)(fp->curlen >> FILESHFT);
    7575                fp->modefl |= FC_ERR;
    7676
     
    8686
    8787        fp->offset = pos & ((int32_t)BPSEC - 1);        /* calculate sector offset */
    88         fp->curlsn = pos >> FILESHFT;           /* calculate logical sector */
     88        fp->curlsn = (int16_t)(pos >> FILESHFT);        /* calculate logical sector */
    8989
    9090        if (_seek(fp) < 0) {                    /* position to the physical sector */
  • libcio/open.c

    r7d0d347 r8973acd  
    1919static struct devtabl devtabl[] = {
    2020
    21         { "con:", &condev,  &devtabl[0] },      /* console device */
    22         { "CON:", &condev,  &devtabl[1] },
    23 
    24         {      0, &filedev,      NULL  }       /* this MUST be the last entry */
     21        { "con:", &condev,  &devtabl[0], CON_DEV },     /* console device */
     22        { "CON:", &condev,  &devtabl[1], CON_DEV },
     23
     24        {      0, &filedev,        NULL,      -1 }      /* this MUST be the last entry */
    2525};
    2626
     
    3434*/
    3535
    36 int16_t open(int8_t *name, int16_t flag, int16_t mode)
     36int16_t open(int8_t *name, uint16_t flag)
    3737{
    3838        register struct devtabl *dp;
    3939        register struct channel *chp;
    4040        register struct device  *dev;
    41         int16_t fd, mdmask;
     41        int16_t fd;
     42        uint16_t mdmask;
    4243
    4344        /* search for a free channel */
     
    8485        chp->c_close = _nopc;
    8586
    86         if ((*dev->d_open)(name, flag, mode, chp, dp) < 0) {    /* open */
     87        if ((*dev->d_open)(name, flag, chp, dp) < 0) {  /* open */
    8788
    8889                chp->c_close = _badfc;  /* couldn't open for some reason */
     
    102103*/
    103104
    104 int16_t opena(int8_t *name, int16_t flag, int16_t mode)
    105 {
    106         return(open(name, flag, mode));
     105int16_t opena(int8_t *name, uint16_t flag)
     106{
     107        return(open(name, flag));
    107108}
    108109
     
    116117*/
    117118
    118 int16_t openb(int8_t *name, int16_t flag, int16_t mode)
    119 {
    120         return(open(name, flag|O_RAW, mode));
     119int16_t openb(int8_t *name, uint16_t flag)
     120{
     121        return(open(name, flag|O_RAW));
    121122}
    122123
     
    131132*/
    132133
    133 int16_t creat(int8_t *name, int16_t mode)
    134 {
    135         return(open(name, O_WRONLY|O_TRUNC|O_CREAT, mode));
     134int16_t creat(int8_t *name)
     135{
     136        return(open(name, O_WRONLY|O_TRUNC|O_CREAT));
    136137}
    137138
     
    146147*/
    147148
    148 int16_t creata(int8_t *name, int16_t mode)
    149 {
    150         return(open(name, O_WRONLY|O_TRUNC|O_CREAT, mode));
     149int16_t creata(int8_t *name)
     150{
     151        return(open(name, O_WRONLY|O_TRUNC|O_CREAT));
    151152}
    152153
     
    161162*/
    162163
    163 int16_t creatb(int8_t *name, int16_t mode)
    164 {
    165         return(open(name, O_WRONLY|O_TRUNC|O_CREAT|O_RAW, mode));
     164int16_t creatb(int8_t *name)
     165{
     166        return(open(name, O_WRONLY|O_TRUNC|O_CREAT|O_RAW));
    166167}
    167168
     
    174175*/
    175176
    176 int16_t _fileop(int8_t *name, int16_t flag, int16_t mode, struct channel *chp, struct devtabl *dp)
     177int16_t _fileop(int8_t *name, uint16_t flag, struct channel *chp, struct devtabl *dp)
    177178{
    178179        register struct fcb *fp;
    179180        int8_t  tmpname[9], tmpext[4];
    180181
    181         (void)mode;
    182182        (void)dp;
    183183
  • libcio/open.x

    r7d0d347 r8973acd  
    1616*/
    1717
    18 extern  int16_t         _fileop(int8_t *name, int16_t flag, int16_t mode, struct channel *chp, struct devtabl *dp);
    19 extern  int16_t         creat(int8_t *name, int16_t mode);
    20 extern  int16_t         creata(int8_t *name, int16_t mode);
    21 extern  int16_t         creatb(int8_t *name, int16_t mode);
    22 extern  int16_t         open(int8_t *name, int16_t flag, int16_t mode);
    23 extern  int16_t         opena(int8_t *name, int16_t flag, int16_t mode);
    24 extern  int16_t         openb(int8_t *name, int16_t flag, int16_t mode);
     18extern  int16_t         _fileop(int8_t *name, uint16_t flag, struct channel *chp, struct devtabl *dp);
     19extern  int16_t         creat(int8_t *name);
     20extern  int16_t         creata(int8_t *name);
     21extern  int16_t         creatb(int8_t *name);
     22extern  int16_t         open(int8_t *name, uint16_t flag);
     23extern  int16_t         opena(int8_t *name, uint16_t flag);
     24extern  int16_t         openb(int8_t *name, uint16_t flag);
  • libcio/posit.c

    r7d0d347 r8973acd  
    1414*/
    1515
    16 int16_t posit(int16_t fd, uint16_t pos)
     16int16_t posit(int16_t fd, int16_t pos)
    1717{
    1818        register struct fcb *fp;
     
    2727
    2828        if ((chantab[fd].c_seek EQ 0)
    29             OR ((pos << FILESHFT) > fp->curlen)) {
     29            OR (((int32_t)pos << FILESHFT) > fp->curlen)) {
    3030
    3131                errno = EINVAL;
  • libcio/posit.x

    r7d0d347 r8973acd  
    1515*/
    1616
    17 extern  int16_t         posit(int16_t fd, uint16_t pos);
     17extern  int16_t         posit(int16_t fd, int16_t pos);
  • libcio/putc.c

    r7d0d347 r8973acd  
    5959        if (data EQ -1) {       /* just flushing, not adding data */
    6060
    61                 ptr->_flags &= ~_DIRTY;
     61                ptr->_flags = (uint8_t)(ptr->_flags & ~_DIRTY);
    6262                ptr->_bend = ptr->_bp = NULL;
    6363                return(0);
     
    7979        ptr->_flags |= _DIRTY;
    8080
    81         return((*ptr->_bp++ = data) & 0x00FF);
     81        return((*ptr->_bp++ = (int8_t)data) & 0x00FF);
    8282}
    8383
     
    134134                return(flush_(ptr, c & 0xFF));
    135135
    136         return((*ptr->_bp++ = c) & 0xFF);
     136        return((*ptr->_bp++ = (int8_t)c) & 0xFF);
    137137}
    138138
  • libcio/putl.c

    r7d0d347 r8973acd  
    1212void putl(int32_t w, FILE *stream)
    1313{
    14         if (putc(((w >> 24) & 0xFF), stream) < 0 )
     14        if (putc(((int16_t)(w >> 24) & 0xFF), stream) < 0)
    1515                return;
    1616
    17         if (putc(((w >> 16) & 0xFF), stream) < 0 )
     17        if (putc((int16_t)((w >> 16) & 0xFF), stream) < 0)
    1818                return;
    1919
    20         if (putc(((w >> 8) & 0xFF), stream) < 0 )
     20        if (putc((int16_t)((w >> 8) & 0xFF), stream) < 0)
    2121                return;
    2222
  • libcio/putw.c

    r7d0d347 r8973acd  
    1010#include "ram.h"
    1111
    12 void putw(uint16_t w, FILE *stream)
     12void putw(int32_t w, FILE *stream)
    1313{
    1414        if (putc(((w >> 8) & 0xFF), stream) < 0 )
  • libcio/putw.x

    r7d0d347 r8973acd  
    1616*/
    1717
    18 extern  void            putw(uint16_t w, FILE *stream);
     18extern  void            putw(int32_t w, FILE *stream);
  • libcio/read.c

    r7d0d347 r8973acd  
    3838#include "ram.h"
    3939
    40 static int16_t (*t_read[])(io_arg arg, int8_t *buff, int16_t len) = {
     40static int16_t (*t_read[])(io_arg arg, void *buff, int16_t len) = {
    4141
    4242        _badfio,        /* 0 - invalid type */
     
    5252*/
    5353
    54 int16_t read(int16_t fd, int8_t *buff, uint16_t len)
     54int16_t read(int16_t fd, void *buff, int16_t len)
    5555{
    5656        register struct channel *chp;
     
    7373*/
    7474
    75 int16_t _getsec(struct fcb *fp, int8_t *buf, uint16_t len)
     75int16_t _getsec(struct fcb *fp, void *buf, int16_t len)
    7676{
    7777        if ((errno = ReadRN(fp, Wrkbuf)) NE 0)  /* get current sector */
     
    9898*/
    9999
    100 int16_t _filerd(struct fcb *fp, int8_t *buffer, uint16_t len)
     100int16_t _filerd(io_arg arg, void *buffer, int16_t len)
    101101{
    102         register uint16_t l;
    103         register uint16_t j, k;
    104         register int32_t curpos, newpos;
     102        struct fcb *fp;
     103        int8_t *buffer8;
     104        register int16_t l;
     105        register int16_t j, k;
     106        register int32_t cpos, npos;
     107
     108        fp = (struct fcb *)arg;
     109        buffer8 = buffer;
    105110
    106111        l = 0;
    107         curpos = fp->offset + (fp->curlsn << FILESHFT);
    108         newpos = curpos + len;
     112        cpos = fp->offset + ((int32_t)fp->curlsn << FILESHFT);
     113        npos = cpos + len;
    109114
    110115#if     DEBUGIT
    111116        if (fsdebug)
    112117                printf("_filerd():  len=%u, curpos=%ld, newpos=%ld, curlen=%ld\n",
    113                         len, curpos, newpos, fp->curlen);
     118                        len, cpos, npos, fp->curlen);
    114119#endif
    115120
    116         if (newpos GT fp->curlen) {
     121        if (npos GT fp->curlen) {
    117122
    118                 len = fp->curlen - curpos;
     123                len = (int16_t)(fp->curlen - cpos);
    119124
    120125#if     DEBUGIT
     
    129134                        l = len;
    130135
    131                 if (_getsec(fp, buffer, l))     /* read what we can */
     136                if (_getsec(fp, buffer8, l))    /* read what we can */
    132137                        return(len);    /* return if ERROR */
    133138        }
    134139
    135         if (k = (len - l) / BPSEC)              /* see what we still need */
    136                         if ((j = blkrd(fp, buffer + l, k)) NE 0)
     140        if ((k = (len - l) / BPSEC)) {          /* see what we still need */
     141                if ((j = blkrd(fp, buffer8 + l, k)) NE 0)
    137142                        return((k - j) * BPSEC + l);    /* return bytes read */
     143        }
    138144
    139145        l += k * BPSEC;                 /* adjust l by what we just read */
    140146
    141147        if (l < len)    /* see if we still need a partial sector */
    142                 if (_getsec(fp, buffer + l, len - l))   /* read partial sector */
     148                if (_getsec(fp, buffer8 + l, len - l))  /* read partial sector */
    143149                        return(l);              /* return if ERROR or EOF */
    144150
  • libcio/read.x

    r7d0d347 r8973acd  
    88
    99#include "biosdefs.h"
     10#include "fspars.h"
    1011#include "stdint.h"
    1112
     
    1617*/
    1718
    18 extern  int16_t         _filerd(struct fcb *fp, int8_t *buffer, uint16_t len);
    19 extern  int16_t         _getsec(struct fcb *fp, int8_t *buf, uint16_t len);
    20 extern  int16_t         read(int16_t fd, int8_t *buff, uint16_t len);
     19extern  int16_t         _filerd(io_arg arg, void *buffer, int16_t len);
     20extern  int16_t         _getsec(struct fcb *fp, void *buf, int16_t len);
     21extern  int16_t         read(int16_t fd, void *buff, int16_t len);
  • libcio/readrn.c

    r7d0d347 r8973acd  
    3030        int32_t brc;            /* bios return code */
    3131
    32         if (sv = _seek(fcp))            /* try to find the sector we want */
     32        if ((sv = _seek(fcp))) {                /* try to find the sector we want */
    3333                if (sv < 0) {
    3434
     
    4141                        return(1);              /* return:  EOF */
    4242                }
     43        }
    4344
    4445#if     DEBUGIT
     
    4950
    5051#if     TBUFFER
    51         if (brc = _secrd(buf, (int16_t)fcp->curdsn)) {
     52        if ((brc = _secrd(buf, (int16_t)fcp->curdsn))) {
    5253#else
    5354        if (brc = BIOS(B_RDWR, 0, buf, 1, (short)fcp->curdsn, 0)) {
  • libcio/scan.c

    r7d0d347 r8973acd  
    3838        while (maxwide--) {
    3939
    40                 if ((cp = index(list, (*gsub)(0))) EQ NULL) {
     40                if ((cp = index(list, (int8_t)(*gsub)(0))) EQ NULL) {
    4141
    4242                        (*gsub)(1);
     
    106106        gsub = getsub;
    107107
    108         while (c = *fmt++) {
     108        while ((c = *fmt++)) {
    109109
    110110                if (c EQ '%') {
     
    180180                                                *(int32_t *)(*args++) = lv;
    181181                                        else
    182                                                 **args++ = lv;
     182                                                **args++ = (int16_t)lv;
    183183                                        ++count;
    184184                                }
     
    220220
    221221                                for (cp = tlist ; (c = *fmt++) != ']' ; )
    222                                         *cp++ = c;
     222                                        *cp++ = (int8_t)c;
    223223
    224224                                *cp = 0;
     
    236236
    237237                                if (!dontdo)
    238                                         cp = *args++;
     238                                        cp = (int8_t *)*args++;
     239                                else
     240                                        cp = NULL;      /* fix compiler warning */
    239241
    240242                                while (maxwide--) {
     
    244246
    245247                                        if (lflag ?
    246                                              (index(tlist, c) NE 0) :
    247                                              (index(tlist, c) EQ 0)) {
     248                                             (index(tlist, (int8_t)c) NE 0) :
     249                                             (index(tlist, (int8_t)c) EQ 0)) {
    248250
    249251                                                (*gsub)(1);     /* unget last character */
     
    252254
    253255                                        if (!dontdo)
    254                                                 *cp++ = c;
     256                                                *cp++ = (int8_t)c;
    255257                                }
    256258
     
    269271                                if (!dontdo) {
    270272
    271                                         *(int8_t *)(*args++) = c;
     273                                        *(int8_t *)(*args++) = (int8_t)c;
    272274                                        ++count;
    273275                                }
  • libcio/ungetc.c

    r7d0d347 r8973acd  
    1313                return(EOF);
    1414
    15         *--ptr->_bp = c;
     15        *--ptr->_bp = (int8_t)c;
    1616
    1717        return(c);
  • libcio/write.c

    r7d0d347 r8973acd  
    1212/* write routine dispatch table */
    1313
    14 static  int16_t (*wr_tab[])(io_arg arg, int8_t *buff, int16_t len) = {
     14static  int16_t (*wr_tab[])(io_arg arg, void *buff, int16_t len) = {
    1515
    1616        _badfio,        /* 0 - invalid entry */
     
    2525*/
    2626
    27 int16_t _putsec(struct fcb *fp, int8_t *buf, uint16_t len)
     27int16_t _putsec(struct fcb *fp, void *buf, int16_t len)
    2828{
    2929#if DEBUGIT
     
    9292*/
    9393
    94 int16_t _filewr(struct fcb *fp, int8_t *buffer, uint16_t len)
     94int16_t _filewr(io_arg arg, void *buffer, int16_t len)
    9595{
    96         register uint16_t j, k, l;
     96        struct fcb *fp;
     97        int8_t *buffer8;
     98        register int16_t j, k, l;
    9799        int16_t clustr;
    98         register int32_t curpos;
    99 
    100         curpos = fp->offset + (fp->curlsn << FILESHFT); /* get position */
     100        register int32_t cpos;
     101
     102        fp = (struct fcb *)arg;
     103        buffer8 = buffer;
     104
     105        cpos = fp->offset + ((int32_t)fp->curlsn << FILESHFT);  /* get position */
    101106
    102107        if (fp->de.bclust EQ 0) {       /* see if we need to allocate */
     
    104109#if DEBUGIT
    105110        if (fsdebug)
    106                 if (curpos)
     111                if (cpos)
    107112                        printf("_filewr():  ERROR - bclust EQ 0 and curpos (%ld) NE 0\n",
    108                                 curpos);
     113                                cpos);
    109114#endif
    110115
     
    115120                }
    116121
    117                 fp->de.bclust = micons(clustr);         /* update FCB */
     122                fp->de.bclust = micon16((uint16_t)clustr);      /* update FCB */
    118123                _ptcl12(_thefat, clustr, 0x0FF8);       /* update FAT */
    119124                _fatmod = TRUE;
     
    137142        if (fsdebug)
    138143                printf("_filewr():  init pos=%ld, len=%u, curcls=%u, offset=%u\n",
    139                         curpos, len, fp->curcls, fp->offset);
     144                        cpos, len, fp->curcls, fp->offset);
    140145#endif
    141146
     
    145150                        l = len;
    146151
    147                 if (_putsec(fp, buffer, l))     /* fill up the sector */
     152                if (_putsec(fp, buffer8, l))    /* fill up the sector */
    148153                        return(-1);
    149154        }
    150155
    151         if (k = (len - l) / BPSEC) {    /* write out any full sectors */
    152 
    153                 if ((j = blkwr(fp, buffer + l, k)) NE 0) {
     156        if ((k = (len - l) / BPSEC)) {  /* write out any full sectors */
     157
     158                if ((j = blkwr(fp, buffer8 + l, k)) NE 0) {
    154159
    155160                        l += (k - j) * BPSEC;   /* update amount written */
    156161
    157                         if ((curpos + l) > fp->curlen)  /* udpate file length */
    158                                 fp->de.flen = miconl(fp->curlen = curpos + l);
     162                        if ((cpos + l) > fp->curlen)    /* udpate file length */
     163                                fp->de.flen = micon32((uint32_t)(fp->curlen = cpos + l));
    159164
    160165#if DEBUGIT
     
    172177        if (l < len) {                  /* write out partial sector at end */
    173178
    174                 if (_putsec(fp, buffer + l, len - l)) {
    175 
    176                         if ((curpos + l) > fp->curlen)  /* update file length */
    177                                 fp->de.flen = miconl(fp->curlen = curpos + l);
     179                if (_putsec(fp, buffer8 + l, len - l)) {
     180
     181                        if ((cpos + l) > fp->curlen)    /* update file length */
     182                                fp->de.flen = micon32((uint32_t)(fp->curlen = cpos + l));
    178183
    179184#if DEBUGIT
     
    187192        }
    188193
    189         if ((curpos + len) > fp->curlen)                /* update file length */
    190                 fp->de.flen = miconl(fp->curlen = curpos + len);
     194        if ((cpos + len) > fp->curlen)          /* update file length */
     195                fp->de.flen = micon32((uint32_t)(fp->curlen = cpos + len));
    191196
    192197#if DEBUGIT
     
    205210*/
    206211
    207 int16_t write(int16_t fd, int8_t *buff, uint16_t len)
     212int16_t write(int16_t fd, void *buff, int16_t len)
    208213{
    209214        register struct channel *chp;
  • libcio/write.x

    r7d0d347 r8973acd  
    88
    99#include "biosdefs.h"
     10#include "fspars.h"
    1011#include "stdint.h"
    1112
     
    1617*/
    1718
    18 extern  int16_t         _filewr(struct fcb *fp, int8_t *buffer, uint16_t len);
    19 extern  int16_t         _putsec(struct fcb *fp, int8_t *buf, uint16_t len);
    20 extern  int16_t         write(int16_t fd, int8_t *buff, uint16_t len);
     19extern  int16_t         _filewr(io_arg arg, void *buffer, int16_t len);
     20extern  int16_t         _putsec(struct fcb *fp, void *buf, int16_t len);
     21extern  int16_t         write(int16_t fd, void *buff, int16_t len);
  • libcio/writern.c

    r7d0d347 r8973acd  
    3030        int32_t brc;            /* bios return code */
    3131
    32         if (sv = _seek(fcp)) {          /* try to find the sector we want */
     32        if ((sv = _seek(fcp))) {                /* try to find the sector we want */
    3333
    3434                if (sv < 0) {                   /* seek error ? */
     
    6767        /* write the sector */
    6868
    69         if (brc = BIOS(B_RDWR, 1, buf, 1, (int16_t)fcp->curdsn, 0)) {
     69        if ((brc = BIOS(B_RDWR, 1, buf, 1, (int16_t)fcp->curdsn, 0))) {
    7070
    7171#if DEBUGIT
Note: See TracChangeset for help on using the changeset viewer.