-
Notifications
You must be signed in to change notification settings - Fork 99
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 overflows in battery calculations #607
Closed
Closed
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
commit 52113d9 (fix battery divisions) actually broke the battery divisions by using int divisions, causing the following calculations to overflow: (100 * BATcapacity_remain) / BATcapacity_full My battery status showed "-19%". Values read from sysfs: BATcapacity_remain = 35140000 BATcapacity_full = 39240000 100 * 35140000 overflows the 31 bits of a signed int so the calculation results in -780967296 / 39240000 = -19. Force these calculatoins to be long long to avoid the overflow. The BATtime_remain calculation just barely does not overflow for me but fix this as well.
gijsbers
added a commit
that referenced
this pull request
Sep 1, 2021
Change defines to enums. Use longs for capacity numbers.
Thanks a lot for reporting this! I made some more changes to the APM module. |
kraj
pushed a commit
to YoeDistro/meta-openembedded
that referenced
this pull request
Oct 13, 2021
Improve the explanation on how to spy on client messages with icesh. When rearranging windows with tile placement or cascade placement, correct for the top side vertical offset, in those themes which have a masked top border. Improve the explanation for some of the preferences. Update the winoptions example on DockApps. Guard against a color name being set to the empty string (bbidulock/icewm#614). Improve the performance and scalability of the window list menu. In the window list window group similar application windows together. Add +group and +Class select options to icesh. Improve the filtering on the WM_CLASS property in icesh. Fix the OSS/ALSA defaults in icesound help message (bbidulock/icewm#609). Fix the OSS/ALSA defaults in icesound man page (bbidulock/icewm#608) Only support SVG for icons, not for icewmbg backgrounds. Let icewmbg pixmaps free its associated Image to reduce memory usage. Prevent a potential trailing -I flag in CMake for issue openembedded#57. Fix the description for sizeby in the icesh manpage. Fix overflows in battery calculations for issue bbidulock/icewm#607. Update the translations, most notably Brazilian Portuguese. Signed-off-by: Wang Mingyu <[email protected]> Signed-off-by: Khem Raj <[email protected]>
kraj
pushed a commit
to YoeDistro/meta-openembedded
that referenced
this pull request
Oct 13, 2021
Improve the explanation on how to spy on client messages with icesh. When rearranging windows with tile placement or cascade placement, correct for the top side vertical offset, in those themes which have a masked top border. Improve the explanation for some of the preferences. Update the winoptions example on DockApps. Guard against a color name being set to the empty string (bbidulock/icewm#614). Improve the performance and scalability of the window list menu. In the window list window group similar application windows together. Add +group and +Class select options to icesh. Improve the filtering on the WM_CLASS property in icesh. Fix the OSS/ALSA defaults in icesound help message (bbidulock/icewm#609). Fix the OSS/ALSA defaults in icesound man page (bbidulock/icewm#608) Only support SVG for icons, not for icewmbg backgrounds. Let icewmbg pixmaps free its associated Image to reduce memory usage. Prevent a potential trailing -I flag in CMake for issue openembedded#57. Fix the description for sizeby in the icesh manpage. Fix overflows in battery calculations for issue bbidulock/icewm#607. Update the translations, most notably Brazilian Portuguese. Signed-off-by: Wang Mingyu <[email protected]> Signed-off-by: Khem Raj <[email protected]>
kraj
pushed a commit
to YoeDistro/meta-openembedded
that referenced
this pull request
Oct 14, 2021
Improve the explanation on how to spy on client messages with icesh. When rearranging windows with tile placement or cascade placement, correct for the top side vertical offset, in those themes which have a masked top border. Improve the explanation for some of the preferences. Update the winoptions example on DockApps. Guard against a color name being set to the empty string (bbidulock/icewm#614). Improve the performance and scalability of the window list menu. In the window list window group similar application windows together. Add +group and +Class select options to icesh. Improve the filtering on the WM_CLASS property in icesh. Fix the OSS/ALSA defaults in icesound help message (bbidulock/icewm#609). Fix the OSS/ALSA defaults in icesound man page (bbidulock/icewm#608) Only support SVG for icons, not for icewmbg backgrounds. Let icewmbg pixmaps free its associated Image to reduce memory usage. Prevent a potential trailing -I flag in CMake for issue openembedded#57. Fix the description for sizeby in the icesh manpage. Fix overflows in battery calculations for issue bbidulock/icewm#607. Update the translations, most notably Brazilian Portuguese. Signed-off-by: Wang Mingyu <[email protected]> Signed-off-by: Khem Raj <[email protected]>
kraj
pushed a commit
to YoeDistro/meta-openembedded
that referenced
this pull request
Oct 14, 2021
Improve the explanation on how to spy on client messages with icesh. When rearranging windows with tile placement or cascade placement, correct for the top side vertical offset, in those themes which have a masked top border. Improve the explanation for some of the preferences. Update the winoptions example on DockApps. Guard against a color name being set to the empty string (bbidulock/icewm#614). Improve the performance and scalability of the window list menu. In the window list window group similar application windows together. Add +group and +Class select options to icesh. Improve the filtering on the WM_CLASS property in icesh. Fix the OSS/ALSA defaults in icesound help message (bbidulock/icewm#609). Fix the OSS/ALSA defaults in icesound man page (bbidulock/icewm#608) Only support SVG for icons, not for icewmbg backgrounds. Let icewmbg pixmaps free its associated Image to reduce memory usage. Prevent a potential trailing -I flag in CMake for issue openembedded#57. Fix the description for sizeby in the icesh manpage. Fix overflows in battery calculations for issue bbidulock/icewm#607. Update the translations, most notably Brazilian Portuguese. Signed-off-by: Wang Mingyu <[email protected]> Signed-off-by: Khem Raj <[email protected]>
kraj
pushed a commit
to YoeDistro/meta-openembedded
that referenced
this pull request
Oct 16, 2021
Improve the explanation on how to spy on client messages with icesh. When rearranging windows with tile placement or cascade placement, correct for the top side vertical offset, in those themes which have a masked top border. Improve the explanation for some of the preferences. Update the winoptions example on DockApps. Guard against a color name being set to the empty string (bbidulock/icewm#614). Improve the performance and scalability of the window list menu. In the window list window group similar application windows together. Add +group and +Class select options to icesh. Improve the filtering on the WM_CLASS property in icesh. Fix the OSS/ALSA defaults in icesound help message (bbidulock/icewm#609). Fix the OSS/ALSA defaults in icesound man page (bbidulock/icewm#608) Only support SVG for icons, not for icewmbg backgrounds. Let icewmbg pixmaps free its associated Image to reduce memory usage. Prevent a potential trailing -I flag in CMake for issue openembedded#57. Fix the description for sizeby in the icesh manpage. Fix overflows in battery calculations for issue bbidulock/icewm#607. Update the translations, most notably Brazilian Portuguese. Signed-off-by: Wang Mingyu <[email protected]> Signed-off-by: Khem Raj <[email protected]>
daregit
pushed a commit
to daregit/yocto-combined
that referenced
this pull request
May 22, 2024
Improve the explanation on how to spy on client messages with icesh. When rearranging windows with tile placement or cascade placement, correct for the top side vertical offset, in those themes which have a masked top border. Improve the explanation for some of the preferences. Update the winoptions example on DockApps. Guard against a color name being set to the empty string (bbidulock/icewm#614). Improve the performance and scalability of the window list menu. In the window list window group similar application windows together. Add +group and +Class select options to icesh. Improve the filtering on the WM_CLASS property in icesh. Fix the OSS/ALSA defaults in icesound help message (bbidulock/icewm#609). Fix the OSS/ALSA defaults in icesound man page (bbidulock/icewm#608) Only support SVG for icons, not for icewmbg backgrounds. Let icewmbg pixmaps free its associated Image to reduce memory usage. Prevent a potential trailing -I flag in CMake for issue #57. Fix the description for sizeby in the icesh manpage. Fix overflows in battery calculations for issue bbidulock/icewm#607. Update the translations, most notably Brazilian Portuguese. Signed-off-by: Wang Mingyu <[email protected]> Signed-off-by: Khem Raj <[email protected]>
daregit
pushed a commit
to daregit/yocto-combined
that referenced
this pull request
May 22, 2024
Improve the explanation on how to spy on client messages with icesh. When rearranging windows with tile placement or cascade placement, correct for the top side vertical offset, in those themes which have a masked top border. Improve the explanation for some of the preferences. Update the winoptions example on DockApps. Guard against a color name being set to the empty string (bbidulock/icewm#614). Improve the performance and scalability of the window list menu. In the window list window group similar application windows together. Add +group and +Class select options to icesh. Improve the filtering on the WM_CLASS property in icesh. Fix the OSS/ALSA defaults in icesound help message (bbidulock/icewm#609). Fix the OSS/ALSA defaults in icesound man page (bbidulock/icewm#608) Only support SVG for icons, not for icewmbg backgrounds. Let icewmbg pixmaps free its associated Image to reduce memory usage. Prevent a potential trailing -I flag in CMake for issue #57. Fix the description for sizeby in the icesh manpage. Fix overflows in battery calculations for issue bbidulock/icewm#607. Update the translations, most notably Brazilian Portuguese. Signed-off-by: Wang Mingyu <[email protected]> Signed-off-by: Khem Raj <[email protected]>
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.
commit 52113d9 (fix battery divisions)
actually broke the battery divisions by using int divisions, causing
the following calculations to overflow:
(100 * BATcapacity_remain) / BATcapacity_full
My battery status showed "-19%".
Values read from sysfs:
BATcapacity_remain = 35140000
BATcapacity_full = 39240000
100 * 35140000 overflows the 31 bits of a signed int so the
calculation results in -780967296 / 39240000 = -19.
Force these calculatoins to be long long to avoid the overflow.
The BATtime_remain calculation just barely does not overflow for me but
fix this as well.