From Simon South <simon@xxxxxxxxxxxxxx>:
Simon South has uploaded this change for review. (
https://review.haiku-os.org/c/haiku/+/1724 ;)
Change subject: BKeymap: Add unit tests and fix issues
......................................................................
BKeymap: Add unit tests and fix issues
Add a preliminary set of unit tests for BKeymap and fix these issues:
* BKeymap::operator=() caused a crash by allocating a zero-byte array to hold
the other object's character data.
* BKeymap::SetToCurrent() and SetToDefault() leaked memory by not freeing an
existing character array before allocating a new one.
* BKeymap::SetToCurrent() incorrectly determined the size of the current
keymap's character array, causing GetChars() to fail whenever the current
keymap was loaded. Now SetToCurrent() uses the _get_key_map() private
function, which accurately reports the size of the array.
This commit also updates a Jamfile by replacing a use of "UseHeaders" to
include private header files with the more concise and expressive
"UsePrivateHeaders".
---
M src/build/libshared/Jamfile
M src/kits/shared/Jamfile
M src/kits/shared/Keymap.cpp
M src/tests/kits/shared/Jamfile
A src/tests/kits/shared/KeymapTest.cpp
A src/tests/kits/shared/KeymapTest.h
M src/tests/kits/shared/SharedTestAddon.cpp
7 files changed, 181 insertions(+), 4 deletions(-)
git pull ssh://git.haiku-os.org:22/haiku refs/changes/24/1724/1
--
To view, visit https://review.haiku-os.org/c/haiku/+/1724
To unsubscribe, or for help writing mail filters, visit
https://review.haiku-os.org/settings
Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: If6f71b209f1bd395be57835c4dd89f0e3f845994
Gerrit-Change-Number: 1724
Gerrit-PatchSet: 1
Gerrit-Owner: Simon South <simon@xxxxxxxxxxxxxx>
Gerrit-MessageType: newchange