Use nullptr instead of NULL when shared_ptr is used

This commit is contained in:
vsonnier 2017-08-27 13:00:32 +02:00
parent 37712c7a81
commit 3c3939e0b7
4 changed files with 20 additions and 20 deletions

View File

@ -16,12 +16,12 @@
#define MAX_BLOCKING_DURATION_MICROS (1000 * 1000) #define MAX_BLOCKING_DURATION_MICROS (1000 * 1000)
SDRPostThread::SDRPostThread() : IOThread(), buffers("SDRPostThreadBuffers"), visualDataBuffers("SDRPostThreadVisualDataBuffers"), frequency(0) { SDRPostThread::SDRPostThread() : IOThread(), buffers("SDRPostThreadBuffers"), visualDataBuffers("SDRPostThreadVisualDataBuffers"), frequency(0) {
iqDataInQueue = NULL; iqDataInQueue = nullptr;
iqDataOutQueue = NULL; iqDataOutQueue = nullptr;
iqVisualQueue = NULL; iqVisualQueue = nullptr;
numChannels = 0; numChannels = 0;
channelizer = NULL; channelizer = nullptr;
sampleRate = 0; sampleRate = 0;
nRunDemods = 0; nRunDemods = 0;
@ -92,7 +92,7 @@ void SDRPostThread::updateActiveDemodulators() {
} }
} else if (!demod->isActive()) { // in range, activate if not activated } else if (!demod->isActive()) { // in range, activate if not activated
demod->setActive(true); demod->setActive(true);
if (wxGetApp().getDemodMgr().getLastActiveDemodulator() == NULL) { if (wxGetApp().getDemodMgr().getLastActiveDemodulator() == nullptr) {
wxGetApp().getDemodMgr().setActiveDemodulator(demod); wxGetApp().getDemodMgr().setActiveDemodulator(demod);
} }
@ -232,7 +232,7 @@ void SDRPostThread::runSingleCH(SDRThreadIQData *data_in) {
size_t refCount = nRunDemods; size_t refCount = nRunDemods;
bool doIQDataOut = (iqDataOutQueue != nullptr && !iqDataOutQueue->full()); bool doIQDataOut = (iqDataOutQueue != nullptr && !iqDataOutQueue->full());
bool doDemodVisOut = (nRunDemods && iqActiveDemodVisualQueue != NULL && !iqActiveDemodVisualQueue->full()); bool doDemodVisOut = (nRunDemods && iqActiveDemodVisualQueue != nullptr && !iqActiveDemodVisualQueue->full());
bool doVisOut = (iqVisualQueue != nullptr && !iqVisualQueue->full()); bool doVisOut = (iqVisualQueue != nullptr && !iqVisualQueue->full());
if (doIQDataOut) { if (doIQDataOut) {
@ -309,7 +309,7 @@ void SDRPostThread::runPFBCH(SDRThreadIQData *data_in) {
bool doVis = false; bool doVis = false;
if (iqVisualQueue != NULL && !iqVisualQueue->full()) { if (iqVisualQueue != nullptr && !iqVisualQueue->full()) {
doVis = true; doVis = true;
} }
@ -371,7 +371,7 @@ void SDRPostThread::runPFBCH(SDRThreadIQData *data_in) {
// Run channels // Run channels
for (int i = 0; i < numChannels+1; i++) { for (int i = 0; i < numChannels+1; i++) {
int doDemodVis = ((activeDemodChannel == i) && (iqActiveDemodVisualQueue != NULL) && !iqActiveDemodVisualQueue->full())?1:0; int doDemodVis = ((activeDemodChannel == i) && (iqActiveDemodVisualQueue != nullptr) && !iqActiveDemodVisualQueue->full())?1:0;
if (!doDemodVis && demodChannelActive[i] == 0) { if (!doDemodVis && demodChannelActive[i] == 0) {
continue; continue;

View File

@ -13,10 +13,10 @@
#define TARGET_DISPLAY_FPS 60 #define TARGET_DISPLAY_FPS 60
SDRThread::SDRThread() : IOThread(), buffers("SDRThreadBuffers") { SDRThread::SDRThread() : IOThread(), buffers("SDRThreadBuffers") {
device = NULL; device = nullptr;
deviceConfig.store(NULL); deviceConfig.store(nullptr);
deviceInfo.store(NULL); deviceInfo.store(nullptr);
sampleRate.store(DEFAULT_SAMPLE_RATE); sampleRate.store(DEFAULT_SAMPLE_RATE);
frequency.store(0); frequency.store(0);

View File

@ -331,7 +331,7 @@ void TuningCanvas::OnMouseMoved(wxMouseEvent& event) {
if (hoverState == TUNING_HOVER_BW || hoverState == TUNING_HOVER_FREQ) { if (hoverState == TUNING_HOVER_BW || hoverState == TUNING_HOVER_FREQ) {
wxGetApp().getDemodMgr().setActiveDemodulator(wxGetApp().getDemodMgr().getLastActiveDemodulator()); wxGetApp().getDemodMgr().setActiveDemodulator(wxGetApp().getDemodMgr().getLastActiveDemodulator());
} else { } else {
wxGetApp().getDemodMgr().setActiveDemodulator(NULL); wxGetApp().getDemodMgr().setActiveDemodulator(nullptr);
} }
} }
@ -401,7 +401,7 @@ void TuningCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
SetCursor(wxCURSOR_CROSS); SetCursor(wxCURSOR_CROSS);
hoverIndex = 0; hoverIndex = 0;
hoverState = TUNING_HOVER_NONE; hoverState = TUNING_HOVER_NONE;
wxGetApp().getDemodMgr().setActiveDemodulator(NULL); wxGetApp().getDemodMgr().setActiveDemodulator(nullptr);
if (currentPPM != lastPPM) { if (currentPPM != lastPPM) {
wxGetApp().saveConfig(); wxGetApp().saveConfig();

View File

@ -309,9 +309,9 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
} }
} else { } else {
if (lastActiveDemodulator) { if (lastActiveDemodulator) {
glContext->DrawDemod(lastActiveDemodulator, ((isNew && activeDemodulator == NULL) || (activeDemodulator != NULL))?currentTheme->waterfallHighlight:currentTheme->waterfallDestroy, currentCenterFreq, currentBandwidth); glContext->DrawDemod(lastActiveDemodulator, ((isNew && activeDemodulator == nullptr) || (activeDemodulator != nullptr))?currentTheme->waterfallHighlight:currentTheme->waterfallDestroy, currentCenterFreq, currentBandwidth);
} }
if (activeDemodulator == NULL) { if (activeDemodulator == nullptr) {
glContext->DrawFreqSelector(mouseTracker.getMouseX(), ((isNew && lastActiveDemodulator) || (!lastActiveDemodulator) )?currentTheme->waterfallNew:currentTheme->waterfallHover, 0, currentCenterFreq, currentBandwidth); glContext->DrawFreqSelector(mouseTracker.getMouseX(), ((isNew && lastActiveDemodulator) || (!lastActiveDemodulator) )?currentTheme->waterfallNew:currentTheme->waterfallHover, 0, currentCenterFreq, currentBandwidth);
} else { } else {
glContext->DrawDemod(activeDemodulator, currentTheme->waterfallHover, currentCenterFreq, currentBandwidth); glContext->DrawDemod(activeDemodulator, currentTheme->waterfallHover, currentCenterFreq, currentBandwidth);
@ -539,7 +539,7 @@ void WaterfallCanvas::updateHoverState() {
} }
} }
if (activeDemodulator == NULL) { if (activeDemodulator == nullptr) {
nextDragState = WF_DRAG_NONE; nextDragState = WF_DRAG_NONE;
SetCursor(wxCURSOR_CROSS); SetCursor(wxCURSOR_CROSS);
return; return;
@ -593,7 +593,7 @@ void WaterfallCanvas::OnMouseMoved(wxMouseEvent& event) {
auto demod = wxGetApp().getDemodMgr().getActiveDemodulator(); auto demod = wxGetApp().getDemodMgr().getActiveDemodulator();
if (mouseTracker.mouseDown()) { if (mouseTracker.mouseDown()) {
if (demod == NULL) { if (demod == nullptr) {
return; return;
} }
if (dragState == WF_DRAG_BANDWIDTH_LEFT || dragState == WF_DRAG_BANDWIDTH_RIGHT) { if (dragState == WF_DRAG_BANDWIDTH_LEFT || dragState == WF_DRAG_BANDWIDTH_RIGHT) {
@ -672,7 +672,7 @@ void WaterfallCanvas::OnMouseReleased(wxMouseEvent& event) {
InteractiveCanvas::OnMouseReleased(event); InteractiveCanvas::OnMouseReleased(event);
wxGetApp().getDemodMgr().updateLastState(); wxGetApp().getDemodMgr().updateLastState();
bool isNew = shiftDown || (wxGetApp().getDemodMgr().getLastActiveDemodulator() == NULL) bool isNew = shiftDown || (wxGetApp().getDemodMgr().getLastActiveDemodulator() == nullptr)
|| (wxGetApp().getDemodMgr().getLastActiveDemodulator() && !wxGetApp().getDemodMgr().getLastActiveDemodulator()->isActive()); || (wxGetApp().getDemodMgr().getLastActiveDemodulator() && !wxGetApp().getDemodMgr().getLastActiveDemodulator()->isActive());
mouseTracker.setVertDragLock(false); mouseTracker.setVertDragLock(false);
@ -832,7 +832,7 @@ void WaterfallCanvas::OnMouseReleased(wxMouseEvent& event) {
wxGetApp().notifyDemodulatorsChanged(); wxGetApp().notifyDemodulatorsChanged();
} }
if (demod == NULL) { if (demod == nullptr) {
dragState = WF_DRAG_NONE; dragState = WF_DRAG_NONE;
return; return;
} }
@ -852,7 +852,7 @@ void WaterfallCanvas::OnMouseReleased(wxMouseEvent& event) {
void WaterfallCanvas::OnMouseLeftWindow(wxMouseEvent& event) { void WaterfallCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
InteractiveCanvas::OnMouseLeftWindow(event); InteractiveCanvas::OnMouseLeftWindow(event);
SetCursor(wxCURSOR_CROSS); SetCursor(wxCURSOR_CROSS);
wxGetApp().getDemodMgr().setActiveDemodulator(NULL); wxGetApp().getDemodMgr().setActiveDemodulator(nullptr);
mouseZoom = 1.0; mouseZoom = 1.0;
} }