diff --git a/Manager/src/cmdparser.cpp b/Manager/src/cmdparser.cpp index 4dd7cae..78618f5 100644 --- a/Manager/src/cmdparser.cpp +++ b/Manager/src/cmdparser.cpp @@ -69,7 +69,7 @@ namespace AkVCam { const std::string &arguments, const std::string &helpString, const ProgramOptionsFunc &func, - const std::vector flags, + const std::vector &flags, bool advanced); }; @@ -360,7 +360,7 @@ int AkVCam::CmdParser::parse(int argc, char **argv) char *p = nullptr; strtod(arg.c_str(), &p); - if (arg[0] == '-' && strlen(p) != 0) { + if (arg[0] == '-' && p && strnlen(p, 1024) != 0) { auto flag = this->d->parserFlag(command->flags, arg); if (!flag) { @@ -2361,7 +2361,7 @@ AkVCam::CmdParserCommand::CmdParserCommand(const std::string &command, const std::string &arguments, const std::string &helpString, const AkVCam::ProgramOptionsFunc &func, - const std::vector flags, + const std::vector &flags, bool advanced): command(command), arguments(arguments), diff --git a/README.md b/README.md index 32cacf8..75e7af2 100644 --- a/README.md +++ b/README.md @@ -2,22 +2,22 @@ akvirtualcamera is virtual camera implemented as a DirectShow filter in Windows, and as a CoreMediaIO plugin in Mac. -## Features ## +## Features * Supports emulated camera controls in capture devices (brightness, contrast, saturation, etc.). * Configurable default picture in case no input signal available. -## Build and Install ## +## Build and Install Visit the [wiki](https://github.com/webcamoid/akvirtualcamera/wiki) for a comprehensive compile and install instructions. -## Status ## +## Status [![Build Status](https://travis-ci.com/webcamoid/akvirtualcamera.svg?branch=master)](https://travis-ci.com/webcamoid/akvirtualcamera) [![Build status](https://ci.appveyor.com/api/projects/status/rwd4of9casmfmmys?svg=true)](https://ci.appveyor.com/project/hipersayanX/akvirtualcamera) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/1cee2645a3604633a506a203fb8c3161)](https://www.codacy.com/gh/webcamoid/akvirtualcamera/dashboard?utm_source=github.com&utm_medium=referral&utm_content=webcamoid/akvirtualcamera&utm_campaign=Badge_Grade) [![Daily Build](https://api.bintray.com/packages/webcamoid/webcamoid/akvirtualcamera/images/download.svg?version=daily)](https://bintray.com/webcamoid/webcamoid/akvirtualcamera/daily) -## Reporting Bugs ## +## Reporting Bugs Report all issues in the [issues tracker](http://github.com/webcamoid/akvirtualcamera/issues). diff --git a/VCamUtils/src/logger.cpp b/VCamUtils/src/logger.cpp index b92a45b..23b31a9 100644 --- a/VCamUtils/src/logger.cpp +++ b/VCamUtils/src/logger.cpp @@ -92,7 +92,9 @@ void AkVCam::Logger::setLogLevel(int logLevel) loggerPrivate()->logLevel = logLevel; } -std::string AkVCam::Logger::header(int logLevel, const std::string file, int line) +std::string AkVCam::Logger::header(int logLevel, + const std::string &file, + int line) { auto now = std::chrono::system_clock::now(); auto nowMSecs = diff --git a/VCamUtils/src/logger.h b/VCamUtils/src/logger.h index edd5b31..ed6a2a9 100644 --- a/VCamUtils/src/logger.h +++ b/VCamUtils/src/logger.h @@ -60,7 +60,7 @@ namespace AkVCam void setLogFile(const std::string &fileName); int logLevel(); void setLogLevel(int logLevel); - std::string header(int logLevel, const std::string file, int line); + std::string header(int logLevel, const std::string &file, int line); std::ostream &log(int logLevel); int levelFromString(const std::string &level); std::string levelToString(int level); diff --git a/VCamUtils/src/settings.cpp b/VCamUtils/src/settings.cpp index d753da3..279feb8 100644 --- a/VCamUtils/src/settings.cpp +++ b/VCamUtils/src/settings.cpp @@ -436,7 +436,7 @@ std::string AkVCam::SettingsPrivate::parseString(const std::string &str) memset(hex, 0, 3); for (size_t i = start; i < end; i++) { - if (str[i] == '\\' && i < str.size() - 2) { + if (i < str.size() - 2 && str[i] == '\\') { auto key = strchr(escape_k, str[i + 1]); if (key) { diff --git a/VCamUtils/src/videoformat.cpp b/VCamUtils/src/videoformat.cpp index e6372d5..d6e6541 100644 --- a/VCamUtils/src/videoformat.cpp +++ b/VCamUtils/src/videoformat.cpp @@ -263,7 +263,7 @@ size_t AkVCam::VideoFormat::planeSize(size_t plane) const bool AkVCam::VideoFormat::isValid() const { - if (this->size() <= 0) + if (this->size() < 1) return false; if (this->d->m_frameRates.empty()) diff --git a/cmio/Assistant/src/assistant.cpp b/cmio/Assistant/src/assistant.cpp index 9423c44..e08d214 100644 --- a/cmio/Assistant/src/assistant.cpp +++ b/cmio/Assistant/src/assistant.cpp @@ -553,7 +553,7 @@ void AkVCam::AssistantPrivate::controlsUpdated(xpc_connection_t client, AkLogFunction(); std::string deviceId = xpc_dictionary_get_string(event, "device"); - if (this->m_deviceConfigs.count(deviceId) <= 0) { + if (this->m_deviceConfigs.count(deviceId) < 1) { AkLogError() << "'" << deviceId << "' device in not in the devices list." diff --git a/cmio/PlatformUtils/src/utils.cpp b/cmio/PlatformUtils/src/utils.cpp index 3a7a142..c421e12 100644 --- a/cmio/PlatformUtils/src/utils.cpp +++ b/cmio/PlatformUtils/src/utils.cpp @@ -187,7 +187,7 @@ std::string AkVCam::realPath(const std::string &path) memset(realPath, 0, PATH_MAX); readlink(resolvedPath, realPath, PATH_MAX); - if (strlen(realPath) < 1) + if (strnlen(realPath, PATH_MAX) < 1) return {resolvedPath}; return {realPath}; diff --git a/dshow/PlatformUtils/src/utils.cpp b/dshow/PlatformUtils/src/utils.cpp index d43510c..96043f9 100644 --- a/dshow/PlatformUtils/src/utils.cpp +++ b/dshow/PlatformUtils/src/utils.cpp @@ -69,7 +69,7 @@ std::string AkVCam::locatePluginPath() GetModuleFileNameA(hmodule, path, MAX_PATH); } - if (strlen(path) < 1) + if (strnlen(path, MAX_PATH) < 1) return {}; return dirname(path); diff --git a/dshow/VirtualCamera/src/basefilter.cpp b/dshow/VirtualCamera/src/basefilter.cpp index cd2649d..b7d45c9 100644 --- a/dshow/VirtualCamera/src/basefilter.cpp +++ b/dshow/VirtualCamera/src/basefilter.cpp @@ -311,7 +311,8 @@ HRESULT AkVCam::BaseFilter::QueryFilterInfo(FILTER_INFO *pInfo) auto filterName = stringToWSTR(this->d->m_filterName); memcpy(pInfo->achName, filterName, - (std::min)(wcslen(filterName) * sizeof(WCHAR), + (std::min)(wcsnlen(filterName, MAX_FILTER_NAME) + * sizeof(WCHAR), MAX_FILTER_NAME)); CoTaskMemFree(filterName); } diff --git a/dshow/VirtualCamera/src/pin.cpp b/dshow/VirtualCamera/src/pin.cpp index e082d8e..0a26a2a 100644 --- a/dshow/VirtualCamera/src/pin.cpp +++ b/dshow/VirtualCamera/src/pin.cpp @@ -702,7 +702,8 @@ HRESULT AkVCam::Pin::QueryPinInfo(PIN_INFO *pInfo) auto pinName = stringToWSTR(this->d->m_pinName); memcpy(pInfo->achName, pinName, - (std::min)(wcslen(pinName) * sizeof(WCHAR), + (std::min)(wcsnlen(pinName, MAX_PIN_NAME) + * sizeof(WCHAR), MAX_PIN_NAME)); CoTaskMemFree(pinName); } diff --git a/ports/ci/travis/build.sh b/ports/ci/travis/build.sh index e3d0925..d7ce233 100644 --- a/ports/ci/travis/build.sh +++ b/ports/ci/travis/build.sh @@ -23,7 +23,7 @@ INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/webcamoid-data if [ "${TRAVIS_OS_NAME}" = linux ]; then sudo mount --bind root.x86_64 root.x86_64 - sudo mount --bind $HOME root.x86_64/$HOME + sudo mount --bind "$HOME" "root.x86_64/$HOME" cat << EOF > ${BUILDSCRIPT} #!/bin/sh @@ -53,12 +53,12 @@ i686-w64-mingw32-cmake \ cmake --build . EOF chmod +x ${BUILDSCRIPT} - sudo cp -vf ${BUILDSCRIPT} root.x86_64/$HOME/ + sudo cp -vf ${BUILDSCRIPT} "root.x86_64/$HOME/" EXEC='sudo ./root.x86_64/bin/arch-chroot root.x86_64' - ${EXEC} bash $HOME/${BUILDSCRIPT} + ${EXEC} bash "$HOME/${BUILDSCRIPT}" - sudo umount root.x86_64/$HOME + sudo umount "root.x86_64/$HOME" sudo umount root.x86_64 elif [ "${TRAVIS_OS_NAME}" = osx ]; then mkdir build diff --git a/ports/ci/travis/deploy.sh b/ports/ci/travis/deploy.sh index 6b2b443..bc01953 100644 --- a/ports/ci/travis/deploy.sh +++ b/ports/ci/travis/deploy.sh @@ -28,7 +28,7 @@ DEPLOYSCRIPT=deployscript.sh if [ "${TRAVIS_OS_NAME}" = linux ]; then sudo mount --bind root.x86_64 root.x86_64 - sudo mount --bind $HOME root.x86_64/$HOME + sudo mount --bind "$HOME" "root.x86_64/$HOME" cat << EOF > package_info_strip.conf [System] @@ -73,10 +73,10 @@ python ./DeployTools/deploy.py \ -o "\${PACKAGES_DIR}" EOF chmod +x ${DEPLOYSCRIPT} - sudo cp -vf ${DEPLOYSCRIPT} root.x86_64/$HOME/ + sudo cp -vf ${DEPLOYSCRIPT} "root.x86_64/$HOME/" - ${EXEC} bash $HOME/${DEPLOYSCRIPT} - sudo umount root.x86_64/$HOME + ${EXEC} bash "$HOME/${DEPLOYSCRIPT}" + sudo umount "root.x86_64/$HOME" sudo umount root.x86_64 elif [ "${TRAVIS_OS_NAME}" = osx ]; then cd build diff --git a/ports/ci/travis/install_deps.sh b/ports/ci/travis/install_deps.sh index 87dbd06..73e8bd2 100644 --- a/ports/ci/travis/install_deps.sh +++ b/ports/ci/travis/install_deps.sh @@ -34,7 +34,7 @@ if [ "${TRAVIS_OS_NAME}" = linux ]; then # Download chroot image archImage=archlinux-bootstrap-${ARCH_ROOT_DATE}-x86_64.tar.gz ${DOWNLOAD_CMD} ${ARCH_ROOT_URL}/iso/${ARCH_ROOT_DATE}/$archImage - sudo tar xzf $archImage + sudo tar xzf "$archImage" # Configure mirrors cp -vf root.x86_64/etc/pacman.conf . @@ -59,9 +59,9 @@ EOF sudo cp -vf mirrorlist root.x86_64/etc/pacman.d/mirrorlist # Install packages - sudo mkdir -pv root.x86_64/$HOME + sudo mkdir -pv "root.x86_64/$HOME" sudo mount --bind root.x86_64 root.x86_64 - sudo mount --bind $HOME root.x86_64/$HOME + sudo mount --bind "$HOME" "root.x86_64/$HOME" ${EXEC} pacman-key --init ${EXEC} pacman-key --populate archlinux @@ -89,7 +89,7 @@ EOF nsis=nsis-${NSIS_VERSION}-setup.exe ${DOWNLOAD_CMD} "https://sourceforge.net/projects/nsis/files/NSIS%20${NSIS_VERSION:0:1}/${NSIS_VERSION}/${nsis}" - if [ -e ${nsis} ]; then + if [ -e "${nsis}" ]; then INSTALLSCRIPT=installscript.sh cat << EOF > ${INSTALLSCRIPT} @@ -104,12 +104,12 @@ wine ./${nsis} /S EOF chmod +x ${INSTALLSCRIPT} - sudo cp -vf ${INSTALLSCRIPT} root.x86_64/$HOME/ - ${EXEC} bash $HOME/${INSTALLSCRIPT} + sudo cp -vf ${INSTALLSCRIPT} "root.x86_64/$HOME/" + ${EXEC} bash "$HOME/${INSTALLSCRIPT}" fi # Finish - sudo umount root.x86_64/$HOME + sudo umount "root.x86_64/$HOME" sudo umount root.x86_64 elif [ "${TRAVIS_OS_NAME}" = osx ]; then brew update @@ -126,7 +126,7 @@ elif [ "${TRAVIS_OS_NAME}" = osx ]; then # Install Qt Installer Framework qtIFW=QtInstallerFramework-macOS-x86_64-${QTIFWVER}.dmg - ${DOWNLOAD_CMD} http://download.qt.io/official_releases/qt-installer-framework/${QTIFWVER}/${qtIFW} || true + ${DOWNLOAD_CMD} "http://download.qt.io/official_releases/qt-installer-framework/${QTIFWVER}/${qtIFW}" || true if [ -e "${qtIFW}" ]; then hdiutil convert ${qtIFW} -format UDZO -o qtifw diff --git a/ports/ci/travis/upload.sh b/ports/ci/travis/upload.sh index 53949a7..1e9f1a5 100644 --- a/ports/ci/travis/upload.sh +++ b/ports/ci/travis/upload.sh @@ -45,23 +45,23 @@ if [[ ! -z "$DAILY_BUILD" || ! -z "$RELEASE_BUILD" ]]; then ./jfrog bt config \ --user=hipersayanx \ - --key=$BT_KEY \ + --key="$BT_KEY" \ --licenses=GPL-3.0-or-later path=webcamoid-packages for f in $(find $path -type f); do packagePath=${f#$path/} - folder=$(dirname $packagePath) + folder=$(dirname "$packagePath") ./jfrog bt upload \ --user=hipersayanx \ --key=$BT_KEY \ --override=true \ --publish=$publish \ - $f \ + "$f" \ webcamoid/webcamoid/akvirtualcamera/$version \ - $folder/ + "$folder/" done # Upload to Github Releases @@ -76,11 +76,11 @@ if [[ ! -z "$DAILY_BUILD" || ! -z "$RELEASE_BUILD" ]]; then hub=hub-darwin-amd64-${GITHUB_HUBVER} fi - cd ${TRAVIS_BUILD_DIR} - ${DOWNLOAD_CMD} https://github.com/github/hub/releases/download/v${GITHUB_HUBVER}/${hub}.tgz || true + cd "${TRAVIS_BUILD_DIR}" + ${DOWNLOAD_CMD} "https://github.com/github/hub/releases/download/v${GITHUB_HUBVER}/${hub}.tgz" || true tar xzf ${hub}.tgz mkdir -p .local - cp -rf ${hub}/* .local/ + cp -rf "${hub}"/* .local/ export PATH="${PWD}/.local/bin:${PATH}"