adobe / XMP-Toolkit-SDK

The XMP Toolkit allows you to integrate XMP functionality into your product or solution
BSD 3-Clause "New" or "Revised" License
199 stars 80 forks source link

Ambiguous bool to int conversion #58

Open hfiguiere opened 2 years ago

hfiguiere commented 2 years ago

This is triggered by clang -Wint-in-bool-context

XMPFiles/source/FileHandlers/FLV_Handler.cpp:200:55: warning: converting the result of '<<' to a boolean; did you mean '(buffer[7] << 24) != 0'? [-Wint-in-bool-context]
        info->time = GetUns24BE ( &buffer[4] ) || (buffer[7] << 24);
                                                             ^
1 warning generated.

Expected Behaviour

Properly written code, no warning.

Actual Behaviour

Seems to want to put a bool value into an XMP_Uns32 with implicit conversion. Seems to be wrong.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Build with clang (Linux) with -Wint-in-bool-context

Platform and Version

clang version 13.0.0 (Fedora 13.0.0-3.fc35)

Sample Code that illustrates the problem

Logs taken while reproducing problem