mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2026-09-20 01:39:50 -05:00
- use const auto& where possible
- avoid using const std::unique_ptr& and const std::shared_ptr& - avoid wrapping results in std::optional - prefer std::string_view over const std::string& - update FSUtils::LoadFileToMem to write into std::vector<uint8_t> - use std::span when possible - Avoid unnessecary copies in PluginDataFactory - allocate plugins as HeapMemoryFixedSize which bascially is a std::unique_ptr with fixed size
This commit is contained in:
@@ -57,7 +57,7 @@ void NotificationMainLoop() {
|
||||
}
|
||||
}
|
||||
|
||||
bool DisplayNotificationMessage(std::string &text, NotificationModuleNotificationType type, float duration) {
|
||||
bool DisplayNotificationMessage(std::string_view text, NotificationModuleNotificationType type, float duration) {
|
||||
if (!gNotificationModuleLoaded) {
|
||||
return false;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ bool DisplayNotificationMessage(std::string &text, NotificationModuleNotificatio
|
||||
if (!param) {
|
||||
return false;
|
||||
}
|
||||
strncpy(param->text, text.c_str(), sizeof(param->text) - 1);
|
||||
strncpy(param->text, text.data(), sizeof(param->text) - 1);
|
||||
param->type = type;
|
||||
param->duration = duration;
|
||||
|
||||
@@ -84,11 +84,11 @@ bool DisplayNotificationMessage(std::string &text, NotificationModuleNotificatio
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DisplayInfoNotificationMessage(std::string &text, float duration) {
|
||||
bool DisplayInfoNotificationMessage(std::string_view text, float duration) {
|
||||
return DisplayNotificationMessage(text, NOTIFICATION_MODULE_NOTIFICATION_TYPE_INFO, duration);
|
||||
}
|
||||
|
||||
bool DisplayErrorNotificationMessage(std::string &text, float duration) {
|
||||
bool DisplayErrorNotificationMessage(std::string_view text, float duration) {
|
||||
return DisplayNotificationMessage(text, NOTIFICATION_MODULE_NOTIFICATION_TYPE_ERROR, duration);
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ void StartNotificationThread() {
|
||||
|
||||
constexpr int32_t messageSize = sizeof(sNotificationMessages) / sizeof(sNotificationMessages[0]);
|
||||
OSInitMessageQueue(&sNotificationQueue, sNotificationMessages, messageSize);
|
||||
sNotificationsThread = std::make_unique<std::thread>(NotificationMainLoop);
|
||||
sNotificationsThread = make_unique_nothrow<std::thread>(NotificationMainLoop);
|
||||
}
|
||||
|
||||
void StopNotificationThread() {
|
||||
|
||||
Reference in New Issue
Block a user