Use nullptr in cpp files
This commit is contained in:
parent
fababe76c4
commit
0537414baf
@ -1012,8 +1012,8 @@ void CalcNonAttnSourceParams(ALvoice *voice, const ALvoicePropsBase *props, cons
|
|||||||
SendSlots[i] = ALContext->DefaultSlot.get();
|
SendSlots[i] = ALContext->DefaultSlot.get();
|
||||||
if(!SendSlots[i] || SendSlots[i]->Params.EffectType == AL_EFFECT_NULL)
|
if(!SendSlots[i] || SendSlots[i]->Params.EffectType == AL_EFFECT_NULL)
|
||||||
{
|
{
|
||||||
SendSlots[i] = NULL;
|
SendSlots[i] = nullptr;
|
||||||
voice->Send[i].Buffer = NULL;
|
voice->Send[i].Buffer = nullptr;
|
||||||
voice->Send[i].Channels = 0;
|
voice->Send[i].Channels = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -156,7 +156,7 @@ void aluInitMixer(void)
|
|||||||
{
|
{
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
if(ConfigValueStr(NULL, NULL, "resampler", &str))
|
if(ConfigValueStr(nullptr, nullptr, "resampler", &str))
|
||||||
{
|
{
|
||||||
if(strcasecmp(str, "point") == 0 || strcasecmp(str, "none") == 0)
|
if(strcasecmp(str, "point") == 0 || strcasecmp(str, "none") == 0)
|
||||||
ResamplerDefault = PointResampler;
|
ResamplerDefault = PointResampler;
|
||||||
@ -698,7 +698,7 @@ ALboolean MixSource(ALvoice *voice, const ALuint SourceID, ALCcontext *Context,
|
|||||||
if(DataPosInt >= BufferListItem->max_samples)
|
if(DataPosInt >= BufferListItem->max_samples)
|
||||||
{
|
{
|
||||||
isplaying = false;
|
isplaying = false;
|
||||||
BufferListItem = NULL;
|
BufferListItem = nullptr;
|
||||||
DataPosInt = 0;
|
DataPosInt = 0;
|
||||||
DataPosFrac = 0;
|
DataPosFrac = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -232,7 +232,7 @@ ALeffect *AllocEffect(ALCcontext *context)
|
|||||||
if(UNLIKELY(device->EffectList.size() >= 1<<25))
|
if(UNLIKELY(device->EffectList.size() >= 1<<25))
|
||||||
{
|
{
|
||||||
alSetError(context, AL_OUT_OF_MEMORY, "Too many effects allocated");
|
alSetError(context, AL_OUT_OF_MEMORY, "Too many effects allocated");
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
device->EffectList.emplace_back();
|
device->EffectList.emplace_back();
|
||||||
sublist = device->EffectList.end() - 1;
|
sublist = device->EffectList.end() - 1;
|
||||||
@ -242,7 +242,7 @@ ALeffect *AllocEffect(ALCcontext *context)
|
|||||||
{
|
{
|
||||||
device->EffectList.pop_back();
|
device->EffectList.pop_back();
|
||||||
alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate effect batch");
|
alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate effect batch");
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
slidx = 0;
|
slidx = 0;
|
||||||
|
@ -47,7 +47,7 @@ AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extName)
|
|||||||
(ptr[len] == '\0' || isspace(ptr[len])))
|
(ptr[len] == '\0' || isspace(ptr[len])))
|
||||||
return AL_TRUE;
|
return AL_TRUE;
|
||||||
|
|
||||||
if((ptr=strchr(ptr, ' ')) != NULL)
|
if((ptr=strchr(ptr, ' ')) != nullptr)
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
++ptr;
|
++ptr;
|
||||||
|
@ -292,7 +292,7 @@ ALfilter *AllocFilter(ALCcontext *context)
|
|||||||
if(UNLIKELY(device->FilterList.size() >= 1<<25))
|
if(UNLIKELY(device->FilterList.size() >= 1<<25))
|
||||||
{
|
{
|
||||||
alSetError(context, AL_OUT_OF_MEMORY, "Too many filters allocated");
|
alSetError(context, AL_OUT_OF_MEMORY, "Too many filters allocated");
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
device->FilterList.emplace_back();
|
device->FilterList.emplace_back();
|
||||||
sublist = device->FilterList.end() - 1;
|
sublist = device->FilterList.end() - 1;
|
||||||
@ -302,7 +302,7 @@ ALfilter *AllocFilter(ALCcontext *context)
|
|||||||
{
|
{
|
||||||
device->FilterList.pop_back();
|
device->FilterList.pop_back();
|
||||||
alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate filter batch");
|
alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate filter batch");
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
slidx = 0;
|
slidx = 0;
|
||||||
|
@ -33,12 +33,12 @@ void *al_malloc(size_t alignment, size_t size)
|
|||||||
void *ret;
|
void *ret;
|
||||||
if(posix_memalign(&ret, alignment, size) == 0)
|
if(posix_memalign(&ret, alignment, size) == 0)
|
||||||
return ret;
|
return ret;
|
||||||
return NULL;
|
return nullptr;
|
||||||
#elif defined(HAVE__ALIGNED_MALLOC)
|
#elif defined(HAVE__ALIGNED_MALLOC)
|
||||||
return _aligned_malloc(size, alignment);
|
return _aligned_malloc(size, alignment);
|
||||||
#else
|
#else
|
||||||
char *ret = static_cast<char*>(malloc(size+alignment));
|
char *ret = static_cast<char*>(malloc(size+alignment));
|
||||||
if(ret != NULL)
|
if(ret != nullptr)
|
||||||
{
|
{
|
||||||
*(ret++) = 0x00;
|
*(ret++) = 0x00;
|
||||||
while(((ptrdiff_t)ret&(alignment-1)) != 0)
|
while(((ptrdiff_t)ret&(alignment-1)) != 0)
|
||||||
@ -62,7 +62,7 @@ void al_free(void *ptr) noexcept
|
|||||||
#elif defined(HAVE__ALIGNED_MALLOC)
|
#elif defined(HAVE__ALIGNED_MALLOC)
|
||||||
_aligned_free(ptr);
|
_aligned_free(ptr);
|
||||||
#else
|
#else
|
||||||
if(ptr != NULL)
|
if(ptr != nullptr)
|
||||||
{
|
{
|
||||||
char *finder = static_cast<char*>(ptr);
|
char *finder = static_cast<char*>(ptr);
|
||||||
do {
|
do {
|
||||||
|
@ -879,7 +879,7 @@ int AudioState::handler()
|
|||||||
ALsizei buffer_len = std::chrono::duration_cast<std::chrono::duration<int>>(
|
ALsizei buffer_len = std::chrono::duration_cast<std::chrono::duration<int>>(
|
||||||
mCodecCtx->sample_rate * AudioBufferTime).count() * mFrameSize;
|
mCodecCtx->sample_rate * AudioBufferTime).count() * mFrameSize;
|
||||||
|
|
||||||
mSamples = NULL;
|
mSamples = nullptr;
|
||||||
mSamplesMax = 0;
|
mSamplesMax = 0;
|
||||||
mSamplesPos = 0;
|
mSamplesPos = 0;
|
||||||
mSamplesLen = 0;
|
mSamplesLen = 0;
|
||||||
|
@ -215,13 +215,13 @@ static QString getNameFromValue(const NameValuePair (&list)[N], const QString &s
|
|||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::MainWindow),
|
ui(new Ui::MainWindow),
|
||||||
mPeriodSizeValidator(NULL),
|
mPeriodSizeValidator(nullptr),
|
||||||
mPeriodCountValidator(NULL),
|
mPeriodCountValidator(nullptr),
|
||||||
mSourceCountValidator(NULL),
|
mSourceCountValidator(nullptr),
|
||||||
mEffectSlotValidator(NULL),
|
mEffectSlotValidator(nullptr),
|
||||||
mSourceSendValidator(NULL),
|
mSourceSendValidator(nullptr),
|
||||||
mSampleRateValidator(NULL),
|
mSampleRateValidator(nullptr),
|
||||||
mJackBufferValidator(NULL),
|
mJackBufferValidator(nullptr),
|
||||||
mNeedsSave(false)
|
mNeedsSave(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@ -1290,7 +1290,7 @@ void MainWindow::showEnabledBackendMenu(QPoint pt)
|
|||||||
delete item;
|
delete item;
|
||||||
enableApplyButton();
|
enableApplyButton();
|
||||||
}
|
}
|
||||||
else if(gotAction != NULL)
|
else if(gotAction != nullptr)
|
||||||
{
|
{
|
||||||
QMap<QAction*,QString>::const_iterator iter = actionMap.find(gotAction);
|
QMap<QAction*,QString>::const_iterator iter = actionMap.find(gotAction);
|
||||||
if(iter != actionMap.end())
|
if(iter != actionMap.end())
|
||||||
@ -1328,7 +1328,7 @@ void MainWindow::showDisabledBackendMenu(QPoint pt)
|
|||||||
delete item;
|
delete item;
|
||||||
enableApplyButton();
|
enableApplyButton();
|
||||||
}
|
}
|
||||||
else if(gotAction != NULL)
|
else if(gotAction != nullptr)
|
||||||
{
|
{
|
||||||
QMap<QAction*,QString>::const_iterator iter = actionMap.find(gotAction);
|
QMap<QAction*,QString>::const_iterator iter = actionMap.find(gotAction);
|
||||||
if(iter != actionMap.end())
|
if(iter != actionMap.end())
|
||||||
|
@ -344,7 +344,7 @@ struct ResamplerT {
|
|||||||
// output is desired.
|
// output is desired.
|
||||||
static void TrSetup(FILE *fp, const char *filename, TokenReaderT *tr)
|
static void TrSetup(FILE *fp, const char *filename, TokenReaderT *tr)
|
||||||
{
|
{
|
||||||
const char *name = NULL;
|
const char *name = nullptr;
|
||||||
|
|
||||||
if(filename)
|
if(filename)
|
||||||
{
|
{
|
||||||
@ -599,7 +599,7 @@ static int TrReadInt(TokenReaderT *tr, const int loBound, const int hiBound, int
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
temp[len] = '\0';
|
temp[len] = '\0';
|
||||||
*value = strtol(temp, NULL, 10);
|
*value = strtol(temp, nullptr, 10);
|
||||||
if(*value < loBound || *value > hiBound)
|
if(*value < loBound || *value > hiBound)
|
||||||
{
|
{
|
||||||
TrErrorAt(tr, tr->mLine, col, "Expected a value from %d to %d.\n", loBound, 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;
|
return 0;
|
||||||
}
|
}
|
||||||
temp[len] = '\0';
|
temp[len] = '\0';
|
||||||
*value = strtod(temp, NULL);
|
*value = strtod(temp, nullptr);
|
||||||
if(*value < loBound || *value > hiBound)
|
if(*value < loBound || *value > hiBound)
|
||||||
{
|
{
|
||||||
TrErrorAt(tr, tr->mLine, col, "Expected a value from %f to %f.\n", loBound, 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;
|
uint i, j;
|
||||||
double dummy;
|
double dummy;
|
||||||
|
|
||||||
TrSetup(fp, NULL, &tr);
|
TrSetup(fp, nullptr, &tr);
|
||||||
for(i = 0;i < src->mOffset;i++)
|
for(i = 0;i < src->mOffset;i++)
|
||||||
{
|
{
|
||||||
if(!ReadAsciiAsDouble(&tr, src->mPath, src->mType, (uint)src->mBits, &dummy))
|
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");
|
fp = fopen(src->mPath, "r");
|
||||||
else
|
else
|
||||||
fp = fopen(src->mPath, "rb");
|
fp = fopen(src->mPath, "rb");
|
||||||
if(fp == NULL)
|
if(fp == nullptr)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error: Could not open source file '%s'.\n", src->mPath);
|
fprintf(stderr, "Error: Could not open source file '%s'.\n", src->mPath);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1799,7 +1799,7 @@ static int StoreMhr(const HrirDataT *hData, const char *filename)
|
|||||||
uint fi, ei, ai, i;
|
uint fi, ei, ai, i;
|
||||||
uint dither_seed = 22222;
|
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);
|
fprintf(stderr, "Error: Could not open MHR file '%s'.\n", filename);
|
||||||
return 0;
|
return 0;
|
||||||
@ -2878,7 +2878,7 @@ static int ProcessSources(const HeadModelT model, TokenReaderT *tr, HrirDataT *h
|
|||||||
return 0;
|
return 0;
|
||||||
HrirAzT *azd = &hData->mFds[fi].mEvs[ei].mAzs[ai];
|
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");
|
TrErrorAt(tr, line, col, "Redefinition of source.\n");
|
||||||
return 0;
|
return 0;
|
||||||
@ -2928,12 +2928,12 @@ static int ProcessSources(const HeadModelT model, TokenReaderT *tr, HrirDataT *h
|
|||||||
}
|
}
|
||||||
if(hData->mChannelType == CT_STEREO)
|
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");
|
TrErrorAt(tr, line, col, "Missing left ear source reference(s).\n");
|
||||||
return 0;
|
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");
|
TrErrorAt(tr, line, col, "Missing right ear source reference(s).\n");
|
||||||
return 0;
|
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++)
|
for(ai = 0;ai < hData->mFds[fi].mEvs[ei].mAzCount;ai++)
|
||||||
{
|
{
|
||||||
HrirAzT *azd = &hData->mFds[fi].mEvs[ei].mAzs[ai];
|
HrirAzT *azd = &hData->mFds[fi].mEvs[ei].mAzs[ai];
|
||||||
if(azd->mIrs[0] != NULL)
|
if(azd->mIrs[0] != nullptr)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(ai < hData->mFds[fi].mEvs[ei].mAzCount)
|
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];
|
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);
|
TrError(tr, "Missing source reference [ %d, %d, %d ].\n", fi, ei, ai);
|
||||||
return 0;
|
return 0;
|
||||||
@ -3009,10 +3009,10 @@ static int ProcessDefinition(const char *inName, const uint outRate, const uint
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
fprintf(stdout, "Reading HRIR definition from %s...\n", inName?inName:"stdin");
|
fprintf(stdout, "Reading HRIR definition from %s...\n", inName?inName:"stdin");
|
||||||
if(inName != NULL)
|
if(inName != nullptr)
|
||||||
{
|
{
|
||||||
fp = fopen(inName, "r");
|
fp = fopen(inName, "r");
|
||||||
if(fp == NULL)
|
if(fp == nullptr)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error: Could not open definition file '%s'\n", inName);
|
fprintf(stderr, "Error: Could not open definition file '%s'\n", inName);
|
||||||
return 0;
|
return 0;
|
||||||
@ -3026,7 +3026,7 @@ static int ProcessDefinition(const char *inName, const uint outRate, const uint
|
|||||||
}
|
}
|
||||||
if(!ProcessMetrics(&tr, fftSize, truncSize, &hData))
|
if(!ProcessMetrics(&tr, fftSize, truncSize, &hData))
|
||||||
{
|
{
|
||||||
if(inName != NULL)
|
if(inName != nullptr)
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -3099,10 +3099,10 @@ static void PrintHelp(const char *argv0, FILE *ofile)
|
|||||||
// Standard command line dispatch.
|
// Standard command line dispatch.
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
const char *inName = NULL, *outName = NULL;
|
const char *inName = nullptr, *outName = nullptr;
|
||||||
uint outRate, fftSize;
|
uint outRate, fftSize;
|
||||||
int equalize, surface;
|
int equalize, surface;
|
||||||
char *end = NULL;
|
char *end = nullptr;
|
||||||
HeadModelT model;
|
HeadModelT model;
|
||||||
uint truncSize;
|
uint truncSize;
|
||||||
double radius;
|
double radius;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user