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

Initialize num and exposureAdjustment values to 0 #496

Merged
merged 2 commits into from
Sep 24, 2021

Conversation

linuxkidd
Copy link
Collaborator

During compile a warning is issued for a possibly uninitialized variable. This is due to the declaration of these variables having no value, and no default 'else' is present to set them should none of the conditional tests match.

Added 0 and 0.0 values to the declaration of these variables to remove the compile warning.

capture.cpp: In function ‘int main(int, char**)’:
capture.cpp:2187:33: warning: ‘num’ may be used uninitialized in this function [-Wmaybe-uninitialized]
                          sprintf(textBuffer, "  > !!! Retrying @ %'ld us because '%s (%d)'\n", currentExposure, why.c_str(), num);
                          ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
capture.cpp:2094:48: warning: ‘exposureAdjustment’ may be used uninitialized in this function [-Wmaybe-uninitialized]
                         maxAcceptableHistogram *= exposureAdjustment;
                         ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~

@thomasjacquin thomasjacquin merged commit 69876bc into AllskyTeam:master Sep 24, 2021
@linuxkidd linuxkidd deleted the fix_uninitialized_warn branch September 24, 2021 21:04
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.

None yet

4 participants