Changeset b7fd2a0 in mainline for uspace/srv/audio/hound/hound_ctx.c


Ignore:
Timestamp:
2018-01-13T03:10:29Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a53ed3a
Parents:
36f0738
Message:

Use errno_t in all uspace and kernel code.

Change type of every variable, parameter and return value that holds an
<errno.h> constant to either errno_t (the usual case), or sys_errno_t
(some places in kernel). This is for the purpose of self-documentation,
as well as for type-checking with a bit of type definition hackery.

Although this is a massive commit, it is a simple text replacement, and thus
is very easy to verify. Simply do the following:

`
git checkout <this commit's hash>
git reset HEAD
git add .
tools/srepl '\berrno_t\b' int
git add .
tools/srepl '\bsys_errno_t\b' sysarg_t
git reset
git diff
`

While this doesn't ensure that the replacements are correct, it does ensure
that the commit doesn't do anything except those replacements. Since errno_t
is typedef'd to int in the usual case (and sys_errno_t to sysarg_t), even if
incorrect, this commit cannot change behavior.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/audio/hound/hound_ctx.c

    r36f0738 rb7fd2a0  
    4545#include "log.h"
    4646
    47 static int update_data(audio_source_t *source, size_t size);
    48 static int new_data(audio_sink_t *sink);
     47static errno_t update_data(audio_source_t *source, size_t size);
     48static errno_t new_data(audio_sink_t *sink);
    4949
    5050/**
     
    6868                        return NULL;
    6969                }
    70                 const int ret = audio_sink_init(ctx->sink, name, ctx, NULL,
     70                const errno_t ret = audio_sink_init(ctx->sink, name, ctx, NULL,
    7171                    NULL, new_data, &AUDIO_FORMAT_DEFAULT);
    7272                if (ret != EOK) {
     
    9999                        return NULL;
    100100                }
    101                 const int ret = audio_source_init(ctx->source, name, ctx, NULL,
     101                const errno_t ret = audio_source_init(ctx->source, name, ctx, NULL,
    102102                    update_data, &AUDIO_FORMAT_DEFAULT);
    103103                if (ret != EOK) {
     
    199199 * @return Error code.
    200200 */
    201 static int stream_push_data(hound_ctx_stream_t *stream, audio_data_t *adata)
     201static errno_t stream_push_data(hound_ctx_stream_t *stream, audio_data_t *adata)
    202202{
    203203        assert(stream);
     
    216216        }
    217217
    218         const int ret = audio_pipe_push(&stream->fifo, adata);
     218        const errno_t ret = audio_pipe_push(&stream->fifo, adata);
    219219        fibril_mutex_unlock(&stream->guard);
    220220        if (ret == EOK)
     
    297297 * @return Error code.
    298298 */
    299 int hound_ctx_stream_write(hound_ctx_stream_t *stream, const void *data,
     299errno_t hound_ctx_stream_write(hound_ctx_stream_t *stream, const void *data,
    300300    size_t size)
    301301{
     
    312312        }
    313313
    314         const int ret =
     314        const errno_t ret =
    315315            audio_pipe_push_data(&stream->fifo, data, size, stream->format);
    316316        fibril_mutex_unlock(&stream->guard);
     
    327327 * @return Error code.
    328328 */
    329 int hound_ctx_stream_read(hound_ctx_stream_t *stream, void *data, size_t size)
     329errno_t hound_ctx_stream_read(hound_ctx_stream_t *stream, void *data, size_t size)
    330330{
    331331        assert(stream);
     
    391391 * Mixes data from all streams and pushes it to all connections.
    392392 */
    393 int update_data(audio_source_t *source, size_t size)
     393errno_t update_data(audio_source_t *source, size_t size)
    394394{
    395395        assert(source);
     
    425425}
    426426
    427 int new_data(audio_sink_t *sink)
     427errno_t new_data(audio_sink_t *sink)
    428428{
    429429        assert(sink);
     
    463463        /* push to all streams */
    464464        list_foreach(ctx->streams, link, hound_ctx_stream_t, stream) {
    465                 const int ret = stream_push_data(stream, adata);
     465                const errno_t ret = stream_push_data(stream, adata);
    466466                if (ret != EOK)
    467467                        log_error("Failed to push data to stream: %s",
Note: See TracChangeset for help on using the changeset viewer.