-
Notifications
You must be signed in to change notification settings - Fork 43
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
lint: fix cppcheck lint errors #587
Merged
poire-z
merged 9 commits into
koreader:master
from
benoit-pierre:pr/fix_cppcheck_lint_errors
Jul 28, 2024
Merged
lint: fix cppcheck lint errors #587
poire-z
merged 9 commits into
koreader:master
from
benoit-pierre:pr/fix_cppcheck_lint_errors
Jul 28, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Comment out unused & problematic code: ``` crengine/include/lvref.h:395:16: warning: Reference to temporary returned. [returnTempReference] return LVRef(NULL); ^ crengine/include/lvref.h:396:15: warning: Reference to temporary returned. [returnTempReference] return LVRef( new T( *_ptr ) ); ```
``` warning: Rethrowing current exception with 'throw;', it seems there is no current exception to rethrow. If there is no current exception this calls std::terminate(). ```
NOTE: only when compiling without ZSTD support.
``` lvxml.cpp|6166 col 42| warning: Uninitialized variable: quote [uninitvar] int endpos = encname.pos(quote); lvxml.cpp|6159 col 28| note: Assuming condition is false while (pos < end) { lvxml.cpp|6166 col 42| note: Uninitialized variable: quote int endpos = encname.pos(quote); ```
poire-z
reviewed
Jul 28, 2024
Comment on lines
-6165
to
+6161
lString8 encname = s.substr(pos + 1, 20 ); | ||
int endpos = encname.pos(quote); | ||
if ( endpos>0 ) { | ||
encname.erase( endpos, encname.length() - endpos ); | ||
lString32 enc32(encname.c_str()); | ||
SetCharset(enc32.c_str()); | ||
endpos = s.pos(s[startpos], startpos + 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it is ok scanning up to m_buf_len
instead of previously 20. We should find that quote soon, and if not the HTML is crap. This is called for each xhtml fragment.
And we already scan the full string for "encoding".
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Most of them.
This change is