diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2020-11-06 13:44:05 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2020-11-06 14:06:05 +0300 |
commit | 311031ecd03dbfbf43e1df672a395f24b2e7d4d3 (patch) | |
tree | baa75eb4b3e62d1caeb710d39291112e41112b37 /extern/mantaflow/preprocessed/fileio | |
parent | 37b155420b7cba189e69f648728be967943c4ec0 (diff) |
Cleanup: Use nullptr everywhere in fluid code
Switched from NULL to nullptr.
Diffstat (limited to 'extern/mantaflow/preprocessed/fileio')
-rw-r--r-- | extern/mantaflow/preprocessed/fileio/iogrids.cpp | 24 | ||||
-rw-r--r-- | extern/mantaflow/preprocessed/fileio/ioutil.cpp | 2 | ||||
-rw-r--r-- | extern/mantaflow/preprocessed/fileio/mantaio.cpp | 4 | ||||
-rw-r--r-- | extern/mantaflow/preprocessed/fileio/mantaio.h | 12 |
4 files changed, 23 insertions, 19 deletions
diff --git a/extern/mantaflow/preprocessed/fileio/iogrids.cpp b/extern/mantaflow/preprocessed/fileio/iogrids.cpp index 825ce0ae8b5..7cedbb484ba 100644 --- a/extern/mantaflow/preprocessed/fileio/iogrids.cpp +++ b/extern/mantaflow/preprocessed/fileio/iogrids.cpp @@ -440,7 +440,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds) FluidSolver *parent = _args.obtainParent(); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(parent, "getUniFileSize", !noTiming); - PyObject *_retval = 0; + PyObject *_retval = nullptr; { ArgLocker _lock; const string &name = _args.get<string>("name", 0, &_lock); @@ -479,7 +479,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds) FluidSolver *parent = _args.obtainParent(); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(parent, "printUniFileInfoString", !noTiming); - PyObject *_retval = 0; + PyObject *_retval = nullptr; { ArgLocker _lock; const string &name = _args.get<string>("name", 0, &_lock); @@ -715,7 +715,7 @@ template<> int writeGridVol<Real>(const string &name, Grid<Real> *grid) header.bboxMax = Vec3(0.5); FILE *fp = fopen(name.c_str(), "wb"); - if (fp == NULL) { + if (fp == nullptr) { errMsg("writeGridVol: Cannot open '" << name << "'"); return 0; } @@ -749,7 +749,7 @@ template<> int readGridVol<Real>(const string &name, Grid<Real> *grid) volHeader header; FILE *fp = fopen(name.c_str(), "rb"); - if (fp == NULL) { + if (fp == nullptr) { errMsg("readGridVol: Cannot open '" << name << "'"); return 0; } @@ -844,11 +844,11 @@ int readGrid4dUni( 1); #if NO_ZLIB != 1 - gzFile gzf = NULL; + gzFile gzf = nullptr; char ID[5] = {0, 0, 0, 0, 0}; // optionally - reuse file handle, if valid one is passed in fileHandle pointer... - if ((!fileHandle) || (fileHandle && (*fileHandle == NULL))) { + if ((!fileHandle) || (fileHandle && (*fileHandle == nullptr))) { gzf = (gzFile)safeGzopen(name.c_str(), "rb"); if (!gzf) { errMsg("readGrid4dUni: can't open file " << name); @@ -969,11 +969,11 @@ int readGrid4dUni( void readGrid4dUniCleanup(void **fileHandle) { #if NO_ZLIB != 1 - gzFile gzf = NULL; + gzFile gzf = nullptr; if (fileHandle) { gzf = (gzFile)(*fileHandle); gzclose(gzf); - *fileHandle = NULL; + *fileHandle = nullptr; } #else debMsg("file format not supported without zlib", 1); @@ -1171,7 +1171,7 @@ int readGridsNumpy(const string &name, std::vector<PbClass *> *grids) // adopted from getUniFileSize void getNpzFileSize( - const string &name, int &x, int &y, int &z, int *t = NULL, std::string *info = NULL) + const string &name, int &x, int &y, int &z, int *t = nullptr, std::string *info = nullptr) { x = y = z = 0; @@ -1207,7 +1207,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds) FluidSolver *parent = _args.obtainParent(); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(parent, "getNpzFileSize", !noTiming); - PyObject *_retval = 0; + PyObject *_retval = nullptr; { ArgLocker _lock; const string &name = _args.get<string>("name", 0, &_lock); @@ -1289,7 +1289,7 @@ static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds) FluidSolver *parent = _args.obtainParent(); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(parent, "quantizeGrid", !noTiming); - PyObject *_retval = 0; + PyObject *_retval = nullptr; { ArgLocker _lock; Grid<Real> &grid = *_args.getPtr<Grid<Real>>("grid", 0, &_lock); @@ -1365,7 +1365,7 @@ static PyObject *_W_4(PyObject *_self, PyObject *_linargs, PyObject *_kwds) FluidSolver *parent = _args.obtainParent(); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(parent, "quantizeGridVec3", !noTiming); - PyObject *_retval = 0; + PyObject *_retval = nullptr; { ArgLocker _lock; Grid<Vec3> &grid = *_args.getPtr<Grid<Vec3>>("grid", 0, &_lock); diff --git a/extern/mantaflow/preprocessed/fileio/ioutil.cpp b/extern/mantaflow/preprocessed/fileio/ioutil.cpp index cf40d71fcc4..2c7ac7be00e 100644 --- a/extern/mantaflow/preprocessed/fileio/ioutil.cpp +++ b/extern/mantaflow/preprocessed/fileio/ioutil.cpp @@ -40,7 +40,7 @@ namespace Manta { #if defined(WIN32) || defined(_WIN32) static wstring stringToWstring(const char *str) { - const int length_wc = MultiByteToWideChar(CP_UTF8, 0, str, strlen(str), NULL, 0); + const int length_wc = MultiByteToWideChar(CP_UTF8, 0, str, strlen(str), nullptr, 0); wstring strWide(length_wc, 0); MultiByteToWideChar(CP_UTF8, 0, str, strlen(str), &strWide[0], length_wc); return strWide; diff --git a/extern/mantaflow/preprocessed/fileio/mantaio.cpp b/extern/mantaflow/preprocessed/fileio/mantaio.cpp index a03bd98d449..3048572261a 100644 --- a/extern/mantaflow/preprocessed/fileio/mantaio.cpp +++ b/extern/mantaflow/preprocessed/fileio/mantaio.cpp @@ -51,7 +51,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds) FluidSolver *parent = _args.obtainParent(); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(parent, "load", !noTiming); - PyObject *_retval = 0; + PyObject *_retval = nullptr; { ArgLocker _lock; const string &name = _args.get<string>("name", 0, &_lock); @@ -118,7 +118,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds) FluidSolver *parent = _args.obtainParent(); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(parent, "save", !noTiming); - PyObject *_retval = 0; + PyObject *_retval = nullptr; { ArgLocker _lock; const string &name = _args.get<string>("name", 0, &_lock); diff --git a/extern/mantaflow/preprocessed/fileio/mantaio.h b/extern/mantaflow/preprocessed/fileio/mantaio.h index d3c7bb3ba6d..d49f4b1369d 100644 --- a/extern/mantaflow/preprocessed/fileio/mantaio.h +++ b/extern/mantaflow/preprocessed/fileio/mantaio.h @@ -93,8 +93,8 @@ template<class T> int readGrid4dUni(const std::string &name, Grid4d<T> *grid, int readTslice = -1, - Grid4d<T> *slice = NULL, - void **fileHandle = NULL); + Grid4d<T> *slice = nullptr, + void **fileHandle = nullptr); void readGrid4dUniCleanup(void **fileHandle); template<class T> int writeGrid4dRaw(const std::string &name, Grid4d<T> *grid); template<class T> int readGrid4dRaw(const std::string &name, Grid4d<T> *grid); @@ -111,8 +111,12 @@ template<class T> int writeMdataUni(const std::string &name, MeshDataImpl<T> *md template<class T> int readMdataUni(const std::string &name, MeshDataImpl<T> *mdata); // Helpers -void getUniFileSize( - const std::string &name, int &x, int &y, int &z, int *t = NULL, std::string *info = NULL); +void getUniFileSize(const std::string &name, + int &x, + int &y, + int &z, + int *t = nullptr, + std::string *info = nullptr); void *safeGzopen(const char *filename, const char *mode); #if OPENVDB == 1 template<class S, class T> void convertFrom(S &in, T *out); |