Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] What mean "Error: Found prohibited APIs in ..." error during

From: Pascal Quantin <pascal@xxxxxxxxxxxxx>
Date: Tue, 9 Feb 2021 09:24:14 +0100
Hi Jirka,

Le mar. 9 févr. 2021 à 09:13, Jirka Novak <j.novak@xxxxxxxxxxxx> a écrit :
Hi,

>>  I commited patch and pipeline failed because:
>>
>> ...
>> FAILED: ui/qt/CMakeFiles/checkAPI_ui-qt
>> ...
>> Error: Found prohibited APIs in utils/rtp_audio_silence_generator.cpp: open
>> Error: Found prohibited APIs in utils/rtp_audio_routing_filter.cpp: open
>>
>>  but message gives me no hint what to change.
>
> Change calls to open() to call ws_open(), instead, so that, on Windows, they can handle UTF-8 pathnames (by turning them into UTF-16 pathnames and passing them to routines that take UTF-16 pathnames, rather than using various code page encodings for strings).
>
> Also use ws_close() instead of close().  (The ws_ calls, on Windows, also call the Visual Studio C library routines that implement UN*X-style APIs, with an underscore preceding the UN*X API name.)

Thank you for explanation and I understand the reasons, but I don't
think it is possible in this case. Classes extending QIODevice where
open/close are parent methods I must call/override.
It looks that it is false positive check. Is there any way how to add
exception to check in this case?

THere is already some code in checkAPIs.pl file to identify false positives:

                # Match function calls, but ignore false positives from:
                # C++ method definition: int MyClass::open(...)
                # Method invocation: myClass->open(...);
                # Function declaration: int open(...);
                # Method invocation: QString().sprintf(...)
                while (${$fileContentsRef} =~ m/ \W (?<!::|->|\w\ ) (?<!\.) $api \W* \( /gx)
                {
                        $cnt += 1;
                }
                if ($cnt > 0) {
                        push @{$foundAPIsRef}, $api;
                        $groupHashRef->{function_counts}->{$api} += 1;
                }

This probably needs to be improved for your use case.

Best regards,
Pascal.