mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-08-17 21:53:35 -04:00
Adds Message Viewer Window to Developer Tools (#3486)
* Adds a MessageViewer window to Developer Tools. * Properly destroys message viewer window. * Adds missing ImGui::End() * Fixes an oopsie crashing non-windows builds after first run. * Adds C ABI for displaying a custom message * Fixes a crash and an issue with messages with SFX. * Remove some osSyncPrintf's that aren't very useful for this case.
This commit is contained in:
committed by
GitHub
parent
0932e1e504
commit
3514954ad1
@@ -336,3 +336,16 @@ std::string SohUtils::Sanitize(std::string stringValue) {
|
||||
|
||||
return stringValue;
|
||||
}
|
||||
|
||||
size_t SohUtils::CopyStringToCharBuffer(char* buffer, const std::string& source, const size_t maxBufferSize) {
|
||||
if (!source.empty()) {
|
||||
// Prevent potential horrible overflow due to implicit conversion of maxBufferSize to an unsigned. Prevents negatives.
|
||||
memset(buffer, 0, std::max<size_t>(0, maxBufferSize));
|
||||
// Gaurentee that this value will be greater than 0, regardless of passed variables.
|
||||
const size_t copiedCharLen = std::min<size_t>(std::max<size_t>(0, maxBufferSize - 1), source.length());
|
||||
memcpy(buffer, source.c_str(), copiedCharLen);
|
||||
return copiedCharLen;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user