diff --git a/extern/lodepng/lodepng.cpp b/extern/lodepng/lodepng.cpp index 51492b887fde87faf0fbfc87899b79d2cc5e7969..3cf94e5929dc33f7f064e3731e0d20db122622ad 100644 --- a/extern/lodepng/lodepng.cpp +++ b/extern/lodepng/lodepng.cpp @@ -224,7 +224,7 @@ typedef struct uivector { static void uivector_cleanup(void* p) { ((uivector*)p)->size = ((uivector*)p)->allocsize = 0; lodepng_free(((uivector*)p)->data); - ((uivector*)p)->data = NULL; + ((uivector*)p)->data = nullptr; } /*returns 1 if success, 0 if failure ==> nothing done*/ @@ -244,7 +244,7 @@ static unsigned uivector_resize(uivector* p, size_t size) { } static void uivector_init(uivector* p) { - p->data = NULL; + p->data = nullptr; p->size = p->allocsize = 0; } @@ -296,7 +296,7 @@ static ucvector ucvector_init(unsigned char* buffer, size_t size) { /*free string pointer and set it to NULL*/ static void string_cleanup(char** out) { lodepng_free(*out); - *out = NULL; + *out = nullptr; } /*also appends null termination character*/ @@ -665,10 +665,10 @@ typedef struct HuffmanTree { } HuffmanTree; static void HuffmanTree_init(HuffmanTree* tree) { - tree->codes = 0; - tree->lengths = 0; - tree->table_len = 0; - tree->table_value = 0; + tree->codes = nullptr; + tree->lengths = nullptr; + tree->table_len = nullptr; + tree->table_value = nullptr; } static void HuffmanTree_cleanup(HuffmanTree* tree) { @@ -897,8 +897,8 @@ static BPMNode* bpmnode_create(BPMLists* lists, int weight, unsigned index, BPMN for(i = 0; i != lists->memsize; ++i) lists->memory[i].in_use = 0; for(i = 0; i != lists->listsize; ++i) { BPMNode* node; - for(node = lists->chains0[i]; node != 0; node = node->tail) node->in_use = 1; - for(node = lists->chains1[i]; node != 0; node = node->tail) node->in_use = 1; + for(node = lists->chains0[i]; node != nullptr; node = node->tail) node->in_use = 1; + for(node = lists->chains1[i]; node != nullptr; node = node->tail) node->in_use = 1; } /*collect those that are free*/ lists->numfree = 0; @@ -945,7 +945,7 @@ static void boundaryPM(BPMLists* lists, BPMNode* leaves, size_t numpresent, int if(c == 0) { if(lastindex >= numpresent) return; lists->chains0[c] = lists->chains1[c]; - lists->chains1[c] = bpmnode_create(lists, leaves[lastindex].weight, lastindex + 1, 0); + lists->chains1[c] = bpmnode_create(lists, leaves[lastindex].weight, lastindex + 1, nullptr); } else { /*sum of the weights of the head nodes of the previous lookahead chains.*/ int sum = lists->chains0[c - 1]->weight + lists->chains1[c - 1]->weight; @@ -1016,8 +1016,8 @@ unsigned lodepng_huffman_code_lengths(unsigned* lengths, const unsigned* frequen if(!error) { for(i = 0; i != lists.memsize; ++i) lists.freelist[i] = &lists.memory[i]; - bpmnode_create(&lists, leaves[0].weight, 1, 0); - bpmnode_create(&lists, leaves[1].weight, 2, 0); + bpmnode_create(&lists, leaves[0].weight, 1, nullptr); + bpmnode_create(&lists, leaves[1].weight, 2, nullptr); for(i = 0; i != lists.listsize; ++i) { lists.chains0[i] = &lists.memory[0]; @@ -1134,10 +1134,10 @@ static unsigned getTreeInflateDynamic(HuffmanTree* tree_ll, HuffmanTree* tree_d, unsigned n, HLIT, HDIST, HCLEN, i; /*see comments in deflateDynamic for explanation of the context and these variables, it is analogous*/ - unsigned* bitlen_ll = 0; /*lit,len code lengths*/ - unsigned* bitlen_d = 0; /*dist code lengths*/ + unsigned* bitlen_ll = nullptr; /*lit,len code lengths*/ + unsigned* bitlen_d = nullptr; /*dist code lengths*/ /*code length code lengths ("clcl"), the bit lengths of the huffman tree used to compress bitlen_ll and bitlen_d*/ - unsigned* bitlen_cl = 0; + unsigned* bitlen_cl = nullptr; HuffmanTree tree_cl; /*the code tree for code length codes (the huffman tree for compressed huffman trees)*/ if(!ensureBits17(reader, 14)) return 49; /*error: the bit pointer is or will go past the memory*/ @@ -1825,11 +1825,11 @@ static unsigned deflateDynamic(LodePNGBitWriter* writer, Hash* hash, HuffmanTree tree_ll; /*tree for lit,len values*/ HuffmanTree tree_d; /*tree for distance codes*/ HuffmanTree tree_cl; /*tree for encoding the code lengths representing tree_ll and tree_d*/ - unsigned* frequencies_ll = 0; /*frequency of lit,len codes*/ - unsigned* frequencies_d = 0; /*frequency of dist codes*/ - unsigned* frequencies_cl = 0; /*frequency of code length codes*/ - unsigned* bitlen_lld = 0; /*lit,len,dist code lengths (int bits), literally (without repeat codes).*/ - unsigned* bitlen_lld_e = 0; /*bitlen_lld encoded with repeat codes (this is a rudimentary run length compression)*/ + unsigned* frequencies_ll = nullptr; /*frequency of lit,len codes*/ + unsigned* frequencies_d = nullptr; /*frequency of dist codes*/ + unsigned* frequencies_cl = nullptr; /*frequency of code length codes*/ + unsigned* bitlen_lld = nullptr; /*lit,len,dist code lengths (int bits), literally (without repeat codes).*/ + unsigned* bitlen_lld_e = nullptr; /*bitlen_lld encoded with repeat codes (this is a rudimentary run length compression)*/ size_t datasize = dataend - datapos; /* @@ -2256,12 +2256,12 @@ unsigned lodepng_zlib_compress(unsigned char** out, size_t* outsize, const unsig size_t insize, const LodePNGCompressSettings* settings) { size_t i; unsigned error; - unsigned char* deflatedata = 0; + unsigned char* deflatedata = nullptr; size_t deflatesize = 0; error = deflate(&deflatedata, &deflatesize, in, insize, settings); - *out = NULL; + *out = nullptr; *outsize = 0; if(!error) { *outsize = deflatesize + 6; @@ -2339,12 +2339,12 @@ void lodepng_compress_settings_init(LodePNGCompressSettings* settings) { settings->nicematch = 128; settings->lazymatching = 1; - settings->custom_zlib = 0; - settings->custom_deflate = 0; - settings->custom_context = 0; + settings->custom_zlib = nullptr; + settings->custom_deflate = nullptr; + settings->custom_context = nullptr; } -const LodePNGCompressSettings lodepng_default_compress_settings = {2, 1, DEFAULT_WINDOWSIZE, 3, 128, 1, 0, 0, 0}; +const LodePNGCompressSettings lodepng_default_compress_settings = {2, 1, DEFAULT_WINDOWSIZE, 3, 128, 1, nullptr, nullptr, nullptr}; #endif /*LODEPNG_COMPILE_ENCODER*/ @@ -2356,12 +2356,12 @@ void lodepng_decompress_settings_init(LodePNGDecompressSettings* settings) { settings->ignore_nlen = 0; settings->max_output_size = 0; - settings->custom_zlib = 0; - settings->custom_inflate = 0; - settings->custom_context = 0; + settings->custom_zlib = nullptr; + settings->custom_inflate = nullptr; + settings->custom_context = nullptr; } -const LodePNGDecompressSettings lodepng_default_decompress_settings = {0, 0, 0, 0, 0, 0}; +const LodePNGDecompressSettings lodepng_default_decompress_settings = {0, 0, 0, nullptr, nullptr, nullptr}; #endif /*LODEPNG_COMPILE_DECODER*/ @@ -2547,7 +2547,7 @@ const unsigned char* lodepng_chunk_next_const(const unsigned char* chunk, const unsigned char* lodepng_chunk_find(unsigned char* chunk, unsigned char* end, const char type[5]) { for(;;) { - if(chunk >= end || end - chunk < 12) return 0; /* past file end: chunk + 12 > end */ + if(chunk >= end || end - chunk < 12) return nullptr; /* past file end: chunk + 12 > end */ if(lodepng_chunk_type_equals(chunk, type)) return chunk; chunk = lodepng_chunk_next(chunk, end); } @@ -2555,7 +2555,7 @@ unsigned char* lodepng_chunk_find(unsigned char* chunk, unsigned char* end, cons const unsigned char* lodepng_chunk_find_const(const unsigned char* chunk, const unsigned char* end, const char type[5]) { for(;;) { - if(chunk >= end || end - chunk < 12) return 0; /* past file end: chunk + 12 > end */ + if(chunk >= end || end - chunk < 12) return nullptr; /* past file end: chunk + 12 > end */ if(lodepng_chunk_type_equals(chunk, type)) return chunk; chunk = lodepng_chunk_next_const(chunk, end); } @@ -2669,7 +2669,7 @@ void lodepng_color_mode_init(LodePNGColorMode* info) { info->key_r = info->key_g = info->key_b = 0; info->colortype = LCT_RGBA; info->bitdepth = 8; - info->palette = 0; + info->palette = nullptr; info->palettesize = 0; } @@ -2733,7 +2733,7 @@ static int lodepng_color_mode_equal(const LodePNGColorMode* a, const LodePNGColo void lodepng_palette_clear(LodePNGColorMode* info) { if(info->palette) lodepng_free(info->palette); - info->palette = 0; + info->palette = nullptr; info->palettesize = 0; } @@ -2846,7 +2846,7 @@ static int lodepng_pixel_overflow(unsigned w, unsigned h, static void LodePNGUnknownChunks_init(LodePNGInfo* info) { unsigned i; - for(i = 0; i != 3; ++i) info->unknown_chunks_data[i] = 0; + for(i = 0; i != 3; ++i) info->unknown_chunks_data[i] = nullptr; for(i = 0; i != 3; ++i) info->unknown_chunks_size[i] = 0; } @@ -2877,8 +2877,8 @@ static unsigned LodePNGUnknownChunks_copy(LodePNGInfo* dest, const LodePNGInfo* static void LodePNGText_init(LodePNGInfo* info) { info->text_num = 0; - info->text_keys = NULL; - info->text_strings = NULL; + info->text_keys = nullptr; + info->text_strings = nullptr; } static void LodePNGText_cleanup(LodePNGInfo* info) { @@ -2893,8 +2893,8 @@ static void LodePNGText_cleanup(LodePNGInfo* info) { static unsigned LodePNGText_copy(LodePNGInfo* dest, const LodePNGInfo* source) { size_t i = 0; - dest->text_keys = NULL; - dest->text_strings = NULL; + dest->text_keys = nullptr; + dest->text_strings = nullptr; dest->text_num = 0; for(i = 0; i != source->text_num; ++i) { CERROR_TRY_RETURN(lodepng_add_text(dest, source->text_keys[i], source->text_strings[i])); @@ -2931,10 +2931,10 @@ void lodepng_clear_text(LodePNGInfo* info) { static void LodePNGIText_init(LodePNGInfo* info) { info->itext_num = 0; - info->itext_keys = NULL; - info->itext_langtags = NULL; - info->itext_transkeys = NULL; - info->itext_strings = NULL; + info->itext_keys = nullptr; + info->itext_langtags = nullptr; + info->itext_transkeys = nullptr; + info->itext_strings = nullptr; } static void LodePNGIText_cleanup(LodePNGInfo* info) { @@ -2953,10 +2953,10 @@ static void LodePNGIText_cleanup(LodePNGInfo* info) { static unsigned LodePNGIText_copy(LodePNGInfo* dest, const LodePNGInfo* source) { size_t i = 0; - dest->itext_keys = NULL; - dest->itext_langtags = NULL; - dest->itext_transkeys = NULL; - dest->itext_strings = NULL; + dest->itext_keys = nullptr; + dest->itext_langtags = nullptr; + dest->itext_transkeys = nullptr; + dest->itext_strings = nullptr; dest->itext_num = 0; for(i = 0; i != source->itext_num; ++i) { CERROR_TRY_RETURN(lodepng_add_itext(dest, source->itext_keys[i], source->itext_langtags[i], @@ -3023,7 +3023,7 @@ unsigned lodepng_set_icc(LodePNGInfo* info, const char* name, const unsigned cha void lodepng_clear_icc(LodePNGInfo* info) { string_cleanup(&info->iccp_name); lodepng_free(info->iccp_profile); - info->iccp_profile = NULL; + info->iccp_profile = nullptr; info->iccp_profile_size = 0; info->iccp_defined = 0; } @@ -3048,8 +3048,8 @@ void lodepng_info_init(LodePNGInfo* info) { info->chrm_defined = 0; info->srgb_defined = 0; info->iccp_defined = 0; - info->iccp_name = NULL; - info->iccp_profile = NULL; + info->iccp_name = nullptr; + info->iccp_profile = nullptr; LodePNGUnknownChunks_init(info); #endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ @@ -4038,7 +4038,7 @@ unsigned lodepng_inspect(unsigned* w, unsigned* h, LodePNGState* state, const unsigned char* in, size_t insize) { unsigned width, height; LodePNGInfo* info = &state->info_png; - if(insize == 0 || in == 0) { + if(insize == 0 || in == nullptr) { CERROR_RETURN_ERROR(state->error, 48); /*error: the given data is empty*/ } if(insize < 33) { @@ -4205,7 +4205,7 @@ static unsigned unfilter(unsigned char* out, const unsigned char* in, unsigned w */ unsigned y; - unsigned char* prevline = 0; + unsigned char* prevline = nullptr; /*bytewidth is used for filtering, is 1 when bpp < 8, number of bytes per pixel otherwise*/ size_t bytewidth = (bpp + 7u) / 8u; @@ -4430,7 +4430,7 @@ static unsigned readChunk_bKGD(LodePNGInfo* info, const unsigned char* data, siz /*text chunk (tEXt)*/ static unsigned readChunk_tEXt(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) { unsigned error = 0; - char *key = 0, *str = 0; + char *key = nullptr, *str = nullptr; while(!error) /*not really a while loop, only used to break on error*/ { unsigned length, string2_begin; @@ -4476,8 +4476,8 @@ static unsigned readChunk_zTXt(LodePNGInfo* info, const LodePNGDecoderSettings* LodePNGDecompressSettings zlibsettings = decoder->zlibsettings; unsigned length, string2_begin; - char *key = 0; - unsigned char* str = 0; + char *key = nullptr; + unsigned char* str = nullptr; size_t size = 0; while(!error) /*not really a while loop, only used to break on error*/ { @@ -4524,7 +4524,7 @@ static unsigned readChunk_iTXt(LodePNGInfo* info, const LodePNGDecoderSettings* LodePNGDecompressSettings zlibsettings = decoder->zlibsettings; unsigned length, begin, compressed; - char *key = 0, *langtag = 0, *transkey = 0; + char *key = nullptr, *langtag = nullptr, *transkey = nullptr; while(!error) /*not really a while loop, only used to break on error*/ { /*Quick check if the chunk length isn't too small. Even without check @@ -4577,7 +4577,7 @@ static unsigned readChunk_iTXt(LodePNGInfo* info, const LodePNGDecoderSettings* length = (unsigned)chunkLength < begin ? 0 : (unsigned)chunkLength - begin; if(compressed) { - unsigned char* str = 0; + unsigned char* str = nullptr; size_t size = 0; zlibsettings.max_output_size = decoder->max_text_size; /*will fail if zlib error, e.g. if length is too small*/ @@ -4761,7 +4761,7 @@ static void decodeGeneric(unsigned char** out, unsigned* w, unsigned* h, const unsigned char* chunk; unsigned char* idat; /*the data from idat chunks, zlib compressed*/ size_t idatsize = 0; - unsigned char* scanlines = 0; + unsigned char* scanlines = nullptr; size_t scanlines_size = 0, expected_size = 0; size_t outsize = 0; @@ -4773,7 +4773,7 @@ static void decodeGeneric(unsigned char** out, unsigned* w, unsigned* h, /* safe output values in case error happens */ - *out = 0; + *out = nullptr; *w = *h = 0; state->error = lodepng_inspect(w, h, state, in, insize); /*reads header and resets other parameters in state->info_png*/ @@ -4951,7 +4951,7 @@ static void decodeGeneric(unsigned char** out, unsigned* w, unsigned* h, unsigned lodepng_decode(unsigned char** out, unsigned* w, unsigned* h, LodePNGState* state, const unsigned char* in, size_t insize) { - *out = 0; + *out = nullptr; decodeGeneric(out, w, h, state, in, insize); if(state->error) return state->error; if(!state->decoder.color_convert || lodepng_color_mode_equal(&state->info_raw, &state->info_png.color)) { @@ -5013,11 +5013,11 @@ unsigned lodepng_decode24(unsigned char** out, unsigned* w, unsigned* h, const u #ifdef LODEPNG_COMPILE_DISK unsigned lodepng_decode_file(unsigned char** out, unsigned* w, unsigned* h, const char* filename, LodePNGColorType colortype, unsigned bitdepth) { - unsigned char* buffer = 0; + unsigned char* buffer = nullptr; size_t buffersize; unsigned error; /* safe output values in case error happens */ - *out = 0; + *out = nullptr; *w = *h = 0; error = lodepng_load_file(&buffer, &buffersize, filename); if(!error) error = lodepng_decode_memory(out, w, h, buffer, buffersize, colortype, bitdepth); @@ -5133,7 +5133,7 @@ static unsigned addChunk_PLTE(ucvector* out, const LodePNGColorMode* info) { } static unsigned addChunk_tRNS(ucvector* out, const LodePNGColorMode* info) { - unsigned char* chunk = 0; + unsigned char* chunk = nullptr; if(info->colortype == LCT_PALETTE) { size_t i, amount = info->palettesize; @@ -5172,7 +5172,7 @@ static unsigned addChunk_tRNS(ucvector* out, const LodePNGColorMode* info) { static unsigned addChunk_IDAT(ucvector* out, const unsigned char* data, size_t datasize, LodePNGCompressSettings* zlibsettings) { unsigned error = 0; - unsigned char* zlib = 0; + unsigned char* zlib = nullptr; size_t zlibsize = 0; error = zlib_compress(&zlib, &zlibsize, data, datasize, zlibsettings); @@ -5184,13 +5184,13 @@ static unsigned addChunk_IDAT(ucvector* out, const unsigned char* data, size_t d } static unsigned addChunk_IEND(ucvector* out) { - return lodepng_chunk_createv(out, 0, "IEND", 0); + return lodepng_chunk_createv(out, 0, "IEND", nullptr); } #ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS static unsigned addChunk_tEXt(ucvector* out, const char* keyword, const char* textstring) { - unsigned char* chunk = 0; + unsigned char* chunk = nullptr; size_t keysize = lodepng_strlen(keyword), textsize = lodepng_strlen(textstring); size_t size = keysize + 1 + textsize; if(keysize < 1 || keysize > 79) return 89; /*error: invalid keyword size*/ @@ -5205,8 +5205,8 @@ static unsigned addChunk_tEXt(ucvector* out, const char* keyword, const char* te static unsigned addChunk_zTXt(ucvector* out, const char* keyword, const char* textstring, LodePNGCompressSettings* zlibsettings) { unsigned error = 0; - unsigned char* chunk = 0; - unsigned char* compressed = 0; + unsigned char* chunk = nullptr; + unsigned char* compressed = nullptr; size_t compressedsize = 0; size_t textsize = lodepng_strlen(textstring); size_t keysize = lodepng_strlen(keyword); @@ -5233,8 +5233,8 @@ static unsigned addChunk_zTXt(ucvector* out, const char* keyword, const char* te static unsigned addChunk_iTXt(ucvector* out, unsigned compress, const char* keyword, const char* langtag, const char* transkey, const char* textstring, LodePNGCompressSettings* zlibsettings) { unsigned error = 0; - unsigned char* chunk = 0; - unsigned char* compressed = 0; + unsigned char* chunk = nullptr; + unsigned char* compressed = nullptr; size_t compressedsize = 0; size_t textsize = lodepng_strlen(textstring); size_t keysize = lodepng_strlen(keyword), langsize = lodepng_strlen(langtag), transsize = lodepng_strlen(transkey); @@ -5275,7 +5275,7 @@ static unsigned addChunk_iTXt(ucvector* out, unsigned compress, const char* keyw } static unsigned addChunk_bKGD(ucvector* out, const LodePNGInfo* info) { - unsigned char* chunk = 0; + unsigned char* chunk = nullptr; if(info->color.colortype == LCT_GREY || info->color.colortype == LCT_GREY_ALPHA) { CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, 2, "bKGD")); chunk[8] = (unsigned char)(info->background_r >> 8); @@ -5350,8 +5350,8 @@ static unsigned addChunk_sRGB(ucvector* out, const LodePNGInfo* info) { static unsigned addChunk_iCCP(ucvector* out, const LodePNGInfo* info, LodePNGCompressSettings* zlibsettings) { unsigned error = 0; - unsigned char* chunk = 0; - unsigned char* compressed = 0; + unsigned char* chunk = nullptr; + unsigned char* compressed = nullptr; size_t compressedsize = 0; size_t keysize = lodepng_strlen(info->iccp_name); @@ -5455,7 +5455,7 @@ static unsigned filter(unsigned char* out, const unsigned char* in, unsigned w, /*bytewidth is used for filtering, is 1 when bpp < 8, number of bytes per pixel otherwise*/ size_t bytewidth = (bpp + 7u) / 8u; - const unsigned char* prevline = 0; + const unsigned char* prevline = nullptr; unsigned x, y; unsigned error = 0; LodePNGFilterStrategy strategy = settings->filter_strategy; @@ -5600,8 +5600,8 @@ static unsigned filter(unsigned char* out, const unsigned char* in, unsigned w, zlibsettings.btype = 1; /*a custom encoder likely doesn't read the btype setting and is optimized for complete PNG images only, so disable it*/ - zlibsettings.custom_zlib = 0; - zlibsettings.custom_deflate = 0; + zlibsettings.custom_zlib = nullptr; + zlibsettings.custom_deflate = nullptr; for(type = 0; type != 5; ++type) { attempt[type] = (unsigned char*)lodepng_malloc(linebytes); if(!attempt[type]) error = 83; /*alloc fail*/ @@ -5614,7 +5614,7 @@ static unsigned filter(unsigned char* out, const unsigned char* in, unsigned w, filterScanline(attempt[type], &in[y * linebytes], prevline, linebytes, bytewidth, type); size[type] = 0; - dummy = 0; + dummy = nullptr; zlib_compress(&dummy, &size[type], attempt[type], testsize, &zlibsettings); lodepng_free(dummy); /*check if this is smallest size (or if type == 0 it's the first case so always store the values)*/ @@ -5814,16 +5814,16 @@ static unsigned isRGBICCProfile(const unsigned char* profile, unsigned size) { unsigned lodepng_encode(unsigned char** out, size_t* outsize, const unsigned char* image, unsigned w, unsigned h, LodePNGState* state) { - unsigned char* data = 0; /*uncompressed version of the IDAT chunk data*/ + unsigned char* data = nullptr; /*uncompressed version of the IDAT chunk data*/ size_t datasize = 0; - ucvector outv = ucvector_init(NULL, 0); + ucvector outv = ucvector_init(nullptr, 0); LodePNGInfo info; const LodePNGInfo* info_png = &state->info_png; lodepng_info_init(&info); /*provide some proper output values if error will happen*/ - *out = 0; + *out = nullptr; *outsize = 0; state->error = 0; @@ -6121,7 +6121,7 @@ void lodepng_encoder_settings_init(LodePNGEncoderSettings* settings) { settings->filter_strategy = LFS_MINSUM; settings->auto_convert = 1; settings->force_palette = 0; - settings->predefined_filters = 0; + settings->predefined_filters = nullptr; #ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS settings->add_id = 0; settings->text_compression = 1; @@ -6282,7 +6282,7 @@ unsigned load_file(std::vector<unsigned char>& buffer, const std::string& filena /*write given buffer to the file, overwriting the file, it doesn't append to it.*/ unsigned save_file(const std::vector<unsigned char>& buffer, const std::string& filename) { - return lodepng_save_file(buffer.empty() ? 0 : &buffer[0], buffer.size(), filename.c_str()); + return lodepng_save_file(buffer.empty() ? nullptr : &buffer[0], buffer.size(), filename.c_str()); } #endif /* LODEPNG_COMPILE_DISK */ @@ -6290,7 +6290,7 @@ unsigned save_file(const std::vector<unsigned char>& buffer, const std::string& #ifdef LODEPNG_COMPILE_DECODER unsigned decompress(std::vector<unsigned char>& out, const unsigned char* in, size_t insize, const LodePNGDecompressSettings& settings) { - unsigned char* buffer = 0; + unsigned char* buffer = nullptr; size_t buffersize = 0; unsigned error = zlib_decompress(&buffer, &buffersize, 0, in, insize, &settings); if(buffer) { @@ -6302,14 +6302,14 @@ unsigned decompress(std::vector<unsigned char>& out, const unsigned char* in, si unsigned decompress(std::vector<unsigned char>& out, const std::vector<unsigned char>& in, const LodePNGDecompressSettings& settings) { - return decompress(out, in.empty() ? 0 : &in[0], in.size(), settings); + return decompress(out, in.empty() ? nullptr : &in[0], in.size(), settings); } #endif /* LODEPNG_COMPILE_DECODER */ #ifdef LODEPNG_COMPILE_ENCODER unsigned compress(std::vector<unsigned char>& out, const unsigned char* in, size_t insize, const LodePNGCompressSettings& settings) { - unsigned char* buffer = 0; + unsigned char* buffer = nullptr; size_t buffersize = 0; unsigned error = zlib_compress(&buffer, &buffersize, in, insize, &settings); if(buffer) { @@ -6321,7 +6321,7 @@ unsigned compress(std::vector<unsigned char>& out, const unsigned char* in, size unsigned compress(std::vector<unsigned char>& out, const std::vector<unsigned char>& in, const LodePNGCompressSettings& settings) { - return compress(out, in.empty() ? 0 : &in[0], in.size(), settings); + return compress(out, in.empty() ? nullptr : &in[0], in.size(), settings); } #endif /* LODEPNG_COMPILE_ENCODER */ #endif /* LODEPNG_COMPILE_ZLIB */ @@ -6351,7 +6351,7 @@ State& State::operator=(const State& other) { unsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h, const unsigned char* in, size_t insize, LodePNGColorType colortype, unsigned bitdepth) { - unsigned char* buffer = 0; + unsigned char* buffer = nullptr; unsigned error = lodepng_decode_memory(&buffer, &w, &h, in, insize, colortype, bitdepth); if(buffer && !error) { State state; @@ -6366,13 +6366,13 @@ unsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h, const unsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h, const std::vector<unsigned char>& in, LodePNGColorType colortype, unsigned bitdepth) { - return decode(out, w, h, in.empty() ? 0 : &in[0], (unsigned)in.size(), colortype, bitdepth); + return decode(out, w, h, in.empty() ? nullptr : &in[0], (unsigned)in.size(), colortype, bitdepth); } unsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h, State& state, const unsigned char* in, size_t insize) { - unsigned char* buffer = NULL; + unsigned char* buffer = nullptr; unsigned error = lodepng_decode(&buffer, &w, &h, &state, in, insize); if(buffer && !error) { size_t buffersize = lodepng_get_raw_size(w, h, &state.info_raw); @@ -6385,7 +6385,7 @@ unsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h, unsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h, State& state, const std::vector<unsigned char>& in) { - return decode(out, w, h, state, in.empty() ? 0 : &in[0], in.size()); + return decode(out, w, h, state, in.empty() ? nullptr : &in[0], in.size()); } #ifdef LODEPNG_COMPILE_DISK @@ -6418,7 +6418,7 @@ unsigned encode(std::vector<unsigned char>& out, const std::vector<unsigned char>& in, unsigned w, unsigned h, LodePNGColorType colortype, unsigned bitdepth) { if(lodepng_get_raw_size_lct(w, h, colortype, bitdepth) > in.size()) return 84; - return encode(out, in.empty() ? 0 : &in[0], w, h, colortype, bitdepth); + return encode(out, in.empty() ? nullptr : &in[0], w, h, colortype, bitdepth); } unsigned encode(std::vector<unsigned char>& out, @@ -6438,7 +6438,7 @@ unsigned encode(std::vector<unsigned char>& out, const std::vector<unsigned char>& in, unsigned w, unsigned h, State& state) { if(lodepng_get_raw_size(w, h, &state.info_raw) > in.size()) return 84; - return encode(out, in.empty() ? 0 : &in[0], w, h, state); + return encode(out, in.empty() ? nullptr : &in[0], w, h, state); } #ifdef LODEPNG_COMPILE_DISK @@ -6455,7 +6455,7 @@ unsigned encode(const std::string& filename, const std::vector<unsigned char>& in, unsigned w, unsigned h, LodePNGColorType colortype, unsigned bitdepth) { if(lodepng_get_raw_size_lct(w, h, colortype, bitdepth) > in.size()) return 84; - return encode(filename, in.empty() ? 0 : &in[0], w, h, colortype, bitdepth); + return encode(filename, in.empty() ? nullptr : &in[0], w, h, colortype, bitdepth); } #endif /* LODEPNG_COMPILE_DISK */ #endif /* LODEPNG_COMPILE_ENCODER */ diff --git a/src/blockforest/GlobalLoadBalancing.h b/src/blockforest/GlobalLoadBalancing.h index ba92b73f23d751e2592e253b3a5f001fba227365..ca1509453d683bf2457c1d91a0c6a1b9f465fb75 100644 --- a/src/blockforest/GlobalLoadBalancing.h +++ b/src/blockforest/GlobalLoadBalancing.h @@ -497,7 +497,7 @@ inline uint_t GlobalLoadBalancing::minimizeProcesses( const std::vector< BLOCK* #ifdef WALBERLA_BUILD_WITH_METIS - if( numberOfProcesses > 1 && metisConfig.includeMetis() && processesWork == NULL && processesMemory == NULL ) { + if( numberOfProcesses > 1 && metisConfig.includeMetis() && processesWork == nullptr && processesMemory == nullptr ) { uint_t max = numberOfProcesses; uint_t min = uint_c( real_c(0.5) + ( real_c( memorySum( blocks ) ) / memoryLimit ) ); @@ -819,8 +819,8 @@ uint_t GlobalLoadBalancing::metis( const std::vector< BLOCK* >& blocks, const me // first call to METIS: always try to balance the workload as good as possible, but allow large imbalances concerning the memory (-> ubvec[1]) - int ret = core::METIS_PartGraphRecursive( &nvtxs, &ncon, &(xadj[0]), &(adjncy[0]), &(vwgt[0]), NULL, &(adjwgt[0]), &nparts, NULL, - &(ubvec[0]), NULL /*idx t *options*/, &objval, &(part[0]) ); + int ret = core::METIS_PartGraphRecursive( &nvtxs, &ncon, &(xadj[0]), &(adjncy[0]), &(vwgt[0]), nullptr, &(adjwgt[0]), &nparts, nullptr, + &(ubvec[0]), nullptr /*idx t *options*/, &objval, &(part[0]) ); // if METIS was successful AND the memory limit of each process is not violated (which is highly unlikely due to a large value for ubvec[1]) // then the algorithm is finished @@ -844,8 +844,8 @@ uint_t GlobalLoadBalancing::metis( const std::vector< BLOCK* >& blocks, const me real_t minUbvec = real_t(1); ubvec[1] = minUbvec; - ret = core::METIS_PartGraphRecursive( &nvtxs, &ncon, &(xadj[0]), &(adjncy[0]), &(vwgt[0]), NULL, &(adjwgt[0]), &nparts, NULL, - &(ubvec[0]), NULL /*idx t *options*/, &objval, &(part[0]) ); + ret = core::METIS_PartGraphRecursive( &nvtxs, &ncon, &(xadj[0]), &(adjncy[0]), &(vwgt[0]), nullptr, &(adjwgt[0]), &nparts, nullptr, + &(ubvec[0]), nullptr /*idx t *options*/, &objval, &(part[0]) ); // ... if this doesn't work OR if the memory limit is still violated then METIS is unable to find a valid partitioning @@ -881,8 +881,8 @@ uint_t GlobalLoadBalancing::metis( const std::vector< BLOCK* >& blocks, const me ubvec[1] = ( maxUbvec + minUbvec ) / real_c(2); - ret = core::METIS_PartGraphRecursive( &nvtxs, &ncon, &(xadj[0]), &(adjncy[0]), &(vwgt[0]), NULL, &(adjwgt[0]), &nparts, NULL, - &(ubvec[0]), NULL /*idx t *options*/, &objval, &(part[0]) ); + ret = core::METIS_PartGraphRecursive( &nvtxs, &ncon, &(xadj[0]), &(adjncy[0]), &(vwgt[0]), nullptr, &(adjwgt[0]), &nparts, nullptr, + &(ubvec[0]), nullptr /*idx t *options*/, &objval, &(part[0]) ); if( ret == core::METIS_OK && metisMaxMemory( blocks, numberOfProcesses, part ) <= memoryLimit ) { @@ -998,8 +998,8 @@ void GlobalLoadBalancing::metis2( const std::vector< BLOCK* >& blocks, const uin options[ core::METIS_OPTION_NSEPS ] = 100; options[ core::METIS_OPTION_NCUTS ] = 100; - int ret = core::METIS_PartGraphKway( &nvtxs, &ncon, &( xadj[ 0 ] ), &( adjncy[ 0 ] ), &( vwgt[ 0 ] ), NULL, &( adjwgt[0] ), - &nparts, NULL, NULL, options, &objval, &( part[ 0 ] ) ); + int ret = core::METIS_PartGraphKway( &nvtxs, &ncon, &( xadj[ 0 ] ), &( adjncy[ 0 ] ), &( vwgt[ 0 ] ), nullptr, &( adjwgt[0] ), + &nparts, nullptr, nullptr, options, &objval, &( part[ 0 ] ) ); if( ret != core::METIS_OK ) { diff --git a/src/boundary/BoundaryHandling.h b/src/boundary/BoundaryHandling.h index 9aa5a34390fb71d7479d512130dca4d81dc982b6..a3bff17631f979719fe1354c0a00b2b8c75f8b23 100644 --- a/src/boundary/BoundaryHandling.h +++ b/src/boundary/BoundaryHandling.h @@ -432,7 +432,7 @@ private: WALBERLA_ABORT( "The requested boundary condition " << uid.getIdentifier() << " is not part of this boundary handling." ); #ifdef __IBMCPP__ - return *(reinterpret_cast< Boundary_T * >( NULL )); // silencing incorrect IBM compiler warning + return *(static_cast< Boundary_T * >( nullptr )); // silencing incorrect IBM compiler warning #endif } @@ -457,7 +457,7 @@ private: template< typename Boundary_T, typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > inline const typename std::enable_if<(N!=0), Boundary_T>::type & getBoundaryCondition_TypeExists( const BoundaryUID & uid, const BoundariesTuple & boundaryConditions, - typename std::enable_if< std::is_same< Boundary_T, typename std::tuple_element<N, BoundariesTuple>::type >::value >::type* /*dummy*/ = 0 ) const + typename std::enable_if< std::is_same< Boundary_T, typename std::tuple_element<N, BoundariesTuple>::type >::value >::type* /*dummy*/ = nullptr ) const { if( uid == std::get<N>( boundaryConditions ).getUID() ) return std::get<N>( boundaryConditions ); @@ -475,7 +475,7 @@ private: WALBERLA_ABORT( "The requested boundary condition " << uid.getIdentifier() << " is not part of this boundary handling." ); #ifdef __IBMCPP__ - return *(reinterpret_cast< Boundary_T * >( NULL )); // silencing incorrect IBM compiler warning + return *(static_cast< Boundary_T * >( nullptr )); // silencing incorrect IBM compiler warning #endif } @@ -495,7 +495,7 @@ private: WALBERLA_ABORT( "The requested boundary condition " << uid.getIdentifier() << " is not part of this boundary handling." ); #ifdef __IBMCPP__ - return *(reinterpret_cast< Boundary_T * >( NULL )); // silencing incorrect IBM compiler warning + return *(static_cast< Boundary_T * >( nullptr )); // silencing incorrect IBM compiler warning #endif } @@ -2501,7 +2501,7 @@ inline typename std::enable_if<(N==-1), BoundaryUID>::type BoundaryHandling< Fla "boundary handling " << uid_.getIdentifier() << "!" ); #ifdef __IBMCPP__ - return *(reinterpret_cast< BoundaryUID * >( NULL )); // silencing incorrect IBM compiler warning + return *(static_cast< BoundaryUID * >( nullptr )); // silencing incorrect IBM compiler warning #endif } diff --git a/src/core/Array.h b/src/core/Array.h index 42ab4efe51118b5edecb211b9066299466725ebc..c047542d7ab8e8af632c7ce56416f403d395bf2a 100644 --- a/src/core/Array.h +++ b/src/core/Array.h @@ -78,7 +78,7 @@ protected: template< typename T > -inline Array<T>::Array( const uint_t n, const T& t ) : array_( n == 0 ? NULL : new T[n] ), size_( n ) +inline Array<T>::Array( const uint_t n, const T& t ) : array_( n == 0 ? nullptr : new T[n] ), size_( n ) { for( uint_t i = 0; i != n; ++i ) array_[i] = t; @@ -89,7 +89,7 @@ inline Array<T>::Array( const uint_t n, const T& t ) : array_( n == 0 ? NULL : n template< typename T > inline Array<T>::Array( const std::vector<T>& vector ) : - array_( vector.size() == 0 ? NULL : new T[ vector.size() ] ), size_( vector.size() ) + array_( vector.size() == 0 ? nullptr : new T[ vector.size() ] ), size_( vector.size() ) { for( uint_t i = 0; i != size_; ++i ) array_[i] = vector[i]; @@ -100,7 +100,7 @@ inline Array<T>::Array( const std::vector<T>& vector ) : template< typename T > inline Array<T>::Array( const Array& array ) : - array_( array.size_ == 0 ? NULL : new T[ array.size_ ] ), size_( array.size_ ) + array_( array.size_ == 0 ? nullptr : new T[ array.size_ ] ), size_( array.size_ ) { for( uint_t i = 0; i != size_; ++i ) array_[i] = array.array_[i]; diff --git a/src/core/math/extern/exprtk.h b/src/core/math/extern/exprtk.h index b3b0070a030015273a58ed382175e16e41bcb4cf..b415b4ba62bd0c0dc1830fd106d562a7a96f4129 100644 --- a/src/core/math/extern/exprtk.h +++ b/src/core/math/extern/exprtk.h @@ -56,6 +56,7 @@ #include <utility> #include <vector> +//NOLINTBEGIN(modernize-use-nullptr) namespace exprtk { @@ -40042,4 +40043,6 @@ namespace exprtk } // namespace exprtk +//NOLINTEND(modernize-use-nullptr) + #endif diff --git a/src/domain_decomposition/BlockStorage.h b/src/domain_decomposition/BlockStorage.h index 2f29acdb7fd45c1e287ebf6d4601b641f303506b..551ff5f6803c0e6f740db717ccf7b2a220048ebb 100644 --- a/src/domain_decomposition/BlockStorage.h +++ b/src/domain_decomposition/BlockStorage.h @@ -273,7 +273,7 @@ public: * \code * for( const_iterator block = begin(); block != end(); ++block ) * if( block->getId() == id ) return *block; - * return NULL; + * return nullptr; * \endcode */ //******************************************************************************************************************* @@ -294,7 +294,7 @@ public: * \code * for( iterator block = begin(); block != end(); ++block ) * if( block->getId() == id ) return *block; - * return NULL; + * return nullptr; * \endcode */ //******************************************************************************************************************* @@ -315,7 +315,7 @@ public: * \code * for( const_iterator block = begin(); block != end(); ++block ) * if( block->getAABB().contains(x,y,z) ) return *block; - * return NULL; + * return nullptr; * \endcode * * Periodicity is not considered! For mapping points to the periodic simulation space see 'mapToPeriodicDomain'. @@ -332,7 +332,7 @@ public: * \code * for( iterator block = begin(); block != end(); ++block ) * if( block->getAABB().contains(x,y,z) ) return *block; - * return NULL; + * return nullptr; * \endcode * * Periodicity is not considered! For mapping points to the periodic simulation space see 'mapToPeriodicDomain'. @@ -716,7 +716,7 @@ inline BlockDataID BlockStorage::loadBlockData( const std::string & file, const /*! * This function can be used for removing all data that corresponds to block data ID 'id'. * Please note: The block data ID 'id' will still be valid, but blocks won't return anything anymore, -* they will only return NULL for 'id'. +* they will only return nullptr for 'id'. */ //********************************************************************************************************************** inline void BlockStorage::clearBlockData( const BlockDataID & id ) diff --git a/src/domain_decomposition/IBlock.h b/src/domain_decomposition/IBlock.h index ef563cc057b2e9157330420f09beb1ad74050168..42f73cd4a43c3b55326c991300ec21035c198487 100644 --- a/src/domain_decomposition/IBlock.h +++ b/src/domain_decomposition/IBlock.h @@ -359,7 +359,7 @@ inline T* IBlock::getData( const BlockDataID & index ) { //********************************************************************************************************************** /*! * Function for removing all data that corresponds to block data ID 'index'. -* Further calls to "getData" with 'index' will return NULL. +* Further calls to "getData" with 'index' will return nullptr. */ //********************************************************************************************************************** inline void IBlock::deleteData( const BlockDataID & index ) diff --git a/src/field/Field.impl.h b/src/field/Field.impl.h index af93706e467f1735c8989230779b1d5a378293cd..cfbd8d1bce47dacd49b33d3b154468b355aaa9e0 100644 --- a/src/field/Field.impl.h +++ b/src/field/Field.impl.h @@ -103,7 +103,7 @@ namespace field { Field<T,fSize_>::Field( uint_t _xSize, uint_t _ySize, uint_t _zSize, const std::vector<T> & fValues, const Layout & l, const shared_ptr<FieldAllocator<T> > &alloc) - : values_( NULL ), valuesWithOffset_( NULL ) + : values_( nullptr ), valuesWithOffset_( nullptr ) { init(_xSize,_ySize,_zSize,l,alloc); set(fValues); @@ -301,7 +301,7 @@ namespace field { * \param _ySize size of y dimension * \param _zSize size of z dimension * \param l memory layout of the field (see Field::Layout) - * \param alloc the allocator to use. If a NULL shared pointer is given, a sensible default is selected, + * \param alloc the allocator to use. If a nullptr is given, a sensible default is selected, * depending on layout * \param innerGhostLayerSizeForAlignedAlloc * This parameter should be set to zero for field that have no ghost layers. diff --git a/src/field/FieldClone.h b/src/field/FieldClone.h index ebb6dddfaede4fa86db5c9e09707edb0f370929b..eb2a3a42547c5e031b31a04a6352bb1356ea7c33 100644 --- a/src/field/FieldClone.h +++ b/src/field/FieldClone.h @@ -60,7 +60,7 @@ class FieldClone { public: - FieldClone( ConstBlockDataID fieldID ) : fieldID_( fieldID ), dstField_( NULL ){} + FieldClone( ConstBlockDataID fieldID ) : fieldID_( fieldID ), dstField_( nullptr ){} ~FieldClone(){ // Free allocated temporary fields @@ -126,7 +126,7 @@ class FieldCreator { public: - FieldCreator() : dstField_( NULL ){} + FieldCreator() : dstField_( nullptr ){} ~FieldCreator(){ // Free allocated temporary fields diff --git a/src/field/vtk/FlagFieldMapping.h b/src/field/vtk/FlagFieldMapping.h index f8cb572b5682f4faaed44832758f45efb5886fa8..267cee26a392cdf6b652c05f2e6939f5aea22611 100644 --- a/src/field/vtk/FlagFieldMapping.h +++ b/src/field/vtk/FlagFieldMapping.h @@ -38,7 +38,7 @@ private: public: FlagFieldMapping( const ConstBlockDataID flagId, const std::string& id ) : - vtk::BlockCellDataWriter<T,1>( id ), flagId_( flagId ), flagField_( NULL ) {} + vtk::BlockCellDataWriter<T,1>( id ), flagId_( flagId ), flagField_( nullptr ) {} FlagFieldMapping( const ConstBlockDataID flagId, const std::string& id, const std::map< FlagUID, T > mapping ) : vtk::BlockCellDataWriter<T,1>( id ), flagId_( flagId ), flagField_( nullptr ), mapping_( mapping ) {} @@ -90,7 +90,7 @@ class BinarizationFieldWriter : public vtk::BlockCellDataWriter<TargetType,1> public: BinarizationFieldWriter( const ConstBlockDataID fieldID, const std::string& id, SrcType mask) : - vtk::BlockCellDataWriter<TargetType,1>( id ), fieldID_( fieldID ), field_( NULL ), mask_( mask ) {} + vtk::BlockCellDataWriter<TargetType,1>( id ), fieldID_( fieldID ), field_( nullptr ), mask_( mask ) {} protected: diff --git a/src/geometry/containment_octree/BranchNode.h b/src/geometry/containment_octree/BranchNode.h index 2b160ad5b3641e5adcbcdba3c6c245bcbc2f89c8..742d09623c73b0e0bc80c9a253262636ed34765d 100644 --- a/src/geometry/containment_octree/BranchNode.h +++ b/src/geometry/containment_octree/BranchNode.h @@ -74,7 +74,7 @@ BranchNode<ContainmentOctreeT>::BranchNode( const shared_ptr<const DistanceObjec const uint_t maxDepth, const Scalar minAABBVolume ) : center_( this->toPoint( aabb.center() ) ) { for( int i = 0; i < 8; ++i ) - children_[i] = NULL; + children_[i] = nullptr; const auto & min = aabb.minCorner(); const auto & max = aabb.maxCorner(); diff --git a/src/lbm/PerformanceEvaluation.h b/src/lbm/PerformanceEvaluation.h index d1deed9c17fd6c7f1b5a0e24da699bc1229ffd45..25bd56517a06b983a547b77b51d112076a4cac96 100644 --- a/src/lbm/PerformanceEvaluation.h +++ b/src/lbm/PerformanceEvaluation.h @@ -226,7 +226,7 @@ PerformanceEvaluationBase< CellCounter_T, FluidCellCounter_T >::PerformanceEvalu fluidCells_( fluidCellCounter ) { #ifdef _OPENMP - if( std::getenv( "OMP_NUM_THREADS" ) == NULL ) + if( std::getenv( "OMP_NUM_THREADS" ) == nullptr ) WALBERLA_ABORT( "If you are using a version of the program that was compiled with OpenMP you have to " "specify the environment variable \'OMP_NUM_THREADS\' accordingly!" ); threadsPerProcess_ = std::atoi( std::getenv( "OMP_NUM_THREADS" ) ); diff --git a/src/lbm/boundary/DiffusionDirichlet.h b/src/lbm/boundary/DiffusionDirichlet.h index 7ffa062a01770210b398a4ba5fa9ff3fa475cbaf..a79292a01ded5a5167d153c2829fbd8b4ef48c4b 100644 --- a/src/lbm/boundary/DiffusionDirichlet.h +++ b/src/lbm/boundary/DiffusionDirichlet.h @@ -82,7 +82,7 @@ public: static shared_ptr<SingleScalarConfiguration> createConfiguration( const Config::BlockHandle & config ) { return make_shared<SingleScalarConfiguration>( config ); } - inline DiffusionDirichlet( const BoundaryUID & boundaryUID, const FlagUID & uid, PDFField* const pdfField, FlagField<flag_t> * const flagField = NULL ); + inline DiffusionDirichlet( const BoundaryUID & boundaryUID, const FlagUID & uid, PDFField* const pdfField, FlagField<flag_t> * const flagField = nullptr ); void pushFlags( std::vector< FlagUID > & uids ) const { uids.push_back( uid_ ); } diff --git a/src/lbm/boundary/ParserUBB.h b/src/lbm/boundary/ParserUBB.h index 309b44c472ed80ad7168145c252b6a312bb5f614..2a4d8e0876014ff4008ef75ebfc5d81826fbcb6b 100644 --- a/src/lbm/boundary/ParserUBB.h +++ b/src/lbm/boundary/ParserUBB.h @@ -297,7 +297,7 @@ inline ParserUBB<LatticeModel_T, flag_t, AdaptVelocityToExternalForce, StoreForc origin_[1] = aabb.yMin() + real_c(0.5) * dx_[1]; origin_[2] = aabb.zMin() + real_c(0.5) * dx_[2]; - if(flagField != NULL) + if(flagField != nullptr) { parserField_ = make_shared<ParserField> ( pdfField->xSize(), pdfField->ySize(), pdfField->zSize(), flagField->nrOfGhostLayers(), field::fzyx ); velocityField_ = make_shared<VelocityField>( pdfField->xSize(), pdfField->ySize(), pdfField->zSize(), flagField->nrOfGhostLayers(), field::fzyx ); diff --git a/src/lbm/boundary/Pressure.h b/src/lbm/boundary/Pressure.h index 51dc64c2aa5ce044d830ea302a050ef43ba386c8..0ac8e13b319f8335293bf1d605ac16ed1b2eb8b8 100644 --- a/src/lbm/boundary/Pressure.h +++ b/src/lbm/boundary/Pressure.h @@ -72,7 +72,7 @@ public: static shared_ptr<LatticeDensity> createConfiguration( const Config::BlockHandle & config ) { return make_shared<LatticeDensity>( config ); } - inline Pressure( const BoundaryUID & boundaryUID, const FlagUID & uid, PDFField* const pdfField, FlagField<flag_t> * const flagField = NULL ); + inline Pressure( const BoundaryUID & boundaryUID, const FlagUID & uid, PDFField* const pdfField, FlagField<flag_t> * const flagField = nullptr ); void pushFlags( std::vector< FlagUID > & uids ) const { uids.push_back( uid_ ); } @@ -124,7 +124,7 @@ inline Pressure< LatticeModel_T, flag_t>::Pressure( const BoundaryUID & boundary WALBERLA_ASSERT_NOT_NULLPTR( pdfField_ ); WALBERLA_ASSERT_NOT_NULLPTR( pdfField_ ); - if (flagField != NULL) + if (flagField != nullptr) latticeDensityField_ = make_shared<LatticeDensityField>( pdfField_->xSize(), pdfField_->ySize(), pdfField_->zSize(), flagField->nrOfGhostLayers(), field::fzyx ); else latticeDensityField_ = make_shared<LatticeDensityField>( pdfField_->xSize(), pdfField_->ySize(), pdfField_->zSize(), pdfField_->nrOfGhostLayers(), field::fzyx ); diff --git a/src/lbm/boundary/VelocityBoundary.h b/src/lbm/boundary/VelocityBoundary.h index 72901642c3d261e9cfd4496d80f5e16ce743a306..bfeb31f461032fb5fe6aa5db668017afad22cae2 100644 --- a/src/lbm/boundary/VelocityBoundary.h +++ b/src/lbm/boundary/VelocityBoundary.h @@ -89,7 +89,7 @@ public: - inline VelocityBoundary( const BoundaryUID & boundaryUID, const FlagUID & uid, PDFField* const pdfField, FlagField<flag_t> * const flagField = NULL ); + inline VelocityBoundary( const BoundaryUID & boundaryUID, const FlagUID & uid, PDFField* const pdfField, FlagField<flag_t> * const flagField = nullptr ); void pushFlags( std::vector< FlagUID > & uids ) const { uids.push_back( uid_ ); } @@ -142,7 +142,7 @@ inline VelocityBoundary< LatticeModel_T, flag_t >::VelocityBoundary( const Bound Boundary<flag_t>( boundaryUID ), uid_( uid ), pdfField_( pdfField ) { WALBERLA_ASSERT_NOT_NULLPTR( pdfField_ ); - if (flagField != NULL) + if (flagField != nullptr) vel_ = make_shared<VelField>( pdfField_->xSize(), pdfField_->ySize(), pdfField_->zSize(), flagField->nrOfGhostLayers(), field::fzyx ); else vel_ = make_shared<VelField>( pdfField_->xSize(), pdfField_->ySize(), pdfField_->zSize(), pdfField_->nrOfGhostLayers(), field::fzyx ); diff --git a/src/lbm/field/DensityVelocityCallback.h b/src/lbm/field/DensityVelocityCallback.h index acf99efbe6bb19706bbdda5ca0372fd2229292f2..925129f36b3678022d2b2eded43d6dfda13e24c9 100644 --- a/src/lbm/field/DensityVelocityCallback.h +++ b/src/lbm/field/DensityVelocityCallback.h @@ -320,7 +320,7 @@ class VelocityCallback { public: - VelocityCallback( const BlockDataID & fieldId ) : fieldId_( fieldId ), field_( NULL ) {} + VelocityCallback( const BlockDataID & fieldId ) : fieldId_( fieldId ), field_( nullptr ) {} void operator()( IBlock & block ) { @@ -349,7 +349,7 @@ template< typename VelocityField_T > class VelocityCallback<VelocityField_T, typename std::enable_if< std::is_same< typename VelocityField_T::value_type, Vector3<real_t> >::value >::type > { public: - VelocityCallback( const BlockDataID & fieldId ) : fieldId_( fieldId ), field_( NULL ) {} + VelocityCallback( const BlockDataID & fieldId ) : fieldId_( fieldId ), field_( nullptr ) {} void operator()( IBlock & block ) { @@ -377,7 +377,7 @@ class DensityCallback { public: - DensityCallback( const BlockDataID & fieldId ) : fieldId_( fieldId ), field_( NULL ) {} + DensityCallback( const BlockDataID & fieldId ) : fieldId_( fieldId ), field_( nullptr ) {} void operator()( IBlock & block ) { @@ -407,7 +407,7 @@ class DensityVelocityCallback public: DensityVelocityCallback( const BlockDataID & velocityFieldId, const BlockDataID & densityFieldId ) : - vId_( velocityFieldId ), dId_( densityFieldId ), vfield_( NULL ), dfield_( NULL ) {} + vId_( velocityFieldId ), dId_( densityFieldId ), vfield_( nullptr ), dfield_( nullptr ) {} void operator()( IBlock & block ) { @@ -715,7 +715,7 @@ private: //{ //public: // -// VelocityCallback( const BlockDataID & fieldId ) : fieldId_( fieldId ), field_( NULL ) {} +// VelocityCallback( const BlockDataID & fieldId ) : fieldId_( fieldId ), field_( nullptr ) {} // // void operator()( IBlock & block ) // { @@ -744,7 +744,7 @@ private: //{ //public: // -// DensityCallback( const BlockDataID & fieldId ) : fieldId_( fieldId ), field_( NULL ) {} +// DensityCallback( const BlockDataID & fieldId ) : fieldId_( fieldId ), field_( nullptr ) {} // // void operator()( IBlock & block ) // { @@ -774,7 +774,7 @@ private: //public: // // DensityVelocityCallback( const BlockDataID & velocityFieldId, const BlockDataID & densityFieldId ) : -// vId_( velocityFieldId ), dId_( densityFieldId ), vfield_( NULL ), dfield_( NULL ) {} +// vId_( velocityFieldId ), dId_( densityFieldId ), vfield_( nullptr ), dfield_( nullptr ) {} // // void operator()( IBlock & block ) // { diff --git a/src/lbm/lattice_model/ForceModel.h b/src/lbm/lattice_model/ForceModel.h index 527b5f5f395d8164b10cde47e6015e91424b72b4..aa1f35752554aadbdd7e1060129437b93b08f8c9 100644 --- a/src/lbm/lattice_model/ForceModel.h +++ b/src/lbm/lattice_model/ForceModel.h @@ -287,7 +287,7 @@ public: static const bool constant = false; EDMField( const BlockDataID & forceDensityFieldId ) : - forceDensityFieldId_( forceDensityFieldId ), forceDensityField_( NULL ) {} + forceDensityFieldId_( forceDensityFieldId ), forceDensityField_( nullptr ) {} void pack( mpi::SendBuffer & buffer ) const { buffer << forceDensityFieldId_; } void unpack( mpi::RecvBuffer & buffer ) { buffer >> forceDensityFieldId_; } @@ -414,7 +414,7 @@ public: static const bool constant = false; LuoField( const BlockDataID & forceDensityFieldId ) : - forceDensityFieldId_( forceDensityFieldId ), forceDensityField_( NULL ) {} + forceDensityFieldId_( forceDensityFieldId ), forceDensityField_( nullptr ) {} void pack( mpi::SendBuffer & buffer ) const { buffer << forceDensityFieldId_; } void unpack( mpi::RecvBuffer & buffer ) { buffer >> forceDensityFieldId_; } diff --git a/src/lbm/sweeps/ActiveCellSweep.h b/src/lbm/sweeps/ActiveCellSweep.h index 4874c36af4fc4c666aaef3f37610d8faeded25c6..91fa31bc563cb9a6360f61d92d3a708769f3c204 100644 --- a/src/lbm/sweeps/ActiveCellSweep.h +++ b/src/lbm/sweeps/ActiveCellSweep.h @@ -84,9 +84,9 @@ private: template< typename LatticeModel_T, typename FlagField_T, typename CellOperation > void ActiveCellSweep< LatticeModel_T, FlagField_T, CellOperation >::operator()( IBlock * const block ) { - PdfField_T * src( NULL ); - PdfField_T * dst( NULL ); - const FlagField_T * flagField( NULL ); + PdfField_T * src( nullptr ); + PdfField_T * dst( nullptr ); + const FlagField_T * flagField( nullptr ); auto lbm = this->getLbmMaskAndFields( block, src, dst, flagField ); diff --git a/src/lbm/sweeps/CellwiseSweep.h b/src/lbm/sweeps/CellwiseSweep.h index e35e32f64b630a998edff5829c7d2f961b707618..70f6bc89922867840a16b028ebc318b033e2bcf3 100644 --- a/src/lbm/sweeps/CellwiseSweep.h +++ b/src/lbm/sweeps/CellwiseSweep.h @@ -139,8 +139,8 @@ class CellwiseSweep void CellwiseSweep< LatticeModel_T, Filter_T, DensityVelocityIn_T, DensityVelocityOut_T, typename std::enable_if< specialization >::type \ >::stream( IBlock * const block, const uint_t numberOfGhostLayersToInclude ) \ { \ - PdfField_T * src( NULL ); \ - PdfField_T * dst( NULL ); \ + PdfField_T * src( nullptr ); \ + PdfField_T * dst( nullptr ); \ this->getFields( block, src, dst ); \ StreamPull< LatticeModel_T >::execute( src, dst, block, this->filter_, numberOfGhostLayersToInclude ); \ } @@ -152,8 +152,8 @@ class CellwiseSweep void CellwiseSweep< LatticeModel_T, Filter_T, DensityVelocityIn_T, DensityVelocityOut_T, typename std::enable_if< specialization >::type \ >::streamCollide( IBlock * const block, const uint_t numberOfGhostLayersToInclude ) \ { \ - PdfField_T * src( NULL ); \ - PdfField_T * dst( NULL ); \ + PdfField_T * src( nullptr ); \ + PdfField_T * dst( nullptr ); \ \ this->getFields( block, src, dst ); \ \ diff --git a/src/lbm/vtk/CurlMagnitude.h b/src/lbm/vtk/CurlMagnitude.h index 6f80fbbcc08b101301c75a4a5e335e489e0875e1..473fc87978c5757656918c9db1b39f6f3aa8d947 100644 --- a/src/lbm/vtk/CurlMagnitude.h +++ b/src/lbm/vtk/CurlMagnitude.h @@ -43,7 +43,7 @@ public: CurlMagnitudeVTKWriter(const shared_ptr<StructuredBlockStorage> blockStorage, Filter_T & filter, const ConstBlockDataID & velocityFieldId, const std::string & id, const real_t lengthScaleWeight = real_t(-1)) : vtk::BlockCellDataWriter< OutputType, 1 >(id), blockStorage_(blockStorage), filter_(filter), - velocityFieldId_(velocityFieldId), velocityField_(NULL), lengthScaleWeight_(lengthScaleWeight) {} + velocityFieldId_(velocityFieldId), velocityField_(nullptr), lengthScaleWeight_(lengthScaleWeight) {} protected: diff --git a/src/lbm/vtk/Density.h b/src/lbm/vtk/Density.h index f40bc63599f003a7a13cb2303d256651b336d6dd..ba5b65d35bcbbe3689012d9c229d642853285e52 100644 --- a/src/lbm/vtk/Density.h +++ b/src/lbm/vtk/Density.h @@ -66,7 +66,7 @@ public: using PdfField_T = PdfField<LatticeModel_T>; DensitySIVTKWriter( const ConstBlockDataID & pdf, const real_t rho_SI, const std::string & id ) : - vtk::BlockCellDataWriter< OutputType >( id ), bdid_( pdf ), pdf_( NULL ), rho_SI_( rho_SI ) {} + vtk::BlockCellDataWriter< OutputType >( id ), bdid_( pdf ), pdf_( nullptr ), rho_SI_( rho_SI ) {} protected: diff --git a/src/lbm/vtk/PressureTensor.h b/src/lbm/vtk/PressureTensor.h index 60c3afe53ce06253e5d689f489f0ddf9d119b2c7..0f43e04dafec65e6dc77d4b070061ea7b2d6e015 100644 --- a/src/lbm/vtk/PressureTensor.h +++ b/src/lbm/vtk/PressureTensor.h @@ -39,7 +39,7 @@ public: using PdfField_T = PdfField<LatticeModel_T>; PressureTensorVTKWriter( const ConstBlockDataID & pdfFieldId, const std::string & id ) : - vtk::BlockCellDataWriter< OutputType, 9 >( id ), bdid_( pdfFieldId ), pdf_( NULL ) {} + vtk::BlockCellDataWriter< OutputType, 9 >( id ), bdid_( pdfFieldId ), pdf_( nullptr ) {} protected: diff --git a/src/lbm/vtk/Velocity.h b/src/lbm/vtk/Velocity.h index 8a31c07d2ec5cb4c73f354e2d27daf11b0ceb9ad..f208158bc3e516078cad28b6cdf1aa79053571a8 100644 --- a/src/lbm/vtk/Velocity.h +++ b/src/lbm/vtk/Velocity.h @@ -93,7 +93,7 @@ public: using PdfField_T = PdfField<LatticeModel_T>; VelocitySIVTKWriter( const ConstBlockDataID & pdfFieldId, const real_t dx_SI, const real_t dt_SI, const std::string & id ) : - vtk::BlockCellDataWriter< OutputType, 3 >( id ), bdid_( pdfFieldId ), pdf_( NULL ), dxDividedByDt_SI_( dx_SI / dt_SI ) {} + vtk::BlockCellDataWriter< OutputType, 3 >( id ), bdid_( pdfFieldId ), pdf_( nullptr ), dxDividedByDt_SI_( dx_SI / dt_SI ) {} protected: @@ -121,7 +121,7 @@ public: using PdfField_T = PdfField<LatticeModel_T>; VelocitySIMagnitudeVTKWriter( const ConstBlockDataID & pdfFieldId, const real_t dx_SI, const real_t dt_SI, const std::string & id ) : - vtk::BlockCellDataWriter< OutputType, 1 >( id ), bdid_( pdfFieldId ), pdf_( NULL ), dxDividedByDt_SI_( dx_SI / dt_SI ) {} + vtk::BlockCellDataWriter< OutputType, 1 >( id ), bdid_( pdfFieldId ), pdf_( nullptr ), dxDividedByDt_SI_( dx_SI / dt_SI ) {} protected: diff --git a/src/lbm/vtk/Vorticity.h b/src/lbm/vtk/Vorticity.h index 1119846c7df0e3ca46ed8e0f4c431a20a51fde1a..13ac64540c3d9de68a3778e673803e7f7f08874a 100644 --- a/src/lbm/vtk/Vorticity.h +++ b/src/lbm/vtk/Vorticity.h @@ -40,7 +40,7 @@ public: const ConstBlockDataID & velocityFieldId, const uint_t componentIdx, const std::string & id, const real_t normalizationConstant = real_t(1)) : vtk::BlockCellDataWriter< OutputType, 1 >(id), blockStorage_(blockStorage), filter_(filter), - velocityFieldId_(velocityFieldId), componentIdx_(componentIdx), velocityField_(NULL), + velocityFieldId_(velocityFieldId), componentIdx_(componentIdx), velocityField_(nullptr), normalizationConstant_(normalizationConstant) { WALBERLA_ASSERT(componentIdx < uint_t(3), "The vorticity vector only has three components, i.e. the highest possible component index is 2."); diff --git a/src/mesh_common/distance_octree/BranchNode.h b/src/mesh_common/distance_octree/BranchNode.h index cf2c2b1920504e7823bc33e5728a3dd087e51f9d..e86821474996699332ee993b40f79cd3b8286261 100644 --- a/src/mesh_common/distance_octree/BranchNode.h +++ b/src/mesh_common/distance_octree/BranchNode.h @@ -122,7 +122,7 @@ BranchNode<MeshType>::BranchNode( const shared_ptr< TriangleDistance<MeshType> > : Node<MeshType>( triDistance->getMesh(), beginFh, endFh ) { for( int i = 0; i < 8; ++i ) - children_[i] = NULL; + children_[i] = nullptr; const auto & min = this->aabb_.minCorner(); const auto & max = this->aabb_.maxCorner(); diff --git a/src/vtk/VTKOutput.cpp b/src/vtk/VTKOutput.cpp index 42d7d9ef434b92b720a95115ed6dbbdd638905e2..eb66d3970ba811ea258c44fd67a081a814fe2109 100644 --- a/src/vtk/VTKOutput.cpp +++ b/src/vtk/VTKOutput.cpp @@ -1784,8 +1784,8 @@ void VTKOutput::writeCollectors( const bool barrier ) } else { - writePVTU( *collector ); // also applies for outputDomainDecomposition_ == true and pointDataSource_ != NULL - // and polylineDataSource_ != NULL (uniformGrid_ will be false) + writePVTU( *collector ); // also applies for outputDomainDecomposition_ == true and pointDataSource_ != nullptr + // and polylineDataSource_ != nullptr (uniformGrid_ will be false) } }