Use nullptr in cpp files

This commit is contained in:
Filip Gawin 2019-01-07 12:37:13 +01:00
parent fababe76c4
commit 0537414baf
9 changed files with 38 additions and 38 deletions

View File

@ -1012,8 +1012,8 @@ void CalcNonAttnSourceParams(ALvoice *voice, const ALvoicePropsBase *props, cons
SendSlots[i] = ALContext->DefaultSlot.get();
if(!SendSlots[i] || SendSlots[i]->Params.EffectType == AL_EFFECT_NULL)
{
SendSlots[i] = NULL;
voice->Send[i].Buffer = NULL;
SendSlots[i] = nullptr;
voice->Send[i].Buffer = nullptr;
voice->Send[i].Channels = 0;
}
else

View File

@ -156,7 +156,7 @@ void aluInitMixer(void)
{
const char *str;
if(ConfigValueStr(NULL, NULL, "resampler", &str))
if(ConfigValueStr(nullptr, nullptr, "resampler", &str))
{
if(strcasecmp(str, "point") == 0 || strcasecmp(str, "none") == 0)
ResamplerDefault = PointResampler;
@ -698,7 +698,7 @@ ALboolean MixSource(ALvoice *voice, const ALuint SourceID, ALCcontext *Context,
if(DataPosInt >= BufferListItem->max_samples)
{
isplaying = false;
BufferListItem = NULL;
BufferListItem = nullptr;
DataPosInt = 0;
DataPosFrac = 0;
break;

View File

@ -232,7 +232,7 @@ ALeffect *AllocEffect(ALCcontext *context)
if(UNLIKELY(device->EffectList.size() >= 1<<25))
{
alSetError(context, AL_OUT_OF_MEMORY, "Too many effects allocated");
return NULL;
return nullptr;
}
device->EffectList.emplace_back();
sublist = device->EffectList.end() - 1;
@ -242,7 +242,7 @@ ALeffect *AllocEffect(ALCcontext *context)
{
device->EffectList.pop_back();
alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate effect batch");
return NULL;
return nullptr;
}
slidx = 0;

View File

@ -47,7 +47,7 @@ AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extName)
(ptr[len] == '\0' || isspace(ptr[len])))
return AL_TRUE;
if((ptr=strchr(ptr, ' ')) != NULL)
if((ptr=strchr(ptr, ' ')) != nullptr)
{
do {
++ptr;

View File

@ -292,7 +292,7 @@ ALfilter *AllocFilter(ALCcontext *context)
if(UNLIKELY(device->FilterList.size() >= 1<<25))
{
alSetError(context, AL_OUT_OF_MEMORY, "Too many filters allocated");
return NULL;
return nullptr;
}
device->FilterList.emplace_back();
sublist = device->FilterList.end() - 1;
@ -302,7 +302,7 @@ ALfilter *AllocFilter(ALCcontext *context)
{
device->FilterList.pop_back();
alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate filter batch");
return NULL;
return nullptr;
}
slidx = 0;

View File

@ -33,12 +33,12 @@ void *al_malloc(size_t alignment, size_t size)
void *ret;
if(posix_memalign(&ret, alignment, size) == 0)
return ret;
return NULL;
return nullptr;
#elif defined(HAVE__ALIGNED_MALLOC)
return _aligned_malloc(size, alignment);
#else
char *ret = static_cast<char*>(malloc(size+alignment));
if(ret != NULL)
if(ret != nullptr)
{
*(ret++) = 0x00;
while(((ptrdiff_t)ret&(alignment-1)) != 0)
@ -62,7 +62,7 @@ void al_free(void *ptr) noexcept
#elif defined(HAVE__ALIGNED_MALLOC)
_aligned_free(ptr);
#else
if(ptr != NULL)
if(ptr != nullptr)
{
char *finder = static_cast<char*>(ptr);
do {

View File

@ -879,7 +879,7 @@ int AudioState::handler()
ALsizei buffer_len = std::chrono::duration_cast<std::chrono::duration<int>>(
mCodecCtx->sample_rate * AudioBufferTime).count() * mFrameSize;
mSamples = NULL;
mSamples = nullptr;
mSamplesMax = 0;
mSamplesPos = 0;
mSamplesLen = 0;

View File

@ -215,13 +215,13 @@ static QString getNameFromValue(const NameValuePair (&list)[N], const QString &s
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
mPeriodSizeValidator(NULL),
mPeriodCountValidator(NULL),
mSourceCountValidator(NULL),
mEffectSlotValidator(NULL),
mSourceSendValidator(NULL),
mSampleRateValidator(NULL),
mJackBufferValidator(NULL),
mPeriodSizeValidator(nullptr),
mPeriodCountValidator(nullptr),
mSourceCountValidator(nullptr),
mEffectSlotValidator(nullptr),
mSourceSendValidator(nullptr),
mSampleRateValidator(nullptr),
mJackBufferValidator(nullptr),
mNeedsSave(false)
{
ui->setupUi(this);
@ -1290,7 +1290,7 @@ void MainWindow::showEnabledBackendMenu(QPoint pt)
delete item;
enableApplyButton();
}
else if(gotAction != NULL)
else if(gotAction != nullptr)
{
QMap<QAction*,QString>::const_iterator iter = actionMap.find(gotAction);
if(iter != actionMap.end())
@ -1328,7 +1328,7 @@ void MainWindow::showDisabledBackendMenu(QPoint pt)
delete item;
enableApplyButton();
}
else if(gotAction != NULL)
else if(gotAction != nullptr)
{
QMap<QAction*,QString>::const_iterator iter = actionMap.find(gotAction);
if(iter != actionMap.end())

View File

@ -344,7 +344,7 @@ struct ResamplerT {
// output is desired.
static void TrSetup(FILE *fp, const char *filename, TokenReaderT *tr)
{
const char *name = NULL;
const char *name = nullptr;
if(filename)
{
@ -599,7 +599,7 @@ static int TrReadInt(TokenReaderT *tr, const int loBound, const int hiBound, int
return 0;
}
temp[len] = '\0';
*value = strtol(temp, NULL, 10);
*value = strtol(temp, nullptr, 10);
if(*value < loBound || *value > hiBound)
{
TrErrorAt(tr, tr->mLine, col, "Expected a value from %d to %d.\n", loBound, hiBound);
@ -695,7 +695,7 @@ static int TrReadFloat(TokenReaderT *tr, const double loBound, const double hiBo
return 0;
}
temp[len] = '\0';
*value = strtod(temp, NULL);
*value = strtod(temp, nullptr);
if(*value < loBound || *value > hiBound)
{
TrErrorAt(tr, tr->mLine, col, "Expected a value from %f to %f.\n", loBound, hiBound);
@ -1696,7 +1696,7 @@ static int LoadAsciiSource(FILE *fp, const SourceRefT *src, const uint n, double
uint i, j;
double dummy;
TrSetup(fp, NULL, &tr);
TrSetup(fp, nullptr, &tr);
for(i = 0;i < src->mOffset;i++)
{
if(!ReadAsciiAsDouble(&tr, src->mPath, src->mType, (uint)src->mBits, &dummy))
@ -1725,7 +1725,7 @@ static int LoadSource(SourceRefT *src, const uint hrirRate, const uint n, double
fp = fopen(src->mPath, "r");
else
fp = fopen(src->mPath, "rb");
if(fp == NULL)
if(fp == nullptr)
{
fprintf(stderr, "Error: Could not open source file '%s'.\n", src->mPath);
return 0;
@ -1799,7 +1799,7 @@ static int StoreMhr(const HrirDataT *hData, const char *filename)
uint fi, ei, ai, i;
uint dither_seed = 22222;
if((fp=fopen(filename, "wb")) == NULL)
if((fp=fopen(filename, "wb")) == nullptr)
{
fprintf(stderr, "Error: Could not open MHR file '%s'.\n", filename);
return 0;
@ -2878,7 +2878,7 @@ static int ProcessSources(const HeadModelT model, TokenReaderT *tr, HrirDataT *h
return 0;
HrirAzT *azd = &hData->mFds[fi].mEvs[ei].mAzs[ai];
if(azd->mIrs[0] != NULL)
if(azd->mIrs[0] != nullptr)
{
TrErrorAt(tr, line, col, "Redefinition of source.\n");
return 0;
@ -2928,12 +2928,12 @@ static int ProcessSources(const HeadModelT model, TokenReaderT *tr, HrirDataT *h
}
if(hData->mChannelType == CT_STEREO)
{
if(azd->mIrs[0] == NULL)
if(azd->mIrs[0] == nullptr)
{
TrErrorAt(tr, line, col, "Missing left ear source reference(s).\n");
return 0;
}
else if(azd->mIrs[1] == NULL)
else if(azd->mIrs[1] == nullptr)
{
TrErrorAt(tr, line, col, "Missing right ear source reference(s).\n");
return 0;
@ -2948,7 +2948,7 @@ static int ProcessSources(const HeadModelT model, TokenReaderT *tr, HrirDataT *h
for(ai = 0;ai < hData->mFds[fi].mEvs[ei].mAzCount;ai++)
{
HrirAzT *azd = &hData->mFds[fi].mEvs[ei].mAzs[ai];
if(azd->mIrs[0] != NULL)
if(azd->mIrs[0] != nullptr)
break;
}
if(ai < hData->mFds[fi].mEvs[ei].mAzCount)
@ -2966,7 +2966,7 @@ static int ProcessSources(const HeadModelT model, TokenReaderT *tr, HrirDataT *h
{
HrirAzT *azd = &hData->mFds[fi].mEvs[ei].mAzs[ai];
if(azd->mIrs[0] == NULL)
if(azd->mIrs[0] == nullptr)
{
TrError(tr, "Missing source reference [ %d, %d, %d ].\n", fi, ei, ai);
return 0;
@ -3009,10 +3009,10 @@ static int ProcessDefinition(const char *inName, const uint outRate, const uint
int ret;
fprintf(stdout, "Reading HRIR definition from %s...\n", inName?inName:"stdin");
if(inName != NULL)
if(inName != nullptr)
{
fp = fopen(inName, "r");
if(fp == NULL)
if(fp == nullptr)
{
fprintf(stderr, "Error: Could not open definition file '%s'\n", inName);
return 0;
@ -3026,7 +3026,7 @@ static int ProcessDefinition(const char *inName, const uint outRate, const uint
}
if(!ProcessMetrics(&tr, fftSize, truncSize, &hData))
{
if(inName != NULL)
if(inName != nullptr)
fclose(fp);
return 0;
}
@ -3099,10 +3099,10 @@ static void PrintHelp(const char *argv0, FILE *ofile)
// Standard command line dispatch.
int main(int argc, char *argv[])
{
const char *inName = NULL, *outName = NULL;
const char *inName = nullptr, *outName = nullptr;
uint outRate, fftSize;
int equalize, surface;
char *end = NULL;
char *end = nullptr;
HeadModelT model;
uint truncSize;
double radius;