Menu

Help to limitation for snd_ctl_elem_set_bytes

2018-10-03
2019-01-07
  • Park Jin Soo

    Park Jin Soo - 2018-10-03

    I’ve got very basic problems for this function, about snd_ctl_elem_set_bytes.
    I’m trying to write 512 bytes data using snd_ctl_elem_set_bytes functions.
    But it’s failed.

    /
    \brief Set values to given data as an element of bytes type.
    \param obj Data of an element.
    \param data Pointer for byte array.
    \param size The number of bytes included in the memory block.
    /
    void snd_ctl_elem_set_bytes(snd_ctl_elem_value_t
    obj, void *data, size_t size)
    {
    assert(obj);
    assert(size < ARRAY_SIZE(obj->value.bytes.data));
    memcpy(obj->value.bytes.data, data, size);
    }

    I know ARRAY_SIZE(obj->value.bytes.data) is 512.

    I know why the assert happened.
    But I want to know why the code blocked to use full size of data.
    And I want to write the 512 bytes data.

    So I think it should be assert(size < (ARRAY_SIZE(obj->value.bytes.data) + 1));.
    How do you think?

    I trying to check why it done like that, But there is no more description for this, please Help me.

     
  • Park Jin Soo

    Park Jin Soo - 2019-01-07

    Is there any progress?
    Or do I need to ask about this to another mail address?

    I think no-one care these pages.

     

Log in to post a comment.