diff --git a/rtengine/EdgePreservingDecomposition.cc b/rtengine/EdgePreservingDecomposition.cc index c80d5e092..7bc292c3f 100644 --- a/rtengine/EdgePreservingDecomposition.cc +++ b/rtengine/EdgePreservingDecomposition.cc @@ -552,7 +552,7 @@ bool MultiDiagonalSymmetricMatrix::CreateIncompleteCholeskyFactorization(int Max return true; } -void MultiDiagonalSymmetricMatrix::KillIncompleteCholeskyFactorization(void) +void MultiDiagonalSymmetricMatrix::KillIncompleteCholeskyFactorization() { delete IncompleteCholeskyFactorization; } diff --git a/rtengine/array2D.h b/rtengine/array2D.h index 2d38d2e15..2fe4ecad4 100644 --- a/rtengine/array2D.h +++ b/rtengine/array2D.h @@ -83,19 +83,19 @@ private: { if ((ptr) && ((h > y) || (4 * h < y))) { delete[] ptr; - ptr = NULL; + ptr = nullptr; } if ((data) && (((h * w) > (x * y)) || ((h * w) < ((x * y) / 4)))) { delete[] data; - data = NULL; + data = nullptr; } - if (ptr == NULL) { + if (ptr == nullptr) { ptr = new T*[h]; } - if (data == NULL) { + if (data == nullptr) { data = new T[h * w + offset]; } @@ -113,7 +113,7 @@ public: // use as empty declaration, resize before use! // very useful as a member object array2D() : - x(0), y(0), owner(0), ptr(NULL), data(NULL), lock(0), flags(0) + x(0), y(0), owner(0), ptr(nullptr), data(nullptr), lock(0), flags(0) { //printf("got empty array2D init\n"); } @@ -151,7 +151,7 @@ public: if (owner) { data = new T[h * w]; } else { - data = NULL; + data = nullptr; } x = w; @@ -192,12 +192,12 @@ public: { if ((owner) && (data)) { delete[] data; - data = NULL; + data = nullptr; } if (ptr) { delete [] ptr; - ptr = NULL; + ptr = nullptr; } } diff --git a/rtengine/cplx_wavelet_dec.h b/rtengine/cplx_wavelet_dec.h index 40639e7ea..45e829322 100644 --- a/rtengine/cplx_wavelet_dec.h +++ b/rtengine/cplx_wavelet_dec.h @@ -155,17 +155,17 @@ wavelet_decomposition::wavelet_decomposition(E * src, int width, int height, int E *buffer[2]; buffer[0] = new (std::nothrow) E[(m_w / 2 + 1) * (m_h / 2 + 1)]; - if(buffer[0] == NULL) { + if(buffer[0] == nullptr) { memoryAllocationFailed = true; return; } buffer[1] = new (std::nothrow) E[(m_w / 2 + 1) * (m_h / 2 + 1)]; - if(buffer[1] == NULL) { + if(buffer[1] == nullptr) { memoryAllocationFailed = true; delete[] buffer[0]; - buffer[0] = NULL; + buffer[0] = nullptr; return; } @@ -210,7 +210,7 @@ void wavelet_decomposition::reconstruct(E * dst, const float blend) E *tmpHi = new (std::nothrow) E[width * height]; - if(tmpHi == NULL) { + if(tmpHi == nullptr) { memoryAllocationFailed = true; return; } @@ -234,7 +234,7 @@ void wavelet_decomposition::reconstruct(E * dst, const float blend) } else { // allocate new block of memory tmpLo = new (std::nothrow) E[width * height]; - if(tmpLo == NULL) { + if(tmpLo == nullptr) { memoryAllocationFailed = true; return; } @@ -242,7 +242,7 @@ void wavelet_decomposition::reconstruct(E * dst, const float blend) E *tmpHi = new (std::nothrow) E[width * height]; - if(tmpHi == NULL) { + if(tmpHi == nullptr) { memoryAllocationFailed = true; if(!wavelet_decomp[0]->bigBlockOfMemoryUsed()) { diff --git a/rtengine/cplx_wavelet_level.h b/rtengine/cplx_wavelet_level.h index 5c13158b8..59c206f27 100644 --- a/rtengine/cplx_wavelet_level.h +++ b/rtengine/cplx_wavelet_level.h @@ -84,7 +84,7 @@ public: template wavelet_level(E * src, E * dst, int level, int subsamp, int w, int h, float *filterV, float *filterH, int len, int offset, int skipcrop, int numThreads) - : lvl(level), subsamp_out((subsamp >> level) & 1), numThreads(numThreads), skip(1 << level), bigBlockOfMemory(true), memoryAllocationFailed(false), wavcoeffs(NULL), m_w(w), m_h(h), m_w2(w), m_h2(h) + : lvl(level), subsamp_out((subsamp >> level) & 1), numThreads(numThreads), skip(1 << level), bigBlockOfMemory(true), memoryAllocationFailed(false), wavcoeffs(nullptr), m_w(w), m_h(h), m_w2(w), m_h2(h) { if (subsamp) { skip = 1; @@ -159,7 +159,7 @@ T ** wavelet_level::create(int n) { T * data = new (std::nothrow) T[3 * n]; - if(data == NULL) { + if(data == nullptr) { bigBlockOfMemory = false; } @@ -171,7 +171,7 @@ T ** wavelet_level::create(int n) } else { subbands[j] = new (std::nothrow) T[n]; - if(subbands[j] == NULL) { + if(subbands[j] == nullptr) { printf("Couldn't allocate memory in level %d of wavelet\n", lvl); memoryAllocationFailed = true; } diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index 54fc09622..169be3c3e 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -947,7 +947,7 @@ void CLASS lossless_jpeg_load_raw() void CLASS canon_sraw_load_raw() { struct jhead jh; - short *rp=0, (*ip)[4]; + short *rp=nullptr, (*ip)[4]; int jwide, slice, scol, ecol, row, col, jrow=0, jcol=0, pix[3], c; int v[3]={0,0,0}, ver, hue; char *cp; @@ -2152,7 +2152,7 @@ void CLASS hasselblad_load_raw() void CLASS leaf_hdr_load_raw() { - ushort *pixel=0; + ushort *pixel=nullptr; unsigned tile=0, r, c, row, col; if (!filters) { @@ -3555,7 +3555,7 @@ const char * CLASS foveon_camf_param (const char *block, const char *param) return dp+sget4(cp+4); } } - return 0; + return nullptr; } void * CLASS foveon_camf_matrix (unsigned dim[3], const char *name) @@ -3589,7 +3589,7 @@ void * CLASS foveon_camf_matrix (unsigned dim[3], const char *name) return mat; } fprintf (stderr,_("%s: \"%s\" matrix not found!\n"), ifname, name); - return 0; + return nullptr; } int CLASS foveon_fixed (void *ptr, int size, const char *name) @@ -4512,7 +4512,7 @@ void CLASS scale_colors() int val, dark, sat; double dsum[8], dmin, dmax; float scale_mul[4], fr, fc; - ushort *img=0, *pix; + ushort *img=nullptr, *pix; if (user_mul[0]) memcpy (pre_mul, user_mul, sizeof pre_mul); @@ -7012,7 +7012,7 @@ void CLASS parse_foveon() case 5: load_flags = 1; case 6: load_raw = &CLASS foveon_sd_load_raw; break; case 30: load_raw = &CLASS foveon_dp_load_raw; break; - default: load_raw = 0; + default: load_raw = nullptr; } raw_width = wide; raw_height = high; @@ -8493,7 +8493,7 @@ void CLASS identify() memset (white, 0, sizeof white); memset (mask, 0, sizeof mask); thumb_offset = thumb_length = thumb_width = thumb_height = 0; - load_raw = thumb_load_raw = 0; + load_raw = thumb_load_raw = nullptr; write_thumb = &CLASS jpeg_thumb; data_offset = meta_offset = meta_length = tiff_bps = tiff_compress = 0; kodak_cbpp = zero_after_ff = dng_version = load_flags = 0; @@ -8755,7 +8755,7 @@ void CLASS identify() case 7: load_raw = &CLASS lossless_dng_load_raw; break; case 8: load_raw = &CLASS deflate_dng_load_raw; break; case 34892: load_raw = &CLASS lossy_dng_load_raw; break; - default: load_raw = 0; + default: load_raw = nullptr; } goto dng_skip; } diff --git a/rtengine/dcraw.h b/rtengine/dcraw.h index 9d15a5826..0a68b02cc 100644 --- a/rtengine/dcraw.h +++ b/rtengine/dcraw.h @@ -43,13 +43,13 @@ public: :exif_base(-1) ,ciff_base(-1) ,ciff_len(0) - ,ifp(NULL),ofp(NULL) + ,ifp(nullptr),ofp(nullptr) ,order(0x4949) - ,ifname(NULL) - ,meta_data(NULL) + ,ifname(nullptr) + ,meta_data(nullptr) ,shot_select(0),multi_out(0) - ,float_raw_image(NULL) - ,image(NULL) + ,float_raw_image(nullptr) + ,image(nullptr) ,bright(1.) ,half_size(0),four_color_rgb(0),document_mode(0),highlight(0) ,verbose(0) diff --git a/rtengine/dfmanager.cc b/rtengine/dfmanager.cc index e0dea012b..ab76ff854 100644 --- a/rtengine/dfmanager.cc +++ b/rtengine/dfmanager.cc @@ -46,7 +46,7 @@ inline dfInfo& dfInfo::operator =(const dfInfo &o) if( ri ) { delete ri; - ri = NULL; + ri = nullptr; } } @@ -140,7 +140,7 @@ void dfInfo::updateRawImage() if( ri->loadRaw(true)) { delete ri; - ri = NULL; + ri = nullptr; } else { int H = ri->get_height(); int W = ri->get_width(); @@ -202,7 +202,7 @@ void dfInfo::updateRawImage() if( ri->loadRaw(true)) { delete ri; - ri = NULL; + ri = nullptr; } else { ri->compress_image(); } @@ -334,11 +334,11 @@ dfInfo* DFManager::addFileInfo (const Glib::ustring& filename, bool pool) auto file = Gio::File::create_for_path (filename); if (!file) { - return 0; + return nullptr; } if (!file->query_exists ()) { - return 0; + return nullptr; } try { @@ -346,11 +346,11 @@ dfInfo* DFManager::addFileInfo (const Glib::ustring& filename, bool pool) auto info = file->query_info (); if (!info && info->get_file_type () == Gio::FILE_TYPE_DIRECTORY) { - return 0; + return nullptr; } if (!options.fbShowHidden && info->is_hidden ()) { - return 0; + return nullptr; } Glib::ustring ext; @@ -361,14 +361,14 @@ dfInfo* DFManager::addFileInfo (const Glib::ustring& filename, bool pool) } if (!options.is_extention_enabled (ext)) { - return 0; + return nullptr; } RawImage ri (filename); int res = ri.loadRaw (false); // Read informations about shot if (res != 0) { - return 0; + return nullptr; } dfList_t::iterator iter; @@ -408,7 +408,7 @@ dfInfo* DFManager::addFileInfo (const Glib::ustring& filename, bool pool) } catch(Gio::Error&) {} - return 0; + return nullptr; } void DFManager::getStat( int &totFiles, int &totTemplates) @@ -435,7 +435,7 @@ void DFManager::getStat( int &totFiles, int &totTemplates) dfInfo* DFManager::find( const std::string &mak, const std::string &mod, int isospeed, double shut, time_t t ) { if( dfList.empty() ) { - return 0; + return nullptr; } std::string key( dfInfo::key(mak, mod, isospeed, shut) ); @@ -469,7 +469,7 @@ dfInfo* DFManager::find( const std::string &mak, const std::string &mod, int iso } } - return bestD != INFINITY ? &(bestMatch->second) : 0 ; + return bestD != INFINITY ? &(bestMatch->second) : nullptr ; } } @@ -480,7 +480,7 @@ RawImage* DFManager::searchDarkFrame( const std::string &mak, const std::string if( df ) { return df->getRawImage(); } else { - return 0; + return nullptr; } } @@ -498,7 +498,7 @@ RawImage* DFManager::searchDarkFrame( const Glib::ustring filename ) return df->getRawImage(); } - return 0; + return nullptr; } std::vector *DFManager::getHotPixels ( const Glib::ustring filename ) { @@ -508,7 +508,7 @@ std::vector *DFManager::getHotPixels ( const Glib::ustring filename ) } } - return 0; + return nullptr; } std::vector *DFManager::getHotPixels ( const std::string &mak, const std::string &mod, int iso, double shut, time_t t ) { @@ -527,7 +527,7 @@ std::vector *DFManager::getHotPixels ( const std::string &mak, const std return &df->getHotPixels(); } else { - return 0; + return nullptr; } } @@ -626,7 +626,7 @@ std::vector *DFManager::getBadPixels ( const std::string &mak, const std } if(!found) { - return 0; + return nullptr; } else { return &(iter->second); } diff --git a/rtengine/ffmanager.cc b/rtengine/ffmanager.cc index 29121a696..069bbf563 100644 --- a/rtengine/ffmanager.cc +++ b/rtengine/ffmanager.cc @@ -42,7 +42,7 @@ inline ffInfo& ffInfo::operator =(const ffInfo &o) if( ri ) { delete ri; - ri = NULL; + ri = nullptr; } } @@ -133,7 +133,7 @@ void ffInfo::updateRawImage() if( ri->loadRaw(true)) { delete ri; - ri = NULL; + ri = nullptr; } else { int H = ri->get_height(); int W = ri->get_width(); @@ -195,7 +195,7 @@ void ffInfo::updateRawImage() if( ri->loadRaw(true)) { delete ri; - ri = NULL; + ri = nullptr; } else { ri->compress_image(); } @@ -293,11 +293,11 @@ ffInfo* FFManager::addFileInfo (const Glib::ustring& filename, bool pool) auto file = Gio::File::create_for_path (filename); if (!file ) { - return 0; + return nullptr; } if (!file->query_exists ()) { - return 0; + return nullptr; } try { @@ -305,11 +305,11 @@ ffInfo* FFManager::addFileInfo (const Glib::ustring& filename, bool pool) auto info = file->query_info (); if (!info || info->get_file_type () == Gio::FILE_TYPE_DIRECTORY) { - return 0; + return nullptr; } if (!options.fbShowHidden && info->is_hidden ()) { - return 0; + return nullptr; } Glib::ustring ext; @@ -321,7 +321,7 @@ ffInfo* FFManager::addFileInfo (const Glib::ustring& filename, bool pool) } if (!options.is_extention_enabled (ext)) { - return 0; + return nullptr; } @@ -329,7 +329,7 @@ ffInfo* FFManager::addFileInfo (const Glib::ustring& filename, bool pool) int res = ri.loadRaw (false); // Read informations about shot if (res != 0) { - return 0; + return nullptr; } ffList_t::iterator iter; @@ -369,7 +369,7 @@ ffInfo* FFManager::addFileInfo (const Glib::ustring& filename, bool pool) } catch (Gio::Error&) {} - return 0; + return nullptr; } void FFManager::getStat( int &totFiles, int &totTemplates) @@ -396,7 +396,7 @@ void FFManager::getStat( int &totFiles, int &totTemplates) ffInfo* FFManager::find( const std::string &mak, const std::string &mod, const std::string &len, double focal, double apert, time_t t ) { if( ffList.empty() ) { - return 0; + return nullptr; } std::string key( ffInfo::key(mak, mod, len, focal, apert) ); @@ -430,7 +430,7 @@ ffInfo* FFManager::find( const std::string &mak, const std::string &mod, const s } } - return bestD != INFINITY ? &(bestMatch->second) : 0 ; + return bestD != INFINITY ? &(bestMatch->second) : nullptr ; } } @@ -441,7 +441,7 @@ RawImage* FFManager::searchFlatField( const std::string &mak, const std::string if( ff ) { return ff->getRawImage(); } else { - return 0; + return nullptr; } } @@ -459,7 +459,7 @@ RawImage* FFManager::searchFlatField( const Glib::ustring filename ) return ff->getRawImage(); } - return 0; + return nullptr; } diff --git a/rtengine/iccstore.cc b/rtengine/iccstore.cc index 7b52a7a53..3cb9b4a71 100644 --- a/rtengine/iccstore.cc +++ b/rtengine/iccstore.cc @@ -207,7 +207,7 @@ cmsHPROFILE ICCStore::makeStdGammaProfile (cmsHPROFILE iprof) } cmsUInt32Number bytesNeeded = 0; - cmsSaveProfileToMem(iprof, 0, &bytesNeeded); + cmsSaveProfileToMem(iprof, nullptr, &bytesNeeded); if (bytesNeeded == 0) { return nullptr; @@ -522,7 +522,7 @@ cmsHPROFILE ICCStore::createGammaProfile (const procparams::ColorManagementParam //lcmsMutex->lock (); Mutex acquired by the caller cmsWhitePointFromTemp(&xyD, (double)temp); - GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildParametricToneCurve(NULL, 5, Parameters); //5 = smoother than 4 + GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildParametricToneCurve(nullptr, 5, Parameters); //5 = smoother than 4 cmsHPROFILE oprofdef = cmsCreateRGBProfile(&xyD, &Primaries, GammaTRC); //oprofdef become Outputprofile cmsFreeToneCurve(GammaTRC[0]); //lcmsMutex->unlock (); @@ -859,7 +859,7 @@ ProfileContent::ProfileContent (cmsHPROFILE hProfile) : data(nullptr), length(0) if (hProfile != nullptr) { cmsUInt32Number bytesNeeded = 0; - cmsSaveProfileToMem(hProfile, 0, &bytesNeeded); + cmsSaveProfileToMem(hProfile, nullptr, &bytesNeeded); if (bytesNeeded > 0) { data = new char[bytesNeeded + 1]; diff --git a/rtengine/iimage.h b/rtengine/iimage.h index 70f07d68f..7e88e407f 100644 --- a/rtengine/iimage.h +++ b/rtengine/iimage.h @@ -592,7 +592,7 @@ public: PlanarPtr g; PlanarPtr b; - PlanarRGBData() : rowstride(0), planestride(0), data (NULL) {} + PlanarRGBData() : rowstride(0), planestride(0), data (nullptr) {} PlanarRGBData(int w, int h) : rowstride(0), planestride(0), data (nullptr) { allocate(w, h); @@ -711,7 +711,7 @@ public: /** Copy the data to another PlanarRGBData */ void copyData(PlanarRGBData *dest) { - assert (dest != NULL); + assert (dest != nullptr); // Make sure that the size is the same, reallocate if necessary dest->allocate(width, height); @@ -1231,7 +1231,7 @@ public: ChunkyPtr g; ChunkyPtr b; - ChunkyRGBData() : data (NULL) {} + ChunkyRGBData() : data (nullptr) {} ChunkyRGBData(int w, int h) : data (nullptr) { allocate(w, h); diff --git a/rtengine/imageio.cc b/rtengine/imageio.cc index 48d9d81b6..f869a0f3e 100644 --- a/rtengine/imageio.cc +++ b/rtengine/imageio.cc @@ -52,7 +52,7 @@ namespace // Opens a file for binary writing and request exclusive lock (cases were you need "wb" mode plus locking) FILE* g_fopen_withBinaryAndLock(const Glib::ustring& fname) { - FILE* f = NULL; + FILE* f = nullptr; #ifdef WIN32 @@ -91,13 +91,13 @@ Glib::ustring ImageIO::errorMsg[6] = {"Success", "Cannot read file.", "Invalid h // For only copying the raw input data void ImageIO::setMetadata (const rtexif::TagDirectory* eroot) { - if (exifRoot != NULL) { + if (exifRoot != nullptr) { delete exifRoot; - exifRoot = NULL; + exifRoot = nullptr; } if (eroot) { - rtexif::TagDirectory* td = ((rtexif::TagDirectory*)eroot)->clone (NULL); + rtexif::TagDirectory* td = ((rtexif::TagDirectory*)eroot)->clone (nullptr); // make IPTC and XMP pass through td->keepTag(0x83bb); // IPTC @@ -115,18 +115,18 @@ void ImageIO::setMetadata (const rtexif::TagDirectory* eroot, const rtengine::pr exifChange.clear(); exifChange = exif; - if (exifRoot != NULL) { + if (exifRoot != nullptr) { delete exifRoot; - exifRoot = NULL; + exifRoot = nullptr; } if (eroot) { - exifRoot = ((rtexif::TagDirectory*)eroot)->clone (NULL); + exifRoot = ((rtexif::TagDirectory*)eroot)->clone (nullptr); } - if (iptc != NULL) { + if (iptc != nullptr) { iptc_data_free (iptc); - iptc = NULL; + iptc = nullptr; } // build iptc structures for libiptcdata @@ -184,7 +184,7 @@ void ImageIO::setOutputProfile (char* pdata, int plen) profileData = new char [plen]; memcpy (profileData, pdata, plen); } else { - profileData = NULL; + profileData = nullptr; } profileLength = plen; @@ -224,7 +224,7 @@ int ImageIO::getPNGSampleFormat (Glib::ustring fname, IIOSampleFormat &sFormat, } //initializing main structures - png_structp png = png_create_read_struct (PNG_LIBPNG_VER_STRING, 0, 0, 0); + png_structp png = png_create_read_struct (PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); if (!png) { fclose (file); @@ -303,7 +303,7 @@ int ImageIO::loadPNG (Glib::ustring fname) } //initializing main structures - png_structp png = png_create_read_struct (PNG_LIBPNG_VER_STRING, 0, 0, 0); + png_structp png = png_create_read_struct (PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); if (!png) { fclose (file); @@ -331,7 +331,7 @@ int ImageIO::loadPNG (Glib::ustring fname) png_read_info(png, info); - embProfile = NULL; + embProfile = nullptr; //retrieving image information png_uint_32 width, height; @@ -388,7 +388,7 @@ int ImageIO::loadPNG (Glib::ustring fname) for (unsigned int i = 0; i < height; i++) { - png_read_row (png, (png_byte*)row, NULL); + png_read_row (png, (png_byte*)row, nullptr); if (bit_depth == 16) { // convert scanline to host byte order unsigned short* srow = (unsigned short*)row; @@ -405,7 +405,7 @@ int ImageIO::loadPNG (Glib::ustring fname) } } - png_read_end (png, 0); + png_read_end (png, nullptr); png_destroy_read_struct (&png, &info, &end_info); delete [] row; @@ -489,7 +489,7 @@ int ImageIO::loadJPEGFromMemory (const char* buffer, int bufsize) if (hasprofile) { embProfile = cmsOpenProfileFromMem (loadedProfileData, loadedProfileLength); } else { - embProfile = NULL; + embProfile = nullptr; } jpeg_start_decompress(&cinfo); @@ -568,7 +568,7 @@ int ImageIO::loadJPEG (Glib::ustring fname) if (hasprofile) { embProfile = cmsOpenProfileFromMem (loadedProfileData, loadedProfileLength); } else { - embProfile = NULL; + embProfile = nullptr; } jpeg_start_decompress(&cinfo); @@ -623,7 +623,7 @@ int ImageIO::getTIFFSampleFormat (Glib::ustring fname, IIOSampleFormat &sFormat, TIFF* in = TIFFOpen(fname.c_str(), "r"); #endif - if (in == NULL) { + if (in == nullptr) { return IMIO_CANNOTREADFILE; } @@ -732,7 +732,7 @@ int ImageIO::loadTIFF (Glib::ustring fname) TIFF* in = TIFFOpen(fname.c_str(), "r"); #endif - if (in == NULL) { + if (in == nullptr) { return IMIO_CANNOTREADFILE; } @@ -814,7 +814,7 @@ int ImageIO::loadTIFF (Glib::ustring fname) loadedProfileData = new char [loadedProfileLength]; memcpy (loadedProfileData, profdata, loadedProfileLength); } else { - embProfile = NULL; + embProfile = nullptr; } allocate (width, height); @@ -837,7 +837,7 @@ int ImageIO::loadTIFF (Glib::ustring fname) if (sampleFormat & (IIOSF_LOGLUV24 | IIOSF_LOGLUV32 | IIOSF_FLOAT)) { setScanline (row, linebuffer, bitspersample, minValue, maxValue); } else { - setScanline (row, linebuffer, bitspersample, NULL, NULL); + setScanline (row, linebuffer, bitspersample, nullptr, nullptr); } if (pl && !(row % 100)) { @@ -908,7 +908,7 @@ int ImageIO::savePNG (Glib::ustring fname, int compression, volatile int bps) pl->setProgress (0.0); } - png_structp png = png_create_write_struct (PNG_LIBPNG_VER_STRING, 0, 0, 0); + png_structp png = png_create_write_struct (PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); if (!png) { fclose (file); @@ -918,7 +918,7 @@ int ImageIO::savePNG (Glib::ustring fname, int compression, volatile int bps) png_infop info = png_create_info_struct(png); if (!info) { - png_destroy_write_struct (&png, 0); + png_destroy_write_struct (&png, nullptr); fclose (file); return IMIO_HEADERERROR; } @@ -1101,7 +1101,7 @@ int ImageIO::saveJPEG (Glib::ustring fname, int quality, int subSamp) int bytes = 0; - if (!error && (bytes = iptc_jpeg_ps3_save_iptc (NULL, 0, iptcdata, size, buffer, 65532)) < 0) { + if (!error && (bytes = iptc_jpeg_ps3_save_iptc (nullptr, 0, iptcdata, size, buffer, 65532)) < 0) { if (iptcdata) { iptc_data_free_buf (iptc, iptcdata); } @@ -1307,23 +1307,23 @@ int ImageIO::saveTIFF (Glib::ustring fname, int bps, bool uncompressed) //TODO Even though we are saving EXIF IFD - MakerNote still comes out screwed. - if ((tag = exifRoot->getTag (TIFFTAG_MODEL)) != NULL) { + if ((tag = exifRoot->getTag (TIFFTAG_MODEL)) != nullptr) { TIFFSetField (out, TIFFTAG_MODEL, tag->getValue()); } - if ((tag = exifRoot->getTag (TIFFTAG_MAKE)) != NULL) { + if ((tag = exifRoot->getTag (TIFFTAG_MAKE)) != nullptr) { TIFFSetField (out, TIFFTAG_MAKE, tag->getValue()); } - if ((tag = exifRoot->getTag (TIFFTAG_DATETIME)) != NULL) { + if ((tag = exifRoot->getTag (TIFFTAG_DATETIME)) != nullptr) { TIFFSetField (out, TIFFTAG_DATETIME, tag->getValue()); } - if ((tag = exifRoot->getTag (TIFFTAG_ARTIST)) != NULL) { + if ((tag = exifRoot->getTag (TIFFTAG_ARTIST)) != nullptr) { TIFFSetField (out, TIFFTAG_ARTIST, tag->getValue()); } - if ((tag = exifRoot->getTag (TIFFTAG_COPYRIGHT)) != NULL) { + if ((tag = exifRoot->getTag (TIFFTAG_COPYRIGHT)) != nullptr) { TIFFSetField (out, TIFFTAG_COPYRIGHT, tag->getValue()); } @@ -1420,7 +1420,7 @@ void png_flush(png_structp png_ptr) FILE *io_ptr; io_ptr = (FILE *)(png_get_io_ptr(png_ptr)); - if (io_ptr != NULL) { + if (io_ptr != nullptr) { fflush(io_ptr); } } diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 2b65e17e4..b3f5afee8 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -33,8 +33,8 @@ namespace rtengine extern const Settings* settings; ImProcCoordinator::ImProcCoordinator () - : orig_prev(NULL), oprevi(NULL), oprevl(NULL), nprevl(NULL), previmg(NULL), workimg(NULL), - ncie(NULL), imgsrc(NULL), shmap(NULL), lastAwbEqual(0.), ipf(¶ms, true), monitorIntent(RI_RELATIVE), + : orig_prev(nullptr), oprevi(nullptr), oprevl(nullptr), nprevl(nullptr), previmg(nullptr), workimg(nullptr), + ncie(nullptr), imgsrc(nullptr), shmap(nullptr), lastAwbEqual(0.), ipf(¶ms, true), monitorIntent(RI_RELATIVE), softProof(false), gamutCheck(false), scale(10), highDetailPreprocessComputed(false), highDetailRawComputed(false), allocated(false), bwAutoR(-9000.f), bwAutoG(-9000.f), bwAutoB(-9000.f), CAMMean(NAN), @@ -87,7 +87,7 @@ ImProcCoordinator::ImProcCoordinator () fw(0), fh(0), tr(0), fullw(1), fullh(1), pW(-1), pH(-1), - plistener(NULL), imageListener(NULL), aeListener(NULL), acListener(NULL), abwListener(NULL), actListener(NULL), adnListener(NULL), awavListener(NULL), dehaListener(NULL), hListener(NULL), + plistener(nullptr), imageListener(nullptr), aeListener(nullptr), acListener(nullptr), abwListener(nullptr), actListener(nullptr), adnListener(nullptr), awavListener(nullptr), dehaListener(nullptr), hListener(nullptr), resultValid(false), lastOutputProfile("BADFOOD"), lastOutputIntent(RI__COUNT), lastOutputBPC(false), thread(nullptr), changeSinceLast(0), updaterRunning(false), destroying(false), utili(false), autili(false), wavcontlutili(false), butili(false), ccutili(false), cclutili(false), clcutili(false), opautili(false), conversionBuffer(1, 1), colourToningSatLimit(0.f), colourToningSatLimitOpacity(0.f) {} @@ -536,7 +536,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) DCPProfile::ApplyState as; DCPProfile *dcpProf = imgsrc->getDCP(params.icm, currWB, as); - ipf.rgbProc (oprevi, oprevl, NULL, hltonecurve, shtonecurve, tonecurve, shmap, params.toneCurve.saturation, + ipf.rgbProc (oprevi, oprevl, nullptr, hltonecurve, shtonecurve, tonecurve, shmap, params.toneCurve.saturation, rCurve, gCurve, bCurve, colourToningSatLimit , colourToningSatLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, beforeToneCurveBW, afterToneCurveBW, rrm, ggm, bbm, bwAutoR, bwAutoG, bwAutoB, params.toneCurve.expcomp, params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh, dcpProf, as); if(params.blackwhite.enabled && params.blackwhite.autoc && abwListener) { @@ -608,7 +608,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) // ipf.MSR(nprevl, nprevl->W, nprevl->H, 1); histCCurve.clear(); histLCurve.clear(); - ipf.chromiLuminanceCurve (NULL, pW, nprevl, nprevl, chroma_acurve, chroma_bcurve, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, histCCurve, histLCurve); + ipf.chromiLuminanceCurve (nullptr, pW, nprevl, nprevl, chroma_acurve, chroma_bcurve, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, histCCurve, histLCurve); ipf.vibrance(nprevl); if((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) { @@ -762,7 +762,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) delete ncie; } - ncie = NULL; + ncie = nullptr; if (CAMBrightCurveJ) { CAMBrightCurveJ.reset(); @@ -841,19 +841,19 @@ void ImProcCoordinator::freeAll () delete oprevi; } - oprevi = NULL; + oprevi = nullptr; delete orig_prev; - orig_prev = NULL; + orig_prev = nullptr; delete oprevl; - oprevl = NULL; + oprevl = nullptr; delete nprevl; - nprevl = NULL; + nprevl = nullptr; if (ncie) { delete ncie; } - ncie = NULL; + ncie = nullptr; if (imageListener) { imageListener->delImage (previmg); @@ -867,7 +867,7 @@ void ImProcCoordinator::freeAll () delete shmap; } - shmap = NULL; + shmap = nullptr; } @@ -1086,7 +1086,7 @@ void ImProcCoordinator::getAutoCrop (double ratio, int &x, int &y, int &w, int & MyMutex::MyLock lock(mProcessing); - LCPMapper *pLCPMap = NULL; + LCPMapper *pLCPMap = nullptr; if (params.lensProf.lcpFile.length() && imgsrc->getMetaData()->getFocalLen() > 0) { LCPProfile *pLCPProf = lcpStore->getProfile(params.lensProf.lcpFile); @@ -1266,7 +1266,7 @@ void ImProcCoordinator::startProcessing () if (!destroying) { if (!updaterRunning) { updaterThreadStart.lock (); - thread = NULL; + thread = nullptr; updaterRunning = true; updaterThreadStart.unlock (); diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 7ea7bbecf..5af2093d9 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -196,7 +196,7 @@ public: double lumimul[3]; ImProcFunctions (const ProcParams* iparams, bool imultiThread = true) - : monitorTransform(NULL), lab2outputTransform(NULL), output2monitorTransform(NULL), params(iparams), scale(1), multiThread(imultiThread), lumimul{} {} + : monitorTransform(nullptr), lab2outputTransform(nullptr), output2monitorTransform(nullptr), params(iparams), scale(1), multiThread(imultiThread), lumimul{} {} ~ImProcFunctions (); void setScale (double iscale); @@ -261,7 +261,7 @@ public: void EPDToneMapResid(float * WavCoeffs_L0, unsigned int Iterates, int skip, struct cont_params& cp, int W_L, int H_L, float max0, float min0); float *CompressDR(float *Source, int skip, struct cont_params &cp, int W_L, int H_L, float Compression, float DetailBoost, float max0, float min0, float ave, float ah, float bh, float al, float bl, float factorx, float *Compressed); void ContrastResid(float * WavCoeffs_L0, unsigned int Iterates, int skip, struct cont_params &cp, int W_L, int H_L, float max0, float min0, float ave, float ah, float bh, float al, float bl, float factorx); - float *ContrastDR(float *Source, int skip, struct cont_params &cp, int W_L, int H_L, float Compression, float DetailBoost, float max0, float min0, float ave, float ah, float bh, float al, float bl, float factorx, float *Contrast = NULL); + float *ContrastDR(float *Source, int skip, struct cont_params &cp, int W_L, int H_L, float Compression, float DetailBoost, float max0, float min0, float ave, float ah, float bh, float al, float bl, float factorx, float *Contrast = nullptr); void EPDToneMap(LabImage *lab, unsigned int Iterates = 0, int skip = 1); void EPDToneMapCIE(CieImage *ncie, float a_w, float c_, float w_h, int Wid, int Hei, int begh, int endh, float minQ, float maxQ, unsigned int Iterates = 0, int skip = 1); @@ -296,11 +296,11 @@ public: void Aver(float * HH_Coeffs, int datalen, float &averagePlus, float &averageNeg, float &max, float &min); void Sigma(float * HH_Coeffs, int datalen, float averagePlus, float averageNeg, float &sigmaPlus, float &sigmaNeg); - void calckoe(float ** WavCoeffs_LL, const struct cont_params& cp, float ** koeLi, int level, int dir, int W_L, int H_L, float edd, float *maxkoeLi, float **tmC = NULL); + void calckoe(float ** WavCoeffs_LL, const struct cont_params& cp, float ** koeLi, int level, int dir, int W_L, int H_L, float edd, float *maxkoeLi, float **tmC = nullptr); - void Median_Denoise( float **src, float **dst, int width, int height, Median medianType, int iterations, int numThreads, float **buffer = NULL); + void Median_Denoise( float **src, float **dst, int width, int height, Median medianType, int iterations, int numThreads, float **buffer = nullptr); void RGB_denoise(int kall, Imagefloat * src, Imagefloat * dst, Imagefloat * calclum, float * ch_M, float *max_r, float *max_b, bool isRAW, const procparams::DirPyrDenoiseParams & dnparams, const double expcomp, const NoiseCurve & noiseLCurve , const NoiseCurve & noiseCCurve , float &chaut, float &redaut, float &blueaut, float &maxredaut, float & maxblueaut, float &nresi, float &highresi); void RGB_denoise_infoGamCurve(const procparams::DirPyrDenoiseParams & dnparams, const bool isRAW, LUTf &gamcurve, float &gam, float &gamthresh, float &gamslope); void RGB_denoise_info(Imagefloat * src, Imagefloat * provicalc, bool isRAW, LUTf &gamcurve, float gam, float gamthresh, float gamslope, const procparams::DirPyrDenoiseParams & dnparams, const double expcomp, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float & maxblueaut, float &minredaut, float & minblueaut, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, bool multiThread = false); @@ -317,7 +317,7 @@ public: const bool useNoiseCCurve, bool autoch, bool denoiseMethodRgb); void ShrinkAllL(wavelet_decomposition &WaveletCoeffs_L, float **buffer, int level, int dir, float *noisevarlum, float * madL, float * vari, int edge); void ShrinkAllAB(wavelet_decomposition &WaveletCoeffs_L, wavelet_decomposition &WaveletCoeffs_ab, float **buffer, int level, int dir, - float *noisevarchrom, float noisevar_ab, const bool useNoiseCCurve, bool autoch, bool denoiseMethodRgb, float * madL, float * madaab = NULL, bool madCalculated = false); + float *noisevarchrom, float noisevar_ab, const bool useNoiseCCurve, bool autoch, bool denoiseMethodRgb, float * madL, float * madaab = nullptr, bool madCalculated = false); void ShrinkAll_info(float ** WavCoeffs_a, float ** WavCoeffs_b, int level, int W_ab, int H_ab, int skip_ab, float **noisevarlum, float **noisevarchrom, float **noisevarhue, int width, int height, float noisevar_abr, float noisevar_abb, LabImage * noi, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &minredaut, float &minblueaut, bool autoch, int schoice, int lvl, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, float &maxchred, float &maxchblue, float &minchred, float &minchblue, int &nb, float &chau, float &chred, float &chblue, bool denoiseMethodRgb, bool multiThread); @@ -344,14 +344,14 @@ public: void BadpixelsLab(LabImage * src, LabImage * dst, double radius, int thresh, int mode, float b_l, float t_l, float t_r, float b_r, float skinprot, float chrom); Image8* lab2rgb (LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm); - Image16* lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm, bool bw, GammaValues *ga=NULL); + Image16* lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm, bool bw, GammaValues *ga=nullptr); // CieImage *ciec; - bool transCoord (int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef = -1, const LCPMapper *pLCPMap = NULL); - bool transCoord (int W, int H, const std::vector &src, std::vector &red, std::vector &green, std::vector &blue, double ascaleDef = -1, const LCPMapper *pLCPMap = NULL); + bool transCoord (int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef = -1, const LCPMapper *pLCPMap = nullptr); + bool transCoord (int W, int H, const std::vector &src, std::vector &red, std::vector &green, std::vector &blue, double ascaleDef = -1, const LCPMapper *pLCPMap = nullptr); static void getAutoExp (const LUTu & histogram, int histcompr, double defgain, double clip, double& expcomp, int& bright, int& contr, int& black, int& hlcompr, int& hlcomprthresh); static double getAutoDistor (const Glib::ustring& fname, int thumb_size); - double getTransformAutoFill (int oW, int oH, const LCPMapper *pLCPMap = NULL); + double getTransformAutoFill (int oW, int oH, const LCPMapper *pLCPMap = nullptr); void rgb2lab(const Imagefloat &src, LabImage &dst, const Glib::ustring &workingSpace); void lab2rgb(const LabImage &src, Imagefloat &dst, const Glib::ustring &workingSpace); }; diff --git a/rtengine/iplab2rgb.cc b/rtengine/iplab2rgb.cc index 924f79e1f..4e23c6400 100644 --- a/rtengine/iplab2rgb.cc +++ b/rtengine/iplab2rgb.cc @@ -173,7 +173,7 @@ Image8* ImProcFunctions::lab2rgb (LabImage* lab, int cx, int cy, int cw, int ch, } else printf("lab2rgb / bpc=false\n"); lcmsMutex->lock (); - cmsHPROFILE LabIProf = cmsCreateLab4Profile(NULL); + cmsHPROFILE LabIProf = cmsCreateLab4Profile(nullptr); cmsHTRANSFORM hTransform = cmsCreateTransform (LabIProf, TYPE_Lab_DBL, oprofG, TYPE_RGB_8, icm.outputIntent, flags); // NOCACHE is important for thread safety cmsCloseProfile(LabIProf); lcmsMutex->unlock (); @@ -284,7 +284,7 @@ Image16* ImProcFunctions::lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int Image16* image = new Image16 (cw, ch); - cmsHPROFILE oprof = NULL; + cmsHPROFILE oprof = nullptr; if (ga) { lcmsMutex->lock (); iccStore->getGammaArray(icm, *ga); diff --git a/rtengine/rawimage.cc b/rtengine/rawimage.cc index cb1c2a9c9..382ebe0a7 100644 --- a/rtengine/rawimage.cc +++ b/rtengine/rawimage.cc @@ -20,11 +20,11 @@ namespace rtengine extern const Settings* settings; RawImage::RawImage( const Glib::ustring &name ) - : data(NULL) + : data(nullptr) , prefilters(0) , filename(name) - , profile_data(NULL) - , allocation(NULL) + , profile_data(nullptr) + , allocation(nullptr) , rotate_deg(0) { memset(maximum_c4, 0, sizeof(maximum_c4)); @@ -45,22 +45,22 @@ RawImage::~RawImage() if(allocation) { delete [] allocation; - allocation = NULL; + allocation = nullptr; } if(float_raw_image) { delete [] float_raw_image; - float_raw_image = NULL; + float_raw_image = nullptr; } if(data) { delete [] data; - data = NULL; + data = nullptr; } if(profile_data) { delete [] profile_data; - profile_data = NULL; + profile_data = nullptr; } } @@ -401,9 +401,9 @@ skip_block: int RawImage::loadRaw (bool loadData, bool closeFile, ProgressListener *plistener, double progressRange) { ifname = filename.c_str(); - image = NULL; + image = nullptr; verbose = settings->verbose; - oprof = NULL; + oprof = nullptr; ifp = gfopen (ifname); // Maps to either file map or direct fopen @@ -415,18 +415,18 @@ int RawImage::loadRaw (bool loadData, bool closeFile, ProgressListener *plistene thumb_length = 0; thumb_offset = 0; - thumb_load_raw = 0; + thumb_load_raw = nullptr; use_camera_wb = 0; highlight = 1; half_size = 0; - raw_image = 0; + raw_image = nullptr; //***************** Read ALL raw file info identify (); if (!is_raw) { fclose(ifp); - ifp = NULL; + ifp = nullptr; if (plistener) { plistener->setProgress(1.0 * progressRange); @@ -532,7 +532,7 @@ int RawImage::loadRaw (bool loadData, bool closeFile, ProgressListener *plistene crop_masked_pixels(); free (raw_image); - raw_image = NULL; + raw_image = nullptr; } else { if (cc && cc->has_rawCrop()) { // foveon images int lm, tm, w, h; @@ -644,7 +644,7 @@ int RawImage::loadRaw (bool loadData, bool closeFile, ProgressListener *plistene if ( closeFile ) { fclose(ifp); - ifp = NULL; + ifp = nullptr; } if (plistener) { @@ -657,7 +657,7 @@ int RawImage::loadRaw (bool loadData, bool closeFile, ProgressListener *plistene float** RawImage::compress_image() { if( !image ) { - return NULL; + return nullptr; } if (isBayer() || isXtrans()) { @@ -700,7 +700,7 @@ float** RawImage::compress_image() } delete [] float_raw_image; - float_raw_image = NULL; + float_raw_image = nullptr; } else if (filters != 0 && !isXtrans()) { #pragma omp parallel for @@ -734,7 +734,7 @@ float** RawImage::compress_image() } free(image); // we don't need this anymore - image = NULL; + image = nullptr; return data; } @@ -783,7 +783,7 @@ void RawImage::getRgbCam (float rgbcam[3][4]) bool RawImage::get_thumbSwap() const { - return ((order == 0x4949) == (ntohs(0x1234) == 0x1234)) ? true : false; + return (order == 0x4949) == (ntohs(0x1234) == 0x1234); } } //namespace rtengine diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 12ac4330a..b2e3e5e56 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -424,10 +424,10 @@ extern const Settings* settings; RawImageSource::RawImageSource () : ImageSource() , W(0), H(0) - , plistener(NULL) + , plistener(nullptr) , border(4) - , ri(NULL) - , cache(NULL) + , ri(nullptr) + , cache(nullptr) , rawData(0, 0) , green(0, 0) , red(0, 0) @@ -463,8 +463,8 @@ RawImageSource::RawImageSource () , defGain(0.0) , threshold(0) { - camProfile = NULL; - embProfile = NULL; + camProfile = nullptr; + embProfile = nullptr; rgbSourceModified = false; } @@ -889,12 +889,12 @@ void RawImageSource::getImage (const ColorTemp &ctemp, int tran, Imagefloat* ima DCPProfile *RawImageSource::getDCP(const ColorManagementParams &cmp, ColorTemp &wb, DCPProfile::ApplyState &as) { - DCPProfile *dcpProf = NULL; + DCPProfile *dcpProf = nullptr; cmsHPROFILE dummy; - findInputProfile(cmp.input, NULL, (static_cast(getMetaData()))->getCamera(), &dcpProf, dummy); + findInputProfile(cmp.input, nullptr, (static_cast(getMetaData()))->getCamera(), &dcpProf, dummy); - if (dcpProf == NULL) { - return NULL; + if (dcpProf == nullptr) { + return nullptr; } dcpProf->setStep2ApplyState(cmp.working, cmp.toneCurve, cmp.applyLookTable, cmp.applyBaselineExposureOffset, as); @@ -1645,7 +1645,7 @@ int RawImageSource::load (const Glib::ustring &fname, bool batch) plistener->setProgress (1.0); } - plistener = NULL; // This must be reset, because only load() is called through progressConnector + plistener = nullptr; // This must be reset, because only load() is called through progressConnector t2.set(); if( settings->verbose ) { @@ -1664,7 +1664,7 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le t1.set(); Glib::ustring newDF = raw.dark_frame; - RawImage *rid = NULL; + RawImage *rid = nullptr; if (!raw.df_autoselect) { if( !raw.dark_frame.empty()) { @@ -1702,7 +1702,7 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le } //FLATFIELD start - RawImage *rif = NULL; + RawImage *rif = nullptr; if (!raw.ff_AutoSelect) { if( !raw.ff_file.empty()) { @@ -1713,7 +1713,7 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le } - bool hasFlatField = (rif != NULL); + bool hasFlatField = (rif != nullptr); if( hasFlatField && settings->verbose) { printf( "Flat Field Correction:%s\n", rif->get_filename().c_str()); @@ -1739,7 +1739,7 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le } // If darkframe selected, correct hotpixels found on darkframe - bp = 0; + bp = nullptr; if( raw.df_autoselect ) { bp = dfm.getHotPixels(idata->getMake(), idata->getModel(), idata->getISOSpeed(), idata->getShutterSpeed(), idata->getDateTimeAsTS()); @@ -2320,7 +2320,7 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC dLcurve(32768); } - FlatCurve* chcurve = NULL;//curve c=f(H) + FlatCurve* chcurve = nullptr;//curve c=f(H) bool chutili = false; if (deh.enabled && deh.retinexMethod == "highli") { @@ -2329,7 +2329,7 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC if (!chcurve || chcurve->isIdentity()) { if (chcurve) { delete chcurve; - chcurve = NULL; + chcurve = nullptr; } } else { chutili = true; @@ -2638,7 +2638,7 @@ void RawImageSource::flushRawData() { if(cache) { delete [] cache; - cache = 0; + cache = nullptr; } if (rawData) { @@ -3705,9 +3705,9 @@ void RawImageSource::getProfilePreprocParams(cmsHPROFILE in, float& gammaFac, fl copyright[0] = 0; if (cmsGetProfileInfoASCII(in, cmsInfoCopyright, cmsNoLanguage, cmsNoCountry, copyright, 256) > 0) { - if (strstr(copyright, "Phase One") != NULL) { + if (strstr(copyright, "Phase One") != nullptr) { gammaFac = 0.55556; // 1.8 - } else if (strstr(copyright, "Nikon Corporation") != NULL) { + } else if (strstr(copyright, "Nikon Corporation") != nullptr) { gammaFac = 0.5; lineFac = -0.4; lineSum = 1.35; // determined in reverse by measuring NX an RT developed colorchecker PNGs @@ -3776,7 +3776,7 @@ void RawImageSource::colorSpaceConversion_ (Imagefloat* im, ColorManagementParam return; } - if (dcpProf != NULL) { + if (dcpProf != nullptr) { // DCP processing const DCPProfile::Triple pre_mul_row = { pre_mul[0], @@ -3793,7 +3793,7 @@ void RawImageSource::colorSpaceConversion_ (Imagefloat* im, ColorManagementParam return; } - if (in == NULL) { + if (in == nullptr) { // use default camprofile, supplied by dcraw // in this case we avoid using the slllllooooooowwww lcms @@ -3869,10 +3869,10 @@ void RawImageSource::colorSpaceConversion_ (Imagefloat* im, ColorManagementParam camera_icc_type = CAMERA_ICC_TYPE_GENERIC; // Note: order the identification with the most detailed matching first since the more general ones may also match the more detailed - if ((strstr(copyright, "Leaf") != NULL || - strstr(copyright, "Phase One A/S") != NULL || - strstr(copyright, "Kodak") != NULL || - strstr(copyright, "Creo") != NULL) && + if ((strstr(copyright, "Leaf") != nullptr || + strstr(copyright, "Phase One A/S") != nullptr || + strstr(copyright, "Kodak") != nullptr || + strstr(copyright, "Creo") != nullptr) && (strstr(description, "LF2 ") == description || strstr(description, "LF3 ") == description || strstr(description, "LeafLF2") == description || @@ -3881,9 +3881,9 @@ void RawImageSource::colorSpaceConversion_ (Imagefloat* im, ColorManagementParam strstr(description, "MamiyaLF2") == description || strstr(description, "MamiyaLF3") == description)) { camera_icc_type = CAMERA_ICC_TYPE_LEAF; - } else if (strstr(copyright, "Phase One A/S") != NULL) { + } else if (strstr(copyright, "Phase One A/S") != nullptr) { camera_icc_type = CAMERA_ICC_TYPE_PHASE_ONE; - } else if (strstr(copyright, "Nikon Corporation") != NULL) { + } else if (strstr(copyright, "Nikon Corporation") != nullptr) { camera_icc_type = CAMERA_ICC_TYPE_NIKON; } } @@ -3902,7 +3902,7 @@ void RawImageSource::colorSpaceConversion_ (Imagefloat* im, ColorManagementParam transform_via_pcs_lab = true; separate_pcs_lab_highlights = true; // We transform to Lab because we can and that we avoid getting an unnecessary unmatched gamma conversion which we would need to revert. - hTransform = cmsCreateTransform (in, TYPE_RGB_FLT, NULL, TYPE_Lab_FLT, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE ); + hTransform = cmsCreateTransform (in, TYPE_RGB_FLT, nullptr, TYPE_Lab_FLT, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE ); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { @@ -3926,7 +3926,7 @@ void RawImageSource::colorSpaceConversion_ (Imagefloat* im, ColorManagementParam lcmsMutex->unlock (); - if (hTransform == NULL) { + if (hTransform == nullptr) { // Fallback: create transform from camera profile. Should not happen normally. lcmsMutex->lock (); hTransform = cmsCreateTransform (camprofile, TYPE_RGB_FLT, prophoto, TYPE_RGB_FLT, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE ); @@ -4136,8 +4136,8 @@ void RawImageSource::colorSpaceConversion_ (Imagefloat* im, ColorManagementParam // Determine RAW input and output profiles. Returns TRUE on success bool RawImageSource::findInputProfile(Glib::ustring inProfile, cmsHPROFILE embedded, std::string camName, DCPProfile **dcpProf, cmsHPROFILE& in) { - in = NULL; // cam will be taken on NULL - *dcpProf = NULL; + in = nullptr; // cam will be taken on NULL + *dcpProf = nullptr; if (inProfile == "(none)") { return false; @@ -4149,7 +4149,7 @@ bool RawImageSource::findInputProfile(Glib::ustring inProfile, cmsHPROFILE embed // DCPs have higher quality, so use them first *dcpProf = DCPStore::getInstance()->getStdProfile(camName); - if (*dcpProf == NULL) { + if (*dcpProf == nullptr) { in = iccStore->getStdProfile(camName); } } else if (inProfile != "(camera)" && inProfile != "") { @@ -4163,7 +4163,7 @@ bool RawImageSource::findInputProfile(Glib::ustring inProfile, cmsHPROFILE embed *dcpProf = DCPStore::getInstance()->getProfile(normalName); } - if (*dcpProf == NULL) { + if (*dcpProf == nullptr) { in = iccStore->getProfile (inProfile); } } diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index e31103929..9e7d5f58f 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -54,7 +54,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p if (errorCode) { delete job; - return NULL; + return nullptr; } } @@ -165,7 +165,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p NoiseCurve noiseLCurve; NoiseCurve noiseCCurve; - Imagefloat *calclum = NULL ; + Imagefloat *calclum = nullptr ; params.dirpyrDenoise.getCurves(noiseLCurve, noiseCCurve); float autoNR = (float) settings->nrauto;// float autoNRmax = (float) settings->nrautomax;// @@ -754,7 +754,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p } // update blurmap - SHMap* shmap = NULL; + SHMap* shmap = nullptr; if (params.sh.enabled) { shmap = new SHMap (fw, fh, true); @@ -858,7 +858,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p DCPProfile::ApplyState as; DCPProfile *dcpProf = imgsrc->getDCP(params.icm, currWB, as); - ipf.rgbProc (baseImg, labView, NULL, curve1, curve2, curve, shmap, params.toneCurve.saturation, rCurve, gCurve, bCurve, satLimit , satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2, rrm, ggm, bbm, autor, autog, autob, expcomp, hlcompr, hlcomprthresh, dcpProf, as); + ipf.rgbProc (baseImg, labView, nullptr, curve1, curve2, curve, shmap, params.toneCurve.saturation, rCurve, gCurve, bCurve, satLimit , satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2, rrm, ggm, bbm, autor, autog, autob, expcomp, hlcompr, hlcomprthresh, dcpProf, as); if (settings->verbose) { printf("Output image / Auto B&W coefs: R=%.2f G=%.2f B=%.2f\n", autor, autog, autob); @@ -881,13 +881,13 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p // Freeing baseImg because not used anymore delete baseImg; - baseImg = NULL; + baseImg = nullptr; if (shmap) { delete shmap; } - shmap = NULL; + shmap = nullptr; if (pl) { pl->setProgress (0.55); @@ -933,7 +933,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p CurveFactory::complexsgnCurve (autili, butili, ccutili, cclutili, params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, params.labCurve.lccurve, curve1, curve2, satcurve, lhskcurve, 1); - ipf.chromiLuminanceCurve (NULL, 1, labView, labView, curve1, curve2, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy); + ipf.chromiLuminanceCurve (nullptr, 1, labView, labView, curve1, curve2, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy); if((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) { ipf.EPDToneMap(labView, 5, 1); @@ -1071,7 +1071,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p } delete cieView; - cieView = NULL; + cieView = nullptr; @@ -1147,8 +1147,8 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p } } - Image16* readyImg = NULL; - cmsHPROFILE jprof = NULL; + Image16* readyImg = nullptr; + cmsHPROFILE jprof = nullptr; bool customGamma = false; bool useLCMS = false; bool bwonly = params.blackwhite.enabled && !params.colorToning.enabled && !autili && !butili ; @@ -1163,7 +1163,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p //or selected Free gamma useLCMS = false; - if ((jprof = iccStore->createCustomGammaOutputProfile (params.icm, ga)) == NULL) { + if ((jprof = iccStore->createCustomGammaOutputProfile (params.icm, ga)) == nullptr) { useLCMS = true; } @@ -1179,7 +1179,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p } delete labView; - labView = NULL; + labView = nullptr; @@ -1229,7 +1229,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p // if iccStore->getProfile send back an object, then iccStore->getContent will do too cmsHPROFILE jprof = iccStore->getProfile(params.icm.output); //get outProfile - if (jprof == NULL) { + if (jprof == nullptr) { if (settings->verbose) { printf("\"%s\" ICC output profile not found!\n - use LCMS2 substitution\n", params.icm.output.c_str()); } @@ -1243,7 +1243,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p } } else { // No ICM - readyImg->setOutputProfile (NULL, 0); + readyImg->setOutputProfile (nullptr, 0); } } @@ -1286,13 +1286,13 @@ void batchProcessingThread (ProcessingJob* job, BatchProcessingListener* bpl, bo if (errorCode) { bpl->error (M("MAIN_MSG_CANNOTLOAD")); - currentJob = NULL; + currentJob = nullptr; } else { try { currentJob = bpl->imageReady (img); } catch (Glib::Exception& ex) { bpl->error (ex.what()); - currentJob = NULL; + currentJob = nullptr; } } } diff --git a/rtengine/stdimagesource.cc b/rtengine/stdimagesource.cc index 826c8a49b..6017a1ca6 100644 --- a/rtengine/stdimagesource.cc +++ b/rtengine/stdimagesource.cc @@ -51,11 +51,11 @@ template T** allocArray (int W, int H) } #define HR_SCALE 2 -StdImageSource::StdImageSource () : ImageSource(), img(NULL), plistener(NULL), full(false), max{}, rgbSourceModified(false) +StdImageSource::StdImageSource () : ImageSource(), img(nullptr), plistener(nullptr), full(false), max{}, rgbSourceModified(false) { - embProfile = NULL; - idata = NULL; + embProfile = nullptr; + idata = nullptr; } StdImageSource::~StdImageSource () @@ -163,7 +163,7 @@ int StdImageSource::load (const Glib::ustring &fname, bool batch) if (error) { delete img; - img = NULL; + img = nullptr; return error; } @@ -228,7 +228,7 @@ void StdImageSource::colorSpaceConversion (Imagefloat* im, const ColorManagement { bool skipTransform = false; - cmsHPROFILE in = NULL; + cmsHPROFILE in = nullptr; cmsHPROFILE out = iccStore->workingSpace (cmp.working); if (cmp.input == "(embedded)" || cmp.input == "" || cmp.input == "(camera)" || cmp.input == "(cameraICC)") { @@ -245,9 +245,9 @@ void StdImageSource::colorSpaceConversion (Imagefloat* im, const ColorManagement if (cmp.input != "(none)") { in = iccStore->getProfile (cmp.input); - if (in == NULL && embedded) { + if (in == nullptr && embedded) { in = embedded; - } else if (in == NULL) { + } else if (in == nullptr) { if (sampleFormat & (IIOSF_LOGLUV24 | IIOSF_LOGLUV32 | IIOSF_FLOAT)) { skipTransform = true; } else { diff --git a/rtgui/progressconnector.h b/rtgui/progressconnector.h index f62b645c3..fce1f17f5 100644 --- a/rtgui/progressconnector.h +++ b/rtgui/progressconnector.h @@ -90,7 +90,7 @@ class ProgressConnector public: - ProgressConnector (): retval( 0 ), workThread( nullptr ) { } + ProgressConnector (): retval( nullptr ), workThread( nullptr ) { } void startFunc (const sigc::slot0& startHandler, const sigc::slot0& endHandler ) {