Changeset 904b1bc in mainline for uspace/lib/hound/src/protocol.c


Ignore:
Timestamp:
2018-05-22T10:36:58Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a4eb3ba2
Parents:
4f8772d4
git-author:
Jiri Svoboda <jiri@…> (2018-05-21 17:36:30)
git-committer:
Jiri Svoboda <jiri@…> (2018-05-22 10:36:58)
Message:

Fix remaining ccheck issues.

File:
1 edited

Legend:

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

    r4f8772d4 r904b1bc  
    7979
    8080
    81 /****
     81/*
    8282 * CLIENT
    83  ****/
     83 */
    8484
    8585/** Well defined service name */
     
    309309    int flags, pcm_format_t format, size_t bsize)
    310310{
    311         const format_convert_t c = { .f = {
    312                 .channels = format.channels,
    313                 .rate = format.sampling_rate / 100,
    314                 .format = format.sample_format,
    315         }};
     311        const format_convert_t c = {
     312                .f = {
     313                        .channels = format.channels,
     314                        .rate = format.sampling_rate / 100,
     315                        .format = format.sample_format,
     316                }
     317        };
     318
    316319        return async_req_4_0(exch, IPC_M_HOUND_STREAM_ENTER, CAP_HANDLE_RAW(id),
    317320            flags, c.arg, bsize);
     
    362365}
    363366
    364 /****
     367/*
    365368 * SERVER
    366  ****/
     369 */
    367370
    368371static void hound_server_read_data(void *stream);
     
    463466                        if (conn)
    464467                                ret = async_data_write_accept(
    465                                     (void**)&conn_name, true, 0, 0, 0, 0);
     468                                    (void **)&conn_name, true, 0, 0, 0, 0);
    466469
    467470                        if (ret == EOK)
     
    559562                case IPC_M_HOUND_STREAM_ENTER:
    560563                        /* check interface functions */
    561                         if (!server_iface || !server_iface->is_record_context
    562                             || !server_iface->add_stream
    563                             || !server_iface->rem_stream) {
     564                        if (!server_iface || !server_iface->is_record_context ||
     565                            !server_iface->add_stream ||
     566                            !server_iface->rem_stream) {
    564567                                async_answer_0(chandle, ENOTSUP);
    565568                                break;
     
    569572                        id = (cap_handle_t) IPC_GET_ARG1(call);
    570573                        flags = IPC_GET_ARG2(call);
    571                         const format_convert_t c = {.arg = IPC_GET_ARG3(call)};
     574                        const format_convert_t c = { .arg = IPC_GET_ARG3(call) };
    572575                        const pcm_format_t f = {
    573                             .sampling_rate = c.f.rate * 100,
    574                             .channels = c.f.channels,
    575                             .sample_format = c.f.format,
     576                                .sampling_rate = c.f.rate * 100,
     577                                .channels = c.f.channels,
     578                                .sample_format = c.f.format,
    576579                        };
    577580                        size_t bsize = IPC_GET_ARG4(call);
     
    587590                            server_iface->server, id);
    588591                        if (rec) {
    589                                 if(server_iface->stream_data_read) {
     592                                if (server_iface->stream_data_read) {
    590593                                        async_answer_0(chandle, EOK);
    591594                                        /* start answering read calls */
     
    631634        errno_t ret_answer = EOK;
    632635        /* accept data write or drain */
    633         while (async_data_write_receive_call(&chandle, &call, &size)
    634             || (IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_DRAIN)) {
     636        while (async_data_write_receive_call(&chandle, &call, &size) ||
     637            (IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_DRAIN)) {
    635638                /* check drain first */
    636639                if (IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_DRAIN) {
     
    660663                }
    661664        }
    662         const errno_t ret = IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_EXIT
    663             ? EOK : EINVAL;
     665        const errno_t ret = IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_EXIT ?
     666            EOK : EINVAL;
    664667
    665668        async_answer_0(chandle, ret);
     
    678681        errno_t ret_answer = EOK;
    679682        /* accept data read and drain */
    680         while (async_data_read_receive_call(&chandle, &call, &size)
    681             || (IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_DRAIN)) {
     683        while (async_data_read_receive_call(&chandle, &call, &size) ||
     684            (IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_DRAIN)) {
    682685                /* drain does not make much sense but it is allowed */
    683686                if (IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_DRAIN) {
     
    704707                }
    705708        }
    706         const errno_t ret = IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_EXIT
    707             ? EOK : EINVAL;
     709        const errno_t ret = IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_EXIT ?
     710            EOK : EINVAL;
    708711
    709712        async_answer_0(chandle, ret);
     
    711714
    712715
    713 /***
     716/*
    714717 * SERVER SIDE
    715  ***/
     718 */
    716719
    717720/**
Note: See TracChangeset for help on using the changeset viewer.