Merge pull request #5016 from zhaowenlan1779/swkbd-fix

applets/swkbd: Remove text memory clearing
This commit is contained in:
Weiyi Wang 2019-12-01 12:09:26 -05:00 committed by GitHub
commit 4efb9c6d99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -99,9 +99,6 @@ ResultCode SoftwareKeyboard::StartImpl(Service::APT::AppletStartupParameter cons
memcpy(&config, parameter.buffer.data(), parameter.buffer.size()); memcpy(&config, parameter.buffer.data(), parameter.buffer.size());
text_memory = std::static_pointer_cast<Kernel::SharedMemory, Kernel::Object>(parameter.object); text_memory = std::static_pointer_cast<Kernel::SharedMemory, Kernel::Object>(parameter.object);
// TODO(Subv): Verify if this is the correct behavior
memset(text_memory->GetPointer(), 0, text_memory->GetSize());
DrawScreenKeyboard(); DrawScreenKeyboard();
using namespace Frontend; using namespace Frontend;
@ -121,7 +118,8 @@ void SoftwareKeyboard::Update() {
using namespace Frontend; using namespace Frontend;
const KeyboardData& data = frontend_applet->ReceiveData(); const KeyboardData& data = frontend_applet->ReceiveData();
std::u16string text = Common::UTF8ToUTF16(data.text); std::u16string text = Common::UTF8ToUTF16(data.text);
memcpy(text_memory->GetPointer(), text.c_str(), text.length() * sizeof(char16_t)); // Include a null terminator
memcpy(text_memory->GetPointer(), text.c_str(), (text.length() + 1) * sizeof(char16_t));
switch (config.num_buttons_m1) { switch (config.num_buttons_m1) {
case SoftwareKeyboardButtonConfig::SingleButton: case SoftwareKeyboardButtonConfig::SingleButton:
config.return_code = SoftwareKeyboardResult::D0Click; config.return_code = SoftwareKeyboardResult::D0Click;