aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/event.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-12-02 19:34:09 -0800
committerChris Robinson <[email protected]>2018-12-02 19:34:09 -0800
commit85e83bbdff9f07132b9fcdddeeccb9d252a13b8c (patch)
treeab4d34479261de8ff0118619380c87e1cf26bdfb /OpenAL32/event.cpp
parent45b65366bb2ba6c11756e2509589e310b9f0df88 (diff)
Use a std::string for the source state change message
Diffstat (limited to 'OpenAL32/event.cpp')
-rw-r--r--OpenAL32/event.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/OpenAL32/event.cpp b/OpenAL32/event.cpp
index 4980abee..d263acc5 100644
--- a/OpenAL32/event.cpp
+++ b/OpenAL32/event.cpp
@@ -45,17 +45,14 @@ static int EventThread(ALCcontext *context)
{
if(!(enabledevts&EventType_SourceStateChange))
continue;
- char msg[1024]{};
- int msglen{snprintf(msg, sizeof(msg), "Source ID %u state changed to %s",
- evt.u.srcstate.id,
- (evt.u.srcstate.state==AL_INITIAL) ? "AL_INITIAL" :
+ std::string msg{"Source ID " + std::to_string(evt.u.srcstate.id)};
+ msg += " state has changed to ";
+ msg += (evt.u.srcstate.state==AL_INITIAL) ? "AL_INITIAL" :
(evt.u.srcstate.state==AL_PLAYING) ? "AL_PLAYING" :
(evt.u.srcstate.state==AL_PAUSED) ? "AL_PAUSED" :
- (evt.u.srcstate.state==AL_STOPPED) ? "AL_STOPPED" : "<unknown>"
- )};
- if(msglen < 1) msglen = strlen(msg);
+ (evt.u.srcstate.state==AL_STOPPED) ? "AL_STOPPED" : "<unknown>";
context->EventCb(AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT, evt.u.srcstate.id,
- evt.u.srcstate.state, msglen, msg, context->EventParam
+ evt.u.srcstate.state, msg.length(), msg.c_str(), context->EventParam
);
}
else if((enabledevts&evt.EnumType) == evt.EnumType)