UI,libobs,libobs-opengl,obs-ffmpeg: Remove unneeded cast in switches

Those casts were usually used to workaround switch warnings.

Also adds default to OBS frontend event switches that had this
workaround.
This commit is contained in:
tytan652 2022-08-05 14:25:57 +02:00
commit cf5c68b773
6 changed files with 10 additions and 6 deletions

View file

@ -636,7 +636,7 @@ void SourceTreeModel::OBSFrontendEvent(enum obs_frontend_event event, void *ptr)
{
SourceTreeModel *stm = reinterpret_cast<SourceTreeModel *>(ptr);
switch ((int)event) {
switch (event) {
case OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED:
stm->SceneChanged();
break;
@ -644,6 +644,8 @@ void SourceTreeModel::OBSFrontendEvent(enum obs_frontend_event event, void *ptr)
case OBS_FRONTEND_EVENT_SCENE_COLLECTION_CLEANUP:
stm->Clear();
break;
default:
break;
}
}

View file

@ -22,13 +22,15 @@ void OBSBasicStats::OBSFrontendEvent(enum obs_frontend_event event, void *ptr)
{
OBSBasicStats *stats = reinterpret_cast<OBSBasicStats *>(ptr);
switch ((int)event) {
switch (event) {
case OBS_FRONTEND_EVENT_RECORDING_STARTED:
stats->StartRecTimeLeft();
break;
case OBS_FRONTEND_EVENT_RECORDING_STOPPED:
stats->ResetRecTimeLeft();
break;
default:
break;
}
}

View file

@ -735,7 +735,7 @@ void gs_shader_set_val(gs_sparam_t *param, const void *val, size_t size)
if (!count)
count = 1;
switch ((uint32_t)param->type) {
switch (param->type) {
case GS_SHADER_PARAM_FLOAT:
expected_size = sizeof(float);
break;

View file

@ -617,7 +617,7 @@ void gs_free_image_deps(void) {}
static inline enum gs_color_format convert_format(enum AVPixelFormat format)
{
switch ((int)format) {
switch (format) {
case AV_PIX_FMT_RGBA:
return GS_RGBA;
case AV_PIX_FMT_BGRA:

View file

@ -56,7 +56,7 @@ static inline void calc_gpu_conversion_sizes(struct obs_core_video_mix *video)
video->conversion_width_i = 0.f;
video->conversion_height_i = 0.f;
switch ((uint32_t)info->format) {
switch (info->format) {
case VIDEO_FORMAT_I420:
video->conversion_needed = true;
video->conversion_techs[0] = "Planar_Y";

View file

@ -98,7 +98,7 @@ determine_chroma_location(enum AVPixelFormat pix_fmt,
static inline enum audio_format
convert_ffmpeg_sample_format(enum AVSampleFormat format)
{
switch ((uint32_t)format) {
switch (format) {
case AV_SAMPLE_FMT_U8:
return AUDIO_FORMAT_U8BIT;
case AV_SAMPLE_FMT_S16: