Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/riff/src/chunk.c

    r20667af rbad765a  
    146146        long pos;
    147147        long cksize;
     148        uint8_t pad;
     149        size_t nw;
    148150        errno_t rc;
    149151
     
    153155
    154156        cksize = pos - wchunk->ckstart;
    155         if (pos % 2 != 0)
     157        if (pos % 2 != 0) {
    156158                ++pos;
     159                pad = 0;
     160                nw = fwrite(&pad, 1, sizeof(pad), rw->f);
     161                if (nw != sizeof(pad))
     162                        return EIO;
     163        }
    157164
    158165        if (fseek(rw->f, wchunk->ckstart - 4, SEEK_SET) < 0)
     
    476483        uint8_t byte;
    477484        size_t nread;
    478         errno_t rc;
    479485
    480486        ckend = riff_rchunk_get_ndpos(rchunk);
     
    483489                /* (Buffered) reading is faster than seeking */
    484490                while (rchunk->riffr->pos < ckend) {
    485                         rc = riff_read(rchunk, &byte, sizeof(byte), &nread);
    486                         if (rc != EOK)
    487                                 return rc;
    488 
     491                        nread = fread(&byte, 1, sizeof(byte), rchunk->riffr->f);
    489492                        if (nread != sizeof(byte))
    490493                                return EIO;
     494
     495                        rchunk->riffr->pos += sizeof(byte);
    491496                }
    492497
     
    495500                if (fseek(rchunk->riffr->f, ckend, SEEK_SET) < 0)
    496501                        return EIO;
     502
    497503                rchunk->riffr->pos = ckend;
    498504        }
Note: See TracChangeset for help on using the changeset viewer.