Changeset 0ee3157 in mainline


Ignore:
Timestamp:
2020-09-18T23:09:04Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
003c413
Parents:
d53af3c8
Message:

Use errno_t for error values in libriff

Location:
uspace/lib/riff
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/riff/include/riff/chunk.h

    rd53af3c8 r0ee3157  
    3737#define RIFF_CHUNK_H
    3838
     39#include <errno.h>
    3940#include <stddef.h>
    4041#include <types/riff/chunk.h>
    4142
    42 extern int riff_wopen(const char *, riffw_t **);
    43 extern int riff_wclose(riffw_t *);
    44 extern int riff_wchunk_start(riffw_t *, riff_ckid_t, riff_wchunk_t *);
    45 extern int riff_wchunk_end(riffw_t *, riff_wchunk_t *);
    46 extern int riff_wchunk_write(riffw_t *, void *, size_t);
    47 extern int riff_write_uint32(riffw_t *, uint32_t);
     43extern errno_t riff_wopen(const char *, riffw_t **);
     44extern errno_t riff_wclose(riffw_t *);
     45extern errno_t riff_wchunk_start(riffw_t *, riff_ckid_t, riff_wchunk_t *);
     46extern errno_t riff_wchunk_end(riffw_t *, riff_wchunk_t *);
     47extern errno_t riff_wchunk_write(riffw_t *, void *, size_t);
     48extern errno_t riff_write_uint32(riffw_t *, uint32_t);
    4849
    49 extern int riff_ropen(const char *, riffr_t **);
    50 extern int riff_rclose(riffr_t *);
    51 extern int riff_read_uint32(riffr_t *, uint32_t *);
    52 extern int riff_rchunk_start(riffr_t *, riff_rchunk_t *);
    53 extern int riff_rchunk_end(riffr_t *, riff_rchunk_t *);
    54 extern int riff_rchunk_read(riffr_t *, riff_rchunk_t *, void *, size_t,
     50extern errno_t riff_ropen(const char *, riffr_t **);
     51extern errno_t riff_rclose(riffr_t *);
     52extern errno_t riff_read_uint32(riffr_t *, uint32_t *);
     53extern errno_t riff_rchunk_start(riffr_t *, riff_rchunk_t *);
     54extern errno_t riff_rchunk_end(riffr_t *, riff_rchunk_t *);
     55extern errno_t riff_rchunk_read(riffr_t *, riff_rchunk_t *, void *, size_t,
    5556    size_t *);
    5657
  • uspace/lib/riff/include/riff/rwave.h

    rd53af3c8 r0ee3157  
    3737#define RIFF_WAVE_H
    3838
     39#include <errno.h>
    3940#include <types/riff/rwave.h>
    4041
    41 extern int rwave_wopen(const char *, rwave_params_t *params, rwavew_t **);
    42 extern int rwave_write_samples(rwavew_t *, void *, size_t);
    43 extern int rwave_wclose(rwavew_t *);
     42extern errno_t rwave_wopen(const char *, rwave_params_t *params, rwavew_t **);
     43extern errno_t rwave_write_samples(rwavew_t *, void *, size_t);
     44extern errno_t rwave_wclose(rwavew_t *);
    4445
    45 extern int rwave_ropen(const char *, rwave_params_t *params, rwaver_t **);
    46 extern int rwave_read_samples(rwaver_t *, void *, size_t, size_t *);
    47 extern int rwave_rclose(rwaver_t *);
     46extern errno_t rwave_ropen(const char *, rwave_params_t *params, rwaver_t **);
     47extern errno_t rwave_read_samples(rwaver_t *, void *, size_t, size_t *);
     48extern errno_t rwave_rclose(rwaver_t *);
    4849
    4950#endif
  • uspace/lib/riff/src/chunk.c

    rd53af3c8 r0ee3157  
    4949 *         file.
    5050 */
    51 int riff_wopen(const char *fname, riffw_t **rrw)
     51errno_t riff_wopen(const char *fname, riffw_t **rrw)
    5252{
    5353        riffw_t *rw;
     
    7373 *         is destroyed anyway.
    7474 */
    75 int riff_wclose(riffw_t *rw)
     75errno_t riff_wclose(riffw_t *rw)
    7676{
    7777        int rv;
     
    8989 * @return EOK on success, EIO on error.
    9090 */
    91 int riff_write_uint32(riffw_t *rw, uint32_t v)
     91errno_t riff_write_uint32(riffw_t *rw, uint32_t v)
    9292{
    9393        uint32_t vle;
     
    108108 * @return EOK on success, EIO on write error
    109109 */
    110 int riff_wchunk_start(riffw_t *rw, riff_ckid_t ckid, riff_wchunk_t *wchunk)
     110errno_t riff_wchunk_start(riffw_t *rw, riff_ckid_t ckid, riff_wchunk_t *wchunk)
    111111{
    112112        long pos;
    113         int rc;
     113        errno_t rc;
    114114
    115115        pos = ftell(rw->f);
     
    141141 * @return EOK on success, EIO error.
    142142 */
    143 int riff_wchunk_end(riffw_t *rw, riff_wchunk_t *wchunk)
     143errno_t riff_wchunk_end(riffw_t *rw, riff_wchunk_t *wchunk)
    144144{
    145145        long pos;
    146146        long cksize;
    147         int rc;
     147        errno_t rc;
    148148
    149149        pos = ftell(rw->f);
     
    176176 * @return EOK on success, EIO on error.
    177177 */
    178 int riff_wchunk_write(riffw_t *rw, void *data, size_t bytes)
     178errno_t riff_wchunk_write(riffw_t *rw, void *data, size_t bytes)
    179179{
    180180        size_t nw;
     
    195195 *         file..
    196196 */
    197 int riff_ropen(const char *fname, riffr_t **rrr)
     197errno_t riff_ropen(const char *fname, riffr_t **rrr)
    198198{
    199199        riffr_t *rr;
    200         int rc;
     200        errno_t rc;
    201201
    202202        rr = calloc(1, sizeof(riffr_t));
     
    226226 * @return EOK on success, EIO on error.
    227227 */
    228 int riff_rclose(riffr_t *rr)
    229 {
    230         int rc;
     228errno_t riff_rclose(riffr_t *rr)
     229{
     230        errno_t rc;
    231231
    232232        rc = fclose(rr->f);
     
    241241 * @return EOK on success, EIO on error.
    242242 */
    243 int riff_read_uint32(riffr_t *rr, uint32_t *v)
     243errno_t riff_read_uint32(riffr_t *rr, uint32_t *v)
    244244{
    245245        uint32_t vle;
     
    259259 * @return EOK on success, EIO on error.
    260260 */
    261 int riff_rchunk_start(riffr_t *rr, riff_rchunk_t *rchunk)
    262 {
    263         int rc;
     261errno_t riff_rchunk_start(riffr_t *rr, riff_rchunk_t *rchunk)
     262{
     263        errno_t rc;
    264264        long pos;
    265265
     
    317317 * @return EOK on success, EIO on error.
    318318 */
    319 int riff_rchunk_end(riffr_t *rr, riff_rchunk_t *rchunk)
     319errno_t riff_rchunk_end(riffr_t *rr, riff_rchunk_t *rchunk)
    320320{
    321321        long ckend;
     
    343343 *         EIO on I/O error.
    344344 */
    345 int riff_rchunk_read(riffr_t *rr, riff_rchunk_t *rchunk, void *buf,
     345errno_t riff_rchunk_read(riffr_t *rr, riff_rchunk_t *rchunk, void *buf,
    346346    size_t bytes, size_t *nread)
    347347{
  • uspace/lib/riff/src/rwave.c

    rd53af3c8 r0ee3157  
    9494 * @return EOK on success, EIO on I/O error, ENOMEM if out of memory.
    9595 */
    96 int rwave_wopen(const char *fname, rwave_params_t *params, rwavew_t **rww)
     96errno_t rwave_wopen(const char *fname, rwave_params_t *params, rwavew_t **rww)
    9797{
    9898        riff_wchunk_t fmt;
    9999        rwave_fmt_t rwfmt;
    100         int rc;
     100        errno_t rc;
    101101        rwavew_t *ww;
    102102
     
    169169 *         not supported.
    170170 */
    171 int rwave_write_samples(rwavew_t *ww, void *data, size_t bytes)
     171errno_t rwave_write_samples(rwavew_t *ww, void *data, size_t bytes)
    172172{
    173173        size_t i;
    174174        uint16_t *d16, *b16;
    175175        size_t now;
    176         int rc;
     176        errno_t rc;
    177177
    178178        /* Convert sample data to little endian */
     
    215215 *         anyway.
    216216 */
    217 int rwave_wclose(rwavew_t *ww)
    218 {
    219         int rc;
     217errno_t rwave_wclose(rwavew_t *ww)
     218{
     219        errno_t rc;
    220220
    221221        rc = riff_wchunk_end(ww->rw, &ww->wave);
     
    240240 * @return EOK on success, EIO on I/O error, ENOMEM if out of memory
    241241 */
    242 int rwave_ropen(const char *fname, rwave_params_t *params, rwaver_t **rwr)
     242errno_t rwave_ropen(const char *fname, rwave_params_t *params, rwaver_t **rwr)
    243243{
    244244        rwaver_t *wr = NULL;
     
    247247        rwave_fmt_t wfmt;
    248248        size_t nread;
    249         int rc;
     249        errno_t rc;
    250250
    251251        wr = calloc(1, sizeof(rwaver_t));
     
    349349 *         EIO on I/O error.
    350350 */
    351 int rwave_read_samples(rwaver_t *wr, void *buf, size_t bytes, size_t *nread)
    352 {
    353         int rc;
     351errno_t rwave_read_samples(rwaver_t *wr, void *buf, size_t bytes, size_t *nread)
     352{
     353        errno_t rc;
    354354
    355355        rc = riff_rchunk_read(wr->rr, &wr->data, buf, bytes, nread);
     
    369369 *         anyway.
    370370 */
    371 int rwave_rclose(rwaver_t *wr)
    372 {
    373         int rc;
     371errno_t rwave_rclose(rwaver_t *wr)
     372{
     373        errno_t rc;
    374374
    375375        rc = riff_rchunk_end(wr->rr, &wr->wave);
Note: See TracChangeset for help on using the changeset viewer.