Some minor changes proposed by the static analyzer.

This commit is contained in:
Leon Styhre 2021-07-09 19:58:21 +02:00
parent aed9e3970b
commit 1cee40f291
3 changed files with 15 additions and 12 deletions

View file

@ -627,7 +627,7 @@ void MiximageGenerator::sampleFrameColor(CImg<unsigned char>& screenshotImage,
// Convert to the HSL color space to be able to modify saturation and lightness. // Convert to the HSL color space to be able to modify saturation and lightness.
CImg<float> colorHSL = CImg<>(1, 1, 1, 3).fill(redC, greenC, blueC).RGBtoHSL(); CImg<float> colorHSL = CImg<>(1, 1, 1, 3).fill(redC, greenC, blueC).RGBtoHSL();
float hue = colorHSL(0, 0, 0, 0); // float hue = colorHSL(0, 0, 0, 0);
float saturation = colorHSL(0, 0, 0, 1); float saturation = colorHSL(0, 0, 0, 1);
float lightness = colorHSL(0, 0, 0, 2); float lightness = colorHSL(0, 0, 0, 2);

View file

@ -307,17 +307,14 @@ void AudioManager::clearStream()
// SDL_AudioStreamClear(sConversionStream); // SDL_AudioStreamClear(sConversionStream);
mIsClearingStream = true; mIsClearingStream = true;
int streamSize;
int length = sAudioFormat.samples * 4; int length = sAudioFormat.samples * 4;
while ((streamSize = SDL_AudioStreamAvailable(sConversionStream)) > 0) { while (SDL_AudioStreamAvailable(sConversionStream) > 0) {
std::vector<Uint8> readBuffer(length); std::vector<Uint8> readBuffer(length);
int processedLength = int processedLength =
SDL_AudioStreamGet(sConversionStream, static_cast<void*>(&readBuffer.at(0)), length); SDL_AudioStreamGet(sConversionStream, static_cast<void*>(&readBuffer.at(0)), length);
if (processedLength <= 0) { if (processedLength <= 0)
break; break;
}
} }
mIsClearingStream = false; mIsClearingStream = false;

View file

@ -37,11 +37,9 @@ namespace Scripting
if (Utils::FileSystem::exists(scriptDir)) if (Utils::FileSystem::exists(scriptDir))
scriptDirList.push_back(scriptDir); scriptDirList.push_back(scriptDir);
for (std::list<std::string>::const_iterator dirIt = scriptDirList.cbegin(); for (auto dirIt = scriptDirList.cbegin(); dirIt != scriptDirList.cend(); dirIt++) {
dirIt != scriptDirList.cend(); dirIt++) {
std::list<std::string> scripts = Utils::FileSystem::getDirContent(*dirIt); std::list<std::string> scripts = Utils::FileSystem::getDirContent(*dirIt);
for (std::list<std::string>::const_iterator it = scripts.cbegin(); // Line break. for (auto it = scripts.cbegin(); it != scripts.cend(); it++) {
it != scripts.cend(); it++) {
std::string arg1Quotation; std::string arg1Quotation;
std::string arg2Quotation; std::string arg2Quotation;
// Add quotation marks around the arguments as long as these are not already // Add quotation marks around the arguments as long as these are not already
@ -50,8 +48,16 @@ namespace Scripting
arg1Quotation = "\""; arg1Quotation = "\"";
if (arg2.front() != '\"') if (arg2.front() != '\"')
arg2Quotation = "\""; arg2Quotation = "\"";
std::string script = *it + " " + arg1Quotation + arg1 + arg1Quotation + " " + std::string script;
arg2Quotation + arg2 + arg2Quotation; script.append(*it)
.append(" ")
.append(arg1Quotation)
.append(arg1)
.append(arg1Quotation)
.append(" ")
.append(arg2Quotation)
.append(arg2)
.append(arg2Quotation);
LOG(LogDebug) << "Executing: " << script; LOG(LogDebug) << "Executing: " << script;
runSystemCommand(script); runSystemCommand(script);
} }