Replace use of C style casts
This commit is contained in:
@@ -321,7 +321,7 @@ const Engine::Scope &GstEngine::scope(const int chunk_length) {
|
||||
// The new buffer could have a different size
|
||||
if (have_new_buffer_) {
|
||||
if (latest_buffer_) {
|
||||
scope_chunks_ = ceil(((double)GST_BUFFER_DURATION(latest_buffer_) / (double)(chunk_length * kNsecPerMsec)));
|
||||
scope_chunks_ = ceil((static_cast<double>(GST_BUFFER_DURATION(latest_buffer_) / static_cast<double>(chunk_length * kNsecPerMsec))));
|
||||
}
|
||||
|
||||
// if the buffer is shorter than the chunk length
|
||||
@@ -514,7 +514,7 @@ void GstEngine::HandlePipelineError(const int pipeline_id, const QString &messag
|
||||
BufferingFinished();
|
||||
emit StateChanged(Engine::Error);
|
||||
|
||||
if (domain == (int)GST_RESOURCE_ERROR && (error_code == (int)GST_RESOURCE_ERROR_NOT_FOUND || error_code == (int)GST_RESOURCE_ERROR_NOT_AUTHORIZED)) {
|
||||
if (domain == static_cast<int>(GST_RESOURCE_ERROR) && (error_code == static_cast<int>(GST_RESOURCE_ERROR_NOT_FOUND) || error_code == static_cast<int>(GST_RESOURCE_ERROR_NOT_AUTHORIZED))) {
|
||||
emit InvalidSongRequested(stream_url_);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -581,13 +581,13 @@ GstPadProbeReturn GstEnginePipeline::HandoffCallback(GstPad *pad, GstPadProbeInf
|
||||
GstMapInfo map_info;
|
||||
gst_buffer_map(buf, &map_info, GST_MAP_READ);
|
||||
|
||||
int32_t *s = (int32_t*) map_info.data;
|
||||
int32_t *s = reinterpret_cast<int32_t*>(map_info.data);
|
||||
int samples = (map_info.size / sizeof(int32_t)) / channels;
|
||||
int buf16_size = samples * sizeof(int16_t) * channels;
|
||||
int16_t *d = (int16_t*) g_malloc(buf16_size);
|
||||
int16_t *d = static_cast<int16_t*>(g_malloc(buf16_size));
|
||||
memset(d, 0, buf16_size);
|
||||
for (int i = 0 ; i < (samples * channels) ; ++i) {
|
||||
d[i] = (int16_t) (s[i] >> 16);
|
||||
d[i] = static_cast<int16_t>((s[i] >> 16));
|
||||
}
|
||||
gst_buffer_unmap(buf, &map_info);
|
||||
buf16 = gst_buffer_new_wrapped(d, buf16_size);
|
||||
@@ -801,7 +801,7 @@ void GstEnginePipeline::ErrorMessageReceived(GstMessage *msg) {
|
||||
g_error_free(error);
|
||||
g_free(debugs);
|
||||
|
||||
if (state() == GST_STATE_PLAYING && pipeline_is_initialised_ && next_uri_set_ && (domain == (int)GST_RESOURCE_ERROR || domain == (int)GST_STREAM_ERROR)) {
|
||||
if (state() == GST_STATE_PLAYING && pipeline_is_initialised_ && next_uri_set_ && (domain == static_cast<int>(GST_RESOURCE_ERROR) || domain == static_cast<int>(GST_STREAM_ERROR))) {
|
||||
// A track is still playing and the next uri is not playable. We ignore the error here so it can play until the end.
|
||||
// But there is no message send to the bus when the current track finishes, we have to add an EOS ourself.
|
||||
qLog(Debug) << "Ignoring error when loading next track";
|
||||
@@ -1187,7 +1187,7 @@ void GstEnginePipeline::StreamDiscovered(GstDiscoverer*, GstDiscovererInfo *info
|
||||
GList *audio_streams = gst_discoverer_info_get_audio_streams(info);
|
||||
if (audio_streams) {
|
||||
|
||||
GstDiscovererStreamInfo *stream_info = (GstDiscovererStreamInfo*) g_list_first(audio_streams)->data;
|
||||
GstDiscovererStreamInfo *stream_info = reinterpret_cast<GstDiscovererStreamInfo*>(g_list_first(audio_streams)->data);
|
||||
|
||||
Engine::SimpleMetaBundle bundle;
|
||||
if (discovered_url == instance->stream_url_) {
|
||||
|
||||
@@ -212,7 +212,7 @@ bool XineEngine::CreateStream() {
|
||||
|
||||
if (eventqueue_) xine_event_dispose_queue(eventqueue_);
|
||||
eventqueue_ = xine_event_new_queue(stream_);
|
||||
xine_event_create_listener_thread(eventqueue_, &XineEngine::XineEventListener, (void*)this);
|
||||
xine_event_create_listener_thread(eventqueue_, &XineEngine::XineEventListener, reinterpret_cast<void*>(this));
|
||||
|
||||
#ifndef XINE_SAFE_MODE
|
||||
xine_set_param(stream_, XINE_PARAM_METRONOM_PREBUFFER, 6000);
|
||||
@@ -644,7 +644,7 @@ void XineEngine::XineEventListener(void *p, const xine_event_t *event) {
|
||||
|
||||
case XINE_EVENT_PROGRESS:
|
||||
{
|
||||
xine_progress_data_t *pd = (xine_progress_data_t*)event->data;
|
||||
xine_progress_data_t *pd = reinterpret_cast<xine_progress_data_t*>(event->data);
|
||||
QString msg = QString("%1 %2%").arg(QString::fromUtf8(pd->description)).arg(QString::number(pd->percent) + QLocale::system().percent());
|
||||
//qLog(Debug) << "Xine:" << msg;
|
||||
}
|
||||
@@ -664,7 +664,7 @@ void XineEngine::XineEventListener(void *p, const xine_event_t *event) {
|
||||
{
|
||||
qLog(Debug) << "XINE_EVENT_UI_MESSAGE";
|
||||
|
||||
xine_ui_message_data_t *data = (xine_ui_message_data_t *)event->data;
|
||||
xine_ui_message_data_t *data = reinterpret_cast<xine_ui_message_data_t*>(event->data);
|
||||
QString message;
|
||||
|
||||
switch (data->type) {
|
||||
@@ -685,7 +685,7 @@ void XineEngine::XineEventListener(void *p, const xine_event_t *event) {
|
||||
message = "Source is encrypted.";
|
||||
if (data->explanation) {
|
||||
message += " : ";
|
||||
message += QString::fromUtf8((char*)data + data->parameters);
|
||||
message += QString::fromUtf8(reinterpret_cast<char*>(data) + data->parameters);
|
||||
}
|
||||
emit engine->StateChanged(Engine::Error);
|
||||
emit engine->InvalidSongRequested(engine->stream_url_);
|
||||
@@ -694,7 +694,7 @@ void XineEngine::XineEventListener(void *p, const xine_event_t *event) {
|
||||
message = "The host is unknown.";
|
||||
if (data->explanation) {
|
||||
message += " : ";
|
||||
message += QString::fromUtf8((char*)data + data->parameters);
|
||||
message += QString::fromUtf8(reinterpret_cast<char*>(data) + data->parameters);
|
||||
}
|
||||
emit engine->StateChanged(Engine::Error);
|
||||
emit engine->InvalidSongRequested(engine->stream_url_);
|
||||
@@ -703,7 +703,7 @@ void XineEngine::XineEventListener(void *p, const xine_event_t *event) {
|
||||
message = "The device name you specified seems invalid.";
|
||||
if (data->explanation) {
|
||||
message += " : ";
|
||||
message += QString::fromUtf8((char*)data + data->parameters);
|
||||
message += QString::fromUtf8(reinterpret_cast<char*>(data) + data->parameters);
|
||||
}
|
||||
emit engine->StateChanged(Engine::Error);
|
||||
emit engine->InvalidSongRequested(engine->stream_url_);
|
||||
@@ -712,7 +712,7 @@ void XineEngine::XineEventListener(void *p, const xine_event_t *event) {
|
||||
message = "The network appears unreachable.";
|
||||
if (data->explanation) {
|
||||
message += " : ";
|
||||
message += QString::fromUtf8((char*)data + data->parameters);
|
||||
message += QString::fromUtf8(reinterpret_cast<char*>(data) + data->parameters);
|
||||
}
|
||||
emit engine->StateChanged(Engine::Error);
|
||||
emit engine->InvalidSongRequested(engine->stream_url_);
|
||||
@@ -721,7 +721,7 @@ void XineEngine::XineEventListener(void *p, const xine_event_t *event) {
|
||||
message = "Audio output unavailable; the device is busy.";
|
||||
if (data->explanation) {
|
||||
message += " : ";
|
||||
message += QString::fromUtf8((char*)data + data->parameters);
|
||||
message += QString::fromUtf8(reinterpret_cast<char*>(data) + data->parameters);
|
||||
}
|
||||
emit engine->StateChanged(Engine::Error);
|
||||
emit engine->FatalError();
|
||||
@@ -730,7 +730,7 @@ void XineEngine::XineEventListener(void *p, const xine_event_t *event) {
|
||||
message = "Connection refused.";
|
||||
if (data->explanation) {
|
||||
message += " : ";
|
||||
message += QString::fromUtf8((char*)data + data->parameters);
|
||||
message += QString::fromUtf8(reinterpret_cast<char*>(data) + data->parameters);
|
||||
}
|
||||
emit engine->StateChanged(Engine::Error);
|
||||
emit engine->InvalidSongRequested(engine->stream_url_);
|
||||
@@ -739,7 +739,7 @@ void XineEngine::XineEventListener(void *p, const xine_event_t *event) {
|
||||
message = "File not found.";
|
||||
if (data->explanation) {
|
||||
message += " : ";
|
||||
message += QString::fromUtf8((char*)data + data->parameters);
|
||||
message += QString::fromUtf8(reinterpret_cast<char*>(data) + data->parameters);
|
||||
}
|
||||
emit engine->StateChanged(Engine::Error);
|
||||
emit engine->InvalidSongRequested(engine->stream_url_);
|
||||
@@ -748,7 +748,7 @@ void XineEngine::XineEventListener(void *p, const xine_event_t *event) {
|
||||
message = "Access denied.";
|
||||
if (data->explanation) {
|
||||
message += " : ";
|
||||
message += QString::fromUtf8((char*)data + data->parameters);
|
||||
message += QString::fromUtf8(reinterpret_cast<char*>(data) + data->parameters);
|
||||
}
|
||||
emit engine->StateChanged(Engine::Error);
|
||||
emit engine->InvalidSongRequested(engine->stream_url_);
|
||||
@@ -757,7 +757,7 @@ void XineEngine::XineEventListener(void *p, const xine_event_t *event) {
|
||||
message = "Read error.";
|
||||
if (data->explanation) {
|
||||
message += " : ";
|
||||
message += QString::fromUtf8((char*)data + data->parameters);
|
||||
message += QString::fromUtf8(reinterpret_cast<char*>(data) + data->parameters);
|
||||
}
|
||||
emit engine->StateChanged(Engine::Error);
|
||||
emit engine->InvalidSongRequested(engine->stream_url_);
|
||||
@@ -766,7 +766,7 @@ void XineEngine::XineEventListener(void *p, const xine_event_t *event) {
|
||||
message = "A problem occurred while loading a library or decoder.";
|
||||
if (data->explanation) {
|
||||
message += " : ";
|
||||
message += QString::fromUtf8((char*)data + data->parameters);
|
||||
message += QString::fromUtf8(reinterpret_cast<char*>(data) + data->parameters);
|
||||
}
|
||||
emit engine->StateChanged(Engine::Error);
|
||||
emit engine->FatalError();
|
||||
@@ -775,7 +775,7 @@ void XineEngine::XineEventListener(void *p, const xine_event_t *event) {
|
||||
message = "General Warning";
|
||||
if (data->explanation) {
|
||||
message += ": ";
|
||||
message += QString::fromUtf8((char*)data + data->explanation);
|
||||
message += QString::fromUtf8(reinterpret_cast<char*>(data) + data->explanation);
|
||||
}
|
||||
else message += ".";
|
||||
break;
|
||||
@@ -783,7 +783,7 @@ void XineEngine::XineEventListener(void *p, const xine_event_t *event) {
|
||||
message = "Security Warning";
|
||||
if (data->explanation) {
|
||||
message += ": ";
|
||||
message += QString::fromUtf8((char*)data + data->explanation);
|
||||
message += QString::fromUtf8(reinterpret_cast<char*>(data) + data->explanation);
|
||||
}
|
||||
else message += ".";
|
||||
break;
|
||||
@@ -791,7 +791,7 @@ void XineEngine::XineEventListener(void *p, const xine_event_t *event) {
|
||||
message = "Unknown Error";
|
||||
if (data->explanation) {
|
||||
message += ": ";
|
||||
message += QString::fromUtf8((char*)data + data->explanation);
|
||||
message += QString::fromUtf8(reinterpret_cast<char*>(data) + data->explanation);
|
||||
}
|
||||
else message += ".";
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user