mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 01:18:38 -05:00
PVS-Studio static analysis corrections (1) issue #137
This commit is contained in:
parent
0ce9035e0a
commit
f01b90094b
@ -621,7 +621,7 @@ void DevicePlutoSDRBox::setLOPPMTenths(int ppmTenths)
|
|||||||
char buff[100];
|
char buff[100];
|
||||||
std::vector<std::string> params;
|
std::vector<std::string> params;
|
||||||
int64_t newXO = m_xoInitial + ((m_xoInitial*ppmTenths) / 10000000L);
|
int64_t newXO = m_xoInitial + ((m_xoInitial*ppmTenths) / 10000000L);
|
||||||
snprintf(buff, sizeof(buff), "xo_correction=%ld", newXO);
|
snprintf(buff, sizeof(buff), "xo_correction=%ld", (long int) newXO);
|
||||||
params.push_back(std::string(buff));
|
params.push_back(std::string(buff));
|
||||||
set_params(DEVICE_PHY, params);
|
set_params(DEVICE_PHY, params);
|
||||||
m_LOppmTenths = ppmTenths;
|
m_LOppmTenths = ppmTenths;
|
||||||
|
@ -93,9 +93,9 @@ void HttpConnectionHandlerPool::cleanup()
|
|||||||
{
|
{
|
||||||
if (++idleCounter > maxIdleHandlers)
|
if (++idleCounter > maxIdleHandlers)
|
||||||
{
|
{
|
||||||
delete handler;
|
|
||||||
pool.removeOne(handler);
|
pool.removeOne(handler);
|
||||||
qDebug("HttpConnectionHandlerPool: Removed connection handler (%p), pool size is now %i",handler,pool.size());
|
qDebug("HttpConnectionHandlerPool: Removed connection handler (%p), pool size is now %i",handler,pool.size());
|
||||||
|
delete handler;
|
||||||
break; // remove only one handler in each interval
|
break; // remove only one handler in each interval
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ HttpCookie::HttpCookie()
|
|||||||
version=1;
|
version=1;
|
||||||
maxAge=0;
|
maxAge=0;
|
||||||
secure=false;
|
secure=false;
|
||||||
|
httpOnly=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpCookie::HttpCookie(const QByteArray name, const QByteArray value, const int maxAge, const QByteArray path, const QByteArray comment, const QByteArray domain, const bool secure, const bool httpOnly)
|
HttpCookie::HttpCookie(const QByteArray name, const QByteArray value, const int maxAge, const QByteArray path, const QByteArray comment, const QByteArray domain, const bool secure, const bool httpOnly)
|
||||||
|
@ -488,13 +488,16 @@ void HttpRequest::parseMultiPartFile()
|
|||||||
#ifdef SUPERVERBOSE
|
#ifdef SUPERVERBOSE
|
||||||
qDebug("HttpRequest::parseMultiPartFile: finishing writing to uploaded file");
|
qDebug("HttpRequest::parseMultiPartFile: finishing writing to uploaded file");
|
||||||
#endif
|
#endif
|
||||||
uploadedFile->resize(uploadedFile->size()-2);
|
|
||||||
uploadedFile->flush();
|
|
||||||
uploadedFile->seek(0);
|
|
||||||
parameters.insert(fieldName,fileName);
|
parameters.insert(fieldName,fileName);
|
||||||
qDebug("HttpRequest::parseMultiPartFile: set parameter %s=%s",fieldName.data(),fileName.data());
|
if (uploadedFile)
|
||||||
uploadedFiles.insert(fieldName,uploadedFile);
|
{
|
||||||
qDebug("HttpRequest::parseMultiPartFile: uploaded file size is %i",(int) uploadedFile->size());
|
uploadedFile->resize(uploadedFile->size()-2);
|
||||||
|
uploadedFile->flush();
|
||||||
|
uploadedFile->seek(0);
|
||||||
|
qDebug("HttpRequest::parseMultiPartFile: set parameter %s=%s",fieldName.data(),fileName.data());
|
||||||
|
uploadedFiles.insert(fieldName,uploadedFile);
|
||||||
|
qDebug("HttpRequest::parseMultiPartFile: uploaded file size is %i",(int) uploadedFile->size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (line.contains(boundary+"--"))
|
if (line.contains(boundary+"--"))
|
||||||
{
|
{
|
||||||
|
@ -451,7 +451,7 @@ void ATVMod::pullVideo(Real& sample)
|
|||||||
if (camera.m_videoFPSCount < camera.m_videoFPSManualEnable ? camera.m_videoFPSManual : camera.m_videoFPS)
|
if (camera.m_videoFPSCount < camera.m_videoFPSManualEnable ? camera.m_videoFPSManual : camera.m_videoFPS)
|
||||||
{
|
{
|
||||||
camera.m_videoPrevFPSCount = (int) camera.m_videoFPSCount;
|
camera.m_videoPrevFPSCount = (int) camera.m_videoFPSCount;
|
||||||
camera.m_videoFPSCount += camera.m_videoFPSManualEnable ? camera.m_videoFPSqManual : camera.m_videoFPSq;
|
camera.m_videoFPSCount += (camera.m_videoFPSManualEnable ? camera.m_videoFPSqManual : camera.m_videoFPSq);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -129,8 +129,12 @@ bool ATVModGUI::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
else if (status == 2) // camera FPS scan is finished
|
else if (status == 2) // camera FPS scan is finished
|
||||||
{
|
{
|
||||||
m_camBusyFPSMessageBox->close();
|
if (m_camBusyFPSMessageBox)
|
||||||
if (m_camBusyFPSMessageBox) delete m_camBusyFPSMessageBox;
|
{
|
||||||
|
m_camBusyFPSMessageBox->close();
|
||||||
|
delete m_camBusyFPSMessageBox;
|
||||||
|
}
|
||||||
|
|
||||||
m_camBusyFPSMessageBox = 0;
|
m_camBusyFPSMessageBox = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
QMutex m_startWaitMutex;
|
QMutex m_startWaitMutex;
|
||||||
QWaitCondition m_startWaiter;
|
QWaitCondition m_startWaiter;
|
||||||
bool m_running;
|
volatile bool m_running;
|
||||||
|
|
||||||
std::ofstream* m_ofstream;
|
std::ofstream* m_ofstream;
|
||||||
std::size_t m_bufsize;
|
std::size_t m_bufsize;
|
||||||
|
@ -112,7 +112,7 @@ void FileSourceInput::seekFileStream(int seekPercentage)
|
|||||||
{
|
{
|
||||||
QMutexLocker mutexLocker(&m_mutex);
|
QMutexLocker mutexLocker(&m_mutex);
|
||||||
|
|
||||||
if ((m_ifstream.is_open()) && !m_fileSourceThread->isRunning())
|
if ((m_ifstream.is_open()) && m_fileSourceThread && !m_fileSourceThread->isRunning())
|
||||||
{
|
{
|
||||||
int seekPoint = ((m_recordLength * seekPercentage) / 100) * m_sampleRate;
|
int seekPoint = ((m_recordLength * seekPercentage) / 100) * m_sampleRate;
|
||||||
m_fileSourceThread->setSamplesCount(seekPoint);
|
m_fileSourceThread->setSamplesCount(seekPoint);
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
QMutex m_startWaitMutex;
|
QMutex m_startWaitMutex;
|
||||||
QWaitCondition m_startWaiter;
|
QWaitCondition m_startWaiter;
|
||||||
bool m_running;
|
volatile bool m_running;
|
||||||
|
|
||||||
std::ifstream* m_ifstream;
|
std::ifstream* m_ifstream;
|
||||||
quint8 *m_fileBuf;
|
quint8 *m_fileBuf;
|
||||||
|
@ -61,7 +61,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
QMutex m_startWaitMutex;
|
QMutex m_startWaitMutex;
|
||||||
QWaitCondition m_startWaiter;
|
QWaitCondition m_startWaiter;
|
||||||
bool m_running;
|
volatile bool m_running;
|
||||||
|
|
||||||
qint16 *m_buf;
|
qint16 *m_buf;
|
||||||
quint32 m_bufsize;
|
quint32 m_bufsize;
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "samplesourcefifo.h"
|
#include "samplesourcefifo.h"
|
||||||
|
|
||||||
@ -40,7 +41,8 @@ void SampleSourceFifo::resize(uint32_t size)
|
|||||||
|
|
||||||
void SampleSourceFifo::init()
|
void SampleSourceFifo::init()
|
||||||
{
|
{
|
||||||
memset(&m_data[0], 0, sizeof(2*m_size*sizeof(Sample)));
|
static Sample zero = {0,0};
|
||||||
|
std::fill(m_data.begin(), m_data.end(), zero);
|
||||||
m_ir = 0;
|
m_ir = 0;
|
||||||
m_iw = m_size/2;
|
m_iw = m_size/2;
|
||||||
m_init = true;
|
m_init = true;
|
||||||
|
@ -36,7 +36,6 @@ set(sdrgui_SOURCES
|
|||||||
gui/rollupwidget.cpp
|
gui/rollupwidget.cpp
|
||||||
gui/samplingdevicecontrol.cpp
|
gui/samplingdevicecontrol.cpp
|
||||||
gui/samplingdevicedialog.cpp
|
gui/samplingdevicedialog.cpp
|
||||||
gui/scale.cpp
|
|
||||||
gui/scaleengine.cpp
|
gui/scaleengine.cpp
|
||||||
gui/tickedslider.cpp
|
gui/tickedslider.cpp
|
||||||
gui/transverterbutton.cpp
|
gui/transverterbutton.cpp
|
||||||
@ -92,7 +91,6 @@ set(sdrgui_HEADERS
|
|||||||
gui/rollupwidget.h
|
gui/rollupwidget.h
|
||||||
gui/samplingdevicecontrol.h
|
gui/samplingdevicecontrol.h
|
||||||
gui/samplingdevicedialog.h
|
gui/samplingdevicedialog.h
|
||||||
gui/scale.h
|
|
||||||
gui/scaleengine.h
|
gui/scaleengine.h
|
||||||
gui/tickedslider.h
|
gui/tickedslider.h
|
||||||
gui/transverterbutton.h
|
gui/transverterbutton.h
|
||||||
|
@ -542,7 +542,10 @@ bool ScopeVisMulti::handleMessage(const Message& message)
|
|||||||
if (m_preTriggerDelay != triggerPre)
|
if (m_preTriggerDelay != triggerPre)
|
||||||
{
|
{
|
||||||
m_preTriggerDelay = triggerPre;
|
m_preTriggerDelay = triggerPre;
|
||||||
m_glScope->setTriggerPre(m_preTriggerDelay);
|
|
||||||
|
if (m_glScope) {
|
||||||
|
m_glScope->setTriggerPre(m_preTriggerDelay);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (freeRun != m_freeRun)
|
if (freeRun != m_freeRun)
|
||||||
|
@ -595,7 +595,10 @@ bool ScopeVisNG::handleMessage(const Message& message)
|
|||||||
if (m_preTriggerDelay != triggerPre)
|
if (m_preTriggerDelay != triggerPre)
|
||||||
{
|
{
|
||||||
m_preTriggerDelay = triggerPre;
|
m_preTriggerDelay = triggerPre;
|
||||||
m_glScope->setTriggerPre(m_preTriggerDelay);
|
|
||||||
|
if (m_glScope) {
|
||||||
|
m_glScope->setTriggerPre(m_preTriggerDelay);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (freeRun != m_freeRun)
|
if (freeRun != m_freeRun)
|
||||||
|
@ -224,7 +224,7 @@ bool GLScopeMultiGUI::deserialize(const QByteArray& data)
|
|||||||
ui->verticalXY->setEnabled(false);
|
ui->verticalXY->setEnabled(false);
|
||||||
ui->polar->setEnabled(false);
|
ui->polar->setEnabled(false);
|
||||||
|
|
||||||
ui->traceMode->setCurrentIndex(intValue);
|
ui->traceMode->setCurrentIndex(0);
|
||||||
d.readS32(1, &intValue, (int) GLScopeMulti::DisplayX);
|
d.readS32(1, &intValue, (int) GLScopeMulti::DisplayX);
|
||||||
m_glScope->setDisplayMode((GLScopeMulti::DisplayMode) intValue);
|
m_glScope->setDisplayMode((GLScopeMulti::DisplayMode) intValue);
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ bool GLScopeNGGUI::deserialize(const QByteArray& data)
|
|||||||
ui->verticalXY->setEnabled(false);
|
ui->verticalXY->setEnabled(false);
|
||||||
ui->polar->setEnabled(false);
|
ui->polar->setEnabled(false);
|
||||||
|
|
||||||
ui->traceMode->setCurrentIndex(intValue);
|
ui->traceMode->setCurrentIndex(0);
|
||||||
d.readS32(1, &intValue, (int) GLScopeNG::DisplayX);
|
d.readS32(1, &intValue, (int) GLScopeNG::DisplayX);
|
||||||
m_glScope->setDisplayMode((GLScopeNG::DisplayMode) intValue);
|
m_glScope->setDisplayMode((GLScopeNG::DisplayMode) intValue);
|
||||||
|
|
||||||
|
@ -1,129 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
|
||||||
// written by Christian Daniel //
|
|
||||||
// //
|
|
||||||
// This program is free software; you can redistribute it and/or modify //
|
|
||||||
// it under the terms of the GNU General Public License as published by //
|
|
||||||
// the Free Software Foundation as version 3 of the License, or //
|
|
||||||
// //
|
|
||||||
// This program is distributed in the hope that it will be useful, //
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
||||||
// GNU General Public License V3 for more details. //
|
|
||||||
// //
|
|
||||||
// You should have received a copy of the GNU General Public License //
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include <QPainter>
|
|
||||||
#include "gui/scale.h"
|
|
||||||
|
|
||||||
Scale::Scale(QWidget* parent) :
|
|
||||||
QWidget(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scale::setOrientation(Qt::Orientation orientation)
|
|
||||||
{
|
|
||||||
m_orientation = orientation;
|
|
||||||
m_scaleEngine.setOrientation(orientation);
|
|
||||||
m_scaleEngine.setFont(font());
|
|
||||||
QFontMetrics fm(font());
|
|
||||||
switch(m_orientation) {
|
|
||||||
case Qt::Horizontal:
|
|
||||||
m_scaleEngine.setSize(width());
|
|
||||||
setMinimumWidth(0);
|
|
||||||
setMaximumWidth(QWIDGETSIZE_MAX);
|
|
||||||
setMinimumHeight(3 + fontMetrics().ascent());
|
|
||||||
setMaximumHeight(3 + fontMetrics().ascent());
|
|
||||||
break;
|
|
||||||
case Qt::Vertical:
|
|
||||||
m_scaleEngine.setSize(height());
|
|
||||||
setMinimumWidth(30);
|
|
||||||
setMaximumWidth(30);
|
|
||||||
setMinimumHeight(0);
|
|
||||||
setMaximumHeight(QWIDGETSIZE_MAX);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scale::setRange(Unit::Physical physicalUnit, float rangeMin, float rangeMax)
|
|
||||||
{
|
|
||||||
m_scaleEngine.setRange(physicalUnit, rangeMin, rangeMax);
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scale::paintEvent(QPaintEvent*)
|
|
||||||
{
|
|
||||||
QPainter painter(this);
|
|
||||||
const ScaleEngine::TickList& tickList = m_scaleEngine.getTickList();
|
|
||||||
QFontMetricsF fontMetrics(font());
|
|
||||||
const ScaleEngine::Tick* tick;
|
|
||||||
int i;
|
|
||||||
float bottomLine;
|
|
||||||
|
|
||||||
switch(m_orientation) {
|
|
||||||
case Qt::Horizontal: {
|
|
||||||
painter.setPen(Qt::black);
|
|
||||||
|
|
||||||
// Zwischenlinien für x-Achse zeichnen
|
|
||||||
for(i = 0; i < tickList.count(); i++) {
|
|
||||||
tick = &tickList[i];
|
|
||||||
if(!tick->major)
|
|
||||||
painter.drawLine(QLineF(tick->pos, 0, tick->pos, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skala am Rand zeichnen
|
|
||||||
painter.drawLine(QLineF(0, 0, width() - 1, 0));
|
|
||||||
|
|
||||||
// Hauptlinien und Beschriftung für x-Achse zeichnen
|
|
||||||
for(i = 0; i < tickList.count(); i++) {
|
|
||||||
tick = &tickList[i];
|
|
||||||
if(tick->major) {
|
|
||||||
painter.drawLine(QLineF(tick->pos - 1, 0, tick->pos - 1, 3));
|
|
||||||
if(tick->textSize > 0) {
|
|
||||||
painter.drawText(QPointF(tick->textPos, 3 + fontMetrics.ascent()), tick->text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case Qt::Vertical: {
|
|
||||||
bottomLine = height() - 1;
|
|
||||||
painter.setPen(Qt::black);
|
|
||||||
|
|
||||||
// Zwischenlinien für y-Achse zeichnen
|
|
||||||
for(i = 0; i < tickList.count(); i++) {
|
|
||||||
tick = &tickList[i];
|
|
||||||
if(!tick->major)
|
|
||||||
painter.drawLine(QLineF(width() - 2, bottomLine - tick->pos, width() - 1, bottomLine - tick->pos));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skala am Rand zeichnen
|
|
||||||
painter.drawLine(QLineF(width() - 1, 0, width() - 1, height() - 1));
|
|
||||||
|
|
||||||
// Hauptlinien und Beschriftung für y-Achse zeichnen
|
|
||||||
for(i = 0; i < tickList.count(); i++) {
|
|
||||||
tick = &tickList[i];
|
|
||||||
if(tick->major) {
|
|
||||||
painter.drawLine(QLineF(width() - 4, bottomLine - tick->pos, width() - 1, bottomLine - tick->pos));
|
|
||||||
if(tick->textSize > 0)
|
|
||||||
painter.drawText(QPointF(width() - 4 - tick->textSize, bottomLine - tick->textPos), tick->text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scale::resizeEvent(QResizeEvent*)
|
|
||||||
{
|
|
||||||
switch(m_orientation) {
|
|
||||||
case Qt::Horizontal:
|
|
||||||
m_scaleEngine.setSize(width());
|
|
||||||
break;
|
|
||||||
case Qt::Vertical:
|
|
||||||
m_scaleEngine.setSize(height());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
|
||||||
// written by Christian Daniel //
|
|
||||||
// //
|
|
||||||
// This program is free software; you can redistribute it and/or modify //
|
|
||||||
// it under the terms of the GNU General Public License as published by //
|
|
||||||
// the Free Software Foundation as version 3 of the License, or //
|
|
||||||
// //
|
|
||||||
// This program is distributed in the hope that it will be useful, //
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
||||||
// GNU General Public License V3 for more details. //
|
|
||||||
// //
|
|
||||||
// You should have received a copy of the GNU General Public License //
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include "gui/scaleengine.h"
|
|
||||||
#include "util/export.h"
|
|
||||||
|
|
||||||
class SDRANGEL_API Scale : public QWidget {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
Scale(QWidget* parent = NULL);
|
|
||||||
|
|
||||||
void setOrientation(Qt::Orientation orientation);
|
|
||||||
void setRange(Unit::Physical physicalUnit, float rangeMin, float rangeMax);
|
|
||||||
|
|
||||||
private:
|
|
||||||
Qt::Orientation m_orientation;
|
|
||||||
ScaleEngine m_scaleEngine;
|
|
||||||
|
|
||||||
void paintEvent(QPaintEvent*);
|
|
||||||
void resizeEvent(QResizeEvent*);
|
|
||||||
};
|
|
@ -75,7 +75,6 @@ SOURCES += mainwindow.cpp\
|
|||||||
gui/samplingdevicecontrol.cpp\
|
gui/samplingdevicecontrol.cpp\
|
||||||
gui/samplingdevicedialog.cpp\
|
gui/samplingdevicedialog.cpp\
|
||||||
gui/mypositiondialog.cpp\
|
gui/mypositiondialog.cpp\
|
||||||
gui/scale.cpp\
|
|
||||||
gui/scaleengine.cpp\
|
gui/scaleengine.cpp\
|
||||||
gui/transverterbutton.cpp\
|
gui/transverterbutton.cpp\
|
||||||
gui/transverterdialog.cpp\
|
gui/transverterdialog.cpp\
|
||||||
@ -126,7 +125,6 @@ HEADERS += mainwindow.h\
|
|||||||
gui/samplingdevicecontrol.h\
|
gui/samplingdevicecontrol.h\
|
||||||
gui/samplingdevicedialog.h\
|
gui/samplingdevicedialog.h\
|
||||||
gui/mypositiondialog.h\
|
gui/mypositiondialog.h\
|
||||||
gui/scale.h\
|
|
||||||
gui/scaleengine.h\
|
gui/scaleengine.h\
|
||||||
gui/tickedslider.h\
|
gui/tickedslider.h\
|
||||||
gui/transverterbutton.h\
|
gui/transverterbutton.h\
|
||||||
|
Loading…
Reference in New Issue
Block a user