Changeset 46577995 in mainline for uspace/lib/hound/src/client.c


Ignore:
Timestamp:
2018-01-04T20:50:52Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
e211ea04
Parents:
facacc71
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-04 20:47:53)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-04 20:50:52)
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.

After this commit, HelenOS is free of code that mixes error codes with non-error
values on the assumption that error codes are negative.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/hound/src/client.c

    rfacacc71 r46577995  
    123123                        return NULL;
    124124                }
    125                 int rc = hound_service_register_context(
     125                errno_t rc = hound_service_register_context(
    126126                    new_context->session, new_context->name, record,
    127127                    &new_context->id);
     
    195195 * The function will return deice sinks or source based on the context type.
    196196 */
    197 int hound_context_get_available_targets(hound_context_t *hound,
     197errno_t hound_context_get_available_targets(hound_context_t *hound,
    198198    const char ***names, size_t *count)
    199199{
     
    212212 * @return Error code.
    213213 */
    214 int hound_context_get_connected_targets(hound_context_t *hound,
     214errno_t hound_context_get_connected_targets(hound_context_t *hound,
    215215    const char ***names, size_t *count)
    216216{
     
    232232 * connect to the first possible target if it is passed this value.
    233233 */
    234 int hound_context_connect_target(hound_context_t *hound, const char* target)
     234errno_t hound_context_connect_target(hound_context_t *hound, const char* target)
    235235{
    236236        assert(hound);
     
    239239        const char **tgt = NULL;
    240240        size_t count = 1;
    241         int ret = EOK;
     241        errno_t ret = EOK;
    242242        if (str_cmp(target, HOUND_DEFAULT_TARGET) == 0) {
    243243                ret = hound_context_get_available_targets(hound, &tgt, &count);
     
    269269 * @return Error code.
    270270 */
    271 int hound_context_disconnect_target(hound_context_t *hound, const char* target)
     271errno_t hound_context_disconnect_target(hound_context_t *hound, const char* target)
    272272{
    273273        assert(hound);
     
    305305                new_stream->context = hound;
    306306                new_stream->flags = flags;
    307                 const int ret = hound_service_stream_enter(new_stream->exch,
     307                const errno_t ret = hound_service_stream_enter(new_stream->exch,
    308308                    hound->id, flags, format, bsize);
    309309                if (ret != EOK) {
     
    343343 * @return error code.
    344344 */
    345 int hound_stream_write(hound_stream_t *stream, const void *data, size_t size)
     345errno_t hound_stream_write(hound_stream_t *stream, const void *data, size_t size)
    346346{
    347347        assert(stream);
     
    358358 * @return error code.
    359359 */
    360 int hound_stream_read(hound_stream_t *stream, void *data, size_t size)
     360errno_t hound_stream_read(hound_stream_t *stream, void *data, size_t size)
    361361{
    362362        assert(stream);
     
    371371 * @return Error code.
    372372 */
    373 int hound_stream_drain(hound_stream_t *stream)
     373errno_t hound_stream_drain(hound_stream_t *stream)
    374374{
    375375        assert(stream);
     
    402402 * @return error code.
    403403 */
    404 int hound_write_main_stream(hound_context_t *hound,
     404errno_t hound_write_main_stream(hound_context_t *hound,
    405405    const void *data, size_t size)
    406406{
     
    422422 * @return error code.
    423423 */
    424 int hound_read_main_stream(hound_context_t *hound, void *data, size_t size)
     424errno_t hound_read_main_stream(hound_context_t *hound, void *data, size_t size)
    425425{
    426426        assert(hound);
     
    442442 * NOT IMPLEMENTED
    443443 */
    444 int hound_write_replace_main_stream(hound_context_t *hound,
     444errno_t hound_write_replace_main_stream(hound_context_t *hound,
    445445    const void *data, size_t size)
    446446{
     
    460460 * NOT IMPLEMENTED
    461461 */
    462 int hound_context_set_main_stream_params(hound_context_t *hound,
     462errno_t hound_context_set_main_stream_params(hound_context_t *hound,
    463463    pcm_format_t format, size_t bsize)
    464464{
     
    479479 * to drain and destroys it before returning.
    480480 */
    481 int hound_write_immediate(hound_context_t *hound, pcm_format_t format,
     481errno_t hound_write_immediate(hound_context_t *hound, pcm_format_t format,
    482482    const void *data, size_t size)
    483483{
     
    488488        if (!tmpstream)
    489489                return ENOMEM;
    490         const int ret = hound_stream_write(tmpstream, data, size);
     490        const errno_t ret = hound_stream_write(tmpstream, data, size);
    491491        if (ret == EOK) {
    492492                //TODO drain?
Note: See TracChangeset for help on using the changeset viewer.