diff options
author | kcat <[email protected]> | 2019-01-07 04:36:50 -0800 |
---|---|---|
committer | GitHub <[email protected]> | 2019-01-07 04:36:50 -0800 |
commit | 2a7f27ca58f9897be06fe815a46ea76a01734a0b (patch) | |
tree | ca9aa7e99770f175209e50f1f88ed3e9b656c89b | |
parent | 4d047e2bc166e8155dd9714e53efda09def2b6ef (diff) | |
parent | 0537414bafe80e5e32486672ddce82581fb5e1c3 (diff) |
Merge pull request #260 from ShFil119/impr/nullptr
Use nullptr in cpp files
-rw-r--r-- | Alc/alu.cpp | 4 | ||||
-rw-r--r-- | Alc/mixvoice.cpp | 4 | ||||
-rw-r--r-- | OpenAL32/alEffect.cpp | 4 | ||||
-rw-r--r-- | OpenAL32/alExtension.cpp | 2 | ||||
-rw-r--r-- | OpenAL32/alFilter.cpp | 4 | ||||
-rw-r--r-- | common/almalloc.cpp | 6 | ||||
-rw-r--r-- | examples/alffplay.cpp | 2 | ||||
-rw-r--r-- | utils/alsoft-config/mainwindow.cpp | 18 | ||||
-rw-r--r-- | utils/makehrtf.cpp | 32 |
9 files changed, 38 insertions, 38 deletions
diff --git a/Alc/alu.cpp b/Alc/alu.cpp index 7d2709ea..77505a0c 100644 --- a/Alc/alu.cpp +++ b/Alc/alu.cpp @@ -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 diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp index 53721201..eb219bad 100644 --- a/Alc/mixvoice.cpp +++ b/Alc/mixvoice.cpp @@ -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; diff --git a/OpenAL32/alEffect.cpp b/OpenAL32/alEffect.cpp index fae6cce2..498c04e8 100644 --- a/OpenAL32/alEffect.cpp +++ b/OpenAL32/alEffect.cpp @@ -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; diff --git a/OpenAL32/alExtension.cpp b/OpenAL32/alExtension.cpp index fff12e01..aef6f7a4 100644 --- a/OpenAL32/alExtension.cpp +++ b/OpenAL32/alExtension.cpp @@ -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; diff --git a/OpenAL32/alFilter.cpp b/OpenAL32/alFilter.cpp index e8bc27a9..b3aaa0ee 100644 --- a/OpenAL32/alFilter.cpp +++ b/OpenAL32/alFilter.cpp @@ -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; diff --git a/common/almalloc.cpp b/common/almalloc.cpp index 7e83672b..da0a1d37 100644 --- a/common/almalloc.cpp +++ b/common/almalloc.cpp @@ -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 { diff --git a/examples/alffplay.cpp b/examples/alffplay.cpp index 771e5ded..f9ced483 100644 --- a/examples/alffplay.cpp +++ b/examples/alffplay.cpp @@ -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; diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index 449c91e5..ce319637 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -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()) diff --git a/utils/makehrtf.cpp b/utils/makehrtf.cpp index 1e58ce28..30440838 100644 --- a/utils/makehrtf.cpp +++ b/utils/makehrtf.cpp @@ -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; |