Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix misleading code formatting & bug #63

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

henrygab
Copy link
Contributor

@henrygab henrygab commented Mar 25, 2021

GCC properly flags this formatting as misleading.
I think it's also a real bug, and should have the two statements wrapped in curly braces.

However, as I am not familiar enough with this code, requesting review / modification / test to ensure it's the proper fix.

...\libraries\Adafruit_CircuitPlayground\utility\IRLibDecodeBase.cpp:
      In member function 'void IRdecodeBase::dumpResults(bool)':
...\libraries\Adafruit_CircuitPlayground\utility\IRLibDecodeBase.cpp:
      Line 59 Char 8
      warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   59 |        if(interval>0)LowSpace=min(LowSpace, interval);  HiSpace=max (HiSpace, interval);
      |        ^~
...\libraries\Adafruit_CircuitPlayground\utility\IRLibDecodeBase.cpp:
      Line 59 Char 57
      note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   59 |        if(interval>0)LowSpace=min(LowSpace, interval);  HiSpace=max (HiSpace, interval);
      |                                                         ^~~~~~~

GCC properly flags this formatting as misleading.
I think it's also a real bug, and should have the two statements wrapped in curly braces.

However, as I am not familiar enough with this code, requesting review / modification / test to ensure it's the proper fix.


```
...\libraries\Adafruit_CircuitPlayground\utility\IRLibDecodeBase.cpp:
      In member function 'void IRdecodeBase::dumpResults(bool)':
...\libraries\Adafruit_CircuitPlayground\utility\IRLibDecodeBase.cpp:
      Line 59 Char 8
      warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   59 |        if(interval>0)LowSpace=min(LowSpace, interval);  HiSpace=max (HiSpace, interval);
      |        ^~
...\libraries\Adafruit_CircuitPlayground\utility\IRLibDecodeBase.cpp:
      Line 59 Char 57
      note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   59 |        if(interval>0)LowSpace=min(LowSpace, interval);  HiSpace=max (HiSpace, interval);
      |                                                         ^~~~~~~
```
@henrygab
Copy link
Contributor Author

Although this shows ladyada as the last editor, it appears to have been a wholesale copy of the library.
The same issue exists in the original depot, so I've asked @cyborg5 whether the second statement on that line is intended to be gated by the if or not.

I've manually decoded IR signals before, thanks to AnalysIR and the convenient LearnIR dongle. However, it's not an area of particular strength. Leaving this one as a WIP until the question in the parent depot is resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant