Skip to content

Fix a handful of compiler warnings#488

Merged
nxpfrankli merged 6 commits intonxp-imx:masterfrom
markuspg:fix_compiler_warnings
Aug 19, 2025
Merged

Fix a handful of compiler warnings#488
nxpfrankli merged 6 commits intonxp-imx:masterfrom
markuspg:fix_compiler_warnings

Conversation

@markuspg
Copy link
Copy Markdown
Contributor

This pull request does nothing more than fixing a few minor bugs regarding error messages and a possible uninitialized return value. Otherwise it's only about reducing compiler warnings.

This change is done to be able to drop a few c-style casts without
having to replace them by a `const_cast`.

Signed-off-by: Markus Prasser <markuspg@users.noreply.github.com>
Signed-off-by: Markus Prasser <markuspg@users.noreply.github.com>
Signed-off-by: Markus Prasser <markuspg@users.noreply.github.com>
Signed-off-by: Markus Prasser <markuspg@users.noreply.github.com>
Signed-off-by: Markus Prasser <markuspg@users.noreply.github.com>
Signed-off-by: Markus Prasser <markuspg@users.noreply.github.com>
Comment thread libuuu/cmd.cpp

int i = 0;

int ret = -1;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(In theory) ret could return an uninitialized value. To avoid this it is initialized explicitly and for following best practises its scope is being reduced additionally.

Comment thread libuuu/cmd.cpp

//trim left space
while (cmd[pos] == separate && pos < cmd.size())
while (pos < cmd.size() && cmd[pos] == separate)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LLVM rightly hinted that pos should be checked for its validity before using it to access the string.

@nxpfrankli nxpfrankli merged commit acd0f9b into nxp-imx:master Aug 19, 2025
18 of 20 checks passed
@markuspg markuspg deleted the fix_compiler_warnings branch August 22, 2025 07:29
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.

2 participants