cginternals / cginternals/openll

FontLoader: bitwise OR always returns true: bug or feature?

Open
#11 1 comment 0 reactions 0 assignees View on GitHub
bug question
Dominant language
C++
Stars
7
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Have a look at FontLoader.cpp, lines 262 - 272 (code below).
If `valid `begins as `true` and further operations are just bitwise OR, then `valid `is always `true`.

Do you want to return an empty `StringPair` if not all mandatory keys are provided, as the comment suggests? If so, this code is a bug.

```
// check if all required keys are provided
auto valid = true;
for (const auto mandatoryKey : mandatoryKeys)
{
valid |= pairs.find(mandatoryKey) != pairs.cend();
}

if (!valid)
return StringPairs();

return pairs;
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.