mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-08 04:20:13 +02:00
Remove redundant conditions
As mentioned in C++ Core Guidelines ES.87.
This commit is contained in:
+3
-3
@@ -39,7 +39,7 @@ class DefaultDataConverter {
|
||||
const int /*index*/,
|
||||
const intptr_t /*value*/,
|
||||
const void* data) {
|
||||
if (data == nullptr) {
|
||||
if (!data) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ auto passthrough_event(AEffect* plugin, F callback) {
|
||||
// `effEditOpen()` I can assume there are plugins that don't
|
||||
// handle this correctly.
|
||||
VstRect* editor_rect = *static_cast<VstRect**>(data);
|
||||
if (editor_rect == nullptr) {
|
||||
if (!editor_rect) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ auto passthrough_event(AEffect* plugin, F callback) {
|
||||
// host doesn't support this.
|
||||
const auto time_info =
|
||||
reinterpret_cast<const VstTimeInfo*>(return_value);
|
||||
if (time_info == nullptr) {
|
||||
if (!time_info) {
|
||||
return nullptr;
|
||||
} else {
|
||||
return *time_info;
|
||||
|
||||
@@ -50,7 +50,7 @@ Configuration::Configuration(const fs::path& config_path,
|
||||
|
||||
// If the table is missing some fields then they will simply be left at
|
||||
// their defaults
|
||||
if (toml::table* config = value.as_table(); config != nullptr) {
|
||||
if (toml::table* config = value.as_table()) {
|
||||
group = (*config)["group"].value<std::string>();
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ uint32_t WINAPI handle_process_replacing_proxy(void*);
|
||||
Vst2Bridge& get_bridge_instance(const AEffect* plugin) {
|
||||
// This is needed during the initialization of the plugin since we can only
|
||||
// add our own pointer after it's done initializing
|
||||
if (current_bridge_instance != nullptr) {
|
||||
if (current_bridge_instance) {
|
||||
return *current_bridge_instance;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ Vst2Bridge::Vst2Bridge(boost::asio::io_context& main_context,
|
||||
host_vst_parameters(io_context),
|
||||
host_vst_process_replacing(io_context) {
|
||||
// Got to love these C APIs
|
||||
if (plugin_handle == nullptr) {
|
||||
if (!plugin_handle) {
|
||||
throw std::runtime_error("Could not load the Windows .dll file at '" +
|
||||
plugin_dll_path + "'");
|
||||
}
|
||||
@@ -90,11 +90,11 @@ Vst2Bridge::Vst2Bridge(boost::asio::io_context& main_context,
|
||||
reinterpret_cast<VstEntryPoint>(reinterpret_cast<size_t>(
|
||||
GetProcAddress(plugin_handle.get(), name)));
|
||||
|
||||
if (vst_entry_point != nullptr) {
|
||||
if (vst_entry_point) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (vst_entry_point == nullptr) {
|
||||
if (!vst_entry_point) {
|
||||
throw std::runtime_error(
|
||||
"Could not find a valid VST entry point for '" + plugin_dll_path +
|
||||
"'.");
|
||||
@@ -116,7 +116,7 @@ Vst2Bridge::Vst2Bridge(boost::asio::io_context& main_context,
|
||||
std::lock_guard lock(current_bridge_instance_mutex);
|
||||
current_bridge_instance = this;
|
||||
plugin = vst_entry_point(host_callback_proxy);
|
||||
if (plugin == nullptr) {
|
||||
if (!plugin) {
|
||||
throw std::runtime_error("VST plugin at '" + plugin_dll_path +
|
||||
"' failed to initialize.");
|
||||
}
|
||||
@@ -301,7 +301,7 @@ void Vst2Bridge::handle_process_replacing() {
|
||||
// Any plugin made in the last fifteen years or so should
|
||||
// support `processReplacing`. In the off chance it does not we
|
||||
// can just emulate this behavior ourselves.
|
||||
if (plugin->processReplacing != nullptr) {
|
||||
if (plugin->processReplacing) {
|
||||
plugin->processReplacing(plugin, inputs.data(),
|
||||
outputs.data(),
|
||||
request.sample_frames);
|
||||
|
||||
@@ -258,7 +258,7 @@ LRESULT CALLBACK window_proc(HWND handle,
|
||||
reinterpret_cast<CREATESTRUCT*>(lParam);
|
||||
const auto editor =
|
||||
static_cast<Editor*>(window_parameters->lpCreateParams);
|
||||
if (editor == nullptr) {
|
||||
if (!editor) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ LRESULT CALLBACK window_proc(HWND handle,
|
||||
case WM_TIMER: {
|
||||
auto editor = reinterpret_cast<Editor*>(
|
||||
GetWindowLongPtr(handle, GWLP_USERDATA));
|
||||
if (editor == nullptr || wParam != idle_timer_id) {
|
||||
if (!editor || wParam != idle_timer_id) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user