adobe / adobe/XMP-Toolkit-SDK

Ambiguous bool to int conversion

Open
#58 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
262
Forks
110
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

Research direction

Start at XMPFiles/source/FileHandlers/FLV_Handler.cpp:200 and inspect how the FLV buffer values are used in the assignment to info->time. Build the project with clang and -Wint-in-bool-context to reproduce the warning. Done means the warning is removed while the existing FLV timestamp behavior remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.