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/panel.h>
#include <wx/numformatter.h> #include <wx/numformatter.h>
#include <stddef.h>
#ifdef __linux__ #ifdef __linux__
#include "CubicSDR.xpm" #include "CubicSDR.xpm"
@ -2576,7 +2577,7 @@ void AppFrame::setViewState(long long center_freq, int bandwidth) {
waterfallCanvas->setView(center_freq, bandwidth); waterfallCanvas->setView(center_freq, bandwidth);
} }
void AppFrame::setViewState(long long center_freq) { void AppFrame::setViewState() {
spectrumCanvas->setCenterFrequency(wxGetApp().getFrequency()); spectrumCanvas->setCenterFrequency(wxGetApp().getFrequency());
waterfallCanvas->setCenterFrequency(wxGetApp().getFrequency()); waterfallCanvas->setCenterFrequency(wxGetApp().getFrequency());
spectrumCanvas->disableView(); 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; std::vector<std::string> vect_out;
int i = 0, j = 0; size_t i = 0, j = 0;
int seperator_len = seperator.length(); size_t seperator_len = seperator.length();
int str_len = in_str.length(); size_t str_len = in_str.length();
while(i < str_len) while(i < str_len)
{ {
j = in_str.find_first_of(seperator,i); 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)); vect_out.push_back(in_str.substr(i,j-i));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -12,14 +12,6 @@
#include "CoreFoundation/CoreFoundation.h" #include "CoreFoundation/CoreFoundation.h"
#endif #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 #ifndef RES_FOLDER
#define RES_FOLDER "" #define RES_FOLDER ""
#endif #endif

View File

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

View File

@ -13,7 +13,7 @@
class InteractiveCanvas: public wxGLCanvas { class InteractiveCanvas: public wxGLCanvas {
public: public:
InteractiveCanvas(wxWindow *parent, std::vector<int> dispAttrs); InteractiveCanvas(wxWindow *parent, std::vector<int> dispAttrs);
~InteractiveCanvas(); virtual ~InteractiveCanvas();
long long getFrequencyAt(float x); long long getFrequencyAt(float x);
long long getFrequencyAt(float x, long long iqCenterFreq, long long iqBandwidth); 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); 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()... //Displayed string is wstring, so use wxString to do the heavy lifting of converting getDemodulatorType()...
wxString demodStr; wxString demodStr;
demodStr.assign(demod->getDemodulatorType()); demodStr.assign(demod->getDemodulatorType());
demodAlign = GLFont::GLFONT_ALIGN_CENTER;
if (demodStr == "LSB") { if (demodStr == "LSB") {
demodAlign = GLFont::GLFONT_ALIGN_RIGHT;
uxPos -= xOfs; uxPos -= xOfs;
} else if (demodStr == "USB") { } else if (demodStr == "USB") {
demodAlign = GLFont::GLFONT_ALIGN_LEFT;
uxPos += xOfs; uxPos += xOfs;
} }
// advanced demodulators start here // advanced demodulators start here