mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
removed core_strdup() usage from ti99 cartridge code (nw)
This commit is contained in:
parent
fef11b9087
commit
e89a090ace
@ -239,7 +239,7 @@ image_init_result ti99_cartridge_device::call_load()
|
||||
}
|
||||
catch (rpk_exception& err)
|
||||
{
|
||||
logerror("Failed to load cartridge '%s': %s\n", basename(), err.to_string());
|
||||
logerror("Failed to load cartridge '%s': %s\n", basename(), err.to_string().c_str());
|
||||
m_rpk = nullptr;
|
||||
m_err = IMAGE_ERROR_INVALIDIMAGE;
|
||||
return image_init_result::FAIL;
|
||||
|
@ -119,12 +119,12 @@ private:
|
||||
rpk_exception(rpk_open_error value): m_err(value), m_detail(nullptr) { }
|
||||
rpk_exception(rpk_open_error value, const char* detail) : m_err(value), m_detail(detail) { }
|
||||
|
||||
const char* to_string()
|
||||
std::string to_string()
|
||||
{
|
||||
// FIXME: this leaks memory - in some cases it returns a new buffer, in other cases it returns a pointer to a static string, so the caller can't know whether it needs to be cleaned up
|
||||
if (m_detail==nullptr) return error_text[(int)m_err];
|
||||
std::string errormsg = std::string(error_text[(int)m_err]).append(": ").append(m_detail);
|
||||
return core_strdup(errormsg.c_str());
|
||||
std::string errmsg(error_text[(int)m_err]);
|
||||
if (m_detail==nullptr)
|
||||
return errmsg;
|
||||
return errmsg.append(": ").append(m_detail);
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user