diff --git a/src/eventhandler/EventHandler.cpp b/src/eventhandler/EventHandler.cpp index bace24ab..c3dcfd9c 100644 --- a/src/eventhandler/EventHandler.cpp +++ b/src/eventhandler/EventHandler.cpp @@ -199,7 +199,7 @@ void EventHandler::DisconnectSourceSignals(obs_source_t *source) void EventHandler::OnFrontendEvent(enum obs_frontend_event event, void *private_data) { - auto eventHandler = reinterpret_cast(private_data); + auto eventHandler = static_cast(private_data); if (!eventHandler->_obsLoaded.load()) { if (event == OBS_FRONTEND_EVENT_FINISHED_LOADING) { @@ -210,14 +210,14 @@ void EventHandler::OnFrontendEvent(enum obs_frontend_event event, void *private_ // In the case that plugins become hotloadable, this will have to go back into `EventHandler::EventHandler()` // Enumerate inputs and connect each one obs_enum_sources([](void* param, obs_source_t* source) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); eventHandler->ConnectSourceSignals(source); return true; }, private_data); // Enumerate scenes and connect each one obs_enum_scenes([](void* param, obs_source_t* source) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); eventHandler->ConnectSourceSignals(source); return true; }, private_data); @@ -243,14 +243,14 @@ void EventHandler::OnFrontendEvent(enum obs_frontend_event event, void *private_ // In the case that plugins become hotloadable, this will have to go back into `EventHandler::~EventHandler()` // Enumerate inputs and disconnect each one obs_enum_sources([](void* param, obs_source_t* source) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); eventHandler->DisconnectSourceSignals(source); return true; }, private_data); // Enumerate scenes and disconnect each one obs_enum_scenes([](void* param, obs_source_t* source) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); eventHandler->DisconnectSourceSignals(source); return true; }, private_data); @@ -365,7 +365,7 @@ void EventHandler::OnFrontendEvent(enum obs_frontend_event event, void *private_ // Only called for creation of a public source void EventHandler::SourceCreatedMultiHandler(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); // Don't react to signals until OBS has finished loading if (!eventHandler->_obsLoaded.load()) @@ -392,7 +392,7 @@ void EventHandler::SourceCreatedMultiHandler(void *param, calldata_t *data) // Only called for destruction of a public source void EventHandler::SourceDestroyedMultiHandler(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); // We can't use any smart types here because releasing the source will cause infinite recursion obs_source_t *source = GetCalldataPointer(data, "source"); @@ -420,7 +420,7 @@ void EventHandler::SourceDestroyedMultiHandler(void *param, calldata_t *data) void EventHandler::SourceRemovedMultiHandler(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); if (!eventHandler->_obsLoaded.load()) return; @@ -443,7 +443,7 @@ void EventHandler::SourceRemovedMultiHandler(void *param, calldata_t *data) void EventHandler::SourceRenamedMultiHandler(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); if (!eventHandler->_obsLoaded.load()) return; diff --git a/src/eventhandler/EventHandler_Inputs.cpp b/src/eventhandler/EventHandler_Inputs.cpp index 7d937939..af3654eb 100644 --- a/src/eventhandler/EventHandler_Inputs.cpp +++ b/src/eventhandler/EventHandler_Inputs.cpp @@ -111,7 +111,7 @@ void EventHandler::HandleInputNameChanged(obs_source_t *, std::string oldInputNa */ void EventHandler::HandleInputActiveStateChanged(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); if (!eventHandler->_inputActiveStateChangedRef.load()) return; @@ -147,7 +147,7 @@ void EventHandler::HandleInputActiveStateChanged(void *param, calldata_t *data) */ void EventHandler::HandleInputShowStateChanged(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); if (!eventHandler->_inputShowStateChangedRef.load()) return; @@ -181,7 +181,7 @@ void EventHandler::HandleInputShowStateChanged(void *param, calldata_t *data) */ void EventHandler::HandleInputMuteStateChanged(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); obs_source_t *source = GetCalldataPointer(data, "source"); if (!source) @@ -213,7 +213,7 @@ void EventHandler::HandleInputMuteStateChanged(void *param, calldata_t *data) */ void EventHandler::HandleInputVolumeChanged(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); obs_source_t *source = GetCalldataPointer(data, "source"); if (!source) @@ -252,7 +252,7 @@ void EventHandler::HandleInputVolumeChanged(void *param, calldata_t *data) */ void EventHandler::HandleInputAudioBalanceChanged(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); obs_source_t *source = GetCalldataPointer(data, "source"); if (!source) @@ -285,7 +285,7 @@ void EventHandler::HandleInputAudioBalanceChanged(void *param, calldata_t *data) */ void EventHandler::HandleInputAudioSyncOffsetChanged(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); obs_source_t *source = GetCalldataPointer(data, "source"); if (!source) @@ -318,7 +318,7 @@ void EventHandler::HandleInputAudioSyncOffsetChanged(void *param, calldata_t *da */ void EventHandler::HandleInputAudioTracksChanged(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); obs_source_t *source = GetCalldataPointer(data, "source"); if (!source) @@ -361,7 +361,7 @@ void EventHandler::HandleInputAudioTracksChanged(void *param, calldata_t *data) */ void EventHandler::HandleInputAudioMonitorTypeChanged(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); obs_source_t *source = GetCalldataPointer(data, "source"); if (!source) diff --git a/src/eventhandler/EventHandler_MediaInputs.cpp b/src/eventhandler/EventHandler_MediaInputs.cpp index 7bd0cb54..faa000c6 100644 --- a/src/eventhandler/EventHandler_MediaInputs.cpp +++ b/src/eventhandler/EventHandler_MediaInputs.cpp @@ -35,7 +35,7 @@ std::string GetMediaInputActionString(ObsMediaInputAction action) { void EventHandler::SourceMediaPauseMultiHandler(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); obs_source_t *source = GetCalldataPointer(data, "source"); if (!source) @@ -49,7 +49,7 @@ void EventHandler::SourceMediaPauseMultiHandler(void *param, calldata_t *data) void EventHandler::SourceMediaPlayMultiHandler(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); obs_source_t *source = GetCalldataPointer(data, "source"); if (!source) @@ -63,7 +63,7 @@ void EventHandler::SourceMediaPlayMultiHandler(void *param, calldata_t *data) void EventHandler::SourceMediaRestartMultiHandler(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); obs_source_t *source = GetCalldataPointer(data, "source"); if (!source) @@ -77,7 +77,7 @@ void EventHandler::SourceMediaRestartMultiHandler(void *param, calldata_t *data) void EventHandler::SourceMediaStopMultiHandler(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); obs_source_t *source = GetCalldataPointer(data, "source"); if (!source) @@ -91,7 +91,7 @@ void EventHandler::SourceMediaStopMultiHandler(void *param, calldata_t *data) void EventHandler::SourceMediaNextMultiHandler(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); obs_source_t *source = GetCalldataPointer(data, "source"); if (!source) @@ -105,7 +105,7 @@ void EventHandler::SourceMediaNextMultiHandler(void *param, calldata_t *data) void EventHandler::SourceMediaPreviousMultiHandler(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); obs_source_t *source = GetCalldataPointer(data, "source"); if (!source) @@ -132,7 +132,7 @@ void EventHandler::SourceMediaPreviousMultiHandler(void *param, calldata_t *data */ void EventHandler::HandleMediaInputPlaybackStarted(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); obs_source_t *source = GetCalldataPointer(data, "source"); if (!source) @@ -161,7 +161,7 @@ void EventHandler::HandleMediaInputPlaybackStarted(void *param, calldata_t *data */ void EventHandler::HandleMediaInputPlaybackEnded(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); obs_source_t *source = GetCalldataPointer(data, "source"); if (!source) diff --git a/src/eventhandler/EventHandler_SceneItems.cpp b/src/eventhandler/EventHandler_SceneItems.cpp index 60b78e04..bac56c4d 100644 --- a/src/eventhandler/EventHandler_SceneItems.cpp +++ b/src/eventhandler/EventHandler_SceneItems.cpp @@ -37,7 +37,7 @@ with this program. If not, see */ void EventHandler::HandleSceneItemCreated(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); obs_scene_t *scene = GetCalldataPointer(data, "scene"); if (!scene) @@ -74,7 +74,7 @@ void EventHandler::HandleSceneItemCreated(void *param, calldata_t *data) */ void EventHandler::HandleSceneItemRemoved(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); obs_scene_t *scene = GetCalldataPointer(data, "scene"); if (!scene) @@ -107,7 +107,7 @@ void EventHandler::HandleSceneItemRemoved(void *param, calldata_t *data) */ void EventHandler::HandleSceneItemListReindexed(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); obs_scene_t *scene = GetCalldataPointer(data, "scene"); if (!scene) @@ -136,7 +136,7 @@ void EventHandler::HandleSceneItemListReindexed(void *param, calldata_t *data) */ void EventHandler::HandleSceneItemEnableStateChanged(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); obs_scene_t *scene = GetCalldataPointer(data, "scene"); if (!scene) @@ -172,7 +172,7 @@ void EventHandler::HandleSceneItemEnableStateChanged(void *param, calldata_t *da */ void EventHandler::HandleSceneItemLockStateChanged(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); obs_scene_t *scene = GetCalldataPointer(data, "scene"); if (!scene) @@ -208,7 +208,7 @@ void EventHandler::HandleSceneItemLockStateChanged(void *param, calldata_t *data */ void EventHandler::HandleSceneItemTransformChanged(void *param, calldata_t *data) { - auto eventHandler = reinterpret_cast(param); + auto eventHandler = static_cast(param); if (!eventHandler->_sceneItemTransformChangedRef.load()) return; diff --git a/src/obs-websocket.cpp b/src/obs-websocket.cpp index 830a2365..e257780d 100644 --- a/src/obs-websocket.cpp +++ b/src/obs-websocket.cpp @@ -68,7 +68,7 @@ bool obs_module_load(void) // Initialize the settings dialog obs_frontend_push_ui_translation(obs_module_get_string); - QMainWindow* mainWindow = reinterpret_cast(obs_frontend_get_main_window()); + QMainWindow* mainWindow = static_cast(obs_frontend_get_main_window()); _settingsDialog = new SettingsDialog(mainWindow); obs_frontend_pop_ui_translation(); diff --git a/src/requesthandler/RequestBatchHandler.cpp b/src/requesthandler/RequestBatchHandler.cpp index 82f8453a..4d3f3383 100644 --- a/src/requesthandler/RequestBatchHandler.cpp +++ b/src/requesthandler/RequestBatchHandler.cpp @@ -109,7 +109,7 @@ static void ObsTickCallback(void *param, float) { ScopeProfiler prof{"obs_websocket_request_batch_frame_tick"}; - auto serialFrameBatch = reinterpret_cast(param); + auto serialFrameBatch = static_cast(param); // Increment frame count serialFrameBatch->frameCount++; diff --git a/src/requesthandler/RequestHandler_Config.cpp b/src/requesthandler/RequestHandler_Config.cpp index 6925986f..86d92f7e 100644 --- a/src/requesthandler/RequestHandler_Config.cpp +++ b/src/requesthandler/RequestHandler_Config.cpp @@ -159,7 +159,7 @@ RequestResult RequestHandler::SetCurrentSceneCollection(const Request& request) // Avoid queueing tasks if nothing will change if (currentSceneCollectionName != sceneCollectionName) { obs_queue_task(OBS_TASK_UI, [](void* param) { - obs_frontend_set_current_scene_collection(reinterpret_cast(param)); + obs_frontend_set_current_scene_collection(static_cast(param)); }, (void*)sceneCollectionName.c_str(), true); } @@ -193,7 +193,7 @@ RequestResult RequestHandler::CreateSceneCollection(const Request& request) if (std::find(sceneCollections.begin(), sceneCollections.end(), sceneCollectionName) != sceneCollections.end()) return RequestResult::Error(RequestStatus::ResourceAlreadyExists); - QMainWindow* mainWindow = reinterpret_cast(obs_frontend_get_main_window()); + QMainWindow* mainWindow = static_cast(obs_frontend_get_main_window()); bool success = false; QMetaObject::invokeMethod(mainWindow, "AddSceneCollection", Qt::BlockingQueuedConnection, Q_RETURN_ARG(bool, success), Q_ARG(bool, true), Q_ARG(QString, QString::fromStdString(sceneCollectionName))); if (!success) @@ -252,7 +252,7 @@ RequestResult RequestHandler::SetCurrentProfile(const Request& request) // Avoid queueing tasks if nothing will change if (currentProfileName != profileName) { obs_queue_task(OBS_TASK_UI, [](void* param) { - obs_frontend_set_current_profile(reinterpret_cast(param)); + obs_frontend_set_current_profile(static_cast(param)); }, (void*)profileName.c_str(), true); } @@ -284,7 +284,7 @@ RequestResult RequestHandler::CreateProfile(const Request& request) if (std::find(profiles.begin(), profiles.end(), profileName) != profiles.end()) return RequestResult::Error(RequestStatus::ResourceAlreadyExists); - QMainWindow* mainWindow = reinterpret_cast(obs_frontend_get_main_window()); + QMainWindow* mainWindow = static_cast(obs_frontend_get_main_window()); QMetaObject::invokeMethod(mainWindow, "NewProfile", Qt::BlockingQueuedConnection, Q_ARG(QString, QString::fromStdString(profileName))); return RequestResult::Success(); @@ -318,7 +318,7 @@ RequestResult RequestHandler::RemoveProfile(const Request& request) if (profiles.size() < 2) return RequestResult::Error(RequestStatus::NotEnoughResources); - QMainWindow* mainWindow = reinterpret_cast(obs_frontend_get_main_window()); + QMainWindow* mainWindow = static_cast(obs_frontend_get_main_window()); QMetaObject::invokeMethod(mainWindow, "DeleteProfile", Qt::BlockingQueuedConnection, Q_ARG(QString, QString::fromStdString(profileName))); return RequestResult::Success(); diff --git a/src/utils/Obs.h b/src/utils/Obs.h index 97fe1894..460d3113 100644 --- a/src/utils/Obs.h +++ b/src/utils/Obs.h @@ -62,7 +62,7 @@ using OBSWeakServiceAutoRelease = OBSRef T* GetCalldataPointer(const calldata_t *data, const char* name) { void *ptr = nullptr; calldata_get_ptr(data, name, &ptr); - return reinterpret_cast(ptr); + return static_cast(ptr); } enum ObsOutputState { diff --git a/src/utils/Obs_ActionHelper.cpp b/src/utils/Obs_ActionHelper.cpp index 5442219b..407f374e 100644 --- a/src/utils/Obs_ActionHelper.cpp +++ b/src/utils/Obs_ActionHelper.cpp @@ -29,7 +29,7 @@ struct CreateSceneItemData { void CreateSceneItemHelper(void *_data, obs_scene_t *scene) { - auto *data = reinterpret_cast(_data); + auto *data = static_cast(_data); data->sceneItem = obs_scene_add(scene, data->source); if (data->sceneItemTransform) diff --git a/src/utils/Obs_ArrayHelper.cpp b/src/utils/Obs_ArrayHelper.cpp index 1ac16263..997512c1 100644 --- a/src/utils/Obs_ArrayHelper.cpp +++ b/src/utils/Obs_ArrayHelper.cpp @@ -61,7 +61,7 @@ std::vector Utils::Obs::ArrayHelper::GetHotkeyList() std::vector ret; obs_enum_hotkeys([](void* data, obs_hotkey_id, obs_hotkey_t* hotkey) { - auto ret = reinterpret_cast *>(data); + auto ret = static_cast *>(data); ret->push_back(hotkey); @@ -132,7 +132,7 @@ std::vector Utils::Obs::ArrayHelper::GetSceneItemList(obs_scene_t *scene, enumData.second = basic; obs_scene_enum_items(scene, [](obs_scene_t*, obs_sceneitem_t* sceneItem, void* param) { - auto enumData = reinterpret_cast, bool>*>(param); + auto enumData = static_cast, bool>*>(param); json item; item["sceneItemId"] = obs_sceneitem_get_id(sceneItem); @@ -175,7 +175,7 @@ std::vector Utils::Obs::ArrayHelper::GetInputList(std::string inputKind) if (obs_source_get_type(input) != OBS_SOURCE_TYPE_INPUT) return true; - auto inputInfo = reinterpret_cast(param); + auto inputInfo = static_cast(param); std::string inputKind = obs_source_get_id(input); diff --git a/src/utils/Obs_NumberHelper.cpp b/src/utils/Obs_NumberHelper.cpp index a3891231..e7c22c9b 100644 --- a/src/utils/Obs_NumberHelper.cpp +++ b/src/utils/Obs_NumberHelper.cpp @@ -39,7 +39,7 @@ size_t Utils::Obs::NumberHelper::GetSceneCount() { size_t ret; auto sceneEnumProc = [](void *param, obs_source_t *scene) { - auto ret = reinterpret_cast(param); + auto ret = static_cast(param); if (obs_source_is_group(scene)) return true; diff --git a/src/utils/Platform.cpp b/src/utils/Platform.cpp index 6f01fb26..41becdf4 100644 --- a/src/utils/Platform.cpp +++ b/src/utils/Platform.cpp @@ -111,9 +111,9 @@ void Utils::Platform::SendTrayNotification(QSystemTrayIcon::MessageIcon icon, QS obs_queue_task(OBS_TASK_UI, [](void* param) { void *systemTrayPtr = obs_frontend_get_system_tray(); - auto systemTray = reinterpret_cast(systemTrayPtr); + auto systemTray = static_cast(systemTrayPtr); - auto notification = reinterpret_cast(param); + auto notification = static_cast(param); systemTray->showMessage(notification->title, notification->body, notification->icon); delete notification; }, (void*)notification, false);