matusnovak/doxybook2

Array in function signature have disappeared

Closed this issue · 3 comments

I have this c++ code:

template <size_t KeySize, size_t SharesCount, size_t Participant>
struct SSS
{
    /** Join the Participant's share into the secret key 
        @param shares       A pointer to Participant's ShareKey
        @param shareIndices An array of Participant's indices containing the shares indices of the given shares 
        @param secret       The secret to combine */
    static void joinShares(const ShareKey * shares, const uint8 shareIndices[Participant], ShareKey secret);
};

In C++, specifying the array size in function parameter is only informative if using T a[n] (it's not if taking a reference like in T &a [n]). Yet, the parameter type is T [] (or at least T*) and not T.

Doxygen generates:

      <memberdef kind="function" id="struct_s_s_s_1a0759d7d268c6ad79d78ba899fc1e4ac3" prot="public" static="yes" const="no" explicit="no" inline="yes" virt="non-virtual">
        <type>void</type>
        <definition>static void SSS&lt; KeySize, SharesCount, Participant &gt;::joinShares</definition>
        <argsstring>(const ShareKey *shares, const uint8 shareIndices[Participant], ShareKey secret)</argsstring>
        <name>joinShares</name>
        <param>
          <type>const <ref refid="struct_s_s_s_1a8ed3e0c52c6cc96cfa7d680d60c9619d" kindref="member">ShareKey</ref> *</type>
          <declname>shares</declname>
        </param>
        <param>
          <type>const uint8</type>
          <declname>shareIndices</declname>
          <array>[Participant]</array>
        </param>
        <param>
          <type><ref refid="struct_s_s_s_1a8ed3e0c52c6cc96cfa7d680d60c9619d" kindref="member">ShareKey</ref></type>
          <declname>secret</declname>
        </param>
        <briefdescription>
<para>Join the Participant&apos;s share into the secret key. </para>        </briefdescription>
        <detaileddescription>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>shares</parametername>
</parameternamelist>
<parameterdescription>
<para>A pointer to Participant&apos;s ShareKey </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>shareIndices</parametername>
</parameternamelist>
<parameterdescription>
<para>An array of Participant&apos;s indices containing the shares indices of the given shares </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>secret</parametername>
</parameternamelist>
<parameterdescription>
<para>The secret to combine </para></parameterdescription>
</parameteritem>
</parameterlist>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="main/SSS.hpp" line="129" column="1" bodyfile="main/SSS.hpp" bodystart="129" bodyend="143"/>
      </memberdef>

(see argstring which contains the [] part for parameter shareIndices)
Yet, doxybook2 generates:

## Public Static Functions

| Type | Name |
| ---: | :--- |
|  void | [**joinShares**](struct_s_s_s.md#function-joinshares) (const [**ShareKey**](struct_s_s_s.md#typedef-sharekey) \* shares, const uint8 shareIndices, [**ShareKey**](struct_s_s_s.md#typedef-sharekey) secret) <br>_Join the Participant's share into the secret key._  |
[...]
### function joinShares


```cpp
static inline void SSS::joinShares (
    const ShareKey * shares,
    const uint8 shareIndices,
    ShareKey secret
)

None of the shareIndices contains an array anymore which completely changes the signature of the function.

Hi @X-Ryl669

Thanks for the detailed XML and an example. I have fixed this issue and released a new version as releases/tag/v1.0.5

Sample code: blob/master/example/src/Audio/AudioBuffer.hpp#L113-L114

Sample output:

2020-04-02 18_43_18-Document

Thanks!
In the given example, there's an error in the code, with void setData(const TypedAudioData[] data, size_t size); that should read void setData(const TypedAudioData data[], size_t size); in C++.

Oh, right. I haven't noticed that. Thanks!