Skip to content

Commit

Permalink
Merge pull request supercollider#5373 from mlang/nullptr
Browse files Browse the repository at this point in the history
plugins: use nullptr
  • Loading branch information
mossheim authored Feb 25, 2021
2 parents 47060e2 + 41e7b80 commit 79f02a6
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 44 deletions.
8 changes: 4 additions & 4 deletions server/plugins/Convolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ static SndBuf* ConvGetBuffer(Unit* unit, uint32 bufnum, const char* ugenName, in
buf = world->mSndBufs + bufnum;
}

if (buf->data == NULL) {
if (buf->data == nullptr) {
if (unit->mWorld->mVerbosity > -1)
Print("%s: uninitialized buffer (%i).\n", ugenName, bufnum);
goto handle_failure;
Expand All @@ -269,7 +269,7 @@ static SndBuf* ConvGetBuffer(Unit* unit, uint32 bufnum, const char* ugenName, in
SETCALC(*ClearUnitOutputs);
ClearUnitOutputs(unit, inNumSamples);
unit->mDone = true;
return NULL;
return nullptr;
}

void Convolution2_Ctor(Convolution2* unit) {
Expand Down Expand Up @@ -345,7 +345,7 @@ void Convolution2_Ctor(Convolution2* unit) {
unit->mDone = true;
}
} else {
unit->m_scfft2 = unit->m_scfft1 = unit->m_scfftR = NULL;
unit->m_scfft2 = unit->m_scfft1 = unit->m_scfftR = nullptr;
printf("Convolution2_Ctor: can't get kernel buffer, giving up.\n");
SETCALC(*ClearUnitOutputs);
}
Expand Down Expand Up @@ -502,7 +502,7 @@ void Convolution2L_Ctor(Convolution2L* unit) {
// initialize output
OUT0(0) = IN0(0);
} else {
unit->m_scfft1 = unit->m_scfft2 = unit->m_scfft3 = unit->m_scfftR = unit->m_scfftR2 = NULL;
unit->m_scfft1 = unit->m_scfft2 = unit->m_scfft3 = unit->m_scfftR = unit->m_scfftR2 = nullptr;
}
}

Expand Down
18 changes: 9 additions & 9 deletions server/plugins/DelayUGens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ void BufWr_next(BufWr* unit, int inNumSamples) {
void RecordBuf_Ctor(RecordBuf* unit) {
uint32 numInputs = unit->mNumInputs - 8;
unit->m_fbufnum = -1e9f;
unit->mIn = 0;
unit->mIn = nullptr;
unit->m_writepos = (int32)ZIN0(1) * numInputs;
unit->m_recLevel = ZIN0(2);
unit->m_preLevel = ZIN0(3);
Expand Down Expand Up @@ -3457,7 +3457,7 @@ static bool DelayUnit_AllocDelayLine(DelayUnit* unit, const char* className) {
std::fill_n(unit->m_dlybuf, delaybufsize, std::numeric_limits<float>::signaling_NaN());
#endif

if (unit->m_dlybuf == NULL) {
if (unit->m_dlybuf == nullptr) {
SETCALC(ft->fClearUnitOutputs);
ClearUnitOutputs(unit, 1);

Expand All @@ -3466,7 +3466,7 @@ static bool DelayUnit_AllocDelayLine(DelayUnit* unit, const char* className) {
}

unit->m_mask = delaybufsize - 1;
return (unit->m_dlybuf != NULL);
return (unit->m_dlybuf != nullptr);
}

template <typename Unit> static float CalcDelay(Unit* unit, float delaytime) {
Expand All @@ -3478,7 +3478,7 @@ template <typename Unit> static float CalcDelay(Unit* unit, float delaytime) {
template <typename Unit> static bool DelayUnit_Reset(Unit* unit, const char* className) {
unit->m_maxdelaytime = ZIN0(1);
unit->m_delaytime = ZIN0(2);
unit->m_dlybuf = 0;
unit->m_dlybuf = nullptr;

if (!DelayUnit_AllocDelayLine(unit, className))
return false;
Expand Down Expand Up @@ -4489,7 +4489,7 @@ void ScopeOut_Ctor(ScopeOut* unit) {
unit->m_fbufnum = -1e9;
unit->m_framepos = 0;
unit->m_framecount = 0;
unit->mIn = 0;
unit->mIn = nullptr;
SETCALC(ScopeOut_next);
}

Expand Down Expand Up @@ -5107,7 +5107,7 @@ void GrainTap_next(GrainTap* unit, int inNumSamples) {
LOOP1(inNumSamples, ZXP(out) = 0.f;);

// do all current grains
prevGrain = NULL;
prevGrain = nullptr;
grain = unit->firstActive;
while (grain) {
dsamp = grain->pos;
Expand Down Expand Up @@ -5269,9 +5269,9 @@ void GrainTap_Ctor(GrainTap* unit) {
for (int i = 0; i < MAXDGRAINS - 1; ++i) {
unit->grains[i].next = unit->grains + (i + 1);
}
unit->grains[MAXDGRAINS - 1].next = NULL;
unit->grains[MAXDGRAINS - 1].next = nullptr;
unit->firstFree = unit->grains;
unit->firstActive = NULL;
unit->firstActive = nullptr;
}


Expand Down Expand Up @@ -5586,7 +5586,7 @@ void Pluck_Ctor(Pluck* unit) {
unit->m_maxdelaytime = IN0(2);
unit->m_delaytime = IN0(3);
unit->m_decaytime = IN0(4);
unit->m_dlybuf = 0;
unit->m_dlybuf = nullptr;
bool allocationSucessful = DelayUnit_AllocDelayLine(unit, "Pluck");
if (!allocationSucessful)
return;
Expand Down
8 changes: 4 additions & 4 deletions server/plugins/FFT_UGens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ void FFT_Ctor(FFT* unit) {
if (!FFTBase_Ctor(unit, 5)) {
SETCALC(FFT_ClearUnitOutputs);
// These zeroes are to prevent the dtor freeing things that don't exist:
unit->m_inbuf = 0;
unit->m_scfft = 0;
unit->m_inbuf = nullptr;
unit->m_scfft = nullptr;
return;
}
int audiosize = unit->m_audiosize * sizeof(float);
Expand Down Expand Up @@ -244,7 +244,7 @@ void IFFT_Ctor(IFFT* unit) {
if (!FFTBase_Ctor(unit, 2)) {
SETCALC(*ClearUnitOutputs);
// These zeroes are to prevent the dtor freeing things that don't exist:
unit->m_olabuf = 0;
unit->m_olabuf = nullptr;
return;
}

Expand All @@ -258,7 +258,7 @@ void IFFT_Ctor(IFFT* unit) {

if (!unit->m_scfft) {
SETCALC(*ClearUnitOutputs);
unit->m_olabuf = 0;
unit->m_olabuf = nullptr;
return;
}

Expand Down
32 changes: 16 additions & 16 deletions server/plugins/IOUGens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1554,7 +1554,7 @@ void LocalOut_next_a(IOUnit* unit, int inNumSamples) {
return;

float* out = localIn->m_bus;
if ((out == NULL) || (numChannels != localIn->mNumOutputs))
if ((out == nullptr) || (numChannels != localIn->mNumOutputs))
return;

int32* touched = localIn->m_busTouched;
Expand Down Expand Up @@ -1584,7 +1584,7 @@ FLATTEN void LocalOut_next_a_nova(IOUnit* unit, int inNumSamples) {
return;

float* out = localIn->m_bus;
if ((out == NULL) || (numChannels != localIn->mNumOutputs))
if ((out == nullptr) || (numChannels != localIn->mNumOutputs))
return;

int32* touched = localIn->m_busTouched;
Expand Down Expand Up @@ -1613,7 +1613,7 @@ FLATTEN void LocalOut_next_a_nova_64(IOUnit* unit, int inNumSamples) {
return;

float* out = localIn->m_bus;
if ((out == NULL) || (numChannels != localIn->mNumOutputs))
if ((out == nullptr) || (numChannels != localIn->mNumOutputs))
return;

int32* touched = localIn->m_busTouched;
Expand Down Expand Up @@ -1641,7 +1641,7 @@ void LocalOut_next_k(IOUnit* unit, int inNumSamples) {
return;

float* out = localIn->m_bus;
if ((out == NULL) || (numChannels != localIn->mNumOutputs))
if ((out == nullptr) || (numChannels != localIn->mNumOutputs))
return;

int32* touched = localIn->m_busTouched;
Expand Down Expand Up @@ -1688,16 +1688,16 @@ PluginLoad(IO) {
DefineSimpleUnit(XOut);
DefineDtorUnit(LagControl);
DefineDtorUnit(AudioControl);
DefineUnit("Control", sizeof(Unit), (UnitCtorFunc)&Control_Ctor, 0, 0);
DefineUnit("TrigControl", sizeof(Unit), (UnitCtorFunc)&TrigControl_Ctor, 0, 0);
DefineUnit("ReplaceOut", sizeof(IOUnit), (UnitCtorFunc)&ReplaceOut_Ctor, 0, 0);
DefineUnit("Out", sizeof(IOUnit), (UnitCtorFunc)&Out_Ctor, 0, 0);
DefineUnit("LocalOut", sizeof(IOUnit), (UnitCtorFunc)&LocalOut_Ctor, 0, 0);
DefineUnit("In", sizeof(IOUnit), (UnitCtorFunc)&In_Ctor, 0, 0);
DefineUnit("LagIn", sizeof(IOUnit), (UnitCtorFunc)&LagIn_Ctor, 0, 0);
DefineUnit("InFeedback", sizeof(IOUnit), (UnitCtorFunc)&InFeedback_Ctor, 0, 0);
DefineUnit("InTrig", sizeof(IOUnit), (UnitCtorFunc)&InTrig_Ctor, 0, 0);

DefineUnit("SharedOut", sizeof(IOUnit), (UnitCtorFunc)&SharedOut_Ctor, 0, 0);
DefineUnit("SharedIn", sizeof(IOUnit), (UnitCtorFunc)&SharedIn_Ctor, 0, 0);
DefineUnit("Control", sizeof(Unit), (UnitCtorFunc)&Control_Ctor, nullptr, 0);
DefineUnit("TrigControl", sizeof(Unit), (UnitCtorFunc)&TrigControl_Ctor, nullptr, 0);
DefineUnit("ReplaceOut", sizeof(IOUnit), (UnitCtorFunc)&ReplaceOut_Ctor, nullptr, 0);
DefineUnit("Out", sizeof(IOUnit), (UnitCtorFunc)&Out_Ctor, nullptr, 0);
DefineUnit("LocalOut", sizeof(IOUnit), (UnitCtorFunc)&LocalOut_Ctor, nullptr, 0);
DefineUnit("In", sizeof(IOUnit), (UnitCtorFunc)&In_Ctor, nullptr, 0);
DefineUnit("LagIn", sizeof(IOUnit), (UnitCtorFunc)&LagIn_Ctor, nullptr, 0);
DefineUnit("InFeedback", sizeof(IOUnit), (UnitCtorFunc)&InFeedback_Ctor, nullptr, 0);
DefineUnit("InTrig", sizeof(IOUnit), (UnitCtorFunc)&InTrig_Ctor, nullptr, 0);

DefineUnit("SharedOut", sizeof(IOUnit), (UnitCtorFunc)&SharedOut_Ctor, nullptr, 0);
DefineUnit("SharedIn", sizeof(IOUnit), (UnitCtorFunc)&SharedIn_Ctor, nullptr, 0);
}
2 changes: 1 addition & 1 deletion server/plugins/ML_SpecStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void SpecPcile_Ctor(SpecPcile* unit) {
unit->m_interpolate = ZIN0(2) > 0.f;

ZOUT0(0) = unit->outval = 0.;
unit->m_tempbuf = 0;
unit->m_tempbuf = nullptr;
}

void SpecPcile_next(SpecPcile* unit, int inNumSamples) {
Expand Down
18 changes: 9 additions & 9 deletions server/plugins/PV_UGens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ void PV_MagSmear_next(PV_MagSmear* unit, int inNumSamples) {
void PV_MagSmear_Ctor(PV_MagSmear* unit) {
SETCALC(PV_MagSmear_next);
ZOUT0(0) = ZIN0(0);
unit->m_tempbuf = 0;
unit->m_tempbuf = nullptr;
}

void PV_MagSmear_Dtor(PV_MagSmear* unit) { RTFree(unit->mWorld, unit->m_tempbuf); }
Expand Down Expand Up @@ -413,7 +413,7 @@ void PV_BinShift_next(PV_BinShift* unit, int inNumSamples) {
void PV_BinShift_Ctor(PV_BinShift* unit) {
SETCALC(PV_BinShift_next);
ZOUT0(0) = ZIN0(0);
unit->m_tempbuf = 0;
unit->m_tempbuf = nullptr;
}

void PV_BinShift_Dtor(PV_BinShift* unit) { RTFree(unit->mWorld, unit->m_tempbuf); }
Expand Down Expand Up @@ -451,7 +451,7 @@ void PV_MagShift_next(PV_MagShift* unit, int inNumSamples) {
void PV_MagShift_Ctor(PV_MagShift* unit) {
SETCALC(PV_MagShift_next);
ZOUT0(0) = ZIN0(0);
unit->m_tempbuf = 0;
unit->m_tempbuf = nullptr;
}

void PV_MagShift_Dtor(PV_MagShift* unit) { RTFree(unit->mWorld, unit->m_tempbuf); }
Expand Down Expand Up @@ -979,7 +979,7 @@ void PV_RandComb_next(PV_RandComb* unit, int inNumSamples) {
void PV_RandComb_Ctor(PV_RandComb* unit) {
SETCALC(PV_RandComb_next);
ZOUT0(0) = ZIN0(0);
unit->m_ordering = 0;
unit->m_ordering = nullptr;
unit->m_prevtrig = 0.f;
unit->m_triggered = false;
}
Expand Down Expand Up @@ -1039,7 +1039,7 @@ void PV_RandWipe_next(PV_RandWipe* unit, int inNumSamples) {
void PV_RandWipe_Ctor(PV_RandWipe* unit) {
SETCALC(PV_RandWipe_next);
ZOUT0(0) = ZIN0(0);
unit->m_ordering = 0;
unit->m_ordering = nullptr;
unit->m_prevtrig = 0.f;
unit->m_triggered = false;
}
Expand Down Expand Up @@ -1089,7 +1089,7 @@ void PV_Diffuser_next(PV_Diffuser* unit, int inNumSamples) {
void PV_Diffuser_Ctor(PV_Diffuser* unit) {
SETCALC(PV_Diffuser_next);
ZOUT0(0) = ZIN0(0);
unit->m_shift = 0;
unit->m_shift = nullptr;
unit->m_prevtrig = 0.f;
unit->m_triggered = false;
}
Expand Down Expand Up @@ -1135,7 +1135,7 @@ void PV_MagFreeze_next(PV_MagFreeze* unit, int inNumSamples) {
void PV_MagFreeze_Ctor(PV_MagFreeze* unit) {
SETCALC(PV_MagFreeze_next);
ZOUT0(0) = ZIN0(0);
unit->m_mags = 0;
unit->m_mags = nullptr;
}

void PV_MagFreeze_Dtor(PV_MagFreeze* unit) { RTFree(unit->mWorld, unit->m_mags); }
Expand Down Expand Up @@ -1215,10 +1215,10 @@ void PV_BinScramble_next(PV_BinScramble* unit, int inNumSamples) {
void PV_BinScramble_Ctor(PV_BinScramble* unit) {
SETCALC(PV_BinScramble_next);
ZOUT0(0) = ZIN0(0);
unit->m_to = 0;
unit->m_to = nullptr;
unit->m_prevtrig = 0.f;
unit->m_triggered = false;
unit->m_tempbuf = 0;
unit->m_tempbuf = nullptr;
}

void PV_BinScramble_Dtor(PV_BinScramble* unit) {
Expand Down
2 changes: 1 addition & 1 deletion server/plugins/PartitionedConvolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void PartConv_Ctor(PartConv* unit) {
unit->m_pos = 0;

// get passed in buffer
unit->m_fd_accumulate = NULL;
unit->m_fd_accumulate = nullptr;

uint32 bufnum = (uint32)ZIN0(2);
SndBuf* buf;
Expand Down

0 comments on commit 79f02a6

Please sign in to comment.