mirror of
https://github.com/citra-emu/citra.git
synced 2024-12-19 11:21:05 +00:00
applets/swkbd: Address comments
This commit is contained in:
parent
8078256a88
commit
25be09c7a3
@ -132,7 +132,7 @@ ValidationError SoftwareKeyboard::Finalize(const std::string& text, u8 button) {
|
||||
return ValidationError::None;
|
||||
}
|
||||
|
||||
bool SoftwareKeyboard::DataReady() {
|
||||
bool SoftwareKeyboard::DataReady() const {
|
||||
return data_ready;
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
/**
|
||||
* Whether the result data is ready to be received.
|
||||
*/
|
||||
bool DataReady();
|
||||
bool DataReady() const;
|
||||
|
||||
/**
|
||||
* Receives the current result data stored in the applet, and clears the ready state.
|
||||
|
@ -26,12 +26,12 @@ namespace HLE::Applets {
|
||||
*/
|
||||
template <typename T>
|
||||
inline std::string TextFromBuffer(const T& text) {
|
||||
std::size_t text_size = text.size();
|
||||
const auto text_end = std::find(text.begin(), text.end(), u'\0');
|
||||
if (text_end != text.end())
|
||||
text_size = std::distance(text.begin(), text_end);
|
||||
const std::size_t text_size = std::distance(text.begin(), text_end);
|
||||
std::u16string buffer(text_size, 0);
|
||||
std::memcpy(buffer.data(), text.data(), text_size * sizeof(u16));
|
||||
std::transform(text.begin(), text_end, buffer.begin(), [](u16_le character) {
|
||||
return static_cast<char16_t>(static_cast<u16>(character));
|
||||
});
|
||||
return Common::UTF16ToUTF8(buffer);
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter con
|
||||
Service::APT::CaptureBufferInfo capture_info;
|
||||
ASSERT(sizeof(capture_info) == parameter.buffer.size());
|
||||
|
||||
memcpy(&capture_info, parameter.buffer.data(), sizeof(capture_info));
|
||||
std::memcpy(&capture_info, parameter.buffer.data(), sizeof(capture_info));
|
||||
|
||||
using Kernel::MemoryPermission;
|
||||
// Create a SharedMemory that directly points to this heap block.
|
||||
@ -69,7 +69,7 @@ ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter con
|
||||
ASSERT_MSG(parameter.buffer.size() == sizeof(config),
|
||||
"The size of the parameter (SoftwareKeyboardConfig) is wrong");
|
||||
|
||||
memcpy(&config, parameter.buffer.data(), parameter.buffer.size());
|
||||
std::memcpy(&config, parameter.buffer.data(), parameter.buffer.size());
|
||||
|
||||
switch (config.callback_result) {
|
||||
case SoftwareKeyboardCallbackResult::OK:
|
||||
@ -177,8 +177,6 @@ void SoftwareKeyboard::Update() {
|
||||
message.sender_id = id;
|
||||
SendParameter(message);
|
||||
} else {
|
||||
// TODO(Subv): We're finalizing the applet immediately after it's started,
|
||||
// but we should defer this call until after all the input has been collected.
|
||||
Finalize();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user