Changeset 8973acd in buchla-68k for libcio/write.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/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;
Note: See TracChangeset for help on using the changeset viewer.