diff --git a/.hgignore b/.hgignore index 2b695e514..e93bfaffa 100644 --- a/.hgignore +++ b/.hgignore @@ -1,6 +1,7 @@ syntax: glob *~ +*.orig CMakeFiles Makefile @@ -10,12 +11,14 @@ CMakeCache.txt Debug RelWithDebInfo MinSizeRel -release +Release + rtdata/rawtherapee.desktop rtengine/librtengine.a rtexif/librtexif.a rtgui/config.h rtgui/version.h rtgui/rawtherapee +rtgui/rawtherapee.exe install_manifest.txt AboutThisBuild.txt diff --git a/rtengine/CA_correct_RT.cc b/rtengine/CA_correct_RT.cc index 3d8642ded..0c050b72a 100644 --- a/rtengine/CA_correct_RT.cc +++ b/rtengine/CA_correct_RT.cc @@ -549,6 +549,7 @@ void RawImageSource::CA_correct_RT(double cared, double cablue) { blockvar[j][c] = blocksqave[j][c]/blockdenom[j][c]-SQR(blockave[j][c]/blockdenom[j][c]); } else { printf ("blockdenom vanishes \n"); + free(buffer1); return; } } @@ -636,6 +637,7 @@ void RawImageSource::CA_correct_RT(double cared, double cablue) { polyord=2; numpar=4; if (numblox[1]< 10) { printf ("numblox = %d \n",numblox[1]); + free(buffer1); return; } } @@ -646,6 +648,7 @@ void RawImageSource::CA_correct_RT(double cared, double cablue) { res = LinEqSolve(numpar, polymat[c][dir], shiftmat[c][dir], fitparams[c][dir]); if (res) { printf ("CA correction pass failed -- can't solve linear equations for color %d direction %d...\n",c,dir); + free(buffer1); return; } } diff --git a/rtengine/array2D.h b/rtengine/array2D.h index 5a6e78367..d0ebbf471 100644 --- a/rtengine/array2D.h +++ b/rtengine/array2D.h @@ -64,6 +64,7 @@ #define ARRAY2D_VERBOSE 8 #include +#include template class array2D { @@ -98,7 +99,7 @@ public: // use as empty declaration, resize before use! // very useful as a member object array2D() : - x(0), y(0), owner(0), data(NULL), ptr(NULL), lock(0) { + x(0), y(0), owner(0), ptr(NULL), data(NULL), lock(0) { //printf("got empty array2D init\n"); } @@ -156,7 +157,7 @@ public: // use with indices T * operator[](size_t index) { - assert(index>=0 && index & operator[](size_t index) { - if (index < 0 || index >= num) { + if (index >= num) { printf("index %zu is out of range[0..%zu]", index, num - 1); raise( SIGSEGV); } diff --git a/rtengine/bilateral3.h b/rtengine/bilateral3.h index f407f10e6..f502348fe 100644 --- a/rtengine/bilateral3.h +++ b/rtengine/bilateral3.h @@ -19,6 +19,10 @@ #include #include #include +#include + +#include "gauss.h" + #define MAXVAL 65535.0 #define CLIP(a) ((a)>0.0?((a)0 && acurvePoints[0]!=0) { + if (!acurvePoints.empty() && acurvePoints[0]!=0) { dCurve = new DiagonalCurve (acurvePoints, CURVES_MIN_POLY_POINTS/skip); if (dCurve && !dCurve->isIdentity()) needed = true; @@ -223,7 +223,7 @@ namespace rtengine { //----------------------------------------------------- needed = false; - if (bcurvePoints.size()>0 && bcurvePoints[0]!=0) { + if (!bcurvePoints.empty() && bcurvePoints[0]!=0) { dCurve = new DiagonalCurve (bcurvePoints, CURVES_MIN_POLY_POINTS/skip); if (dCurve && !dCurve->isIdentity()) needed = true; @@ -419,7 +419,7 @@ namespace rtengine { // create a curve if needed bool histNeeded = false; DiagonalCurve* tcurve = NULL; - if (curvePoints.size()>0 && curvePoints[0]!=0) { + if (!curvePoints.empty() && curvePoints[0]!=0) { tcurve = new DiagonalCurve (curvePoints, CURVES_MIN_POLY_POINTS/skip); if (outBeforeCCurveHistogram /*&& histogramCropped*/) histNeeded = true; @@ -584,7 +584,7 @@ namespace rtengine { // create a curve if needed DiagonalCurve* tcurve = NULL; bool histNeeded = false; - if (curvePoints.size()>0 && curvePoints[0]!=0) { + if (!curvePoints.empty() && curvePoints[0]!=0) { tcurve = new DiagonalCurve (curvePoints, CURVES_MIN_POLY_POINTS/skip); if (outBeforeCCurveHistogram /*&& histogramCropped*/) histNeeded = true; @@ -647,7 +647,7 @@ namespace rtengine { // create a curve if needed DiagonalCurve* tcurve = NULL; bool histNeeded = false; - if (curvePoints.size()>0 && curvePoints[0]!=0) { + if (!curvePoints.empty() && curvePoints[0]!=0) { tcurve = new DiagonalCurve (curvePoints, CURVES_MIN_POLY_POINTS/skip); } if (tcurve && tcurve->isIdentity()) { diff --git a/rtengine/dcraw.h b/rtengine/dcraw.h index fc8de6f86..306cacf01 100644 --- a/rtengine/dcraw.h +++ b/rtengine/dcraw.h @@ -40,20 +40,23 @@ public: DCraw() - :ifp(NULL),ofp(NULL) + :exif_base(-1) + ,ciff_base(-1) + ,ciff_len(0) + ,ifp(NULL),ofp(NULL) ,order(0x4949) ,ifname(NULL) ,meta_data(NULL) ,shot_select(0),multi_out(0) - ,half_size(0),four_color_rgb(0),document_mode(0),highlight(0) - ,verbose(0),use_auto_wb(0),use_camera_wb(0),use_camera_matrix(-1) - ,output_color(1),output_bps(8),output_tiff(0),med_passes(0),no_auto_bright(0) + ,image(NULL) ,bright(1.),threshold(0.) + ,half_size(0),four_color_rgb(0),document_mode(0),highlight(0) + ,verbose(0) + ,use_auto_wb(0),use_camera_wb(0),use_camera_matrix(-1) + ,output_color(1),output_bps(8),output_tiff(0),med_passes(0),no_auto_bright(0) ,getbithuff(this,ifp,zero_after_ff) + ,ph1_bithuff(this,ifp,order) ,pana_bits(ifp,load_flags) - ,ph1_bithuff(this,ifp,order) - ,image(NULL) - ,exif_base(-1), ciff_base(-1), ciff_len(0) { aber[0]=aber[1]=aber[2]=aber[3]=1; gamm[0]=0.45;gamm[1]=4.5;gamm[2]=gamm[3]=gamm[4]=gamm[5]=0; @@ -89,7 +92,7 @@ protected: double gamm[6]; dcrawImage_t image; ushort white[8][8], curve[0x10000], cr2_slice[3], sraw_mul[4]; - float bright, user_mul[4], threshold; + float bright, threshold, user_mul[4]; int half_size, four_color_rgb, document_mode, highlight; int verbose, use_auto_wb, use_camera_wb, use_camera_matrix; diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 8dbf71322..41c8cbaaa 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -30,9 +30,9 @@ extern const Settings* settings; Crop::Crop (ImProcCoordinator* parent) : resizeCrop(NULL), transCrop(NULL), updating(false), - cropw(-1), croph(-1), trafw(-1), trafh(-1), + skip(10),cropw(-1), croph(-1), trafw(-1), trafh(-1), borderRequested(32), cropAllocated(false), - cropImageListener(NULL), parent(parent),skip(10) + cropImageListener(NULL), parent(parent) { parent->crops.push_back (this); } diff --git a/rtengine/dfmanager.cc b/rtengine/dfmanager.cc index f49668e0d..ca197399d 100644 --- a/rtengine/dfmanager.cc +++ b/rtengine/dfmanager.cc @@ -110,7 +110,7 @@ std::list& dfInfo::getHotPixels() void dfInfo::updateRawImage() { typedef unsigned int acc_t; - if( pathNames.size() >0 ){ + if( !pathNames.empty() ){ std::list::iterator iName = pathNames.begin(); ri = new RawImage(*iName); // First file used also for extra pixels informations (width,height, shutter, filters etc.. ) if( ri->loadRaw(true)){ @@ -228,7 +228,7 @@ void DFManager::init( Glib::ustring pathname ) // Where multiple shots exist for same group, move filename to list for( dfList_t::iterator iter = dfList.begin(); iter != dfList.end();iter++ ){ dfInfo &i = iter->second; - if( i.pathNames.size()>0 && !i.pathname.empty() ){ + if( !i.pathNames.empty() && !i.pathname.empty() ){ i.pathNames.push_back( i.pathname ); i.pathname.clear(); } @@ -316,7 +316,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.size() == 0 ) + if( dfList.empty() ) return 0; std::string key( dfInfo::key(mak,mod,isospeed,shut) ); dfList_t::iterator iter = dfList.find( key ); @@ -380,9 +380,9 @@ std::list *DFManager::getHotPixels ( const std::string &mak, const std:: dfInfo *df = find( mak, mod, iso, shut, t ); if( df ){ if( settings->verbose ) - if( df->pathname.size() >0 ) + if( !df->pathname.empty() ) printf( "Searched hotpixels from %s\n",df->pathname.c_str()); - else if( df->pathNames.size() >0 ) + else if( !df->pathNames.empty() ) printf( "Searched hotpixels from template (first %s)\n",df->pathNames.begin()->c_str()); return &df->getHotPixels(); }else @@ -419,7 +419,7 @@ std::list *DFManager::getBadPixels ( const std::string &mak, const std:: { std::ostringstream s; s << mak << " " <0) + if( !serial.empty()) s << " " << serial; bpList_t::iterator iter = bpList.find( s.str() ); if( iter != bpList.end() ){ diff --git a/rtengine/ffmanager.cc b/rtengine/ffmanager.cc index a07a3c9a9..7a6f2048e 100644 --- a/rtengine/ffmanager.cc +++ b/rtengine/ffmanager.cc @@ -106,7 +106,7 @@ void ffInfo::updateRawImage() typedef unsigned int acc_t; // averaging of flatfields if more than one is found matching the same key. // this may not be necessary, as flatfield is further blurred before being applied to the processed image. - if( pathNames.size() >0 ){ + if( !pathNames.empty() ){ std::list::iterator iName = pathNames.begin(); ri = new RawImage(*iName); // First file used also for extra pixels informations (width,height, shutter, filters etc.. ) if( ri->loadRaw(true)){ @@ -187,7 +187,7 @@ void FFManager::init( Glib::ustring pathname ) // Where multiple shots exist for same group, move filename to list for( ffList_t::iterator iter = ffList.begin(); iter != ffList.end();iter++ ){ ffInfo &i = iter->second; - if( i.pathNames.size()>0 && !i.pathname.empty() ){ + if( !i.pathNames.empty() && !i.pathname.empty() ){ i.pathNames.push_back( i.pathname ); i.pathname.clear(); } @@ -275,7 +275,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.size() == 0 ) + if( ffList.empty() ) return 0; std::string key( ffInfo::key(mak,mod,len,focal,apert) ); ffList_t::iterator iter = ffList.find( key ); diff --git a/rtengine/ffmanager.h b/rtengine/ffmanager.h index 25581a061..1e0fb44e7 100644 --- a/rtengine/ffmanager.h +++ b/rtengine/ffmanager.h @@ -41,7 +41,7 @@ public: ffInfo(const Glib::ustring &name, const std::string &mak, const std::string &mod,const std::string & len,double focal,double apert,time_t t) - :pathname(name),maker(mak),model(mod),lens(len),focallength(focal),aperture(apert),timestamp(t),ri(NULL){} + :pathname(name),maker(mak),model(mod),lens(len),aperture(apert),focallength(focal),timestamp(t),ri(NULL){} ffInfo( const ffInfo &o) :pathname(o.pathname),maker(o.maker),model(o.model),lens(o.lens),focallength(o.focallength),aperture(o.aperture),timestamp(o.timestamp),ri(NULL){} diff --git a/rtengine/iccjpeg.cc b/rtengine/iccjpeg.cc index bfc194cb3..85721f631 100644 --- a/rtengine/iccjpeg.cc +++ b/rtengine/iccjpeg.cc @@ -216,9 +216,6 @@ read_icc_profile (j_decompress_ptr cinfo, total_length += data_length[seq_no]; } - if (total_length <= 0) - return FALSE; /* found only empty markers? */ - /* Allocate space for assembled data */ icc_data = (JOCTET *) malloc(total_length * sizeof(JOCTET)); if (icc_data == NULL) diff --git a/rtengine/iccstore.cc b/rtengine/iccstore.cc index 56af58223..7c68f0f6e 100644 --- a/rtengine/iccstore.cc +++ b/rtengine/iccstore.cc @@ -316,7 +316,7 @@ ProfileContent::ProfileContent (cmsHPROFILE hProfile) { } -ProfileContent& ProfileContent::operator= (const ProfileContent other) { +ProfileContent& ProfileContent::operator= (const ProfileContent& other) { length = other.length; if (data) diff --git a/rtengine/iccstore.h b/rtengine/iccstore.h index 16630c90a..acad32c9d 100644 --- a/rtengine/iccstore.h +++ b/rtengine/iccstore.h @@ -39,7 +39,7 @@ class ProfileContent { ProfileContent (const ProfileContent& other); ProfileContent (cmsHPROFILE hProfile); ~ProfileContent (); - ProfileContent& operator= (const ProfileContent other); + ProfileContent& operator= (const rtengine::ProfileContent& other); cmsHPROFILE toProfile (); }; diff --git a/rtengine/imageio.cc b/rtengine/imageio.cc index 33a2fe475..8592ff97e 100644 --- a/rtengine/imageio.cc +++ b/rtengine/imageio.cc @@ -78,12 +78,12 @@ void ImageIO::setMetadata (const rtexif::TagDirectory* eroot, const std::vector< if (iptc!=NULL) { iptc_data_free (iptc); iptc = NULL; } // build iptc structures for libiptcdata - if (iptcc.size()==0) + if (iptcc.empty()) return; iptc = iptc_data_new (); for (int i=0; i0) { + if (iptcc[i].field == "Keywords" && !(iptcc[i].values.empty())) { for (int j=0; j0) { + else if (iptcc[i].field == "SupplementalCategories" && !(iptcc[i].values.empty())) { for (int j=0; j0) { + if (iptcc[i].field == strTags[j].field && !(iptcc[i].values.empty())) { IptcDataSet * ds = iptc_dataset_new (); iptc_dataset_set_tag (ds, IPTC_RECORD_APP_2, strTags[j].tag); std::string loc = safe_locale_to_utf8(iptcc[i].values[0]); @@ -723,8 +723,10 @@ int ImageIO::saveTIFF (Glib::ustring fname, int bps, bool uncompressed) { if (exifRoot && uncompressed) { FILE *file = safe_g_fopen_WriteBinLock (fname); - if (!file) + if (!file) { + delete [] linebuffer; return IMIO_CANNOTREADFILE; + } if (pl) { pl->setProgressStr ("PROGRESSBAR_SAVETIFF"); @@ -776,8 +778,10 @@ int ImageIO::saveTIFF (Glib::ustring fname, int bps, bool uncompressed) { #else TIFF* out = TIFFOpen(fname.c_str(), mode); #endif - if (!out) + if (!out) { + delete [] linebuffer; return IMIO_CANNOTREADFILE; + } if (pl) { pl->setProgressStr ("PROGRESSBAR_SAVETIFF"); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 620589962..6bc3f43b1 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -30,10 +30,10 @@ namespace rtengine { extern const Settings* settings; ImProcCoordinator::ImProcCoordinator () - : awbComputed(false), ipf(¶ms, true), scale(10), allocated(false), - pW(-1), pH(-1), plistener(NULL), lastHighDetail(false), + : workimg(NULL), awbComputed(false), ipf(¶ms, true), scale(10), lastHighDetail(false), allocated(false), + pW(-1), pH(-1), plistener(NULL), imageListener(NULL), aeListener(NULL), hListener(NULL), resultValid(false), - changeSinceLast(0), updaterRunning(false), destroying(false), workimg(NULL) { + changeSinceLast(0), updaterRunning(false), destroying(false) { hltonecurve(65536,0); shtonecurve(65536,2);//clip above @@ -433,7 +433,7 @@ if (settings->verbose) printf ("setscale before lock\n"); fullw = fw; fullh = fh; if (settings->verbose) printf ("setscale ends\n"); - if (sizeListeners.size()>0) + if (!sizeListeners.empty()) for (int i=0; isizeChanged (fullw, fullh, fw, fh); if (settings->verbose) printf ("setscale ends2\n"); diff --git a/rtengine/ipsharpen.cc b/rtengine/ipsharpen.cc index a8f042517..bd91c21a2 100644 --- a/rtengine/ipsharpen.cc +++ b/rtengine/ipsharpen.cc @@ -322,7 +322,7 @@ void ImProcFunctions::MLsharpen (LabImage* lab) { contrast=1.0; // new possible values - if ((L[offset]L[offset+1])||(L[offset]>L[offset-1])&&(L[offset]L[offset+1])) || ((L[offset]>L[offset-1])&&(L[offset]L[offset+width])||(L[offset]>L[offset-width])&&(L[offset]L[offset+width])) || ((L[offset]>L[offset-width])&&(L[offset]L[offset+1+width])||(L[offset]>L[offset-1-width])&&(L[offset]L[offset+1+width])) || ((L[offset]>L[offset-1-width])&&(L[offset]L[offset-1+width])||(L[offset]>L[offset+1-width])&&(L[offset]L[offset-1+width])) || ((L[offset]>L[offset+1-width])&&(L[offset]infile, src->buffer, INPUT_BUF_SIZE); - if (nbytes <= 0) { + if (nbytes == 0) { if (src->start_of_file) /* Treat empty input file as fatal error */ ERREXIT(cinfo, JERR_INPUT_EMPTY); WARNMS(cinfo, JWRN_JPEG_EOF); diff --git a/rtengine/klt/convolve.cc b/rtengine/klt/convolve.cc index 75918f72a..b6041a7a6 100644 --- a/rtengine/klt/convolve.cc +++ b/rtengine/klt/convolve.cc @@ -87,9 +87,11 @@ static void _computeKernels( for (i = -hw ; fabs(gaussderiv->data[i+hw] / max_gaussderiv) < factor ; i++, gaussderiv->width -= 2); if (gauss->width == MAX_KERNEL_WIDTH || - gaussderiv->width == MAX_KERNEL_WIDTH) + gaussderiv->width == MAX_KERNEL_WIDTH) { KLTError("(_computeKernels) MAX_KERNEL_WIDTH %d is too small for " "a sigma of %f", MAX_KERNEL_WIDTH, sigma); + exit(1); + } } /* Shift if width less than MAX_KERNEL_WIDTH */ diff --git a/rtengine/klt/klt.cc b/rtengine/klt/klt.cc index e5938f112..8e0c78d9b 100644 --- a/rtengine/klt/klt.cc +++ b/rtengine/klt/klt.cc @@ -71,9 +71,10 @@ static void** _createArray2D(int ncols, int nrows, int nbytes) tt = (char **) malloc(nrows * sizeof(void *) + ncols * nrows * nbytes); - if (tt == NULL) + if (tt == NULL) { KLTError("(createArray2D) Out of memory"); - + exit(1); + } for (i = 0 ; i < nrows ; i++) tt[i] = ((char *) tt) + (nrows * sizeof(void *) + i * ncols * nbytes); diff --git a/rtengine/klt/klt_util.cc b/rtengine/klt/klt_util.cc index ee299453c..0e3563daf 100644 --- a/rtengine/klt/klt_util.cc +++ b/rtengine/klt/klt_util.cc @@ -37,8 +37,10 @@ _KLT_FloatImage _KLTCreateFloatImage( ncols * nrows * sizeof(float); floatimg = (_KLT_FloatImage) malloc(nbytes); - if (floatimg == NULL) + if (floatimg == NULL) { KLTError("(_KLTCreateFloatImage) Out of memory"); + exit(1); + } floatimg->ncols = ncols; floatimg->nrows = nrows; floatimg->data = (float *) (floatimg + 1); diff --git a/rtengine/klt/pnmio.cc b/rtengine/klt/pnmio.cc index e1c334bd9..82ae5c467 100644 --- a/rtengine/klt/pnmio.cc +++ b/rtengine/klt/pnmio.cc @@ -53,9 +53,11 @@ void pnmReadHeader( /* Read magic number */ _getNextString(fp, line); - if (line[0] != 'P') + if (line[0] != 'P') { KLTError("(pnmReadHeader) Magic number does not begin with 'P', " "but with a '%c'", line[0]); + exit(1); + } sscanf(line, "P%d", magic); /* Read size, skipping comments */ @@ -63,9 +65,11 @@ void pnmReadHeader( *ncols = atoi(line); _getNextString(fp, line); *nrows = atoi(line); - if (*ncols < 0 || *nrows < 0 || *ncols > 10000 || *nrows > 10000) + if (*ncols < 0 || *nrows < 0 || *ncols > 10000 || *nrows > 10000) { KLTError("(pnmReadHeader) The dimensions %d x %d are unacceptable", *ncols, *nrows); + exit(1); + } /* Read maxval, skipping comments */ _getNextString(fp, line); @@ -88,8 +92,10 @@ void pgmReadHeader( int *maxval) { pnmReadHeader(fp, magic, ncols, nrows, maxval); - if (*magic != 5) + if (*magic != 5) { KLTError("(pgmReadHeader) Magic number is not 'P5', but 'P%d'", *magic); + exit(1); + } } @@ -104,8 +110,10 @@ void ppmReadHeader( int *maxval) { pnmReadHeader(fp, magic, ncols, nrows, maxval); - if (*magic != 6) + if (*magic != 6) { KLTError("(ppmReadHeader) Magic number is not 'P6', but 'P%d'", *magic); + exit(1); + } } @@ -122,8 +130,10 @@ void pgmReadHeaderFile( FILE *fp; /* Open file */ - if ( (fp = fopen(fname, "rb")) == NULL) + if ( (fp = fopen(fname, "rb")) == NULL) { KLTError("(pgmReadHeaderFile) Can't open file named '%s' for reading\n", fname); + exit(1); + } /* Read header */ pgmReadHeader(fp, magic, ncols, nrows, maxval); @@ -146,8 +156,10 @@ void ppmReadHeaderFile( FILE *fp; /* Open file */ - if ( (fp = fopen(fname, "rb")) == NULL) + if ( (fp = fopen(fname, "rb")) == NULL) { KLTError("(ppmReadHeaderFile) Can't open file named '%s' for reading\n", fname); + exit(1); + } /* Read header */ ppmReadHeader(fp, magic, ncols, nrows, maxval); @@ -178,8 +190,10 @@ unsigned char* pgmRead( /* Allocate memory, if necessary, and set pointer */ if (img == NULL) { ptr = (unsigned char *) malloc(*ncols * *nrows * sizeof(char)); - if (ptr == NULL) + if (ptr == NULL) { KLTError("(pgmRead) Memory not allocated"); + exit(1); + } } else ptr = img; @@ -212,8 +226,10 @@ unsigned char* pgmReadFile( FILE *fp; /* Open file */ - if ( (fp = fopen(fname, "rb")) == NULL) + if ( (fp = fopen(fname, "rb")) == NULL) { KLTError("(pgmReadFile) Can't open file named '%s' for reading\n", fname); + exit(1); + } /* Read file */ ptr = pgmRead(fp, img, ncols, nrows); @@ -263,8 +279,10 @@ void pgmWriteFile( FILE *fp; /* Open file */ - if ( (fp = fopen(fname, "wb")) == NULL) + if ( (fp = fopen(fname, "wb")) == NULL) { KLTError("(pgmWriteFile) Can't open file named '%s' for writing\n", fname); + exit(1); + } /* Write to file */ pgmWrite(fp, img, ncols, nrows); @@ -320,8 +338,10 @@ void ppmWriteFileRGB( FILE *fp; /* Open file */ - if ( (fp = fopen(fname, "wb")) == NULL) + if ( (fp = fopen(fname, "wb")) == NULL) { KLTError("(ppmWriteFileRGB) Can't open file named '%s' for writing\n", fname); + exit(1); + } /* Write to file */ ppmWrite(fp, redimg, greenimg, blueimg, ncols, nrows); diff --git a/rtengine/klt/pyramid.cc b/rtengine/klt/pyramid.cc index fc3809854..e8b9f47ec 100644 --- a/rtengine/klt/pyramid.cc +++ b/rtengine/klt/pyramid.cc @@ -34,15 +34,19 @@ _KLT_Pyramid _KLTCreatePyramid( int i; if (subsampling != 2 && subsampling != 4 && - subsampling != 8 && subsampling != 16 && subsampling != 32) + subsampling != 8 && subsampling != 16 && subsampling != 32) { KLTError("(_KLTCreatePyramid) Pyramid's subsampling must " "be either 2, 4, 8, 16, or 32"); + exit(1); + } /* Allocate memory for structure and set parameters */ pyramid = (_KLT_Pyramid) malloc(nbytes); - if (pyramid == NULL) + if (pyramid == NULL) { KLTError("(_KLTCreatePyramid) Out of memory"); + exit(1); + } /* Set parameters */ pyramid->subsampling = subsampling; @@ -98,9 +102,11 @@ void _KLTComputePyramid( int i, x, y; if (subsampling != 2 && subsampling != 4 && - subsampling != 8 && subsampling != 16 && subsampling != 32) + subsampling != 8 && subsampling != 16 && subsampling != 32) { KLTError("(_KLTComputePyramid) Pyramid's subsampling must " "be either 2, 4, 8, 16, or 32"); + exit(1); + } assert(pyramid->ncols[0] == img->ncols); assert(pyramid->nrows[0] == img->nrows); diff --git a/rtengine/klt/storeFeatures.cc b/rtengine/klt/storeFeatures.cc index 467905b50..149cc90d4 100644 --- a/rtengine/klt/storeFeatures.cc +++ b/rtengine/klt/storeFeatures.cc @@ -3,6 +3,8 @@ * *********************************************************************/ +#include + /* Our includes */ #include "error.h" #include "klt.h" @@ -19,13 +21,17 @@ void KLTStoreFeatureList( { int feat; - if (frame < 0 || frame >= ft->nFrames) + if (frame < 0 || frame >= ft->nFrames) { KLTError("(KLTStoreFeatures) Frame number %d is not between 0 and %d", frame, ft->nFrames - 1); + exit(1); + } - if (fl->nFeatures != ft->nFeatures) + if (fl->nFeatures != ft->nFeatures) { KLTError("(KLTStoreFeatures) FeatureList and FeatureTable must " "have the same number of features"); + exit(1); + } for (feat = 0 ; feat < fl->nFeatures ; feat++) { ft->feature[feat][frame]->x = fl->feature[feat]->x; @@ -46,13 +52,17 @@ void KLTExtractFeatureList( { int feat; - if (frame < 0 || frame >= ft->nFrames) + if (frame < 0 || frame >= ft->nFrames) { KLTError("(KLTExtractFeatures) Frame number %d is not between 0 and %d", frame, ft->nFrames - 1); + exit(1); + } - if (fl->nFeatures != ft->nFeatures) + if (fl->nFeatures != ft->nFeatures) { KLTError("(KLTExtractFeatures) FeatureList and FeatureTable must " "have the same number of features"); + exit(1); + } for (feat = 0 ; feat < fl->nFeatures ; feat++) { fl->feature[feat]->x = ft->feature[feat][frame]->x; @@ -73,13 +83,17 @@ void KLTStoreFeatureHistory( { int frame; - if (feat < 0 || feat >= ft->nFeatures) + if (feat < 0 || feat >= ft->nFeatures) { KLTError("(KLTStoreFeatureHistory) Feature number %d is not between 0 and %d", feat, ft->nFeatures - 1); + exit(1); + } - if (fh->nFrames != ft->nFrames) + if (fh->nFrames != ft->nFrames) { KLTError("(KLTStoreFeatureHistory) FeatureHistory and FeatureTable must " "have the same number of frames"); + exit(1); + } for (frame = 0 ; frame < fh->nFrames ; frame++) { ft->feature[feat][frame]->x = fh->feature[frame]->x; @@ -100,13 +114,17 @@ void KLTExtractFeatureHistory( { int frame; - if (feat < 0 || feat >= ft->nFeatures) + if (feat < 0 || feat >= ft->nFeatures) { KLTError("(KLTExtractFeatureHistory) Feature number %d is not between 0 and %d", feat, ft->nFeatures - 1); + exit(1); + } - if (fh->nFrames != ft->nFrames) + if (fh->nFrames != ft->nFrames) { KLTError("(KLTExtractFeatureHistory) FeatureHistory and FeatureTable must " "have the same number of frames"); + exit(1); + } for (frame = 0 ; frame < fh->nFrames ; frame++) { fh->feature[frame]->x = ft->feature[feat][frame]->x; diff --git a/rtengine/klt/trackFeatures.cc b/rtengine/klt/trackFeatures.cc index 90352129c..4c9b063fa 100644 --- a/rtengine/klt/trackFeatures.cc +++ b/rtengine/klt/trackFeatures.cc @@ -318,7 +318,10 @@ static _FloatWindow _allocateFloatWindow( _FloatWindow fw; fw = (_FloatWindow) malloc(width*height*sizeof(float)); - if (fw == NULL) KLTError("(_allocateFloatWindow) Out of memory."); + if (fw == NULL) { + KLTError("(_allocateFloatWindow) Out of memory."); + exit(1); + } return fw; } @@ -578,7 +581,12 @@ static int _am_gauss_jordan_elimination(float **a, int n, float **b, int m) } indxr[i]=row; indxc[i]=col; - if (a[col][col] == 0.0) return KLT_SMALL_DET; + if (a[col][col] == 0.0) { + free(ipiv); + free(indxr); + free(indxc); + return KLT_SMALL_DET; + } pivinv=1.0f/a[col][col]; a[col][col]=1.0; for (l=0;lpyramid_last; pyramid1_gradx = (_KLT_Pyramid) tc->pyramid_last_gradx; pyramid1_grady = (_KLT_Pyramid) tc->pyramid_last_grady; - if (pyramid1->ncols[0] != ncols || pyramid1->nrows[0] != nrows) + if (pyramid1->ncols[0] != ncols || pyramid1->nrows[0] != nrows) { KLTError("(KLTTrackFeatures) Size of incoming image (%d by %d) " "is different from size of previous image (%d by %d)\n", ncols, nrows, pyramid1->ncols[0], pyramid1->nrows[0]); + exit(1); + } assert(pyramid1_gradx != NULL); assert(pyramid1_grady != NULL); } else { diff --git a/rtengine/klt/writeFeatures.cc b/rtengine/klt/writeFeatures.cc index 79aba6229..e0be198fc 100644 --- a/rtengine/klt/writeFeatures.cc +++ b/rtengine/klt/writeFeatures.cc @@ -17,6 +17,8 @@ #include "pnmio.h" /* ppmWriteFileRGB() */ #include "klt.h" +using namespace std; + #define BINHEADERLENGTH 6 extern int KLT_verbose; @@ -54,8 +56,10 @@ void KLTWriteFeatureListToPPM( redimg = (uchar *) malloc(nbytes); grnimg = (uchar *) malloc(nbytes); bluimg = (uchar *) malloc(nbytes); - if (redimg == NULL || grnimg == NULL || bluimg == NULL) + if (redimg == NULL || grnimg == NULL || bluimg == NULL) { KLTError("(KLTWriteFeaturesToPPM) Out of memory\n"); + exit(1); + } /* Copy grey image to component images */ if (sizeof(KLT_PixelType) != 1) @@ -102,16 +106,22 @@ static FILE* _printSetupTxt( /* Either open file or use stderr */ if (fname == NULL) fp = stderr; else fp = fopen(fname, "wb"); - if (fp == NULL) + if (fp == NULL) { KLTError("(KLTWriteFeatures) " "Can't open file '%s' for writing\n", fname); + exit(1); + } /* Parse format */ - if (fmt[0] != '%') + if (fmt[0] != '%') { KLTError("(KLTWriteFeatures) Bad Format: %s\n", fmt); + exit(1); + } i = 0; while (fmt[i] != '\0') i++; *type = fmt[i-1]; - if (*type != 'f' && *type != 'd') + if (*type != 'f' && *type != 'd') { KLTError("(KLTWriteFeatures) Format must end in 'f' or 'd'."); + exit(1); + } /* Construct feature format */ sprintf(format, "(%s,%s)=%%%dd ", fmt, fmt, val_width); @@ -124,12 +134,16 @@ static FILE* _printSetupBin( char *fname) /* Input: filename */ { FILE *fp; - if (fname == NULL) + if (fname == NULL) { KLTError("(KLTWriteFeatures) Can't write binary data to stderr"); + exit(1); + } fp = fopen(fname, "wb"); - if (fp == NULL) + if (fp == NULL) { KLTError("(KLTWriteFeatures) " "Can't open file '%s' for writing", fname); + exit(1); + } return fp; } @@ -193,17 +207,21 @@ static int _findStringWidth( i += 2; while (!_isCharInString(str[i], "diouxefgn")) { i++; - if (i > maxi) + if (i > maxi) { KLTError("(_findStringWidth) Can't determine length " "of string '%s'", str); + exit(1); + } } i++; } else if (str[i+1] == 'c') { width++; i += 2; - } else + } else { KLTError("(_findStringWidth) Can't determine length " "of string '%s'", str); + exit(1); + } } else { i++; width++; @@ -483,9 +501,11 @@ static structureType _readHeader( /* Skip comments until warning line */ while (strcmp(line, warning_line) != 0) { fgets(line, LINELENGTH, fp); - if (feof(fp)) + if (feof(fp)) { KLTError("(_readFeatures) File is corrupted -- Couldn't find line:\n" "\t%s\n", warning_line); + exit(1); + } } /* Read 'Feature List', 'Feature History', or 'Feature Table' */ @@ -495,9 +515,11 @@ static structureType _readHeader( if (strcmp(line, "KLT Feature List\n") == 0) id = FEATURE_LIST; else if (strcmp(line, "KLT Feature History\n") == 0) id = FEATURE_HISTORY; else if (strcmp(line, "KLT Feature Table\n") == 0) id = FEATURE_TABLE; - else + else { KLTError("(_readFeatures) File is corrupted -- (Not 'KLT Feature List', " "'KLT Feature History', or 'KLT Feature Table')"); + exit(1); + } /* If there's an incompatibility between the type of file */ /* and the parameters passed, exit now before we attempt */ @@ -513,33 +535,45 @@ static structureType _readHeader( while (fgetc(fp) != '\n'); fscanf(fp, "%s", line); if (id == FEATURE_LIST) { - if (strcmp(line, "nFeatures") != 0) + if (strcmp(line, "nFeatures") != 0) { KLTError("(_readFeatures) File is corrupted -- " "(Expected 'nFeatures', found '%s' instead)", line); - } else if (strcmp(line, "nFrames") != 0) + exit(1); + } + } else if (strcmp(line, "nFrames") != 0) { KLTError("(_readFeatures) File is corrupted -- " "(Expected 'nFrames', found '%s' instead)", line); + exit(1); + } fscanf(fp, "%s", line); - if (strcmp(line, "=") != 0) + if (strcmp(line, "=") != 0) { KLTError("(_readFeatures) File is corrupted -- " "(Expected '=', found '%s' instead)", line); + exit(1); + } if (id == FEATURE_LIST) fscanf(fp, "%d", nFeatures); else fscanf(fp, "%d", nFrames); /* If 'Feature Table', then also get nFeatures */ if (id == FEATURE_TABLE) { fscanf(fp, "%s", line); - if (strcmp(line, ",") != 0) + if (strcmp(line, ",") != 0) { KLTError("(_readFeatures) File '%s' is corrupted -- " "(Expected 'comma', found '%s' instead)", line); + exit(1); + } fscanf(fp, "%s", line); - if (strcmp(line, "nFeatures") != 0) + if (strcmp(line, "nFeatures") != 0) { KLTError("(_readFeatures) File '%s' is corrupted -- " "(2 Expected 'nFeatures ', found '%s' instead)", line); + exit(1); + } fscanf(fp, "%s", line); - if (strcmp(line, "=") != 0) + if (strcmp(line, "=") != 0) { KLTError("(_readFeatures) File '%s' is corrupted -- " "(2 Expected '= ', found '%s' instead)", line); + exit(1); + } fscanf(fp, "%d", nFeatures); } @@ -593,14 +627,19 @@ KLT_FeatureList KLTReadFeatureList( int i; fp = fopen(fname, "rb"); - if (fp == NULL) KLTError("(KLTReadFeatureList) Can't open file '%s' " + if (fp == NULL) { + KLTError("(KLTReadFeatureList) Can't open file '%s' " "for reading", fname); + exit(1); + } if (KLT_verbose >= 1) fprintf(stderr, "(KLT) Reading feature list from '%s'\n", fname); id = _readHeader(fp, NULL, &nFeatures, &binary); - if (id != FEATURE_LIST) + if (id != FEATURE_LIST) { KLTError("(KLTReadFeatureList) File '%s' does not contain " "a FeatureList", fname); + exit(1); + } if (fl_in == NULL) { fl = KLTCreateFeatureList(nFeatures); @@ -608,17 +647,22 @@ KLT_FeatureList KLTReadFeatureList( } else { fl = fl_in; - if (fl->nFeatures != nFeatures) + if (fl->nFeatures != nFeatures) { KLTError("(KLTReadFeatureList) The feature list passed " "does not contain the same number of features as " "the feature list in file '%s' ", fname); + exit(1); + } } if (!binary) { /* text file */ for (i = 0 ; i < fl->nFeatures ; i++) { fscanf(fp, "%d |", &indx); - if (indx != i) KLTError("(KLTReadFeatureList) Bad index at i = %d" + if (indx != i) { + KLTError("(KLTReadFeatureList) Bad index at i = %d" "-- %d", i, indx); + exit(1); + } _readFeatureTxt(fp, fl->feature[i]); } } else { /* binary file */ @@ -646,12 +690,18 @@ KLT_FeatureHistory KLTReadFeatureHistory( int i; fp = fopen(fname, "rb"); - if (fp == NULL) KLTError("(KLTReadFeatureHistory) Can't open file '%s' " + if (fp == NULL) { + KLTError("(KLTReadFeatureHistory) Can't open file '%s' " "for reading", fname); + exit(1); + } if (KLT_verbose >= 1) fprintf(stderr, "(KLT) Reading feature history from '%s'\n", fname); id = _readHeader(fp, &nFrames, NULL, &binary); - if (id != FEATURE_HISTORY) KLTError("(KLTReadFeatureHistory) File '%s' does not contain " + if (id != FEATURE_HISTORY) { + KLTError("(KLTReadFeatureHistory) File '%s' does not contain " "a FeatureHistory", fname); + exit(1); + } if (fh_in == NULL) { fh = KLTCreateFeatureHistory(nFrames); @@ -659,18 +709,22 @@ KLT_FeatureHistory KLTReadFeatureHistory( } else { fh = fh_in; - if (fh->nFrames != nFrames) + if (fh->nFrames != nFrames) { KLTError("(KLTReadFeatureHistory) The feature history passed " "does not contain the same number of frames as " "the feature history in file '%s' ", fname); + exit(1); + } } if (!binary) { /* text file */ for (i = 0 ; i < fh->nFrames ; i++) { fscanf(fp, "%d |", &indx); - if (indx != i) + if (indx != i) { KLTError("(KLTReadFeatureHistory) Bad index at i = %d" "-- %d", i, indx); + exit(1); + } _readFeatureTxt(fp, fh->feature[i]); } } else { /* binary file */ @@ -699,12 +753,18 @@ KLT_FeatureTable KLTReadFeatureTable( int i, j; fp = fopen(fname, "rb"); - if (fp == NULL) KLTError("(KLTReadFeatureTable) Can't open file '%s' " + if (fp == NULL) { + KLTError("(KLTReadFeatureTable) Can't open file '%s' " "for reading", fname); + exit(1); + } if (KLT_verbose >= 1) fprintf(stderr, "(KLT) Reading feature table from '%s'\n", fname); id = _readHeader(fp, &nFrames, &nFeatures, &binary); - if (id != FEATURE_TABLE) KLTError("(KLTReadFeatureTable) File '%s' does not contain " + if (id != FEATURE_TABLE) { + KLTError("(KLTReadFeatureTable) File '%s' does not contain " "a FeatureTable", fname); + exit(1); + } if (ft_in == NULL) { ft = KLTCreateFeatureTable(nFrames, nFeatures); @@ -714,18 +774,22 @@ KLT_FeatureTable KLTReadFeatureTable( else { ft = ft_in; - if (ft->nFrames != nFrames || ft->nFeatures != nFeatures) + if (ft->nFrames != nFrames || ft->nFeatures != nFeatures) { KLTError("(KLTReadFeatureTable) The feature table passed " "does not contain the same number of frames and " "features as the feature table in file '%s' ", fname); + exit(1); + } } if (!binary) { /* text file */ for (j = 0 ; j < ft->nFeatures ; j++) { fscanf(fp, "%d |", &indx); - if (indx != j) + if (indx != j) { KLTError("(KLTReadFeatureTable) Bad index at j = %d" "-- %d", j, indx); + exit(1); + } for (i = 0 ; i < ft->nFrames ; i++) _readFeatureTxt(fp, ft->feature[j][i]); } diff --git a/rtengine/myfile.cc b/rtengine/myfile.cc index bc3f93d37..e79dc4f1b 100644 --- a/rtengine/myfile.cc +++ b/rtengine/myfile.cc @@ -126,6 +126,7 @@ IMFILE* fopen (const char* fname) while (ret == BZ_OK) { buffer = static_cast( realloc(buffer, buffer_size)); // allocate/resize buffer + if (!buffer) free(buffer); stream.next_out = buffer + buffer_out_count; // output data adress stream.avail_out = buffer_size - buffer_out_count; @@ -238,6 +239,7 @@ IMFILE* gfopen (const char* fname) { while (ret == BZ_OK) { buffer = static_cast( realloc(buffer, buffer_size)); // allocate/resize buffer + if (!buffer) free(buffer); stream.next_out = buffer + buffer_out_count; // output data adress stream.avail_out = buffer_size - buffer_out_count; diff --git a/rtengine/rawimage.cc b/rtengine/rawimage.cc index 3352da938..4bab16460 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 ) -:allocation(NULL) -,data(NULL) -,profile_data(NULL) -,filename(name) +:data(NULL) ,prefilters(0) +,filename(name) +,profile_data(NULL) +,allocation(NULL) { } diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 5413c928e..61513bcf7 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -77,13 +77,13 @@ PIX_SORT(p[1],p[2]) ; median=p[2] ;} RawImageSource::RawImageSource () :ImageSource() ,plistener(NULL) +,border(4) +,ri(NULL) +,cache(NULL) +,rawData(NULL) ,green(NULL) ,red(NULL) ,blue(NULL) -,cache(NULL) -,border(4) -,rawData(NULL) -,ri(NULL) { hrmap[0] = NULL; hrmap[1] = NULL; @@ -965,7 +965,7 @@ void RawImageSource::preprocess (const RAWParams &raw) Glib::ustring newDF = raw.dark_frame; RawImage *rid=NULL; if (!raw.df_autoselect) { - if( raw.dark_frame.size()>0) + if( !raw.dark_frame.empty()) rid = dfm.searchDarkFrame( raw.dark_frame ); } else { rid = dfm.searchDarkFrame( ri->get_maker(), ri->get_model(), ri->get_ISOspeed(), ri->get_shutter(), ri->get_timestamp()); @@ -979,7 +979,7 @@ void RawImageSource::preprocess (const RAWParams &raw) Glib::ustring newFF = raw.ff_file; RawImage *rif=NULL; if (!raw.ff_AutoSelect) { - if( raw.ff_file.size()>0) + if( !raw.ff_file.empty()) rif = ffm.searchFlatField( raw.ff_file ); } else { rif = ffm.searchFlatField( idata->getMake(), idata->getModel(),idata->getLens(),idata->getFocalLen(), idata->getFNumber(), idata->getDateTimeAsTS()); @@ -1008,11 +1008,11 @@ void RawImageSource::preprocess (const RAWParams &raw) bp = 0; if( raw.df_autoselect ){ bp = dfm.getHotPixels( ri->get_maker(), ri->get_model(), ri->get_ISOspeed(), ri->get_shutter(), ri->get_timestamp()); - }else if( raw.dark_frame.size()>0 ) + }else if( !raw.dark_frame.empty() ) bp = dfm.getHotPixels( raw.dark_frame ); if(bp){ totBP+=bitmapBads.set( *bp ); - if( settings->verbose && bp->size()>0){ + if( settings->verbose && !bp->empty()){ std::cout << "Correcting " << bp->size() << " hotpixels from darkframe" << std::endl; } } @@ -1037,7 +1037,7 @@ void RawImageSource::preprocess (const RAWParams &raw) cfaCleanFromMap( bitmapBads ); // check if it is an olympus E camera, if yes, compute G channel pre-compensation factors - if ( raw.greenthresh || (((idata->getMake().size()>=7 && idata->getMake().substr(0,7)=="OLYMPUS" && idata->getModel()[0]=='E') || (idata->getMake().size()>=9 && idata->getMake().substr(0,7)=="Panasonic")) && raw.dmethod != RAWParams::methodstring[ RAWParams::vng4] && ri->isBayer()) ) { + if ( raw.greenthresh || (((idata->getMake().size()>=7 && idata->getMake().substr(0,7)=="OLYMPUS" && idata->getModel()[0]=='E') || (idata->getMake().size()>=9 && idata->getMake().substr(0,9)=="Panasonic")) && raw.dmethod != RAWParams::methodstring[ RAWParams::vng4] && ri->isBayer()) ) { // global correction int ng1=0, ng2=0, i=0; double avgg1=0., avgg2=0.; diff --git a/rtexif/nikonattribs.cc b/rtexif/nikonattribs.cc index fe21299c0..bd1f0e176 100644 --- a/rtexif/nikonattribs.cc +++ b/rtexif/nikonattribs.cc @@ -26,6 +26,8 @@ #include "rtexif.h" +using namespace std; + namespace rtexif { class NAISOInterpreter : public Interpreter { @@ -664,7 +666,7 @@ class NALensDataInterpreter : public Interpreter { buffer[i] ^= (cj += ci * ck++); } - if (!d100) + if (!d100) { if( ver<204 ){ ld << "ExitPupilPosition = " << (int) buffer[0] << std::endl; ld << "AFAperture = " << (int) buffer[1] << std::endl; @@ -680,6 +682,7 @@ class NALensDataInterpreter : public Interpreter { ld << "FocalLength = " << (int) buffer[7] << std::endl; ld << "EffectiveMaxAperture = " << (int) buffer[15] << std::endl; } + } for (int i=0; i<7; i++) lid << std::setw(2) << std::setfill('0') << (int)buffer[lidoffs+i] << ' '; diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc index a2a571a64..8a8ecf0f6 100644 --- a/rtexif/rtexif.cc +++ b/rtexif/rtexif.cc @@ -27,6 +27,8 @@ #include "rtexif.h" +using namespace std; + namespace rtexif { StdInterpreter stdInterpreter; @@ -302,7 +304,6 @@ void TagDirectory::applyChange (std::string name, std::string value) { else { // try to find it std::string::size_type dp1 = fseg.find_first_of ('['); - std::string::size_type dp2 = fseg.find_first_of (']'); std::string basename = fseg.substr (0,dp1); Tag* t = NULL; int dirnum = -1; @@ -405,7 +406,7 @@ Tag::Tag (TagDirectory* p, FILE* f, int base) keep = false; // filter out invalid tags - if ((int)type<1 || (int)type>14 || count>900000 || count<0) { + if ((int)type<1 || (int)type>14 || count>900000) { type = INVALID; return; } @@ -845,6 +846,7 @@ void Tag::toString (char* buffer, int ofs) { case SRATIONAL: case RATIONAL: sprintf (b, "%d/%d", (int)sget4 (value+8*i+ofs, getOrder()), (int)sget4 (value+8*i+ofs+4, getOrder())); break; case FLOAT: sprintf (b, "%g", toDouble(8*i+ofs)); break; + default: break; } } if (count > maxcount) @@ -1356,7 +1358,6 @@ TagDirectory* ExifManager::parseJPEG (FILE* f) { fread (&c, 1, 1, f); const char exifid[] = "Exif\0\0"; char idbuff[8]; - bool success = false; int tiffbase = -1; while (fread (&c, 1, 1, f)) { if (c!=markerl) continue; diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index fd97a2431..72d949981 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -335,7 +335,7 @@ void BatchQueue::selectAll () { } void BatchQueue::startProcessing () { - if (!processing && fd.size()>0) { + if (!processing && !fd.empty()) { BatchQueueEntry* next; { @@ -421,7 +421,7 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) { fd.erase (fd.begin()); // return next job - if (fd.size()==0) { + if (fd.empty()) { queueEmptied=true; } else if (listener && listener->canStartNext ()) { @@ -442,7 +442,7 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) { if (saveBatchQueue( )) { safe_g_remove( processedParams ); // Delete all files in directory \batch when finished, just to be sure to remove zombies - if( fd.size()==0 ){ + if( fd.empty() ){ std::vector names; Glib::ustring batchdir = options.rtdir+"/batch/"; Glib::RefPtr dir = Gio::File::create_for_path (batchdir); diff --git a/rtgui/batchqueue.h b/rtgui/batchqueue.h index c0191118b..73d3de48f 100644 --- a/rtgui/batchqueue.h +++ b/rtgui/batchqueue.h @@ -69,7 +69,7 @@ class BatchQueue : public ThumbBrowserBase, void startProcessing (); - bool hasJobs () { return fd.size()>0; } + bool hasJobs () { return (!fd.empty()); } rtengine::ProcessingJob* imageReady (rtengine::IImage16* img); void setProgress (double p); diff --git a/rtgui/batchtoolpanelcoord.cc b/rtgui/batchtoolpanelcoord.cc index 3101f2e03..98da9a8a9 100644 --- a/rtgui/batchtoolpanelcoord.cc +++ b/rtgui/batchtoolpanelcoord.cc @@ -99,7 +99,7 @@ void BatchToolPanelCoordinator::initSession () { crop->setDimensions (100000, 100000); -/* if (selected.size()>0) { +/* if (!selected.empty()) { pparams = selected[0]->getProcParams (); for (int i=0; isetDefaults (&pparams, &pparamsEdited); @@ -110,7 +110,7 @@ void BatchToolPanelCoordinator::initSession () { } */ - if (selected.size()>0) { + if (!selected.empty()) { // The first selected image (in the thumbnail list, not the click list) is used to populate the EditorPanel and set the default values pparams = selected[0]->getProcParams (); @@ -234,7 +234,7 @@ void BatchToolPanelCoordinator::initSession () { void BatchToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const Glib::ustring& descr) { - if (selected.size()==0) + if (selected.empty()) return; somethingChanged = true; @@ -280,13 +280,13 @@ void BatchToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const G void BatchToolPanelCoordinator::getAutoWB (double& temp, double& green) { - if (selected.size()>0) + if (!selected.empty()) selected[0]->getAutoWB (temp, green); } void BatchToolPanelCoordinator::getCamWB (double& temp, double& green) { - if (selected.size()>0) + if (!selected.empty()) selected[0]->getCamWB (temp, green); } diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index b426debd8..e2054f3dd 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -50,11 +50,11 @@ ZoomStep zoomSteps[] = {{" 10%", 0.1, 10}, #define ZOOM11INDEX 7 CropWindow::CropWindow (ImageArea* parent, rtengine::StagedImageProcessor* ipc_, bool isLowUpdatePriority_) - : onResizeArea(false), deleted(false), fitZoomEnabled(true), fitZoom(false), + : onResizeArea(false), deleted(false), fitZoomEnabled(true), fitZoom(false), isLowUpdatePriority(isLowUpdatePriority_), backColor(options.bgcolor), decorated(true), titleHeight(30), sideBorderWidth(3), lowerBorderWidth(3), upperBorderWidth(1), sepWidth(2), xpos(30), ypos(30), imgX(0), imgY(0), imgW(1), imgH(1), iarea(parent), - cropZoom(0), cropgl(NULL), pmlistener(NULL), observedCropWin(NULL), isLowUpdatePriority(isLowUpdatePriority_) { + cropZoom(0), cropgl(NULL), pmlistener(NULL), observedCropWin(NULL) { Glib::RefPtr context = parent->get_pango_context () ; Pango::FontDescription fontd = context->get_font_description (); diff --git a/rtgui/curveeditorgroup.cc b/rtgui/curveeditorgroup.cc index d47e6653a..17b8b2b18 100644 --- a/rtgui/curveeditorgroup.cc +++ b/rtgui/curveeditorgroup.cc @@ -234,7 +234,7 @@ void CurveEditorGroup::updateGUI (CurveEditor* ce) { * Called from the outside to set the curve type & values */ void CurveEditorGroup::setCurveExternal (CurveEditor* ce, const std::vector& c) { - if (c.size()) { + if (!c.empty()) { ce->subGroup->storeCurveValues(ce, c); // The new curve is saved in the CurveEditor (ce)->selected = c[0]; // We set the selected curve type in the CurveEditor to the one of the specified curve } diff --git a/rtgui/diagonalcurveeditorsubgroup.cc b/rtgui/diagonalcurveeditorsubgroup.cc index a018ae40f..2a678fb90 100644 --- a/rtgui/diagonalcurveeditorsubgroup.cc +++ b/rtgui/diagonalcurveeditorsubgroup.cc @@ -501,7 +501,7 @@ void DiagonalCurveEditorSubGroup::restoreDisplayedHistogram() { } void DiagonalCurveEditorSubGroup::storeCurveValues (CurveEditor* ce, const std::vector& p) { - if (p.size()) { + if (!p.empty()) { DiagonalCurveType t = (DiagonalCurveType)p[0]; for (int i=0; i<(int)p.size(); i++) diff --git a/rtgui/dirbrowser.cc b/rtgui/dirbrowser.cc index 196c74cc6..ab1604ef2 100644 --- a/rtgui/dirbrowser.cc +++ b/rtgui/dirbrowser.cc @@ -204,7 +204,7 @@ void DirBrowser::row_expanded (const Gtk::TreeModel::iterator& iter, const Gtk:: safe_build_subdir_list (dir, subDirs, options.fbShowHidden); - if (subDirs.size() == 0) + if (subDirs.empty()) dirtree->collapse_row (path); else { diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 9611c06b5..c758a1797 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -31,7 +31,7 @@ using namespace rtengine::procparams; EditorPanel::EditorPanel (FilePanel* filePanel) - : beforePreviewHandler(NULL), beforeIarea(NULL), parent(NULL), beforeIpc(NULL), ipc(NULL), catalogPane(NULL), isProcessing(false) { + : beforePreviewHandler(NULL), beforeIarea(NULL), parent(NULL), ipc(NULL), beforeIpc(NULL), isProcessing(false), catalogPane(NULL) { epih = new EditorPanelIdleHelper; epih->epanel = this; diff --git a/rtgui/editwindow.cc b/rtgui/editwindow.cc index fe9b0f60b..f87e9e80f 100644 --- a/rtgui/editwindow.cc +++ b/rtgui/editwindow.cc @@ -20,7 +20,7 @@ #include "preferences.h" #include "cursormanager.h" #include "rtwindow.h" -#include +#include #include "rtimage.h" static EditWindow* editWnd = NULL; diff --git a/rtgui/exifpanel.cc b/rtgui/exifpanel.cc index 7ea5f4b46..4bc333a71 100644 --- a/rtgui/exifpanel.cc +++ b/rtgui/exifpanel.cc @@ -227,7 +227,7 @@ void ExifPanel::exifSelectionChanged () { keep->set_sensitive (0); reset->set_sensitive (0); } - else if (iter->children().size()>0) { + else if (!iter->children().empty()) { remove->set_sensitive (1); keep->set_sensitive (1); reset->set_sensitive (1); @@ -553,7 +553,7 @@ void ExifPanel::row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewCo Gtk::TreeModel::iterator iter = exifTreeModel->get_iter (path); if (iter) { - if (iter->children().size()>0) + if (!iter->children().empty()) if (exifTree->row_expanded (path)) exifTree->collapse_row (path); else diff --git a/rtgui/filebrowser.cc b/rtgui/filebrowser.cc index 45626c118..93d7bb987 100644 --- a/rtgui/filebrowser.cc +++ b/rtgui/filebrowser.cc @@ -235,7 +235,7 @@ void FileBrowser::rightClicked (ThumbBrowserEntryBase* entry) { pasteprof->set_sensitive (clipboard.hasProcParams()); partpasteprof->set_sensitive (clipboard.hasProcParams()); copyprof->set_sensitive (selected.size()==1); - clearprof->set_sensitive (selected.size()>0); + clearprof->set_sensitive (!selected.empty()); // submenu applmenu int p = 0; @@ -446,7 +446,7 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) { for (int i=0; ithumbnail->setProcParams(pp,FILEBROWSER,false); } }else if (m==selectDF){ - if( mselected.size() > 0 ){ + if( !mselected.empty() ){ rtengine::procparams::ProcParams pp=mselected[0]->thumbnail->getProcParams(); Gtk::FileChooserDialog fc("Dark Frame",Gtk::FILE_CHOOSER_ACTION_OPEN ); fc.add_button( Gtk::StockID("gtk-cancel"), Gtk::RESPONSE_CANCEL); @@ -530,7 +530,7 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) { } } }else if( m==thisIsDF){ - if( options.rtSettings.darkFramesPath.size() >0 && Gio::File::create_for_path(options.rtSettings.darkFramesPath)->query_exists() ){ + if( !options.rtSettings.darkFramesPath.empty() && Gio::File::create_for_path(options.rtSettings.darkFramesPath)->query_exists() ){ for (int i=0; i file = Gio::File::create_for_path ( mselected[i]->filename ); if( !file )continue; @@ -551,7 +551,7 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) { } } else if (m==selectFF){ - if( mselected.size() > 0 ){ + if( !mselected.empty() ){ rtengine::procparams::ProcParams pp=mselected[0]->thumbnail->getProcParams(); Gtk::FileChooserDialog fc("Flat Field",Gtk::FILE_CHOOSER_ACTION_OPEN ); fc.add_button( Gtk::StockID("gtk-cancel"), Gtk::RESPONSE_CANCEL); @@ -571,7 +571,7 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) { } } else if( m==thisIsFF){ - if( options.rtSettings.flatFieldsPath.size() >0 && Gio::File::create_for_path(options.rtSettings.flatFieldsPath)->query_exists() ){ + if( !options.rtSettings.flatFieldsPath.empty() && Gio::File::create_for_path(options.rtSettings.flatFieldsPath)->query_exists() ){ for (int i=0; i file = Gio::File::create_for_path ( mselected[i]->filename ); if( !file )continue; @@ -625,7 +625,7 @@ void FileBrowser::pasteProfile () { for (int i=0; i0) { + if (pparams && !selected.empty()) { for (int i=0; ithumbnail->setProcParams (*pparams, FILEBROWSER); queue_draw (); @@ -730,7 +730,7 @@ void FileBrowser::applyMenuItemActivated (Glib::ustring ppname) { void FileBrowser::applyPartialMenuItemActivated (Glib::ustring ppname) { - if (!tbl || selected.size()==0) + if (!tbl || selected.empty()) return; rtengine::procparams::ProcParams* pparams = profileStore.getProfile (ppname); @@ -801,7 +801,7 @@ bool FileBrowser::checkFilter (ThumbBrowserEntryBase* entryb) { // true -> entry return false; // return false is query is not satisfied - if (filter.queryFileName.size()>0){ + if (!filter.queryFileName.empty()){ // check if image's FileName contains queryFileName (case insensitive) // TODO should we provide case-sensitive search option via preferences? Glib::ustring FileName; @@ -945,7 +945,7 @@ void FileBrowser::openNextImage () { Glib::RWLock::ReaderLock l(entryRW); #endif - if (fd.size()>0) { + if (!fd.empty()) { for (int i=fd.size()-1; i>=0; i--) if (editedFiles.find (fd[i]->filename)!=editedFiles.end()) if (i0) { + if (!fd.empty()) { for (int i=0; ifilename)!=editedFiles.end()) if (i>0 && tbl) { diff --git a/rtgui/filecatalog.cc b/rtgui/filecatalog.cc index d9d58215f..1707d662e 100644 --- a/rtgui/filecatalog.cc +++ b/rtgui/filecatalog.cc @@ -38,17 +38,17 @@ extern Glib::ustring argv0; FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel) : + filepanel(filepanel), selectedDirectoryId(1), listener(NULL), fslistener(NULL), dirlistener(NULL), hasValidCurrentEFS(false), filterPanel(NULL), - coarsePanel(cp), - toolBar(tb), - filepanel(filepanel), previewsToLoad(0), - previewsLoaded(0) + previewsLoaded(0), + coarsePanel(cp), + toolBar(tb) { inTabMode=false; @@ -708,7 +708,7 @@ void FileCatalog::openRequested (std::vector tmb) { void FileCatalog::deleteRequested (std::vector tbe, bool inclBatchProcessed) { - if (tbe.size()==0) + if (tbe.empty()) return; Gtk::MessageDialog msd (M("FILEBROWSER_DELETEDLGLABEL"), false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO, true); @@ -748,7 +748,7 @@ void FileCatalog::deleteRequested (std::vector tbe, bool inc void FileCatalog::copyMoveRequested (std::vector tbe, bool moveRequested) { - if (tbe.size()==0) + if (tbe.empty()) return; @@ -977,7 +977,7 @@ void FileCatalog::renameRequested (std::vector tbe) { void FileCatalog::clearFromCacheRequested (std::vector tbe, bool leavenotrace) { - if (tbe.size()==0) + if (tbe.empty()) return; for (unsigned int i=0; i& p) { - if (p.size()) { + if (!p.empty()) { FlatCurveType t = (FlatCurveType)p[0]; for (int i=0; i<(int)p.size(); i++) diff --git a/rtgui/iptcpanel.cc b/rtgui/iptcpanel.cc index 282d24d48..b0d592006 100644 --- a/rtgui/iptcpanel.cc +++ b/rtgui/iptcpanel.cc @@ -339,7 +339,7 @@ IPTCPanel::IPTCPanel () { void IPTCPanel::read (const ProcParams* pp, const ParamsEdited* pedited) { disableListener (); - if (pp->iptc.size()>0) + if (!pp->iptc.empty()) changeList = pp->iptc; else changeList = embeddedData; @@ -364,7 +364,7 @@ void IPTCPanel::setImageData (const ImageMetaData* id) { else embeddedData.clear (); - file->set_sensitive (embeddedData.size() > 0); + file->set_sensitive (!embeddedData.empty()); } void IPTCPanel::notifyListener () { @@ -400,7 +400,7 @@ void IPTCPanel::addKeyWord () { void IPTCPanel::delKeyWord () { std::vector selection = keywords->get_selected (); - if (selection.size()>0) { + if (!selection.empty()) { std::vector keep; for (int i=0; isize(); i++) if (std::find (selection.begin(), selection.end(), i) == selection.end()) @@ -439,7 +439,7 @@ void IPTCPanel::addSuppCategory () { void IPTCPanel::delSuppCategory () { std::vector selection = suppCategories->get_selected (); - if (selection.size()>0) { + if (!selection.empty()) { std::vector keep; for (int i=0; isize(); i++) if (std::find (selection.begin(), selection.end(), i) == selection.end()) @@ -525,43 +525,43 @@ void IPTCPanel::applyChangeList () { suppCategory->get_entry()->set_text (""); for (int i=0; i0) + if (changeList[i].field == "Caption" && !changeList[i].values.empty()) captionText->set_text (changeList[i].values[0]); - else if (changeList[i].field == "CaptionWriter" && changeList[i].values.size()>0) + else if (changeList[i].field == "CaptionWriter" && !changeList[i].values.empty()) captionWriter->set_text (changeList[i].values[0]); - else if (changeList[i].field == "Headline" && changeList[i].values.size()>0) + else if (changeList[i].field == "Headline" && !changeList[i].values.empty()) headline->set_text (changeList[i].values[0]); - else if (changeList[i].field == "Instructions" && changeList[i].values.size()>0) + else if (changeList[i].field == "Instructions" && !changeList[i].values.empty()) instructions->set_text (changeList[i].values[0]); else if (changeList[i].field == "Keywords") for (int j=0; jappend_text (changeList[i].values[j]); - else if (changeList[i].field == "Category" && changeList[i].values.size()>0) + else if (changeList[i].field == "Category" && !changeList[i].values.empty()) category->get_entry()->set_text (changeList[i].values[0]); else if (changeList[i].field == "SupplementalCategories") for (int j=0; jappend_text (changeList[i].values[j]); - else if (changeList[i].field == "Author" && changeList[i].values.size()>0) + else if (changeList[i].field == "Author" && !changeList[i].values.empty()) author->set_text (changeList[i].values[0]); - else if (changeList[i].field == "AuthorsPosition" && changeList[i].values.size()>0) + else if (changeList[i].field == "AuthorsPosition" && !changeList[i].values.empty()) authorPos->set_text (changeList[i].values[0]); - else if (changeList[i].field == "Credit" && changeList[i].values.size()>0) + else if (changeList[i].field == "Credit" && !changeList[i].values.empty()) credit->set_text (changeList[i].values[0]); - else if (changeList[i].field == "Source" && changeList[i].values.size()>0) + else if (changeList[i].field == "Source" && !changeList[i].values.empty()) source->set_text (changeList[i].values[0]); - else if (changeList[i].field == "Copyright" && changeList[i].values.size()>0) + else if (changeList[i].field == "Copyright" && !changeList[i].values.empty()) copyright->set_text (changeList[i].values[0]); - else if (changeList[i].field == "City" && changeList[i].values.size()>0) + else if (changeList[i].field == "City" && !changeList[i].values.empty()) city->set_text (changeList[i].values[0]); - else if (changeList[i].field == "Province" && changeList[i].values.size()>0) + else if (changeList[i].field == "Province" && !changeList[i].values.empty()) province->set_text (changeList[i].values[0]); - else if (changeList[i].field == "Country" && changeList[i].values.size()>0) + else if (changeList[i].field == "Country" && !changeList[i].values.empty()) country->set_text (changeList[i].values[0]); - else if (changeList[i].field == "Title" && changeList[i].values.size()>0) + else if (changeList[i].field == "Title" && !changeList[i].values.empty()) title->set_text (changeList[i].values[0]); - else if (changeList[i].field == "DateCreated" && changeList[i].values.size()>0) + else if (changeList[i].field == "DateCreated" && !changeList[i].values.empty()) dateCreated->set_text (changeList[i].values[0]); - else if (changeList[i].field == "TransReference" && changeList[i].values.size()>0) + else if (changeList[i].field == "TransReference" && !changeList[i].values.empty()) transReference->set_text (changeList[i].values[0]); for (int i=0; i<16; i++) diff --git a/rtgui/main.cc b/rtgui/main.cc index a5ebd0028..c8a081b1d 100644 --- a/rtgui/main.cc +++ b/rtgui/main.cc @@ -296,7 +296,7 @@ int processLineParams( int argc, char **argv ) } if( !argv1.empty() ) return 1; - if( !inputFiles.size() ) + if( inputFiles.empty() ) return 2; rtengine::procparams::ProcParams params,paramsRaw,paramsImg, *currentParams; diff --git a/rtgui/mydiagonalcurve.cc b/rtgui/mydiagonalcurve.cc index 951bd58ec..7902bd2ed 100644 --- a/rtgui/mydiagonalcurve.cc +++ b/rtgui/mydiagonalcurve.cc @@ -391,7 +391,7 @@ bool MyDiagonalCurve::handleEvents (GdkEvent* event) { if (dst < src) { curve.x.erase (itx, curve.x.end()); curve.y.erase (ity, curve.y.end()); - if (!curve.x.size()) { + if (curve.x.empty()) { curve.x.push_back (0); curve.y.push_back (0); interpolate (); diff --git a/rtgui/myflatcurve.cc b/rtgui/myflatcurve.cc index cbc0953de..eab9e8bdf 100644 --- a/rtgui/myflatcurve.cc +++ b/rtgui/myflatcurve.cc @@ -651,7 +651,7 @@ bool MyFlatCurve::handleEvents (GdkEvent* event) { curve.y.erase (ity, curve.y.end()); curve.leftTangent.erase (itlt, curve.leftTangent.end()); curve.rightTangent.erase (itrt, curve.rightTangent.end()); - if (!curve.x.size()) { + if (curve.x.empty()) { curve.x.push_back (0.5); curve.y.push_back (0.5); curve.leftTangent.push_back (0.3); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 66eb60cba..ed0b87071 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -209,7 +209,7 @@ using namespace rtengine::procparams; void ParamsEdited::initFrom (const std::vector& src) { set (true); - if (src.size()==0) + if (src.empty()) return; const ProcParams& p = src[0]; diff --git a/rtgui/placesbrowser.cc b/rtgui/placesbrowser.cc index 103330752..398c3b0ce 100644 --- a/rtgui/placesbrowser.cc +++ b/rtgui/placesbrowser.cc @@ -118,7 +118,7 @@ void PlacesBrowser::refreshPlacesList () { } catch (Gio::Error&) { /* This will be thrown if the path doesn't exist */ } } - if (placesModel->children().size()>0) { + if (!placesModel->children().empty()) { Gtk::TreeModel::Row newrow = *(placesModel->append()); newrow[placesColumns.rowSeparator] = true; } @@ -127,7 +127,7 @@ void PlacesBrowser::refreshPlacesList () { std::vector > drives = vm->get_connected_drives (); for (int j=0; j > volumes = drives[j]->get_volumes (); - if (volumes.size()==0) { + if (volumes.empty()) { Gtk::TreeModel::Row newrow = *(placesModel->append()); newrow[placesColumns.label] = drives[j]->get_name (); newrow[placesColumns.icon] = drives[j]->get_icon (); @@ -200,7 +200,7 @@ void PlacesBrowser::refreshPlacesList () { } } // append favorites - if (placesModel->children().size()>0) { + if (!placesModel->children().empty()) { Gtk::TreeModel::Row newrow = *(placesModel->append()); newrow[placesColumns.rowSeparator] = true; } diff --git a/rtgui/previewwindow.cc b/rtgui/previewwindow.cc index 39b9be571..fafd6a563 100644 --- a/rtgui/previewwindow.cc +++ b/rtgui/previewwindow.cc @@ -21,7 +21,7 @@ #include "imagearea.h" #include "cursormanager.h" -PreviewWindow::PreviewWindow () : previewHandler(NULL), mainCropWin(NULL), isMoving(false), imageArea(NULL) { +PreviewWindow::PreviewWindow () : previewHandler(NULL), mainCropWin(NULL), imageArea(NULL), isMoving(false) { rconn = signal_size_allocate().connect( sigc::mem_fun(*this, &PreviewWindow::on_resized) ); } diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index 6cb011981..3a56f33a1 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -24,10 +24,10 @@ #include "whitebalance.h" RTWindow::RTWindow () -:fpanel(NULL) -,epanel(NULL) +:mainNB(NULL) ,bpanel(NULL) -,mainNB(NULL) +,epanel(NULL) +,fpanel(NULL) { cacheMgr->init (); @@ -465,7 +465,7 @@ void RTWindow::SetMainCurrent() void RTWindow::MoveFileBrowserToMain() { - if( fpanel->ribbonPane->get_children().size() ==0) + if( fpanel->ribbonPane->get_children().empty()) { FileCatalog *fCatalog = fpanel->fileCatalog; epanel->catalogPane->remove(*fCatalog); @@ -478,7 +478,7 @@ void RTWindow::MoveFileBrowserToMain() void RTWindow::MoveFileBrowserToEditor() { - if(epanel->catalogPane->get_children().size() ==0 ) + if(epanel->catalogPane->get_children().empty() ) { FileCatalog *fCatalog = fpanel->fileCatalog; fpanel->ribbonPane->remove(*fCatalog); diff --git a/rtgui/thumbbrowserbase.cc b/rtgui/thumbbrowserbase.cc index 21050c878..38e142dbd 100644 --- a/rtgui/thumbbrowserbase.cc +++ b/rtgui/thumbbrowserbase.cc @@ -327,7 +327,7 @@ void ThumbBrowserBase::buttonPressed (int x, int y, int button, GdkEventType typ doubleClicked (selected[0]); else if (button==1 && type==GDK_BUTTON_PRESS) { if (fileDescr && state & GDK_SHIFT_MASK) { - if (selected.size()==0) { + if (selected.empty()) { selected.push_back (fileDescr); fileDescr->selected = true; lastClicked = fileDescr; @@ -473,7 +473,7 @@ void ThumbBrowserBase::redraw () { void ThumbBrowserBase::zoomChanged (bool zoomIn) { - int newHeight; + int newHeight=0; int i=0; int optThumbSize=getCurrentThumbSize(); if (zoomIn) diff --git a/rtgui/thumbbrowserentrybase.cc b/rtgui/thumbbrowserentrybase.cc index 720a6765c..6d2af486a 100644 --- a/rtgui/thumbbrowserentrybase.cc +++ b/rtgui/thumbbrowserentrybase.cc @@ -125,7 +125,7 @@ void ThumbBrowserEntryBase::updateBackBuffer () { istartx += iofs_x; istarty += iofs_y; - if (bbIcons.size()>0) { + if (!bbIcons.empty()) { int iwidth = igap; int iheight = 0; for (int i=0; i