we had some night spare time on our extended Lan and one of us does backporting for a livin. He backported SciTe within a night, which is impressiv, but we had a problem.
std::string ScintillaCall::CallReturnString(Message msg, uintptr_t wParam) {
// Get the length of the data from CallPointer
size_t len = CallPointer(msg, wParam, nullptr);
// Ensure len is valid and non-zero
if (len == 0) {
return std::string(); // Return empty string if length is 0
}
std::string result(len, '\0'); // Initialize the string with 'len' null characters
CallPointer(msg, wParam, &result[0]);
return result;
}
We used BackportCpp which dod great with one exception. its not 100% compliant. we couldnt use result.data() so he came up with the above solution. First, without the len guard it crashed. (debugging showed that len was sometimes zero) . With the above implementation it seems to be fine. so id like to share here in case there are other people wnting to use BackportCpp. Ill share the diffs too when they ready. Have a nice Day!
Thorsten