From 7d2a6cb48d1b505a8b67da70c61f346da41db1cd Mon Sep 17 00:00:00 2001 From: Gonzalo Exequiel Pedone Date: Thu, 20 Feb 2025 20:39:56 -0300 Subject: [PATCH] Make MSVC happy. --- cmio/PlatformUtils/src/preferences.cpp | 4 ++-- cmio/VCamIPC/src/ipcbridge.cpp | 10 ++++++++-- dshow/VCamIPC/src/ipcbridge.cpp | 18 ++++++++++-------- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/cmio/PlatformUtils/src/preferences.cpp b/cmio/PlatformUtils/src/preferences.cpp index 2e26792..eb92de3 100644 --- a/cmio/PlatformUtils/src/preferences.cpp +++ b/cmio/PlatformUtils/src/preferences.cpp @@ -160,8 +160,8 @@ std::string AkVCam::Preferences::readString(const std::string &key, auto value = defaultValue; if (cfValue) { - auto len = size_t(CFStringGetLength(cfValue)); - auto data = CFStringGetCStringPtr(cfValue, kCFStringEncodingUTF8); + auto len = size_t(CFStringGetLength(CFStringRef(cfValue))); + auto data = CFStringGetCStringPtr(CFStringRef(cfValue), kCFStringEncodingUTF8); if (data) { value = std::string(data, len); diff --git a/cmio/VCamIPC/src/ipcbridge.cpp b/cmio/VCamIPC/src/ipcbridge.cpp index 0a8510e..13c1a8b 100644 --- a/cmio/VCamIPC/src/ipcbridge.cpp +++ b/cmio/VCamIPC/src/ipcbridge.cpp @@ -884,8 +884,14 @@ AkVCam::Hack &AkVCam::Hack::operator =(const Hack &other) } #ifdef VCAMIPC_LIBRARY_SHARED -extern "C" AkVCam::IpcBridgePtr akCreateBridge() +extern "C" AkVCam::IpcBridge *akCreateBridge() { - return std::make_shared(); + return new AkVCam::IpcBridge; +} + +extern "C" void akDestroyBridge(AkVCam::IpcBridge *bridge) +{ + if (bridge) + delete AkVCam::IpcBridge; } #endif diff --git a/dshow/VCamIPC/src/ipcbridge.cpp b/dshow/VCamIPC/src/ipcbridge.cpp index 7c80aba..4912bdf 100644 --- a/dshow/VCamIPC/src/ipcbridge.cpp +++ b/dshow/VCamIPC/src/ipcbridge.cpp @@ -630,14 +630,10 @@ bool AkVCam::IpcBridgePrivate::launchService() AkLogDebug() << "Launching the service" << std::endl; auto servicePath = locateServicePath(); - if (!servicePath.empty()) { - //char cmd[4096]; - //snprintf(cmd, 4096, "start /b \"\" \"%s\"", servicePath.c_str()); - //system(cmd); + if (!servicePath.empty()) execDetached({servicePath}); - } else { + else AkLogDebug() << "Service path not found" << std::endl; - } } bool ok = false; @@ -863,8 +859,14 @@ AkVCam::Hack &AkVCam::Hack::operator =(const Hack &other) } #ifdef VCAMIPC_LIBRARY_SHARED -extern "C" AkVCam::IpcBridgePtr akCreateBridge() +extern "C" AkVCam::IpcBridge *akCreateBridge() +{ + return new AkVCam::IpcBridge; +} + +extern "C" void akDestroyBridge(AkVCam::IpcBridge *bridge) { - return std::make_shared(); + if (bridge) + delete AkVCam::IpcBridge; } #endif