Fixed Codacy errors.
This commit is contained in:
parent
0957eb4be6
commit
84e639fd49
15 changed files with 43 additions and 39 deletions
|
@ -69,7 +69,7 @@ namespace AkVCam {
|
||||||
const std::string &arguments,
|
const std::string &arguments,
|
||||||
const std::string &helpString,
|
const std::string &helpString,
|
||||||
const ProgramOptionsFunc &func,
|
const ProgramOptionsFunc &func,
|
||||||
const std::vector<CmdParserFlags> flags,
|
const std::vector<CmdParserFlags> &flags,
|
||||||
bool advanced);
|
bool advanced);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ int AkVCam::CmdParser::parse(int argc, char **argv)
|
||||||
char *p = nullptr;
|
char *p = nullptr;
|
||||||
strtod(arg.c_str(), &p);
|
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);
|
auto flag = this->d->parserFlag(command->flags, arg);
|
||||||
|
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
|
@ -2361,7 +2361,7 @@ AkVCam::CmdParserCommand::CmdParserCommand(const std::string &command,
|
||||||
const std::string &arguments,
|
const std::string &arguments,
|
||||||
const std::string &helpString,
|
const std::string &helpString,
|
||||||
const AkVCam::ProgramOptionsFunc &func,
|
const AkVCam::ProgramOptionsFunc &func,
|
||||||
const std::vector<AkVCam::CmdParserFlags> flags,
|
const std::vector<AkVCam::CmdParserFlags> &flags,
|
||||||
bool advanced):
|
bool advanced):
|
||||||
command(command),
|
command(command),
|
||||||
arguments(arguments),
|
arguments(arguments),
|
||||||
|
|
|
@ -2,22 +2,22 @@
|
||||||
|
|
||||||
akvirtualcamera is virtual camera implemented as a DirectShow filter in Windows, and as a CoreMediaIO plugin in Mac.
|
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.).
|
* Supports emulated camera controls in capture devices (brightness, contrast, saturation, etc.).
|
||||||
* Configurable default picture in case no input signal available.
|
* 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.
|
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://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)
|
[![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)
|
[![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)
|
[![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).
|
Report all issues in the [issues tracker](http://github.com/webcamoid/akvirtualcamera/issues).
|
||||||
|
|
|
@ -92,7 +92,9 @@ void AkVCam::Logger::setLogLevel(int logLevel)
|
||||||
loggerPrivate()->logLevel = 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 now = std::chrono::system_clock::now();
|
||||||
auto nowMSecs =
|
auto nowMSecs =
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace AkVCam
|
||||||
void setLogFile(const std::string &fileName);
|
void setLogFile(const std::string &fileName);
|
||||||
int logLevel();
|
int logLevel();
|
||||||
void setLogLevel(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);
|
std::ostream &log(int logLevel);
|
||||||
int levelFromString(const std::string &level);
|
int levelFromString(const std::string &level);
|
||||||
std::string levelToString(int level);
|
std::string levelToString(int level);
|
||||||
|
|
|
@ -436,7 +436,7 @@ std::string AkVCam::SettingsPrivate::parseString(const std::string &str)
|
||||||
memset(hex, 0, 3);
|
memset(hex, 0, 3);
|
||||||
|
|
||||||
for (size_t i = start; i < end; i++) {
|
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]);
|
auto key = strchr(escape_k, str[i + 1]);
|
||||||
|
|
||||||
if (key) {
|
if (key) {
|
||||||
|
|
|
@ -263,7 +263,7 @@ size_t AkVCam::VideoFormat::planeSize(size_t plane) const
|
||||||
|
|
||||||
bool AkVCam::VideoFormat::isValid() const
|
bool AkVCam::VideoFormat::isValid() const
|
||||||
{
|
{
|
||||||
if (this->size() <= 0)
|
if (this->size() < 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (this->d->m_frameRates.empty())
|
if (this->d->m_frameRates.empty())
|
||||||
|
|
|
@ -553,7 +553,7 @@ void AkVCam::AssistantPrivate::controlsUpdated(xpc_connection_t client,
|
||||||
AkLogFunction();
|
AkLogFunction();
|
||||||
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
||||||
|
|
||||||
if (this->m_deviceConfigs.count(deviceId) <= 0) {
|
if (this->m_deviceConfigs.count(deviceId) < 1) {
|
||||||
AkLogError() << "'"
|
AkLogError() << "'"
|
||||||
<< deviceId
|
<< deviceId
|
||||||
<< "' device in not in the devices list."
|
<< "' device in not in the devices list."
|
||||||
|
|
|
@ -187,7 +187,7 @@ std::string AkVCam::realPath(const std::string &path)
|
||||||
memset(realPath, 0, PATH_MAX);
|
memset(realPath, 0, PATH_MAX);
|
||||||
readlink(resolvedPath, realPath, PATH_MAX);
|
readlink(resolvedPath, realPath, PATH_MAX);
|
||||||
|
|
||||||
if (strlen(realPath) < 1)
|
if (strnlen(realPath, PATH_MAX) < 1)
|
||||||
return {resolvedPath};
|
return {resolvedPath};
|
||||||
|
|
||||||
return {realPath};
|
return {realPath};
|
||||||
|
|
|
@ -69,7 +69,7 @@ std::string AkVCam::locatePluginPath()
|
||||||
GetModuleFileNameA(hmodule, path, MAX_PATH);
|
GetModuleFileNameA(hmodule, path, MAX_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(path) < 1)
|
if (strnlen(path, MAX_PATH) < 1)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
return dirname(path);
|
return dirname(path);
|
||||||
|
|
|
@ -311,7 +311,8 @@ HRESULT AkVCam::BaseFilter::QueryFilterInfo(FILTER_INFO *pInfo)
|
||||||
auto filterName = stringToWSTR(this->d->m_filterName);
|
auto filterName = stringToWSTR(this->d->m_filterName);
|
||||||
memcpy(pInfo->achName,
|
memcpy(pInfo->achName,
|
||||||
filterName,
|
filterName,
|
||||||
(std::min<size_t>)(wcslen(filterName) * sizeof(WCHAR),
|
(std::min<size_t>)(wcsnlen(filterName, MAX_FILTER_NAME)
|
||||||
|
* sizeof(WCHAR),
|
||||||
MAX_FILTER_NAME));
|
MAX_FILTER_NAME));
|
||||||
CoTaskMemFree(filterName);
|
CoTaskMemFree(filterName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -702,7 +702,8 @@ HRESULT AkVCam::Pin::QueryPinInfo(PIN_INFO *pInfo)
|
||||||
auto pinName = stringToWSTR(this->d->m_pinName);
|
auto pinName = stringToWSTR(this->d->m_pinName);
|
||||||
memcpy(pInfo->achName,
|
memcpy(pInfo->achName,
|
||||||
pinName,
|
pinName,
|
||||||
(std::min<size_t>)(wcslen(pinName) * sizeof(WCHAR),
|
(std::min<size_t>)(wcsnlen(pinName, MAX_PIN_NAME)
|
||||||
|
* sizeof(WCHAR),
|
||||||
MAX_PIN_NAME));
|
MAX_PIN_NAME));
|
||||||
CoTaskMemFree(pinName);
|
CoTaskMemFree(pinName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/webcamoid-data
|
||||||
|
|
||||||
if [ "${TRAVIS_OS_NAME}" = linux ]; then
|
if [ "${TRAVIS_OS_NAME}" = linux ]; then
|
||||||
sudo mount --bind root.x86_64 root.x86_64
|
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}
|
cat << EOF > ${BUILDSCRIPT}
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
@ -53,12 +53,12 @@ i686-w64-mingw32-cmake \
|
||||||
cmake --build .
|
cmake --build .
|
||||||
EOF
|
EOF
|
||||||
chmod +x ${BUILDSCRIPT}
|
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='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
|
sudo umount root.x86_64
|
||||||
elif [ "${TRAVIS_OS_NAME}" = osx ]; then
|
elif [ "${TRAVIS_OS_NAME}" = osx ]; then
|
||||||
mkdir build
|
mkdir build
|
||||||
|
|
|
@ -28,7 +28,7 @@ DEPLOYSCRIPT=deployscript.sh
|
||||||
|
|
||||||
if [ "${TRAVIS_OS_NAME}" = linux ]; then
|
if [ "${TRAVIS_OS_NAME}" = linux ]; then
|
||||||
sudo mount --bind root.x86_64 root.x86_64
|
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
|
cat << EOF > package_info_strip.conf
|
||||||
[System]
|
[System]
|
||||||
|
@ -73,10 +73,10 @@ python ./DeployTools/deploy.py \
|
||||||
-o "\${PACKAGES_DIR}"
|
-o "\${PACKAGES_DIR}"
|
||||||
EOF
|
EOF
|
||||||
chmod +x ${DEPLOYSCRIPT}
|
chmod +x ${DEPLOYSCRIPT}
|
||||||
sudo cp -vf ${DEPLOYSCRIPT} root.x86_64/$HOME/
|
sudo cp -vf ${DEPLOYSCRIPT} "root.x86_64/$HOME/"
|
||||||
|
|
||||||
${EXEC} bash $HOME/${DEPLOYSCRIPT}
|
${EXEC} bash "$HOME/${DEPLOYSCRIPT}"
|
||||||
sudo umount root.x86_64/$HOME
|
sudo umount "root.x86_64/$HOME"
|
||||||
sudo umount root.x86_64
|
sudo umount root.x86_64
|
||||||
elif [ "${TRAVIS_OS_NAME}" = osx ]; then
|
elif [ "${TRAVIS_OS_NAME}" = osx ]; then
|
||||||
cd build
|
cd build
|
||||||
|
|
|
@ -34,7 +34,7 @@ if [ "${TRAVIS_OS_NAME}" = linux ]; then
|
||||||
# Download chroot image
|
# Download chroot image
|
||||||
archImage=archlinux-bootstrap-${ARCH_ROOT_DATE}-x86_64.tar.gz
|
archImage=archlinux-bootstrap-${ARCH_ROOT_DATE}-x86_64.tar.gz
|
||||||
${DOWNLOAD_CMD} ${ARCH_ROOT_URL}/iso/${ARCH_ROOT_DATE}/$archImage
|
${DOWNLOAD_CMD} ${ARCH_ROOT_URL}/iso/${ARCH_ROOT_DATE}/$archImage
|
||||||
sudo tar xzf $archImage
|
sudo tar xzf "$archImage"
|
||||||
|
|
||||||
# Configure mirrors
|
# Configure mirrors
|
||||||
cp -vf root.x86_64/etc/pacman.conf .
|
cp -vf root.x86_64/etc/pacman.conf .
|
||||||
|
@ -59,9 +59,9 @@ EOF
|
||||||
sudo cp -vf mirrorlist root.x86_64/etc/pacman.d/mirrorlist
|
sudo cp -vf mirrorlist root.x86_64/etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
# Install packages
|
# 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 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 --init
|
||||||
${EXEC} pacman-key --populate archlinux
|
${EXEC} pacman-key --populate archlinux
|
||||||
|
@ -89,7 +89,7 @@ EOF
|
||||||
nsis=nsis-${NSIS_VERSION}-setup.exe
|
nsis=nsis-${NSIS_VERSION}-setup.exe
|
||||||
${DOWNLOAD_CMD} "https://sourceforge.net/projects/nsis/files/NSIS%20${NSIS_VERSION:0:1}/${NSIS_VERSION}/${nsis}"
|
${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
|
INSTALLSCRIPT=installscript.sh
|
||||||
|
|
||||||
cat << EOF > ${INSTALLSCRIPT}
|
cat << EOF > ${INSTALLSCRIPT}
|
||||||
|
@ -104,12 +104,12 @@ wine ./${nsis} /S
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
chmod +x ${INSTALLSCRIPT}
|
chmod +x ${INSTALLSCRIPT}
|
||||||
sudo cp -vf ${INSTALLSCRIPT} root.x86_64/$HOME/
|
sudo cp -vf ${INSTALLSCRIPT} "root.x86_64/$HOME/"
|
||||||
${EXEC} bash $HOME/${INSTALLSCRIPT}
|
${EXEC} bash "$HOME/${INSTALLSCRIPT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
sudo umount root.x86_64/$HOME
|
sudo umount "root.x86_64/$HOME"
|
||||||
sudo umount root.x86_64
|
sudo umount root.x86_64
|
||||||
elif [ "${TRAVIS_OS_NAME}" = osx ]; then
|
elif [ "${TRAVIS_OS_NAME}" = osx ]; then
|
||||||
brew update
|
brew update
|
||||||
|
@ -126,7 +126,7 @@ elif [ "${TRAVIS_OS_NAME}" = osx ]; then
|
||||||
|
|
||||||
# Install Qt Installer Framework
|
# Install Qt Installer Framework
|
||||||
qtIFW=QtInstallerFramework-macOS-x86_64-${QTIFWVER}.dmg
|
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
|
if [ -e "${qtIFW}" ]; then
|
||||||
hdiutil convert ${qtIFW} -format UDZO -o qtifw
|
hdiutil convert ${qtIFW} -format UDZO -o qtifw
|
||||||
|
|
|
@ -45,23 +45,23 @@ if [[ ! -z "$DAILY_BUILD" || ! -z "$RELEASE_BUILD" ]]; then
|
||||||
|
|
||||||
./jfrog bt config \
|
./jfrog bt config \
|
||||||
--user=hipersayanx \
|
--user=hipersayanx \
|
||||||
--key=$BT_KEY \
|
--key="$BT_KEY" \
|
||||||
--licenses=GPL-3.0-or-later
|
--licenses=GPL-3.0-or-later
|
||||||
|
|
||||||
path=webcamoid-packages
|
path=webcamoid-packages
|
||||||
|
|
||||||
for f in $(find $path -type f); do
|
for f in $(find $path -type f); do
|
||||||
packagePath=${f#$path/}
|
packagePath=${f#$path/}
|
||||||
folder=$(dirname $packagePath)
|
folder=$(dirname "$packagePath")
|
||||||
|
|
||||||
./jfrog bt upload \
|
./jfrog bt upload \
|
||||||
--user=hipersayanx \
|
--user=hipersayanx \
|
||||||
--key=$BT_KEY \
|
--key=$BT_KEY \
|
||||||
--override=true \
|
--override=true \
|
||||||
--publish=$publish \
|
--publish=$publish \
|
||||||
$f \
|
"$f" \
|
||||||
webcamoid/webcamoid/akvirtualcamera/$version \
|
webcamoid/webcamoid/akvirtualcamera/$version \
|
||||||
$folder/
|
"$folder/"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Upload to Github Releases
|
# Upload to Github Releases
|
||||||
|
@ -76,11 +76,11 @@ if [[ ! -z "$DAILY_BUILD" || ! -z "$RELEASE_BUILD" ]]; then
|
||||||
hub=hub-darwin-amd64-${GITHUB_HUBVER}
|
hub=hub-darwin-amd64-${GITHUB_HUBVER}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ${TRAVIS_BUILD_DIR}
|
cd "${TRAVIS_BUILD_DIR}"
|
||||||
${DOWNLOAD_CMD} https://github.com/github/hub/releases/download/v${GITHUB_HUBVER}/${hub}.tgz || true
|
${DOWNLOAD_CMD} "https://github.com/github/hub/releases/download/v${GITHUB_HUBVER}/${hub}.tgz" || true
|
||||||
tar xzf ${hub}.tgz
|
tar xzf ${hub}.tgz
|
||||||
mkdir -p .local
|
mkdir -p .local
|
||||||
cp -rf ${hub}/* .local/
|
cp -rf "${hub}"/* .local/
|
||||||
|
|
||||||
export PATH="${PWD}/.local/bin:${PATH}"
|
export PATH="${PWD}/.local/bin:${PATH}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue