-
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
Fix warnings #527
Fix warnings #527
Conversation
These warnings can be seen by enabling -Wall.
@@ -136,8 +136,6 @@ static css_font_family_t DEFAULT_FONT_FAMILY = css_ff_sans_serif; | |||
/// minimum EM width of page (prevents show two pages for windows that not enougn wide) | |||
#define MIN_EM_PER_PAGE 20 | |||
|
|||
static int def_font_sizes[] = { 18, 20, 22, 24, 29, 33, 39, 44 }; |
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.
This is used like 10 lines down ftr.
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.
Though strictly I suppose you might argue it should also have USE_LIMITED_FONT_SIZES_SET
around it.
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.
You're right. Fixed. I also reverted the change in lvrend.cpp in case of side effects.
a0eb8f7
to
b55027c
Compare
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.
Reviewed 8 of 16 files at r1, 1 of 8 files at r2, 7 of 7 files at r3, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @bbshelper and @Frenzie)
crengine/src/lvstsheet.cpp
line 25 at r3 (raw file):
//#define DUMP_CSS_PARSING // Helper to debug string parsing, showing current position and context
I imagine that one may have been left in on purpose (but perhaps should be behind ifdefs). Or not. @poire-z will tell us ;).
Will look at all that better by end of week. But what's with the random reordering of fields ? |
It's about initialization order: https://stackoverflow.com/questions/1828037/whats-the-point-of-g-wreorder Honestly I haven't noticed any real problems uncovered in our code by this warning, but eliminating them is desirable. |
If you mean that you finally decided to not remove |
Oh, ok - you did not change my declarations ordering (what I will look at), you just made the initializations (that I will rarely look at) order similar to the declaration order - which is fine and add consistency :) So, fine with me. |
crengine/src/lvtinydom.cpp
Outdated
int new_h = new_rc.bottom - base_y; | ||
int next_fragments_shift_y = new_rc.bottom - orig_rc.bottom; | ||
// printf("fixing fragment %d (%d ~ %d => %d , +%d => +%d)\n", node->getNodeIndex(), base_y, orig_rc.top, new_rc.top, orig_h, new_h); |
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.
Please live line 5440 in, just comment it out (new_h
is used in the commented out printf on line 5442 - so if removed, that printf won't work if I need debugging - so best to have them both commented out).
crengine/src/lvstsheet.cpp
Outdated
// Helper to debug string parsing, showing current position and context | ||
static void dbg_str_pos(const char * prefix, const char * str) { | ||
printf("/----------|---------- %s\n", prefix); | ||
printf("\\%.*s\n", 20, str - 10); | ||
} | ||
|
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.
Might also be useful in the future, so don't remove it please :) Just wrap it with #if 0
or something like that.
crengine/src/lvstsheet.cpp
Outdated
static int substr_compare( const char * sub, const char * & str ) | ||
{ |
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.
No longer used since a few months ago - but don't kill it, might be useful some day. Just wrap it with /* No longer used
or something.
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.
For this and other comments - I will make the change at some later time. It's already midnight here.
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.
Good night :) (no hurry needed)
I wanted to play safe. After another look at |
b55027c
to
09edc77
Compare
- koreader/crengine#527 - koreader/crengine#528 - koreader/crengine#530 - koreader/crengine#531 - koreader/crengine#532 - koreader/crengine#533 - koreader/crengine#534 - koreader/crengine#535 - koreader/crengine#536 - koreader/crengine#538 - koreader/crengine#539 - koreader/crengine#540 - koreader/crengine#541 - koreader/crengine#542 - koreader/crengine#544
- koreader/crengine#527 - koreader/crengine#528 - koreader/crengine#530 - koreader/crengine#531 - koreader/crengine#532 - koreader/crengine#533 - koreader/crengine#534 - koreader/crengine#535 - koreader/crengine#536 - koreader/crengine#538 - koreader/crengine#539 - koreader/crengine#540 - koreader/crengine#541 - koreader/crengine#542 - koreader/crengine#544
These are some warnings exposed by enabling
-Wall
, and are relatively easy to fix. Others like comparison between signed and unsigned integers are much harder to solve. I suggest that we enable-Wall -Werror
ASAP to prevent new warnings, while adding waivers for legacy code.This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)