Cleanup: remove some unused params and variables, conversion warnings seen with #550.

This commit is contained in:
vsonnier 2017-05-29 20:08:45 +02:00
parent be3c0c9778
commit 8f608bbf5c
15 changed files with 25 additions and 36 deletions

View File

@ -29,6 +29,7 @@
#include <wx/panel.h>
#include <wx/numformatter.h>
#include <stddef.h>
#ifdef __linux__
#include "CubicSDR.xpm"
@ -2576,7 +2577,7 @@ void AppFrame::setViewState(long long center_freq, int bandwidth) {
waterfallCanvas->setView(center_freq, bandwidth);
}
void AppFrame::setViewState(long long center_freq) {
void AppFrame::setViewState() {
spectrumCanvas->setCenterFrequency(wxGetApp().getFrequency());
waterfallCanvas->setCenterFrequency(wxGetApp().getFrequency());
spectrumCanvas->disableView();
@ -2600,17 +2601,21 @@ std::vector<std::string> str_explode(const std::string &seperator, const std::st
{
std::vector<std::string> vect_out;
int i = 0, j = 0;
int seperator_len = seperator.length();
int str_len = in_str.length();
size_t i = 0, j = 0;
size_t seperator_len = seperator.length();
size_t str_len = in_str.length();
while(i < str_len)
{
j = in_str.find_first_of(seperator,i);
if (j == std::string::npos && i < str_len) j = str_len;
if (j == std::string::npos && i < str_len) {
j = str_len;
}
if (j == std::string::npos) break;
if (j == std::string::npos) {
break;
}
vect_out.push_back(in_str.substr(i,j-i));

View File

@ -115,7 +115,7 @@ public:
FrequencyDialog::FrequencyDialogTarget getFrequencyDialogTarget();
void refreshGainUI();
void setViewState(long long center_freq, int bandwidth);
void setViewState(long long center_freq);
void setViewState();
long long getViewCenterFreq();
int getViewBandwidth();

View File

@ -149,7 +149,7 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup) {
setExpandState(groupName, (expandState == "true"));
while (group->hasAnother("modem")) {
DataNode *modem = group->getNext("modem");
BookmarkEntryPtr be = nodeToBookmark("modem", modem);
BookmarkEntryPtr be = nodeToBookmark(modem);
if (be) {
addBookmark(groupName.c_str(), be);
} else {
@ -165,7 +165,7 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup) {
while (recent_modems->hasAnother("modem")) {
DataNode *modem = recent_modems->getNext("modem");
BookmarkEntryPtr be = nodeToBookmark("modem", modem);
BookmarkEntryPtr be = nodeToBookmark(modem);
if (be) {
addRecent(be);
} else {
@ -499,7 +499,7 @@ BookmarkEntryPtr BookmarkMgr::demodToBookmarkEntry(DemodulatorInstance *demod) {
return be;
}
BookmarkEntryPtr BookmarkMgr::nodeToBookmark(const char *name_in, DataNode *node) {
BookmarkEntryPtr BookmarkMgr::nodeToBookmark(DataNode *node) {
if (!node->hasAnother("frequency") || !node->hasAnother("type") || !node->hasAnother("bandwidth")) {
return nullptr;
}

View File

@ -126,7 +126,7 @@ protected:
void trimRecents();
BookmarkEntryPtr demodToBookmarkEntry(DemodulatorInstance *demod);
BookmarkEntryPtr nodeToBookmark(const char *name_in, DataNode *node);
BookmarkEntryPtr nodeToBookmark(DataNode *node);
BookmarkMap bmData;
BookmarkMapSorted bmDataSorted;

View File

@ -122,7 +122,7 @@ void FrequencyDialog::OnChar(wxKeyEvent& event) {
}
if (freq == freq2) {
wxGetApp().setFrequency(freq_ctr);
wxGetApp().getAppFrame()->setViewState(freq_ctr);
wxGetApp().getAppFrame()->setViewState();
} else {
if (wxGetApp().getSampleRate()/4 > range_bw) {
wxGetApp().setFrequency(freq_ctr + wxGetApp().getSampleRate()/4);

View File

@ -526,12 +526,10 @@ DemodulatorInstance *DemodulatorMgr::loadInstance(DataNode *node) {
}
//Attach to sound output:
bool found_device = false;
std::map<int, RtAudio::DeviceInfo>::iterator i;
for (i = outputDevices.begin(); i != outputDevices.end(); i++) {
if (i->second.name == output_device) {
newDemod->setOutputDevice(i->first);
found_device = true;
break;
}
}

View File

@ -126,7 +126,7 @@ bool MeterPanel::isMeterHit(CubicVR::vec2 mousePoint) {
return false;
}
float MeterPanel::getMeterHitValue(CubicVR::vec2 mousePoint, GLPanel &panel) {
float MeterPanel::getMeterHitValue(CubicVR::vec2 mousePoint) {
CubicVR::vec2 hitResult;
if (bgPanel.hitTest(mousePoint, hitResult)) {

View File

@ -20,7 +20,7 @@ public:
void setHighlightVisible(bool vis);
float getValue();
bool isMeterHit(CubicVR::vec2 mousePoint);
float getMeterHitValue(CubicVR::vec2 mousePoint, GLPanel &panel);
float getMeterHitValue(CubicVR::vec2 mousePoint);
void setChanged(bool changed);
bool getChanged();

View File

@ -240,7 +240,7 @@ void SpectrumVisualProcessor::process() {
unsigned int num_written;
long resampleBw = iqData->sampleRate;
bool newResampler = false;
int bwDiff;
int bwDiff = 0;
if (is_view.load()) {
if (!iqData->sampleRate) {

View File

@ -95,8 +95,7 @@ void SDRPostThread::updateActiveDemodulators() {
for (demod_i = demodulators.begin(); demod_i != demodulators.end(); demod_i++) {
DemodulatorInstance *demod = *demod_i;
DemodulatorThreadInputQueue *demodQueue = demod->getIQInputDataPipe();
// not in range?
if (demod->isDeltaLock()) {
if (demod->getFrequency() != centerFreq + demod->getDeltaLockOfs()) {

View File

@ -63,6 +63,7 @@ public:
std::vector<GLPanel *> children;
GLPanel();
virtual ~GLPanel() {};
void setPosition(float x, float y);

View File

@ -12,14 +12,6 @@
#include "CoreFoundation/CoreFoundation.h"
#endif
static std::wstring getExePath(void)
{
//get the dir path of the executable
wxFileName exePath = wxFileName(wxStandardPaths::Get().GetExecutablePath());
return std::wstring(exePath.GetPath().ToStdWstring());
}
#ifndef RES_FOLDER
#define RES_FOLDER ""
#endif

View File

@ -83,7 +83,7 @@ void GainCanvas::SetLevel() {
for (auto gi : gainPanels) {
if (gi->isMeterHit(mpos)) {
float value = gi->getMeterHitValue(mpos, *gi);
float value = gi->getMeterHitValue(mpos);
gi->setValue(value);
gi->setChanged(true);
@ -100,7 +100,7 @@ void GainCanvas::OnMouseMoved(wxMouseEvent& event) {
for (auto gi : gainPanels) {
if (gi->isMeterHit(mpos)) {
float value = gi->getMeterHitValue(mpos, *gi);
float value = gi->getMeterHitValue(mpos);
gi->setHighlight(value);
gi->setHighlightVisible(true);

View File

@ -13,7 +13,7 @@
class InteractiveCanvas: public wxGLCanvas {
public:
InteractiveCanvas(wxWindow *parent, std::vector<int> dispAttrs);
~InteractiveCanvas();
virtual ~InteractiveCanvas();
long long getFrequencyAt(float x);
long long getFrequencyAt(float x, long long iqCenterFreq, long long iqBandwidth);

View File

@ -356,20 +356,14 @@ void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGBA4f color, long
glEnable(GL_BLEND);
GLFont::Align demodAlign = GLFont::GLFONT_ALIGN_CENTER;
//Displayed string is wstring, so use wxString to do the heavy lifting of converting getDemodulatorType()...
wxString demodStr;
demodStr.assign(demod->getDemodulatorType());
demodAlign = GLFont::GLFONT_ALIGN_CENTER;
if (demodStr == "LSB") {
demodAlign = GLFont::GLFONT_ALIGN_RIGHT;
uxPos -= xOfs;
} else if (demodStr == "USB") {
demodAlign = GLFont::GLFONT_ALIGN_LEFT;
uxPos += xOfs;
}
// advanced demodulators start here