diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b07b6078..cf20be270 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,7 @@ if (APPLE) endif (APPLE) option(USE_CLANG "Build rawtherapee with clang" OFF) +option(USE_EXPERIMENTAL_LANG_VERSIONS "Build RT with -std=c++0x" OFF) option (AUTOMATED_BUILD_SYSTEM "TRUE if built by an automate" OFF) option (BUILD_SHARED "Build rawtherapee with shared libraries" OFF) @@ -309,6 +310,11 @@ if (OPTION_OMP) endif (OPENMP_FOUND) endif (OPTION_OMP) +if(USE_EXPERIMENTAL_LANG_VERSIONS) + SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu1x") + SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x") +endif (USE_EXPERIMENTAL_LANG_VERSIONS) + if(USE_CLANG) find_file(CLANG_CMD clang) find_file(CLANGPP_CMD clang++) @@ -320,14 +326,14 @@ if(USE_CLANG) message(STATUS "clang++ found: ${CLANGPP_CMD}") SET (CMAKE_C_COMPILER ${CLANG_CMD}) - SET (CMAKE_C_FLAGS "") #-Wall + SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ") #-Wall SET (CMAKE_C_FLAGS_DEBUG "-O0 -g") SET (CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG") SET (CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG") SET (CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g") SET (CMAKE_CXX_COMPILER ${CLANGPP_CMD}) - SET (CMAKE_CXX_FLAGS "") #-Wall + SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ") #-Wall SET (CMAKE_CXX_FLAGS_DEBUG "-O0 -g") SET (CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG") SET (CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") diff --git a/rtengine/EdgePreservingDecomposition.cc b/rtengine/EdgePreservingDecomposition.cc index b8d35b8f8..72bdc9820 100644 --- a/rtengine/EdgePreservingDecomposition.cc +++ b/rtengine/EdgePreservingDecomposition.cc @@ -1,5 +1,5 @@ #include -#include +#include "rt_math.h" #include "EdgePreservingDecomposition.h" diff --git a/rtengine/amaze_demosaic_RT.cc b/rtengine/amaze_demosaic_RT.cc index f99b1186a..5c4f3f7a8 100644 --- a/rtengine/amaze_demosaic_RT.cc +++ b/rtengine/amaze_demosaic_RT.cc @@ -31,8 +31,6 @@ using namespace rtengine; void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh) { -#define LIM(x,MIN,MAX) max(MIN,min(x,MAX)) -#define ULIM(x,y,z) ((y) < (z) ? LIM(x,y,z) : LIM(x,z,y)) #define HCLIP(x) x //is this still necessary??? //min(clip_pt,x) diff --git a/rtengine/bilateral2.h b/rtengine/bilateral2.h index 0066acdbe..4154387a6 100644 --- a/rtengine/bilateral2.h +++ b/rtengine/bilateral2.h @@ -22,17 +22,19 @@ #include #include #include -#include +#include +#include "rtengine.h" +#include "rt_math.h" #include "alignedbuffer.h" #include "mytime.h" #include "gauss.h" -#include + #ifdef _OPENMP #include #endif -using namespace std; +using namespace rtengine; // This seems ugly, but way faster than any other solutions I tried #define ELEM(a,b) (src[i - a][j - b] * ec[src[i - a][j - b]-src[i][j]+65536.0f]) @@ -435,9 +437,6 @@ template void bilateral (T** src, T** dst, T** buffer, int W, // START OF EXPERIMENTAL CODE: O(1) bilateral box filter // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define MAXVAL 65535.0 -#define CLIP(a) ((a)>0.0?((a) void bilateral (T** src, T** dst, int W, int H, int sigmar, do // calculate histogram at the beginning of the row rhist.clear(); - for (int x = max(0,row_from-r-1); x>TRANSBIT]++; @@ -485,10 +484,10 @@ template void bilateral (T** src, T** dst, int W, int H, int sigmar, do // substract pixels at the left and add pixels at the right if (j>r) - for (int x=max(0,i-r); x<=min(i+r,H-1); x++) + for (int x=std::max(0,i-r); x<=std::min(i+r,H-1); x++) hist[(int)(src[x][j-r-1])>>TRANSBIT]--; if (j>TRANSBIT]++; // calculate pixel value @@ -520,8 +519,6 @@ template void bilateral (T** src, T** dst, int W, int H, int sigmar, do delete [] real_buff_final; delete [] buff_final; } -#undef MAXVAL -#undef CLIP #undef BINBIT #undef TRANSBIT diff --git a/rtengine/bilateral3.h b/rtengine/bilateral3.h index f502348fe..a0a93f1bd 100644 --- a/rtengine/bilateral3.h +++ b/rtengine/bilateral3.h @@ -23,9 +23,6 @@ #include "gauss.h" -#define MAXVAL 65535.0 -#define CLIP(a) ((a)>0.0?((a)>8)+1)<<8) / ((src[i][j]>>8)+1)]) //#define ELEM(a,b) (src[i-a][j-b] * ec[src[i-a][j-b]-src[i][j]+0x10000]) //#define SULY(a,b) (ec[src[i-a][j-b]-src[i][j]+0x10000]) diff --git a/rtengine/color.cc b/rtengine/color.cc index b1eeaf2ef..a7b8be1b4 100644 --- a/rtengine/color.cc +++ b/rtengine/color.cc @@ -25,9 +25,6 @@ using namespace std; namespace rtengine { -#undef MAXVAL -#define MAXVAL 0xffff - #define eps_max 580.40756 //(MAXVAL* 216.0f/24389.0); #define kappa 903.29630 //24389.0/27.0; diff --git a/rtengine/colortemp.h b/rtengine/colortemp.h index 9a5a6c4c5..8059c367f 100644 --- a/rtengine/colortemp.h +++ b/rtengine/colortemp.h @@ -90,5 +90,5 @@ class ColorTemp { static void spectrum_to_xyz (double (*spec_intens)(double wavelength, double m1, double m2, double temp), double _m1, double _m2, double _temp, double &x, double &y, double &z); }; -}; +} #endif diff --git a/rtengine/coord2d.h b/rtengine/coord2d.h index 40066c948..fb9fd1616 100644 --- a/rtengine/coord2d.h +++ b/rtengine/coord2d.h @@ -29,5 +29,5 @@ class Coord2D { Coord2D () {} void set (double x_, double y_) { x = x_; y = y_; } }; -}; +} #endif diff --git a/rtengine/cubint.cc b/rtengine/cubint.cc index 3ba890b6f..0c65b7fcc 100644 --- a/rtengine/cubint.cc +++ b/rtengine/cubint.cc @@ -17,7 +17,6 @@ * along with RawTherapee. If not, see . */ #define A (-0.85) -//#define CLIP(a) ((a>CMAXVAL)?a=CMAXVAL:((a<0)?0:a)) inline void cubint (Imagefloat* src, int xs, int ys, double Dx, double Dy, float *r, float *g, float *b, double mul) { diff --git a/rtengine/curves.cc b/rtengine/curves.cc index 0d6dec281..e06d747c3 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -32,8 +32,8 @@ #undef CLIPD #define CLIPD(a) ((a)>0.0f?((a)<1.0f?(a):1.0f):0.0f) -#define CLIP(a) ((a)<65535 ? (a) : (65535)) +using namespace std; namespace rtengine { @@ -102,7 +102,7 @@ namespace rtengine { } fclose (f); f = fopen ("poly_x.txt", "wt"); - for (unsigned int i=0; i0?((a)0 && !filename.casefold().compare (pos, 4, ".dcp"); } \ No newline at end of file diff --git a/rtengine/dcp.h b/rtengine/dcp.h index 7ff047228..11e5af535 100644 --- a/rtengine/dcp.h +++ b/rtengine/dcp.h @@ -72,5 +72,5 @@ namespace rtengine { }; #define dcpStore DCPStore::getInstance() -}; +} #endif diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index 2a34ab281..85fb07432 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -3,7 +3,6 @@ /*RT*/#undef MAX /*RT*/#undef MIN /*RT*/#undef ABS -/*RT*/#include /*RT*/#include "rt_math.h" /*RT*/#define NO_LCMS /*RT*/#define NO_JPEG @@ -182,13 +181,11 @@ struct ph1 { #define SQR(x) rtengine::SQR(x) #define ABS(x) (((int)(x) ^ ((int)(x) >> 31)) - ((int)(x) >> 31)) -#define MIN(a,b) rtengine::min(a,b) -#define MAX(a,b) rtengine::max(a,b) -#define LIM(x,min,max) MAX(min,MIN(x,max)) -#define ULIM(x,y,z) ((y) < (z) ? LIM(x,y,z) : LIM(x,z,y)) -#define CLIP(x) LIM(x,0,65535) -#define CLIPD(x) LIM(x,0.0,65535.0) -#define CLIPF(x) LIM(x,0.0f,65535.0f) +#define MIN(a,b) rtengine::min(a,static_cast(b)) +#define MAX(a,b) rtengine::max(a,static_cast(b)) +#define LIM(x,min,max) rtengine::LIM(x,static_cast(min),static_cast(max)) +#define ULIM(x,y,z) rtengine::ULIM(x,static_cast(y),static_cast(z)) +#define CLIP(x) rtengine::CLIP(x) #define SWAP(a,b) { a=a+b; b=a-b; a=a-b; } /* @@ -1185,7 +1182,7 @@ void CLASS nikon_compressed_load_raw() else hpred[col & 1] += diff; if ((ushort)(hpred[col & 1] + min) >= max) derror(); if ((unsigned) (col-left_margin) < width) - BAYER(row,col-left_margin) = curve[LIM((short)hpred[col & 1],(short)0,(short)0x3fff)]; + BAYER(row,col-left_margin) = curve[LIM((short)hpred[col & 1],0,0x3fff)]; } } free (huff); @@ -1421,7 +1418,7 @@ void CLASS phase_one_flat_field (int is_float, int nc) c = nc > 2 ? FC(row,col) : 0; if (!(c & 1)) { c = BAYER(row,col) * mult[c]; - BAYER(row,col) = LIM(c,0u,65535u); + BAYER(row,col) = LIM(c,0,65535); } for (c=0; c < nc; c+=2) mult[c] += mult[c+1]; @@ -1465,7 +1462,7 @@ void CLASS phase_one_correct() poly[3] += (ph1.tag_210 - poly[7]) * poly[6] + 1; for (i=0; i < 0x10000; i++) { num = (poly[5]*i + poly[3])*i + poly[1]; - curve[i] = CLIPF(num); + curve[i] = LIM(num,0,65535); } goto apply; /* apply to right half */ } else if (tag == 0x41a) { /* Polynomial curve */ for (i=0; i < 4; i++) @@ -1473,7 +1470,7 @@ void CLASS phase_one_correct() for (i=0; i < 0x10000; i++) { for (num=0, j=4; j--; ) num = num * i + poly[j]; - curve[i] = CLIPF(num+i); + curve[i] = LIM(num+i,0,65535); } apply: /* apply to whole image */ for (row=0; row < height; row++) for (col = (tag & 1)*ph1.split_col; col < width; col++) @@ -3684,7 +3681,7 @@ void CLASS wavelet_denoise() hpass = lpass; } for (i=0; i < size; i++) - image[i][c] = CLIPF(SQR(fimg[i]+fimg[lpass+i])/0x10000); + image[i][c] = CLIP(SQR(fimg[i]+fimg[lpass+i])/0x10000); } if (filters && colors == 3) { /* pull G1 and G3 closer together */ for (row=0; row < 2; row++) { @@ -3710,7 +3707,7 @@ void CLASS wavelet_denoise() if (diff < -thold) diff += thold; else if (diff > thold) diff -= thold; else diff = 0; - BAYER(row,col) = CLIPD(SQR(avg+diff) + 0.5); + BAYER(row,col) = CLIP(SQR(avg+diff) + 0.5); } } } @@ -3730,8 +3727,8 @@ void CLASS scale_colors() memcpy (pre_mul, user_mul, sizeof pre_mul); if (use_auto_wb || (use_camera_wb && cam_mul[0] == -1)) { memset (dsum, 0, sizeof dsum); - bottom = MIN (greybox[1]+greybox[3], static_cast(height)); - right = MIN (greybox[0]+greybox[2], static_cast(width)); + bottom = MIN (greybox[1]+greybox[3], height); + right = MIN (greybox[0]+greybox[2], width); for (row=greybox[1]; row < bottom; row += 8) for (col=greybox[0]; col < right; col += 8) { memset (sum, 0, sizeof sum); @@ -4085,7 +4082,7 @@ void CLASS ppg_interpolate() ABS(pix[-3*d][1] - pix[-d][1]) ) * 2; } d = dir[i = diff[0] > diff[1]]; - pix[0][1] = ULIM(guess[i] >> 2, static_cast(pix[d][1]), static_cast(pix[-d][1])); + pix[0][1] = ULIM(guess[i] >> 2, pix[d][1], pix[-d][1]); } /* Calculate red and blue for each green pixel: */ for (row=1; row < height-1; row++) @@ -4158,10 +4155,10 @@ void CLASS ahd_interpolate() pix = image + row*width+col; val = ((pix[-1][1] + pix[0][c] + pix[1][1]) * 2 - pix[-2][c] - pix[2][c]) >> 2; - rgb[0][row-top][col-left][1] = ULIM(val,static_cast(pix[-1][1]),static_cast(pix[1][1])); + rgb[0][row-top][col-left][1] = ULIM(val,pix[-1][1],pix[1][1]); val = ((pix[-width][1] + pix[0][c] + pix[width][1]) * 2 - pix[-2*width][c] - pix[2*width][c]) >> 2; - rgb[1][row-top][col-left][1] = ULIM(val,static_cast(pix[-width][1]),static_cast(pix[width][1])); + rgb[1][row-top][col-left][1] = ULIM(val,pix[-width][1],pix[width][1]); } } /* Interpolate red and blue, and convert to CIELab: */ @@ -4292,7 +4289,7 @@ void CLASS blend_highlights() if (c == colors) continue; FORCC { cam[0][c] = image[row*width+col][c]; - cam[1][c] = MIN(cam[0][c],static_cast(clip)); + cam[1][c] = MIN(cam[0][c],clip); } for (i=0; i < 2; i++) { FORCC for (lab[i][c]=j=0; j < colors; j++) @@ -4791,7 +4788,7 @@ void CLASS parse_gps (int base) case 6: FORC(2) gpsdata[18+c] = get4(); break; case 18: case 29: - fgets ((char *) (gpsdata+14+tag/3), MIN(len,12u), ifp); + fgets ((char *) (gpsdata+14+tag/3), MIN(len,12), ifp); } fseek (ifp, save, SEEK_SET); } @@ -6822,16 +6819,16 @@ void CLASS adobe_coeff (const char *make, const char *model) { 5413,-1162,-365,-5665,13098,2866,-608,1179,8440 } }, { "SONY DSLR-A900", 128, 0, /* RT */ { 5715,-1433,-410,-5603,12937,2989,-644,1247,8372 } }, + { "SONY NEX-5N", 138, 0, /* RT - Colin Walker */ + { 5130,-1055,-269,-4473,11797,3050,-701,1310,7121 } }, + { "SONY NEX-C3", 128, 0, /* RT - Colin Walker */ + { 5130,-1055,-269,-4473,11797,3050,-701,1310,7121 } }, { "SONY NEX-3", 128, 0, /* RT - Colin Walker */ { 5145,-741,-123,-4915,12310,2945,-794,1489,6906 } }, { "SONY NEX-5", 128, 0, /* RT - Colin Walker */ { 5154,-716,-115,-5065,12506,2882,-988,1715,6800 } }, { "SONY NEX-7", 128, 0, { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, - { "SONY NEX-C3", 128, 0, /* RT - Colin Walker */ - { 5130,-1055,-269,-4473,11797,3050,-701,1310,7121 } }, - { "SONY NEX-5N", 138, 0, /* RT - Colin Walker */ - { 5130,-1055,-269,-4473,11797,3050,-701,1310,7121 } }, { "SONY SLT-A33", 128, 0, { 6069,-1221,-366,-5221,12779,2734,-1024,2066,6834 } }, { "SONY SLT-A35", 128, 0, @@ -7189,7 +7186,8 @@ void CLASS identify() parse_redcine(); load_raw = &CLASS redcine_load_raw; gamma_curve (1/2.4, 12.92, 1, 4095); - filters = 0x49494949; } else if (!memcmp (head,"DSC-Image",9)) + filters = 0x49494949; + } else if (!memcmp (head,"DSC-Image",9)) parse_rollei(); else if (!memcmp (head,"PWAD",4)) parse_sinar_ia(); @@ -9268,6 +9266,10 @@ cleanup: return status; } */ +/*RT*/#undef SQR /*RT*/#undef MAX /*RT*/#undef MIN /*RT*/#undef ABS +/*RT*/#undef LIM +/*RT*/#undef ULIM +/*RT*/#undef CLIP diff --git a/rtengine/dcraw.patch b/rtengine/dcraw.patch index d2a1eabf8..11df4c2bc 100644 --- a/rtengine/dcraw.patch +++ b/rtengine/dcraw.patch @@ -1,12 +1,11 @@ ---- dcraw.c 2012-04-06 17:30:26.000000000 +0400 -+++ dcraw.cc 2012-04-06 21:59:43.816583252 +0400 -@@ -1,3 +1,16 @@ +--- dcraw.c 2012-04-21 12:55:36.000000000 +0400 ++++ dcraw.cc 2012-04-21 13:11:13.000000000 +0400 +@@ -1,3 +1,15 @@ +/*RT*/#include +/*RT*/#include +/*RT*/#undef MAX +/*RT*/#undef MIN +/*RT*/#undef ABS -+/*RT*/#include +/*RT*/#include "rt_math.h" +/*RT*/#define NO_LCMS +/*RT*/#define NO_JPEG @@ -17,7 +16,7 @@ /* dcraw.c -- Dave Coffin's raw photo decoder Copyright 1997-2011 by Dave Coffin, dcoffin a cybercom o net -@@ -29,17 +42,17 @@ +@@ -29,17 +41,17 @@ #define _GNU_SOURCE #endif #define _USE_MATH_DEFINES @@ -45,7 +44,7 @@ #include #ifdef NODEPS -@@ -98,18 +111,16 @@ +@@ -98,18 +110,16 @@ #define LONG_BIT (8 * sizeof (long)) #endif @@ -69,7 +68,7 @@ FILE *ifp, *ofp; short order; const char *ifname; -@@ -137,13 +148,13 @@ +@@ -137,13 +147,13 @@ int output_color=1, output_bps=8, output_tiff=0, med_passes=0; int no_auto_bright=0; unsigned greybox[4] = { 0, 0, UINT_MAX, UINT_MAX }; @@ -86,7 +85,7 @@ void (*write_thumb)(), (*write_fun)(); void (*load_raw)(), (*thumb_load_raw)(); jmp_buf failure; -@@ -161,21 +172,23 @@ +@@ -161,21 +171,21 @@ int format, key_off, black, black_off, split_col, tag_21a; float tag_210; } ph1; @@ -105,17 +104,18 @@ #define ABS(x) (((int)(x) ^ ((int)(x) >> 31)) - ((int)(x) >> 31)) -#define MIN(a,b) ((a) < (b) ? (a) : (b)) -#define MAX(a,b) ((a) > (b) ? (a) : (b)) -+#define MIN(a,b) rtengine::min(a,b) -+#define MAX(a,b) rtengine::max(a,b) - #define LIM(x,min,max) MAX(min,MIN(x,max)) - #define ULIM(x,y,z) ((y) < (z) ? LIM(x,y,z) : LIM(x,z,y)) - #define CLIP(x) LIM(x,0,65535) -+#define CLIPD(x) LIM(x,0.0,65535.0) -+#define CLIPF(x) LIM(x,0.0f,65535.0f) +-#define LIM(x,min,max) MAX(min,MIN(x,max)) +-#define ULIM(x,y,z) ((y) < (z) ? LIM(x,y,z) : LIM(x,z,y)) +-#define CLIP(x) LIM(x,0,65535) ++#define MIN(a,b) rtengine::min(a,static_cast(b)) ++#define MAX(a,b) rtengine::max(a,static_cast(b)) ++#define LIM(x,min,max) rtengine::LIM(x,static_cast(min),static_cast(max)) ++#define ULIM(x,y,z) rtengine::ULIM(x,static_cast(y),static_cast(z)) ++#define CLIP(x) rtengine::CLIP(x) #define SWAP(a,b) { a=a+b; b=a-b; a=a-b; } /* -@@ -280,6 +293,7 @@ +@@ -280,6 +290,7 @@ fprintf (stderr,_("Corrupt data near 0x%llx\n"), (INT64) ftello(ifp)); } data_error++; @@ -123,7 +123,7 @@ } ushort CLASS sget2 (uchar *s) -@@ -353,7 +367,7 @@ +@@ -353,7 +364,7 @@ { if (fread (pixel, 2, count, ifp) < count) derror(); if ((order == 0x4949) == (ntohs(0x1234) == 0x1234)) @@ -132,7 +132,7 @@ } void CLASS canon_600_fixed_wb (int temp) -@@ -545,10 +559,10 @@ +@@ -545,10 +556,10 @@ getbits(-1) initializes the buffer getbits(n) where 0 <= n <= 25 returns an n-bit integer */ @@ -146,16 +146,7 @@ unsigned c; if (nbits == -1) -@@ -1171,7 +1185,7 @@ - else hpred[col & 1] += diff; - if ((ushort)(hpred[col & 1] + min) >= max) derror(); - if ((unsigned) (col-left_margin) < width) -- BAYER(row,col-left_margin) = curve[LIM((short)hpred[col & 1],0,0x3fff)]; -+ BAYER(row,col-left_margin) = curve[LIM((short)hpred[col & 1],(short)0,(short)0x3fff)]; - } - } - free (huff); -@@ -1261,7 +1275,7 @@ +@@ -1261,7 +1272,7 @@ int i, nz; char tail[424]; @@ -164,7 +155,7 @@ fread (tail, 1, sizeof tail, ifp); for (nz=i=0; i < sizeof tail; i++) if (tail[i]) nz++; -@@ -1297,7 +1311,7 @@ +@@ -1297,7 +1308,7 @@ free (pixel); } @@ -173,34 +164,7 @@ void CLASS ppm_thumb() { -@@ -1407,7 +1421,7 @@ - c = nc > 2 ? FC(row,col) : 0; - if (!(c & 1)) { - c = BAYER(row,col) * mult[c]; -- BAYER(row,col) = LIM(c,0,65535); -+ BAYER(row,col) = LIM(c,0u,65535u); - } - for (c=0; c < nc; c+=2) - mult[c] += mult[c+1]; -@@ -1451,7 +1465,7 @@ - poly[3] += (ph1.tag_210 - poly[7]) * poly[6] + 1; - for (i=0; i < 0x10000; i++) { - num = (poly[5]*i + poly[3])*i + poly[1]; -- curve[i] = LIM(num,0,65535); -+ curve[i] = CLIPF(num); - } goto apply; /* apply to right half */ - } else if (tag == 0x41a) { /* Polynomial curve */ - for (i=0; i < 4; i++) -@@ -1459,7 +1473,7 @@ - for (i=0; i < 0x10000; i++) { - for (num=0, j=4; j--; ) - num = num * i + poly[j]; -- curve[i] = LIM(num+i,0,65535); -+ curve[i] = CLIPF(num+i); - } apply: /* apply to whole image */ - for (row=0; row < height; row++) - for (col = (tag & 1)*ph1.split_col; col < width; col++) -@@ -1573,10 +1587,10 @@ +@@ -1573,10 +1584,10 @@ phase_one_correct(); } @@ -214,7 +178,7 @@ unsigned c; if (nbits == -1) -@@ -1702,7 +1716,7 @@ +@@ -1702,7 +1713,7 @@ } } @@ -223,7 +187,16 @@ void CLASS sinar_4shot_load_raw() { -@@ -1843,10 +1857,10 @@ +@@ -1731,7 +1742,7 @@ + if ((r = row-top_margin - (shot >> 1 & 1)) >= height) continue; + for (col=0; col < raw_width; col++) { + if ((c = col-left_margin - (shot & 1)) >= width) continue; +- image[r*width+c][FC(row,col)] = pixel[col]; ++ image[r*width+c][FC(row,col)] = pixel[col]; + } + } + } +@@ -1843,10 +1854,10 @@ maximum = 0x3ff; } @@ -237,7 +210,7 @@ int byte; if (!nbits) return vbits=0; -@@ -2135,11 +2149,11 @@ +@@ -2135,11 +2146,11 @@ METHODDEF(boolean) fill_input_buffer (j_decompress_ptr cinfo) { @@ -251,7 +224,16 @@ cinfo->src->next_input_byte = jpeg_buffer; cinfo->src->bytes_in_buffer = nbytes; return TRUE; -@@ -2411,9 +2425,9 @@ +@@ -2215,7 +2226,7 @@ + for (col=0; col < raw_width; col++) { + val = curve[pixel[col]]; + if ((unsigned) (col-left_margin) < width) +- BAYER(row,col-left_margin) = val; ++ BAYER(row,col-left_margin) = val; + else lblack += val; + } + } +@@ -2411,9 +2422,9 @@ maximum = (1 << (thumb_misc & 31)) - 1; } @@ -263,7 +245,7 @@ if (start) { for (p=0; p < 4; p++) -@@ -2712,7 +2726,7 @@ +@@ -2712,7 +2723,7 @@ void CLASS foveon_decoder (unsigned size, unsigned code) { @@ -272,36 +254,16 @@ struct decode *cur; int i, len; -@@ -3670,7 +3684,7 @@ - hpass = lpass; +@@ -3651,7 +3662,7 @@ + lpass = size*((lev & 1)+1); + for (row=0; row < iheight; row++) { + hat_transform (temp, fimg+hpass+row*iwidth, 1, iwidth, 1 << lev); +- for (col=0; col < iwidth; col++) ++ for (col=0; col < iwidth; col++) + fimg[lpass + row*iwidth + col] = temp[col] * 0.25; } - for (i=0; i < size; i++) -- image[i][c] = CLIP(SQR(fimg[i]+fimg[lpass+i])/0x10000); -+ image[i][c] = CLIPF(SQR(fimg[i]+fimg[lpass+i])/0x10000); - } - if (filters && colors == 3) { /* pull G1 and G3 closer together */ - for (row=0; row < 2; row++) { -@@ -3696,7 +3710,7 @@ - if (diff < -thold) diff += thold; - else if (diff > thold) diff -= thold; - else diff = 0; -- BAYER(row,col) = CLIP(SQR(avg+diff) + 0.5); -+ BAYER(row,col) = CLIPD(SQR(avg+diff) + 0.5); - } - } - } -@@ -3716,8 +3730,8 @@ - memcpy (pre_mul, user_mul, sizeof pre_mul); - if (use_auto_wb || (use_camera_wb && cam_mul[0] == -1)) { - memset (dsum, 0, sizeof dsum); -- bottom = MIN (greybox[1]+greybox[3], height); -- right = MIN (greybox[0]+greybox[2], width); -+ bottom = MIN (greybox[1]+greybox[3], static_cast(height)); -+ right = MIN (greybox[0]+greybox[2], static_cast(width)); - for (row=greybox[1]; row < bottom; row += 8) - for (col=greybox[0]; col < right; col += 8) { - memset (sum, 0, sizeof sum); -@@ -3921,7 +3935,7 @@ + for (col=0; col < iwidth; col++) { +@@ -3921,7 +3932,7 @@ */ void CLASS vng_interpolate() { @@ -310,38 +272,7 @@ -2,-2,+0,-1,0,0x01, -2,-2,+0,+0,1,0x01, -2,-1,-1,+0,0,0x01, -2,-1,+0,-1,0,0x02, -2,-1,+0,+0,0,0x03, -2,-1,+0,+1,1,0x01, -2,+0,+0,-1,0,0x06, -2,+0,+0,+0,1,0x02, -2,+0,+0,+1,0,0x03, -@@ -4071,7 +4085,7 @@ - ABS(pix[-3*d][1] - pix[-d][1]) ) * 2; - } - d = dir[i = diff[0] > diff[1]]; -- pix[0][1] = ULIM(guess[i] >> 2, pix[d][1], pix[-d][1]); -+ pix[0][1] = ULIM(guess[i] >> 2, static_cast(pix[d][1]), static_cast(pix[-d][1])); - } - /* Calculate red and blue for each green pixel: */ - for (row=1; row < height-1; row++) -@@ -4144,10 +4158,10 @@ - pix = image + row*width+col; - val = ((pix[-1][1] + pix[0][c] + pix[1][1]) * 2 - - pix[-2][c] - pix[2][c]) >> 2; -- rgb[0][row-top][col-left][1] = ULIM(val,pix[-1][1],pix[1][1]); -+ rgb[0][row-top][col-left][1] = ULIM(val,static_cast(pix[-1][1]),static_cast(pix[1][1])); - val = ((pix[-width][1] + pix[0][c] + pix[width][1]) * 2 - - pix[-2*width][c] - pix[2*width][c]) >> 2; -- rgb[1][row-top][col-left][1] = ULIM(val,pix[-width][1],pix[width][1]); -+ rgb[1][row-top][col-left][1] = ULIM(val,static_cast(pix[-width][1]),static_cast(pix[width][1])); - } - } - /* Interpolate red and blue, and convert to CIELab: */ -@@ -4278,7 +4292,7 @@ - if (c == colors) continue; - FORCC { - cam[0][c] = image[row*width+col][c]; -- cam[1][c] = MIN(cam[0][c],clip); -+ cam[1][c] = MIN(cam[0][c],static_cast(clip)); - } - for (i=0; i < 2; i++) { - FORCC for (lab[i][c]=j=0; j < colors; j++) -@@ -4397,7 +4411,7 @@ +@@ -4397,7 +4408,7 @@ } } @@ -350,7 +281,7 @@ void CLASS parse_makernote (int base, int uptag) { -@@ -4528,12 +4542,12 @@ +@@ -4528,12 +4539,12 @@ cam_mul[0] = getreal(type); cam_mul[2] = getreal(type); } @@ -369,16 +300,7 @@ if (tag == 0x10 && type == 4) unique_id = get4(); if (tag == 0x11 && is_raw && !strncmp(make,"NIKON",5)) { -@@ -4777,7 +4791,7 @@ - case 6: - FORC(2) gpsdata[18+c] = get4(); break; - case 18: case 29: -- fgets ((char *) (gpsdata+14+tag/3), MIN(len,12), ifp); -+ fgets ((char *) (gpsdata+14+tag/3), MIN(len,12u), ifp); - } - fseek (ifp, save, SEEK_SET); - } -@@ -4912,8 +4926,8 @@ +@@ -4912,8 +4923,8 @@ } } @@ -389,7 +311,7 @@ int CLASS parse_tiff_ifd (int base) { -@@ -4927,7 +4941,7 @@ +@@ -4927,7 +4938,7 @@ unsigned sony_curve[] = { 0,0,0,0,0,4095 }; unsigned *buf, sony_offset=0, sony_length=0, sony_key=0; struct jhead jh; @@ -398,7 +320,7 @@ if (tiff_nifds >= sizeof tiff_ifd / sizeof tiff_ifd[0]) return 1; -@@ -4944,6 +4958,9 @@ +@@ -4944,6 +4955,9 @@ case 6: height = get2(); break; case 7: width += get2(); break; case 9: filters = get2(); break; @@ -408,7 +330,7 @@ case 17: case 18: if (type == 3 && len == 1) cam_mul[(tag-17)*2] = get2() / 256.0; -@@ -5347,12 +5364,13 @@ +@@ -5347,12 +5361,13 @@ fread (buf, sony_length, 1, ifp); sony_decrypt (buf, sony_length/4, 1, sony_key); sfp = ifp; @@ -427,7 +349,7 @@ ifp = sfp; free (buf); } -@@ -5377,6 +5395,8 @@ +@@ -5377,6 +5392,8 @@ { int doff; @@ -436,7 +358,7 @@ fseek (ifp, base, SEEK_SET); order = get2(); if (order != 0x4949 && order != 0x4d4d) return 0; -@@ -5551,7 +5571,7 @@ +@@ -5551,7 +5568,7 @@ { const char *file, *ext; char *jname, *jfile, *jext; @@ -445,7 +367,14 @@ ext = strrchr (ifname, '.'); file = strrchr (ifname, '/'); -@@ -5579,7 +5599,8 @@ +@@ -5573,13 +5590,14 @@ + } else + while (isdigit(*--jext)) { + if (*jext != '9') { +- (*jext)++; ++ (*jext)++; + break; + } *jext = '0'; } if (strcmp (jname, ifname)) { @@ -455,19 +384,20 @@ if (verbose) fprintf (stderr,_("Reading metadata from %s ...\n"), jname); parse_tiff (12); -@@ -5918,7 +5939,11 @@ +@@ -5918,7 +5936,11 @@ order = get2(); hlen = get4(); if (get4() == 0x48454150) /* "HEAP" */ +- parse_ciff (save+hlen, len-hlen); +/*RT*/ { +/*RT*/ ciff_base = save+hlen; +/*RT*/ ciff_len = len-hlen; - parse_ciff (save+hlen, len-hlen); ++ parse_ciff (save+hlen, len-hlen); +/*RT*/ } if (parse_tiff (save+6)) apply_tiff(); fseek (ifp, save+len, SEEK_SET); } -@@ -6165,7 +6190,9 @@ +@@ -6165,7 +6187,9 @@ { static const struct { const char *prefix; @@ -478,7 +408,7 @@ } table[] = { { "AGFAPHOTO DC-833m", 0, 0, /* DJC */ { 11438,-3762,-1115,-2409,9914,2497,-1227,2295,5300 } }, -@@ -6181,36 +6208,36 @@ +@@ -6181,36 +6205,36 @@ { 6188,-1341,-890,-7168,14489,2937,-2640,3228,8483 } }, { "Canon EOS 5D Mark II", 0, 0x3cf0, { 4716,603,-830,-7798,15474,2480,-1496,1937,6651 } }, @@ -529,7 +459,7 @@ { "Canon EOS 600D", 0, 0x3510, { 6461,-907,-882,-4300,12184,2378,-819,1944,5931 } }, { "Canon EOS 1000D", 0, 0xe43, -@@ -6223,8 +6250,8 @@ +@@ -6223,8 +6247,8 @@ { 6517,-602,-867,-8180,15926,2378,-1618,1771,7633 } }, { "Canon EOS-1D Mark IV", 0, 0x3bb0, { 6014,-220,-795,-4109,12014,2361,-561,1824,5787 } }, @@ -540,7 +470,7 @@ { "Canon EOS-1D Mark II N", 0, 0xe80, { 6240,-466,-822,-8180,15825,2500,-1801,1938,8042 } }, { "Canon EOS-1D Mark II", 0, 0xe80, -@@ -6241,12 +6268,12 @@ +@@ -6241,12 +6265,12 @@ { -5300,9846,1776,3436,684,3939,-5540,9879,6200,-1404,11175,217 } }, { "Canon PowerShot A5", 0, 0, { -4801,9475,1952,2926,1611,4094,-5259,10164,5947,-1554,10883,547 } }, @@ -557,7 +487,16 @@ { "Canon PowerShot G1", 0, 0, { -4778,9467,2172,4743,-1141,4344,-5146,9908,6077,-1566,11051,557 } }, { "Canon PowerShot G2", 0, 0, -@@ -6373,8 +6400,8 @@ +@@ -6302,7 +6326,7 @@ + { "Canon PowerShot SX1 IS", 0, 0, + { 6578,-259,-502,-5974,13030,3309,-308,1058,4970 } }, + { "Canon PowerShot SX110 IS", 0, 0, /* DJC */ +- { 14134,-5576,-1527,-1991,10719,1273,-1158,1929,3581 } }, ++ { 14134,-5576,-1527,-1991,10719,1273,-1158,1929,3581 } }, + { "CASIO EX-S20", 0, 0, /* DJC */ + { 11634,-3924,-1128,-4968,12954,2015,-1588,2648,7206 } }, + { "CASIO EX-Z750", 0, 0, /* DJC */ +@@ -6373,8 +6397,8 @@ { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, { "FUJIFILM FinePix F600EXR", 0, 0, { 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } }, @@ -568,7 +507,7 @@ { "FUJIFILM X10", 0, 0, { 13509,-6199,-1254,-4430,12733,1865,-331,1441,5022 } }, { "Imacon Ixpress", 0, 0, /* DJC */ -@@ -6475,22 +6502,22 @@ +@@ -6475,22 +6499,22 @@ { 7702,-2245,-975,-9114,17242,1875,-2679,3055,8521 } }, { "NIKON D1", 0, 0, /* multiplied by 2.218750, 1.0, 1.148438 */ { 16772,-4726,-2141,-7611,15713,1972,-2846,3494,9521 } }, @@ -599,7 +538,7 @@ { "NIKON D3", 0, 0, { 8139,-2171,-663,-8747,16541,2295,-1925,2008,8093 } }, { "NIKON D40X", 0, 0, -@@ -6505,10 +6532,10 @@ +@@ -6505,10 +6529,10 @@ { 7732,-2422,-789,-8238,15884,2498,-859,783,7330 } }, { "NIKON D60", 0, 0, { 8736,-2458,-935,-9075,16894,2251,-1354,1242,8263 } }, @@ -614,7 +553,7 @@ { "NIKON D70", 0, 0, { 7732,-2422,-789,-8238,15884,2498,-859,783,7330 } }, { "NIKON D80", 0, 0, -@@ -6569,8 +6596,8 @@ +@@ -6569,8 +6593,8 @@ { 7828,-1761,-348,-5788,14071,1830,-2853,4518,6557 } }, { "OLYMPUS E-330", 0, 0, { 8961,-2473,-1084,-7979,15990,2067,-2319,3035,8249 } }, @@ -625,7 +564,7 @@ { "OLYMPUS E-3", 0, 0xf99, { 9487,-2875,-1115,-7533,15606,2010,-1618,2100,7389 } }, { "OLYMPUS E-400", 0, 0, -@@ -6587,26 +6614,26 @@ +@@ -6587,26 +6611,26 @@ { 8785,-2529,-1033,-7639,15624,2112,-1783,2300,7817 } }, { "OLYMPUS E-520", 0, 0xfd2, { 8344,-2322,-1020,-7596,15635,2048,-1748,2269,7287 } }, @@ -668,7 +607,7 @@ { "OLYMPUS E-PM1", 0, 0, { 7575,-2159,-571,-3722,11341,2725,-1434,2819,6271 } }, { "OLYMPUS SP350", 0, 0, -@@ -6623,8 +6650,8 @@ +@@ -6623,8 +6647,8 @@ { 10915,-3677,-982,-5587,12986,2911,-1168,1968,6223 } }, { "OLYMPUS SP570UZ", 0, 0, { 11522,-4044,-1146,-4736,12172,2904,-988,1829,6039 } }, @@ -679,7 +618,7 @@ { "PENTAX *ist DL2", 0, 0, { 10504,-2438,-1189,-8603,16207,2531,-1022,863,12242 } }, { "PENTAX *ist DL", 0, 0, -@@ -6641,8 +6668,8 @@ +@@ -6641,8 +6665,8 @@ { 11095,-3157,-1324,-8377,15834,2720,-1108,947,11688 } }, { "PENTAX K20D", 0, 0, { 9427,-2714,-868,-7493,16092,1373,-2199,3264,7180 } }, @@ -690,7 +629,7 @@ { "PENTAX K2000", 0, 0, { 11057,-3604,-1155,-5152,13046,2329,-282,375,8104 } }, { "PENTAX K-m", 0, 0, -@@ -6699,34 +6726,36 @@ +@@ -6699,34 +6723,36 @@ { 10909,-4295,-948,-1333,9306,2399,22,1738,4582 } }, { "LEICA D-LUX 5", 143, 0, { 10909,-4295,-948,-1333,9306,2399,22,1738,4582 } }, @@ -747,7 +686,7 @@ { "Panasonic DMC-GX1", 143, 0, { 6763,-1919,-863,-3868,11515,2684,-1216,2387,5879 } }, { "Phase One H 20", 0, 0, /* DJC */ -@@ -6787,26 +6816,22 @@ +@@ -6787,24 +6813,20 @@ { 5932,-1492,-411,-4813,12285,2856,-741,1524,6739 } }, { "SONY DSLR-A5", 128, 0xfeb, { 4950,-580,-103,-5228,12542,3029,-709,1435,7371 } }, @@ -773,20 +712,18 @@ - { 6549,-1550,-436,-4880,12435,2753,-854,1868,6976 } }, + { "SONY DSLR-A900", 128, 0, /* RT */ + { 5715,-1433,-410,-5603,12937,2989,-644,1247,8372 } }, ++ { "SONY NEX-5N", 138, 0, /* RT - Colin Walker */ ++ { 5130,-1055,-269,-4473,11797,3050,-701,1310,7121 } }, ++ { "SONY NEX-C3", 128, 0, /* RT - Colin Walker */ ++ { 5130,-1055,-269,-4473,11797,3050,-701,1310,7121 } }, + { "SONY NEX-3", 128, 0, /* RT - Colin Walker */ + { 5145,-741,-123,-4915,12310,2945,-794,1489,6906 } }, + { "SONY NEX-5", 128, 0, /* RT - Colin Walker */ + { 5154,-716,-115,-5065,12506,2882,-988,1715,6800 } }, { "SONY NEX-7", 128, 0, { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, -+ { "SONY NEX-C3", 128, 0, /* RT - Colin Walker */ -+ { 5130,-1055,-269,-4473,11797,3050,-701,1310,7121 } }, -+ { "SONY NEX-5N", 138, 0, /* RT - Colin Walker */ -+ { 5130,-1055,-269,-4473,11797,3050,-701,1310,7121 } }, { "SONY SLT-A33", 128, 0, - { 6069,-1221,-366,-5221,12779,2734,-1024,2066,6834 } }, - { "SONY SLT-A35", 128, 0, -@@ -6815,8 +6840,8 @@ +@@ -6815,8 +6837,8 @@ { 5932,-1492,-411,-4813,12285,2856,-741,1524,6739 } }, { "SONY SLT-A65", 128, 0, { 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } }, @@ -797,7 +734,7 @@ }; double cam_xyz[4][3]; char name[130]; -@@ -7060,6 +7085,12 @@ +@@ -7060,6 +7082,12 @@ fread (head, 1, 32, ifp); fseek (ifp, 0, SEEK_END); flen = fsize = ftell(ifp); @@ -810,7 +747,7 @@ if ((cp = (char *) memmem (head, 32, "MMMM", 4)) || (cp = (char *) memmem (head, 32, "IIII", 4))) { parse_phase_one (cp-head); -@@ -7067,6 +7098,8 @@ +@@ -7067,6 +7095,8 @@ } else if (order == 0x4949 || order == 0x4d4d) { if (!memcmp (head+6,"HEAPCCDR",8)) { data_offset = hlen; @@ -819,7 +756,7 @@ parse_ciff (hlen, flen - hlen); } else if (parse_tiff(0)) apply_tiff(); } else if (!memcmp (head,"\xff\xd8\xff\xe1",4) && -@@ -7110,6 +7143,7 @@ +@@ -7110,6 +7140,7 @@ fseek (ifp, 100+28*(shot_select > 0), SEEK_SET); parse_tiff (data_offset = get4()); parse_tiff (thumb_offset+12); @@ -827,17 +764,7 @@ apply_tiff(); } else if (!memcmp (head,"RIFF",4)) { fseek (ifp, 0, SEEK_SET); -@@ -7155,8 +7189,7 @@ - parse_redcine(); - load_raw = &CLASS redcine_load_raw; - gamma_curve (1/2.4, 12.92, 1, 4095); -- filters = 0x49494949; -- } else if (!memcmp (head,"DSC-Image",9)) -+ filters = 0x49494949; } else if (!memcmp (head,"DSC-Image",9)) - parse_rollei(); - else if (!memcmp (head,"PWAD",4)) - parse_sinar_ia(); -@@ -7211,7 +7244,7 @@ +@@ -7211,7 +7242,7 @@ if (height == 3136 && width == 4864) /* Pentax K20D and Samsung GX20 */ { height = 3124; width = 4688; filters = 0x16161616; } if (width == 4352 && (!strcmp(model,"K-r") || !strcmp(model,"K-x"))) @@ -846,7 +773,16 @@ if (width >= 4960 && !strcmp(model,"K-5")) { left_margin = 10; width = 4950; filters = 0x16161616; } if (width == 4736 && !strcmp(model,"K-7")) -@@ -8779,7 +8812,7 @@ +@@ -8553,7 +8584,7 @@ + for (j=0; j < 3; j++) { + for (num = k=0; k < 3; k++) + num += xyzd50_srgb[i][k] * inverse[j][k]; +- oprof[pbody[j*3+23]/4+i+2] = num * 0x10000 + 0.5; ++ oprof[pbody[j*3+23]/4+i+2] = num * 0x10000 + 0.5; + } + for (i=0; i < phead[0]/4; i++) + oprof[i] = htonl(oprof[i]); +@@ -8779,7 +8810,7 @@ strncpy (th->desc, desc, 512); strncpy (th->make, make, 64); strncpy (th->model, model, 64); @@ -855,7 +791,7 @@ t = localtime (×tamp); sprintf (th->date, "%04d:%02d:%02d %02d:%02d:%02d", t->tm_year+1900,t->tm_mon+1,t->tm_mday,t->tm_hour,t->tm_min,t->tm_sec); -@@ -8852,13 +8885,13 @@ +@@ -8852,13 +8883,13 @@ FORCC ppm [col*colors+c] = curve[image[soff][c]] >> 8; else FORCC ppm2[col*colors+c] = curve[image[soff][c]]; if (output_bps == 16 && !output_tiff && htons(0x55aa) != 0x55aa) @@ -871,7 +807,7 @@ { int arg, status=0; int timestamp_only=0, thumbnail_only=0, identify_only=0; -@@ -8971,7 +9004,7 @@ +@@ -8971,7 +9002,7 @@ case 'i': identify_only = 1; break; case 'c': write_to_stdout = 1; break; case 'v': verbose = 1; break; @@ -880,11 +816,15 @@ case 'f': four_color_rgb = 1; break; case 'A': FORC4 greybox[c] = atoi(argv[arg++]); case 'a': use_auto_wb = 1; break; -@@ -9234,3 +9267,7 @@ +@@ -9234,3 +9265,11 @@ } return status; } +*/ ++/*RT*/#undef SQR +/*RT*/#undef MAX +/*RT*/#undef MIN +/*RT*/#undef ABS ++/*RT*/#undef LIM ++/*RT*/#undef ULIM ++/*RT*/#undef CLIP diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index c45954693..ff7ed811d 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -20,8 +20,8 @@ #include "curves.h" #include "mytime.h" #include "refreshmap.h" -#define CLIPTO(a,b,c) ((a)>b?((a) 0)) namespace rtengine { @@ -283,12 +283,12 @@ if (settings->verbose) printf ("setcropsizes before lock\n"); rqcroph = rch; // store and set requested crop size - int rqx1 = CLIPTO(rqcropx,0,parent->fullw-1); - int rqy1 = CLIPTO(rqcropy,0,parent->fullh-1); + int rqx1 = LIM(rqcropx,0,parent->fullw-1); + int rqy1 = LIM(rqcropy,0,parent->fullh-1); int rqx2 = rqx1 + rqcropw - 1; int rqy2 = rqy1 + rqcroph - 1; - rqx2 = CLIPTO(rqx2,0,parent->fullw-1); - rqy2 = CLIPTO(rqy2,0,parent->fullh-1); + rqx2 = LIM(rqx2,0,parent->fullw-1); + rqy2 = LIM(rqy2,0,parent->fullh-1); this->skip = skip; @@ -298,10 +298,10 @@ if (settings->verbose) printf ("setcropsizes before lock\n"); int bx2 = rqx2 + skip*borderRequested; int by2 = rqy2 + skip*borderRequested; // clip it to fit into image area - bx1 = CLIPTO(bx1,0,parent->fullw-1); - by1 = CLIPTO(by1,0,parent->fullh-1); - bx2 = CLIPTO(bx2,0,parent->fullw-1); - by2 = CLIPTO(by2,0,parent->fullh-1); + bx1 = LIM(bx1,0,parent->fullw-1); + by1 = LIM(by1,0,parent->fullh-1); + bx2 = LIM(bx2,0,parent->fullw-1); + by2 = LIM(by2,0,parent->fullh-1); int bw = bx2 - bx1 + 1; int bh = by2 - by1 + 1; diff --git a/rtengine/demosaic_algos.cc b/rtengine/demosaic_algos.cc index 5004293cd..af3b6d509 100644 --- a/rtengine/demosaic_algos.cc +++ b/rtengine/demosaic_algos.cc @@ -163,12 +163,11 @@ void RawImageSource::eahd_demosaic () { homh[ipx][j] = 0; homv[ipx][j] = 0; } - int sh, sv, idx, idx2; + int sh, sv, idx; for (int j=1; jget_filters() >> ((((row) << 1 & 14) + ((col) & 1)) << 1) & 3) -#define LIM(x,MIN,MAX) max(MIN,min(x,MAX)) -#define ULIM(x,y,z) ((y) < (z) ? LIM(x,y,z) : LIM(x,z,y)) /* Patterned Pixel Grouping Interpolation by Alain Desbiolles @@ -847,8 +844,8 @@ void RawImageSource::ppg_demosaic() void RawImageSource::border_interpolate(int border, float (*image)[4], int start, int end) { unsigned row, col, y, x, f, c, sum[8]; - int width=W, height=H; - int colors = 3; + unsigned int width=W, height=H; + unsigned int colors = 3; if (end == 0 )end = H; for (row=start; row < end; row++) @@ -1283,7 +1280,7 @@ void RawImageSource::fill_border( float (*cache )[4], int border, int x0, int y0 { unsigned row, col, y, x, f, c; float sum[8]; - const int colors = 3; // used in FORCC + const unsigned int colors = 3; // used in FORCC for (row = y0; row < y0+TILESIZE+TILEBORDER && row0 && settings->verbose) @@ -256,7 +256,7 @@ dfInfo *DFManager::addFileInfo(const Glib::ustring &filename ,bool pool ) return false; Glib::RefPtr info = safe_query_file_info(file); if (info && info->get_file_type() != Gio::FILE_TYPE_DIRECTORY && (!info->is_hidden() || !options.fbShowHidden)) { - int lastdot = info->get_name().find_last_of ('.'); + size_t lastdot = info->get_name().find_last_of ('.'); if (options.is_extention_enabled(lastdot!=Glib::ustring::npos ? info->get_name().substr (lastdot+1) : "")){ RawImage ri(filename); int res = ri.loadRaw(false); // Read informations about shot @@ -397,9 +397,9 @@ int DFManager::scanBadPixelsFile( Glib::ustring filename ) { FILE *file = fopen( filename.c_str(),"r" ); if( !file ) return false; - int lastdot = filename.find_last_of ('.'); - int dirpos1 = filename.find_last_of ('/'); - int dirpos2 = filename.find_last_of ('\\'); + size_t lastdot = filename.find_last_of ('.'); + size_t dirpos1 = filename.find_last_of ('/'); + size_t dirpos2 = filename.find_last_of ('\\'); if( dirpos1 == Glib::ustring::npos && dirpos2== Glib::ustring::npos ) dirpos1 =0; else diff --git a/rtengine/diagonalcurves.cc b/rtengine/diagonalcurves.cc index 335d5484b..9c74ba88c 100644 --- a/rtengine/diagonalcurves.cc +++ b/rtengine/diagonalcurves.cc @@ -196,7 +196,7 @@ void DiagonalCurve::NURBS_set () { // TODO: Speeding-up the interface by caching the polyline, instead of rebuilding it at each action on sliders !!! nbr_points = (int)(((double)(ppn+N-2) * sc_length[i/3] )/ total_length); if (nbr_points<0){ - for(int it=0;it < sc_x.size(); it+=3) printf("sc_length[%d/3]=%f \n",it,sc_length[it/3]); + for(size_t it=0;it < sc_x.size(); it+=3) printf("sc_length[%zu/3]=%f \n",it,sc_length[it/3]); printf("NURBS diagonal curve: error detected!\n i=%d nbr_points=%d ppn=%d N=%d sc_length[i/3]=%f total_length=%f",i,nbr_points,ppn,N,sc_length[i/3],total_length); exit(0); } diff --git a/rtengine/dirpyrLab_denoise.cc b/rtengine/dirpyrLab_denoise.cc index c1a216c7c..c1c5cedf2 100644 --- a/rtengine/dirpyrLab_denoise.cc +++ b/rtengine/dirpyrLab_denoise.cc @@ -30,10 +30,7 @@ #include #endif -#define CLIPTO(a,b,c) ((a)>(b)?((a)<(c)?(a):(c)):(b)) #define CLIPC(a) ((a)>-32000?((a)<32000?(a):32000):-32000) -#define CLIP(a) (CLIPTO(a,0,65535)) - #define DIRWT_L(i1,j1,i,j) ( rangefn_L[(data_fine->L[i1][j1]-data_fine->L[i][j]+32768)] ) @@ -277,7 +274,7 @@ namespace rtengine { } } - }; + } void ImProcFunctions::dirpyr(LabImage* data_fine, LabImage* data_coarse, int level, LUTf & rangefn_L, LUTf & rangefn_ab, int pitch, int scale, @@ -355,7 +352,7 @@ namespace rtengine { - }; + } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -694,7 +691,7 @@ namespace rtengine { delete smooth; }//end of pitch>1 - }; + } #undef DIRWT_L diff --git a/rtengine/dirpyrLab_equalizer.cc b/rtengine/dirpyrLab_equalizer.cc index 76b5183bc..de7dd402d 100644 --- a/rtengine/dirpyrLab_equalizer.cc +++ b/rtengine/dirpyrLab_equalizer.cc @@ -30,12 +30,7 @@ #include #endif -#define CLIPTO(a,b,c) ((a)>(b)?((a)<(c)?(a):(c)):(b)) #define CLIPC(a) ((a)>-32000?((a)<32000?(a):32000):-32000) -#define CLIP(a) (CLIPTO(a,0,65535)) - - - #define DIRWT(i1,j1,i,j) (rangefn[abs((int)data_fine->L[i1][j1]-data_fine->L[i][j])+abs((int)data_fine->a[i1][j1]-data_fine->a[i][j])+abs((int)data_fine->b[i1][j1]-data_fine->b[i][j])] ) @@ -225,7 +220,7 @@ namespace rtengine { //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - }; + } void ImProcFunctions::dirpyr_eq(LabImage* data_fine, LabImage* data_coarse, LUTf & rangefn, int level, int pitch, int scale, const double * mult ) { @@ -282,7 +277,7 @@ namespace rtengine { - }; + } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -483,7 +478,7 @@ namespace rtengine { delete smooth; } - }; + } #undef DIRWT_L diff --git a/rtengine/dirpyr_equalizer.cc b/rtengine/dirpyr_equalizer.cc index 2880dc822..470b473b6 100644 --- a/rtengine/dirpyr_equalizer.cc +++ b/rtengine/dirpyr_equalizer.cc @@ -18,7 +18,6 @@ * */ -//#include "rtengine.h" #include #include #include "curves.h" @@ -26,18 +25,13 @@ #include "improcfun.h" #include "rawimagesource.h" #include "array2D.h" +#include "rt_math.h" #ifdef _OPENMP #include #endif -#include "rt_math.h" -#define CLIPTO(a,b,c) ((a)>(b)?((a)<(c)?(a):(c)):(b)) #define CLIPC(a) ((a)>-32000?((a)<32000?(a):32000):-32000) -#define CLIP(a) (CLIPTO(a,0,65535)) - - - #define DIRWT(i1,j1,i,j) ( domker[(i1-i)/scale+halfwin][(j1-j)/scale+halfwin] * rangefn[abs((int)data_fine[i1][j1]-data_fine[i][j])] ) namespace rtengine { diff --git a/rtengine/ffmanager.cc b/rtengine/ffmanager.cc index 68237f488..6e5c1c70f 100644 --- a/rtengine/ffmanager.cc +++ b/rtengine/ffmanager.cc @@ -178,7 +178,7 @@ void FFManager::init( Glib::ustring pathname ) safe_build_file_list (dir, names, pathname); ffList.clear(); - for (int i=0; i info = safe_query_file_info(file); if (info && info->get_file_type() != Gio::FILE_TYPE_DIRECTORY && (!info->is_hidden() || !options.fbShowHidden)) { - int lastdot = info->get_name().find_last_of ('.'); + size_t lastdot = info->get_name().find_last_of ('.'); if (options.is_extention_enabled(lastdot!=Glib::ustring::npos ? info->get_name().substr (lastdot+1) : "")){ RawImage ri(filename); int res = ri.loadRaw(false); // Read informations about shot diff --git a/rtengine/flatcurves.cc b/rtengine/flatcurves.cc index 68ddb6689..1f64bce45 100644 --- a/rtengine/flatcurves.cc +++ b/rtengine/flatcurves.cc @@ -277,7 +277,7 @@ void FlatCurve::CtrlPoints_set () { else { nbr_points = (int)(((double)(ppn) * sc_length[i] )/ total_length); if (nbr_points<0){ - for(unsigned int it=0;it < sc_x.size(); it+=3) printf("sc_length[%d/3]=%f \n",it,sc_length[it/3]); + for(size_t it=0;it < sc_x.size(); it+=3) printf("sc_length[%zd/3]=%f \n",it,sc_length[it/3]); printf("Flat curve: error detected!\n i=%d periodic=%d nbr_points=%d ppn=%d N=%d sc_length[i/3]=%f total_length=%f",i,periodic,nbr_points,ppn,N,sc_length[i/3],total_length); exit(0); } diff --git a/rtengine/gamutbdy.cc b/rtengine/gamutbdy.cc index b6e75557d..1b57b1cfb 100644 --- a/rtengine/gamutbdy.cc +++ b/rtengine/gamutbdy.cc @@ -25,8 +25,6 @@ #include "rt_math.h" -#define D50x 0.96422 -#define D50z 0.82521 #define u0 4.0*D50x/(D50x+15+3*D50z) #define v0 9.0/(D50x+15+3*D50z) diff --git a/rtengine/hlmultipliers.cc b/rtengine/hlmultipliers.cc index 664b67b7e..e842f3165 100644 --- a/rtengine/hlmultipliers.cc +++ b/rtengine/hlmultipliers.cc @@ -22,9 +22,6 @@ #include "rawimagesource_i.h" #include "../rtgui/options.h" -#define MAXVAL 0xffff -#define CLIP(a) ((a)>0?((a) 1 ? 0x58595a20 : 0x64657363) : 0x74657874; pbody[i*3+2] = oprof[0]; oprof[0] += (pbody[i*3+3] + 3) & -4; @@ -417,7 +417,7 @@ cmsHPROFILE ICCStore::createFromMatrix (const double matrix[3][3], bool gamma, G } // convert to network byte order - for (int i=0; i < phead[0]/4; i++) + for (unsigned int i=0; i < phead[0]/4; i++) oprof[i] = htonl(oprof[i]); // cprt diff --git a/rtengine/image16.h b/rtengine/image16.h index deb28edd6..f14831a2e 100644 --- a/rtengine/image16.h +++ b/rtengine/image16.h @@ -90,5 +90,5 @@ class Image16 : public ImageIO, public IImage16 { void ExecCMSTransform(cmsHTRANSFORM hTransform); }; -}; +} #endif diff --git a/rtengine/image8.h b/rtengine/image8.h index 195846dc3..404e602c1 100644 --- a/rtengine/image8.h +++ b/rtengine/image8.h @@ -67,5 +67,5 @@ class Image8 : public ImageIO, public IImage8 { virtual const unsigned char* getData () { return data; } }; -}; +} #endif diff --git a/rtengine/imagedata.cc b/rtengine/imagedata.cc index 508df3a80..a46e07c33 100644 --- a/rtengine/imagedata.cc +++ b/rtengine/imagedata.cc @@ -36,7 +36,7 @@ ImageMetaData* ImageMetaData::fromFile (const Glib::ustring& fname, RawMetaDataL ImageData::ImageData (Glib::ustring fname, RawMetaDataLocation* ri) { - int dotpos = fname.find_last_of ('.'); + size_t dotpos = fname.find_last_of ('.'); root = NULL; iptc = NULL; @@ -57,7 +57,7 @@ ImageData::ImageData (Glib::ustring fname, RawMetaDataLocation* ri) { extractInfo (); } } - else if (dotpos<(int)fname.size()-3 && !fname.casefold().compare (dotpos, 4, ".jpg")) { + else if (dotposgetTag ("Lens")) { std::string ldata = mnote->getTag ("Lens")->valueToString (); - int i=0, j=0; + size_t i=0, j=0; double n[4]; for (int m=0; m<4; m++) { while (i #include #include -#include +#include "rt_math.h" #ifdef WIN32 #include @@ -282,7 +282,7 @@ int ImageIO::loadJPEGFromMemory (const char* buffer, int bufsize) jpeg_create_decompress(&cinfo); jpeg_memory_src (&cinfo,(const JOCTET*)buffer,bufsize); - if ( setjmp(((rt_jpeg_error_mgr*)cinfo.src)->error_jmp_buf) == 0 ) + if ( setjmp((reinterpret_cast(cinfo.src))->error_jmp_buf) == 0 ) { if (pl) { pl->setProgressStr ("PROGRESSBAR_LOADJPEG"); @@ -307,8 +307,8 @@ int ImageIO::loadJPEGFromMemory (const char* buffer, int bufsize) jpeg_start_decompress(&cinfo); - int width = cinfo.output_width; - int height = cinfo.output_height; + unsigned int width = cinfo.output_width; + unsigned int height = cinfo.output_height; allocate (width, height); @@ -353,7 +353,7 @@ int ImageIO::loadJPEG (Glib::ustring fname) { jpeg_create_decompress(&cinfo); my_jpeg_stdio_src (&cinfo,file); - if ( setjmp(((rt_jpeg_error_mgr*)cinfo.src)->error_jmp_buf) == 0 ) + if ( setjmp((reinterpret_cast(cinfo.src))->error_jmp_buf) == 0 ) { if (pl) { pl->setProgressStr ("PROGRESSBAR_LOADJPEG"); @@ -382,8 +382,8 @@ int ImageIO::loadJPEG (Glib::ustring fname) { jpeg_start_decompress(&cinfo); - int width = cinfo.output_width; - int height = cinfo.output_height; + unsigned int width = cinfo.output_width; + unsigned int height = cinfo.output_height; allocate (width, height); @@ -897,7 +897,7 @@ void png_flush(png_structp png_ptr) { int ImageIO::load (Glib::ustring fname) { - unsigned int lastdot = fname.find_last_of ('.'); + size_t lastdot = fname.find_last_of ('.'); if( Glib::ustring::npos == lastdot ) return IMIO_FILETYPENOTSUPPORTED; if (!fname.casefold().compare (lastdot, 4, ".png")) @@ -911,7 +911,7 @@ int ImageIO::load (Glib::ustring fname) { int ImageIO::save (Glib::ustring fname) { - unsigned int lastdot = fname.find_last_of ('.'); + size_t lastdot = fname.find_last_of ('.'); if( Glib::ustring::npos == lastdot ) return IMIO_FILETYPENOTSUPPORTED; if (!fname.casefold().compare (lastdot, 4, ".png")) diff --git a/rtengine/imageio.h b/rtengine/imageio.h index 4908c9ad9..ea08bbc0f 100644 --- a/rtengine/imageio.h +++ b/rtengine/imageio.h @@ -88,5 +88,5 @@ class ImageIO { Glib::Mutex& mutex () { return imutex; } }; -}; +} #endif diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index 726145517..0f34e06dc 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -109,5 +109,5 @@ class ImageSource : public InitialImage { virtual const ImageMetaData* getMetaData () { return idata; } virtual ImageSource* getImageSource () { return this; } }; -}; +} #endif diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 65e66b974..ecf170a45 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -22,8 +22,6 @@ #include "refreshmap.h" #include "simpleprocess.h" #include "../rtgui/ppversion.h" -#define CLIPTO(a,b,c) ((a)>b?((a)0?((a)<65535?(a):65535):0) namespace rtengine { @@ -79,7 +77,7 @@ ImProcCoordinator::~ImProcCoordinator () { freeAll (); std::vector toDel = crops; - for (int i=0; idecreaseRef (); @@ -105,7 +103,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) { // Check if any detail crops need high detail. If not, take a fast path short cut bool highDetailNeeded = (todo & M_HIGHQUAL); if (!highDetailNeeded) { - for (int i=0; iget_skip() == 1 ) { // skip=1 -> full resolution highDetailNeeded=true; break; @@ -326,7 +324,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) { } // process crop, if needed - for (int i=0; ihasListener () && cropCall != crops[i] ) crops[i]->update (todo); // may call outselves @@ -435,7 +433,7 @@ if (settings->verbose) printf ("setscale before lock\n"); fullh = fh; if (settings->verbose) printf ("setscale ends\n"); if (!sizeListeners.empty()) - for (int i=0; isizeChanged (fullw, fullh, fw, fh); if (settings->verbose) printf ("setscale ends2\n"); diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index bd1918835..9480d8a60 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -44,32 +44,16 @@ namespace rtengine { using namespace procparams; -#undef MAXVAL -#undef CMAXVAL -#undef MAXL - - #undef ABS -#undef CLIP #undef CLIPS #undef CLIPC -#undef CLIPTO - -#define MAXVAL 0xffff -#define CMAXVAL 0xffff -#define MAXL 0xffff - #define ABS(a) ((a)<0?-(a):(a)) -#define CLIP(a) ((a)>0?((a)-32768?((a)<32767?(a):32767):-32768) #define CLIPC(a) ((a)>-32000?((a)<32000?(a):32000):-32000) -#define CLIPTO(a,b,c) ((a)>(b)?((a)<(c)?(a):(c)):(b)) #define CLIP2(a) ((a)0.0?((a)<65535.5?(a):65535.5):0.0) -#define D50x 0.96422 -#define D50z 0.82521 #define u0 4.0*D50x/(D50x+15+3*D50z) #define v0 9.0/(D50x+15+3*D50z) @@ -581,8 +565,8 @@ void ImProcFunctions::colorCurve (LabImage* lold, LabImage* lnew) { float nna = ((oa[i][j]+shift_a) * real_c * amul); float nnb = ((ob[i][j]+shift_b) * real_c * bmul); - lnew->a[i][j] = CLIPTO(nna,-32000.0f,32000.0f); - lnew->b[i][j] = CLIPTO(nnb,-32000.0f,32000.0f); + lnew->a[i][j] = LIM(nna,-32000.0f,32000.0f); + lnew->b[i][j] = LIM(nnb,-32000.0f,32000.0f); } */ //delete [] cmultiplier; diff --git a/rtengine/impulse_denoise.h b/rtengine/impulse_denoise.h index a5922003c..aba9f3246 100644 --- a/rtengine/impulse_denoise.h +++ b/rtengine/impulse_denoise.h @@ -18,7 +18,7 @@ * */ #include -#include +#include "rt_math.h" #include "rt_math.h" #include "labimage.h" diff --git a/rtengine/iplab2rgb.cc b/rtengine/iplab2rgb.cc index ed82e75c7..8c89a65b5 100644 --- a/rtengine/iplab2rgb.cc +++ b/rtengine/iplab2rgb.cc @@ -34,19 +34,8 @@ namespace rtengine { -#undef CLIP -#undef CLIPTO -#undef CMAXVAL - -#define CMAXVAL 0xffff -#define CLIP(a) ((a)>0?((a)(b)?((a)<(c)?(a):(c)):(b)) #define CLIP01(a) ((a)>0?((a)<1?(a):1):0) - -#define D50x 0.96422 -#define D50z 0.82521 - extern const Settings* settings; const double (*wprof[])[3] = {xyz_sRGB, xyz_adobe, xyz_prophoto, xyz_widegamut, xyz_bruce, xyz_beta, xyz_best}; @@ -86,9 +75,9 @@ void ImProcFunctions::lab2monitorRgb (LabImage* lab, Image8* image) { y_ = f2xyz(fy); z_ = f2xyz(fz)*D50z; - buffer[iy++] = (unsigned short)CLIP(x_* CMAXVAL+0.5); - buffer[iy++] = (unsigned short)CLIP(y_* CMAXVAL+0.5); - buffer[iy++] = (unsigned short)CLIP(z_* CMAXVAL+0.5); + buffer[iy++] = (unsigned short)CLIP(x_* MAXVAL+0.5); + buffer[iy++] = (unsigned short)CLIP(y_* MAXVAL+0.5); + buffer[iy++] = (unsigned short)CLIP(z_* MAXVAL+0.5); } cmsDoTransform (monitorTransform, buffer, image->data + ix, lab->W); diff --git a/rtengine/ipresize.cc b/rtengine/ipresize.cc index 954e7bf04..7263ba53a 100644 --- a/rtengine/ipresize.cc +++ b/rtengine/ipresize.cc @@ -32,14 +32,6 @@ namespace rtengine { -#undef CLIP -#undef CLIPTO -#undef CMAXVAL - -#define CMAXVAL 0xffff -#define CLIP(a) ((a)>0?((a)(b)?((a)<(c)?(a):(c)):(b)) - static inline float Lanc(float x, float a) { if (x * x < 1e-6f) @@ -236,8 +228,8 @@ void ImProcFunctions::resize (Image16* src, Image16* dst, float dScale) { dst->b[i][j] = CLIP(b); } else { - xc = CLIPTO(xc, 0, src->width-1); - yc = CLIPTO(yc, 0, src->height-1); + xc = LIM(xc, 0, src->width-1); + yc = LIM(yc, 0, src->height-1); int nx = xc + 1; if (nx >= src->width) nx = xc; @@ -255,14 +247,14 @@ void ImProcFunctions::resize (Image16* src, Image16* dst, float dScale) { #pragma omp parallel for if (multiThread) for (int i=0; iheight; i++) { int sy = i/dScale; - sy = CLIPTO(sy, 0, src->height-1); + sy = LIM(sy, 0, src->height-1); float dy = i/dScale - sy; int ny = sy+1; if (ny>=src->height) ny = sy; for (int j=0; jwidth; j++) { int sx = j/dScale; - sx = CLIPTO(sx, 0, src->width-1); + sx = LIM(sx, 0, src->width-1); float dx = j/dScale - sx; int nx = sx+1; if (nx>=src->width) @@ -278,10 +270,10 @@ void ImProcFunctions::resize (Image16* src, Image16* dst, float dScale) { #pragma omp parallel for if (multiThread) for (int i=0; iheight; i++) { int sy = i/dScale; - sy = CLIPTO(sy, 0, src->height-1); + sy = LIM(sy, 0, src->height-1); for (int j=0; jwidth; j++) { int sx = j/dScale; - sx = CLIPTO(sx, 0, src->width-1); + sx = LIM(sx, 0, src->width-1); dst->r[i][j] = src->r[sy][sx]; dst->g[i][j] = src->g[sy][sx]; dst->b[i][j] = src->b[sy][sx]; diff --git a/rtengine/ipsharpen.cc b/rtengine/ipsharpen.cc index 1911ebe8d..ad11a6b9c 100644 --- a/rtengine/ipsharpen.cc +++ b/rtengine/ipsharpen.cc @@ -30,14 +30,9 @@ using namespace std; namespace rtengine { -#undef CLIP -#undef CMAXVAL #undef ABS -#define CMAXVAL 0xffff -#define CLIP(a) ((a)>0?((a)sharpenMicro.matrix == false) k=2; else k=1; // k=2 matrix 5x5 k=1 matrix 3x3 - int offset,offset2,c,i,j,col,row,n; + int offset,offset2,i,j,col,row,n; float temp,temp2,temp3,temp4,tempL; float *LM,v,s,contrast; int signs[25]; @@ -473,7 +468,6 @@ void ImProcFunctions::MLmicrocontrast(LabImage* lab) { float chmax=8.0f; LM = new float[width*height];//allocation for Luminance - c=0; #pragma omp parallel for private(offset, i,j) shared(LM) for(j=0; j(b)?((a)<(c)?(a):(c)):(b)) #define CLIPTOC(a,b,c,d) ((a)>=(b)?((a)<=(c)?(a):(d=true,(c))):(d=true,(b))) #define RT_PI 3.141592653589 @@ -53,7 +44,7 @@ bool ImProcFunctions::transCoord (int W, int H, std::vector &src, std:: if (!needsCA() && !needsDistortion() && !needsRotation() && !needsPerspective()) { if (clipresize) { - for (int i=0; i &src, std:: double ascale = ascaleDef>0 ? ascaleDef : (params->commonTrans.autofill ? getTransformAutoFill (oW, oH) : 1.0); - for (int i=0; i &src, std:: } if (clipresize) { - for (int i=0; ix2d) x2d = transCorners[i].x; int x2v = (int)ceil(x2d); double y2d = transCorners[0].y; - for (int i=1; iy2d) y2d = transCorners[i].y; int y2v = (int)ceil(y2d); @@ -328,10 +319,10 @@ void ImProcFunctions::transformNonSep (Imagefloat* original, Imagefloat* transfo if (yc > 0 && yc < original->height-2 && xc > 0 && xc < original->width-2) // all interpolation pixels inside image cubint (original, xc-1, yc-1, Dx, Dy, &(transformed->r[y][x]), &(transformed->g[y][x]), &(transformed->b[y][x]), vignmul); else { // edge pixels - int y1 = CLIPTO(yc, 0, original->height-1); - int y2 = CLIPTO(yc+1, 0, original->height-1); - int x1 = CLIPTO(xc, 0, original->width-1); - int x2 = CLIPTO(xc+1, 0, original->width-1); + int y1 = LIM(yc, 0, original->height-1); + int y2 = LIM(yc+1, 0, original->height-1); + int x1 = LIM(xc, 0, original->width-1); + int x2 = LIM(xc+1, 0, original->width-1); transformed->r[y][x] = vignmul*(original->r[y1][x1]*(1.0-Dx)*(1.0-Dy) + original->r[y1][x2]*Dx*(1.0-Dy) + original->r[y2][x1]*(1.0-Dx)*Dy + original->r[y2][x2]*Dx*Dy); transformed->g[y][x] = vignmul*(original->g[y1][x1]*(1.0-Dx)*(1.0-Dy) + original->g[y1][x2]*Dx*(1.0-Dy) + original->g[y2][x1]*(1.0-Dx)*Dy + original->g[y2][x2]*Dx*Dy); transformed->b[y][x] = vignmul*(original->b[y1][x1]*(1.0-Dx)*(1.0-Dy) + original->b[y1][x2]*Dx*(1.0-Dy) + original->b[y2][x1]*(1.0-Dx)*Dy + original->b[y2][x2]*Dx*Dy); @@ -453,10 +444,10 @@ void ImProcFunctions::transformSep (Imagefloat* original, Imagefloat* transforme if (yc > 0 && yc < original->height-2 && xc > 0 && xc < original->width-2) // all interpolation pixels inside image cubintch (chorig[c], xc-1, yc-1, Dx, Dy, &(chtrans[c][y][x]), vignmul); else { // edge pixels - int y1 = CLIPTO(yc, 0, original->height-1); - int y2 = CLIPTO(yc+1, 0, original->height-1); - int x1 = CLIPTO(xc, 0, original->width-1); - int x2 = CLIPTO(xc+1, 0, original->width-1); + int y1 = LIM(yc, 0, original->height-1); + int y2 = LIM(yc+1, 0, original->height-1); + int x1 = LIM(xc, 0, original->width-1); + int x2 = LIM(xc+1, 0, original->width-1); chtrans[c][y][x] = vignmul*(chorig[c][y1][x1]*(1.0-Dx)*(1.0-Dy) + chorig[c][y1][x2]*Dx*(1.0-Dy) + chorig[c][y2][x1]*(1.0-Dx)*Dy + chorig[c][y2][x2]*Dx*Dy); } } @@ -557,10 +548,10 @@ void ImProcFunctions::simpltransform (Imagefloat* original, Imagefloat* transfor transformed->b[y][x] = vignmul*(original->b[yc][xc]*(1.0-Dx)*(1.0-Dy) + original->b[yc][xc+1]*Dx*(1.0-Dy) + original->b[yc+1][xc]*(1.0-Dx)*Dy + original->b[yc+1][xc+1]*Dx*Dy); } else { // edge pixels - int y1 = CLIPTO(yc, 0, original->height-1); - int y2 = CLIPTO(yc+1, 0, original->height-1); - int x1 = CLIPTO(xc, 0, original->width-1); - int x2 = CLIPTO(xc+1, 0, original->width-1); + int y1 = LIM(yc, 0, original->height-1); + int y2 = LIM(yc+1, 0, original->height-1); + int x1 = LIM(xc, 0, original->width-1); + int x2 = LIM(xc+1, 0, original->width-1); transformed->r[y][x] = vignmul*(original->r[y1][x1]*(1.0-Dx)*(1.0-Dy) + original->r[y1][x2]*Dx*(1.0-Dy) + original->r[y2][x1]*(1.0-Dx)*Dy + original->r[y2][x2]*Dx*Dy); transformed->g[y][x] = vignmul*(original->g[y1][x1]*(1.0-Dx)*(1.0-Dy) + original->g[y1][x2]*Dx*(1.0-Dy) + original->g[y2][x1]*(1.0-Dx)*Dy + original->g[y2][x2]*Dx*Dy); transformed->b[y][x] = vignmul*(original->b[y1][x1]*(1.0-Dx)*(1.0-Dy) + original->b[y1][x2]*Dx*(1.0-Dy) + original->b[y2][x1]*(1.0-Dx)*Dy + original->b[y2][x2]*Dx*Dy); diff --git a/rtengine/ipvibrance.cc b/rtengine/ipvibrance.cc index 64c7d5766..1f461bc02 100644 --- a/rtengine/ipvibrance.cc +++ b/rtengine/ipvibrance.cc @@ -18,7 +18,7 @@ * along with RawTherapee. If not, see . */ -#include +#include "rt_math.h" #include "rtengine.h" #include "improcfun.h" @@ -38,9 +38,6 @@ using namespace procparams; #define SAT(a,b,c) ((float)max(a,b,c)-(float)min(a,b,c))/(float)max(a,b,c) -#define D50x 0.96422 -#define D50z 0.82521 - extern const Settings* settings; //Munsell Lch LUTf : 195 LUT diff --git a/rtengine/jdatasrc.cc b/rtengine/jdatasrc.cc index d5875b3ce..92cc3492f 100644 --- a/rtengine/jdatasrc.cc +++ b/rtengine/jdatasrc.cc @@ -236,7 +236,8 @@ my_error_exit (j_common_ptr cinfo) //jpeg_destroy(cinfo); j_decompress_ptr dinfo = (j_decompress_ptr)cinfo; - longjmp (((rt_jpeg_error_mgr*)(dinfo->src))->error_jmp_buf, 1); +// longjmp (((rt_jpeg_error_mgr*)(dinfo->src))->error_jmp_buf, 1); + longjmp ((reinterpret_cast(dinfo->src)) ->error_jmp_buf, 1); } diff --git a/rtengine/klt/klt.cc b/rtengine/klt/klt.cc index d08999e62..f650e5e81 100644 --- a/rtengine/klt/klt.cc +++ b/rtengine/klt/klt.cc @@ -8,7 +8,7 @@ #include #include /* logf() */ #include /* malloc() */ -#include +#include "../rt_math.h" /* Our includes */ #include "base.h" diff --git a/rtengine/klt/klt_util.cc b/rtengine/klt/klt_util.cc index 2e8bb6cde..e1fc342f3 100644 --- a/rtengine/klt/klt_util.cc +++ b/rtengine/klt/klt_util.cc @@ -6,7 +6,8 @@ #include #include /* malloc() */ #include /* fabs() */ -#include + +#include "../rt_math.h" /* Our includes */ #include "base.h" diff --git a/rtengine/klt/selectGoodFeatures.cc b/rtengine/klt/selectGoodFeatures.cc index 5dacf72ea..176057f39 100644 --- a/rtengine/klt/selectGoodFeatures.cc +++ b/rtengine/klt/selectGoodFeatures.cc @@ -382,13 +382,12 @@ void _KLTSelectGoodFeatures( int borderx = tc->borderx; /* Must not touch cols */ int bordery = tc->bordery; /* lost by convolution */ int x, y; - int i; if (borderx < window_hw) borderx = window_hw; if (bordery < window_hh) bordery = window_hh; /* Find largest value of an int */ - for (i = 0 ; i < sizeof(int) ; i++) limit *= 256; + for (size_t i = 0 ; i < sizeof(int) ; i++) limit *= 256; limit = limit/2 - 1; /* For most of the pixels in the image, do ... */ diff --git a/rtengine/myfile.cc b/rtengine/myfile.cc index e3139203c..9b3b5a10a 100644 --- a/rtengine/myfile.cc +++ b/rtengine/myfile.cc @@ -98,7 +98,7 @@ IMFILE* fopen (const char* fname) { bool bzip = false; Glib::ustring bname = Glib::path_get_basename(fname); - int lastdot = bname.find_last_of ('.'); + size_t lastdot = bname.find_last_of ('.'); if (lastdot!=bname.npos) bzip = bname.substr (lastdot).casefold() == Glib::ustring(".bz2").casefold(); @@ -211,7 +211,7 @@ IMFILE* gfopen (const char* fname) { { bool bzip = false; Glib::ustring bname = Glib::path_get_basename(fname); - int lastdot = bname.find_last_of ('.'); + size_t lastdot = bname.find_last_of ('.'); if (lastdot!=bname.npos) bzip = bname.substr (lastdot).casefold() == Glib::ustring(".bz2").casefold(); diff --git a/rtengine/processingjob.h b/rtengine/processingjob.h index 11be16e36..800b58820 100644 --- a/rtengine/processingjob.h +++ b/rtengine/processingjob.h @@ -40,6 +40,6 @@ class ProcessingJobImpl : public ProcessingJob { ~ProcessingJobImpl () { if (initialImage) initialImage->decreaseRef(); } }; -}; +} #endif diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index ca5430037..8a4965a5b 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -20,7 +20,7 @@ #include #include #include -#include +#include "rt_math.h" #include "safegtk.h" #include "../rtgui/multilangmgr.h" @@ -1325,7 +1325,7 @@ PartialProfile::PartialProfile(ProcParams* pp, ParamsEdited* pe, bool fullCopy) } else pedited = pe; -}; +} PartialProfile::PartialProfile(const ProcParams* pp, const ParamsEdited* pe) { if (pp) { @@ -1339,7 +1339,7 @@ PartialProfile::PartialProfile(const ProcParams* pp, const ParamsEdited* pe) { } else pedited = NULL; -}; +} int PartialProfile::load (Glib::ustring fName) { if (!pparams) pparams = new ProcParams(); @@ -1379,7 +1379,7 @@ void PartialProfile::applyTo(ProcParams *destParams) const { void PartialProfile::set(bool v) { if (pedited) pedited->set(v); -}; +} } } diff --git a/rtengine/rawimage.cc b/rtengine/rawimage.cc index f060bf545..74499ed17 100644 --- a/rtengine/rawimage.cc +++ b/rtengine/rawimage.cc @@ -42,7 +42,7 @@ RawImage::~RawImage() /* Similar to dcraw scale_colors for coeff. calculation, but without actual pixels scaling. * need pixels in data[][] available */ -int RawImage::get_colorsCoeff( float *pre_mul_, float *scale_mul_, float *cblack_) +void RawImage::get_colorsCoeff( float *pre_mul_, float *scale_mul_, float *cblack_) { unsigned row, col, x, y, c, sum[8]; @@ -193,7 +193,7 @@ int RawImage::loadRaw (bool loadData, bool closeFile) } // Setting the black and cblack - int i = cblack[3]; + unsigned int i = cblack[3]; for (int c=0; c <3; c++) if (i > cblack[c]) i = cblack[c]; @@ -264,4 +264,4 @@ RawImage::get_thumbSwap() const return ((order == 0x4949) == (ntohs(0x1234) == 0x1234)) ? true : false; } -}; //namespace rtengine +} //namespace rtengine diff --git a/rtengine/rawimage.h b/rtengine/rawimage.h index 7225342a9..867ecffea 100644 --- a/rtengine/rawimage.h +++ b/rtengine/rawimage.h @@ -90,7 +90,7 @@ public: ~RawImage(); int loadRaw (bool loadData=true, bool closeFile=true); - int get_colorsCoeff( float *pre_mul, float *scale_mul, float *cblack ); + void get_colorsCoeff( float* pre_mul_, float* scale_mul_, float* cblack_ ); void set_prefilters(){ if (isBayer() && get_colors() == 3) { prefilters = filters; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index b5bb28568..03ee3507d 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -18,7 +18,8 @@ */ #include #include -#include + +#include "rtengine.h" #include "rawimagesource.h" #include "rawimagesource_i.h" #include "median.h" @@ -34,9 +35,8 @@ #include "../rtgui/options.h" #include "dcp.h" #include "rt_math.h" +#include "improcfun.h" - -#include "improcfun.h" #ifdef _OPENMP #include #endif @@ -46,12 +46,9 @@ namespace rtengine { extern const Settings* settings; #undef ABS #undef DIST -#undef CLIP #define ABS(a) ((a)<0?-(a):(a)) #define DIST(a,b) (ABS(a-b)) -#define MAXVAL 0xffff -#define CLIP(a) ((a)>0?((a)(b)) {temp=(a);(a)=(b);(b)=temp;} } @@ -1529,7 +1526,7 @@ void RawImageSource::processFalseColorCorrectionThread (Imagefloat* im, int row float middle_Q[6]; float* tmp; - int ppx=0, px=(row_from-1)%3, cx=row_from%3, nx=0; + int ppx, px=(row_from-1)%3, cx=row_from%3, nx=0; convert_row_to_YIQ (im->r[row_from-1], im->g[row_from-1], im->b[row_from-1], rbconv_Y[px], rbconv_I[px], rbconv_Q[px], W); convert_row_to_YIQ (im->r[row_from], im->g[row_from], im->b[row_from], rbconv_Y[cx], rbconv_I[cx], rbconv_Q[cx], W); @@ -2026,8 +2023,6 @@ void RawImageSource::HLRecovery_blend(float* rin, float* gin, float* bin, int wi { { 1,1,1 }, { 1,-1,1 }, { 1,1,-1 } } }; #define FOREACHCOLOR for (int c=0; c < ColorCount; c++) -#include "rt_math.h" - float minpt=min(hlmax[0],hlmax[1],hlmax[2]);//min of the raw clip points //float maxpt=max(hlmax[0],hlmax[1],hlmax[2]);//max of the raw clip points @@ -2445,7 +2440,7 @@ void RawImageSource::getRowStartEnd (int x, int &start, int &end) { if (!ri->isBayer()) { int xmin, xmax, ymin, ymax; int xr, xg, xb, yr, yg, yb; - for (int i=0; i0?((a) inline const _Tp SQR (_Tp x) { // return std::pow(x,2); Slower than: @@ -22,6 +27,24 @@ namespace rtengine { return std::max(a,b); } + + template + inline const _Tp& LIM(const _Tp& a, const _Tp& b, const _Tp& c) { + return std::max(b,std::min(a,c)); + } + + template + inline const _Tp& ULIM(const _Tp& a, const _Tp& b, const _Tp& c) { + return ((b < c) ? LIM(a,b,c) : LIM(a,c,b)); + } + + template + inline const _Tp& CLIP(const _Tp& a) { + return LIM(a, static_cast(0), static_cast(MAXVAL)); + //return ((a)>0.0? ((a) inline const _Tp& min(const _Tp& a, const _Tp& b, const _Tp& c) { return std::min(c,std::min(a,b)); diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index ad02e6add..e6f57071c 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -38,9 +38,6 @@ #include "jpeg.h" #include "../rtgui/ppversion.h" -#define MAXVAL 0xffff -#define CLIP(a) ((a)>0?((a)=0 && y>=0 && xwidth && yheight) { reds += thumbImg->r[y][x]; @@ -1255,7 +1249,7 @@ bool Thumbnail::readImage (const Glib::ustring& fname) { cinfo.err = my_jpeg_std_error (&jerr); jpeg_create_decompress (&cinfo); my_jpeg_stdio_src (&cinfo,f); - if ( setjmp(((rt_jpeg_error_mgr*)cinfo.src)->error_jmp_buf) == 0 ) + if ( setjmp((reinterpret_cast(cinfo.src))->error_jmp_buf) == 0 ) { jpeg_read_header (&cinfo, TRUE); int width, height; diff --git a/rtengine/safegtk.cc b/rtengine/safegtk.cc index 56e5fb218..922c4c330 100644 --- a/rtengine/safegtk.cc +++ b/rtengine/safegtk.cc @@ -130,14 +130,14 @@ void safe_build_file_list (Glib::RefPtr &dir, std::vectorget_name()).lowercase(); - int pos = fname.find_last_of('.'); - if (pos > -1 && pos < (fname.length()-1)) { + size_t pos = fname.find_last_of('.'); + if (pos < (fname.length()-1)) { // there is an extension to the filename Glib::ustring lcFileExt = fname.substr(pos+1).lowercase(); // look out if it has one of the retained extensions - for (unsigned int i=0; iget_name())); break; diff --git a/rtengine/shmap.cc b/rtengine/shmap.cc index 18a2fdf1d..689e7ac8f 100644 --- a/rtengine/shmap.cc +++ b/rtengine/shmap.cc @@ -23,9 +23,7 @@ #include "rt_math.h" #include "rawimagesource.h" -#undef MAXVAL #undef THREAD_PRIORITY_NORMAL -#define MAXVAL 0xffff namespace rtengine { diff --git a/rtengine/shmap.h b/rtengine/shmap.h index 9d9cdf4fb..f352b0f82 100644 --- a/rtengine/shmap.h +++ b/rtengine/shmap.h @@ -40,5 +40,5 @@ class SHMap { void dirpyr_shmap (float ** data_fine, float ** data_coarse, int width, int height, LUTf & rangefn, int level, int scale); }; -}; +} #endif diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 3455245a6..460379e61 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -29,10 +29,6 @@ #include "rawimagesource.h" #include "../rtgui/ppversion.h" #undef THREAD_PRIORITY_NORMAL -#define CLIP(a) ((a)>0?((a)<65535?(a):65535):0) - - - namespace rtengine { extern const Settings* settings; diff --git a/rtengine/slicer.cc b/rtengine/slicer.cc index e832b62e3..0a3eafece 100644 --- a/rtengine/slicer.cc +++ b/rtengine/slicer.cc @@ -19,7 +19,7 @@ #include #include -#include +#include "rt_math.h" #include "slicer.h" diff --git a/rtengine/stdimagesource.cc b/rtengine/stdimagesource.cc index 8001ce1ae..f9911de56 100644 --- a/rtengine/stdimagesource.cc +++ b/rtengine/stdimagesource.cc @@ -19,8 +19,6 @@ #include "stdimagesource.h" #include "mytime.h" #include "iccstore.h" -#define MAXVAL 0xffff -#define CLIP(a) ((a)>0?((a) red, std::vector=0 && y>=0 && xwidth && yheight) { reds += img->r[y][x]; diff --git a/rtengine/stdimagesource.h b/rtengine/stdimagesource.h index e16597f00..22e810d09 100644 --- a/rtengine/stdimagesource.h +++ b/rtengine/stdimagesource.h @@ -69,5 +69,5 @@ class StdImageSource : public ImageSource { void hflip (Imagefloat* im); void vflip (Imagefloat* im); }; -}; +} #endif diff --git a/rtengine/utils.cc b/rtengine/utils.cc index fa7ba7eec..3f368873f 100644 --- a/rtengine/utils.cc +++ b/rtengine/utils.cc @@ -19,7 +19,7 @@ #include #include #include -#include +#include "rt_math.h" #include "utils.h" #include "rt_math.h" diff --git a/rtexif/canonattribs.cc b/rtexif/canonattribs.cc index a070a950b..faf0bcd5a 100644 --- a/rtexif/canonattribs.cc +++ b/rtexif/canonattribs.cc @@ -1454,6 +1454,6 @@ const TagAttrib canonAttribs[] = { {1, 1, 0, 0, 0x4008, "BlackLevel", &stdInterpreter}, {1, 1, 0, canonMicroAdjustAttrib, 0x4013, "AFMicroAdj", &stdInterpreter}, {-1, 0, 0, 0, 0, "", NULL}}; -}; +} #endif diff --git a/rtexif/fujiattribs.cc b/rtexif/fujiattribs.cc index 1f17c988c..93d2170f6 100644 --- a/rtexif/fujiattribs.cc +++ b/rtexif/fujiattribs.cc @@ -255,6 +255,6 @@ const TagAttrib fujiAttribs[] = { {0, 1, 0, 0, 0x8002, "OrderNumber", &stdInterpreter}, {0, 1, 0, 0, 0x8003, "FrameNumber", &stdInterpreter}, {-1, 0, 0, 0, 0, "", NULL}}; -}; +} #endif diff --git a/rtexif/olympusattribs.cc b/rtexif/olympusattribs.cc index 441a872a5..9cc6206d0 100644 --- a/rtexif/olympusattribs.cc +++ b/rtexif/olympusattribs.cc @@ -696,6 +696,6 @@ const TagAttrib olympusAttribs[] = { {1, 1, 0, 0, 0x2900, "Olympus2900", &stdInterpreter}, {0, 1, 0, 0, 0x3000, "RawInfo", &stdInterpreter}, {-1, 0, 0, 0, 0, "", NULL}}; -}; +} #endif diff --git a/rtexif/pentaxattribs.cc b/rtexif/pentaxattribs.cc index 22f03db4c..1abb90c9a 100644 --- a/rtexif/pentaxattribs.cc +++ b/rtexif/pentaxattribs.cc @@ -1199,7 +1199,7 @@ const TagAttrib pentaxCameraInfoAttribs[] = { {0, 1, 0, 0, 4, "InternalSerialNumber", &stdInterpreter}, {-1, 0, 0, 0, 0, "", NULL}}; -}; +} #endif diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc index 500d20780..2de29d2b7 100644 --- a/rtexif/rtexif.cc +++ b/rtexif/rtexif.cc @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -86,7 +85,7 @@ TagDirectory::TagDirectory (TagDirectory* p, FILE* f, int base, const TagAttrib* TagDirectory::~TagDirectory () { - for (int i=0; iisDirectory()) for (int j=0; tags[i]->getDirectory(j); j++) tags[i]->getDirectory(j)->sort (); @@ -133,7 +132,7 @@ const TagAttrib* TagDirectory::getAttrib (const char* name) { void TagDirectory::printAll () const { - for (int i=0; inameToString (); if (tags[i]->isDirectory()) for (int j=0; tags[i]->getDirectory(j); j++) { @@ -169,7 +168,7 @@ void TagDirectory::addTagFront (Tag* tag) { void TagDirectory::replaceTag (Tag* tag) { // look up if it already exists: - for (int i=0; igetID()==tag->getID()) { delete tags[i]; tags[i] = tag; @@ -180,7 +179,7 @@ void TagDirectory::replaceTag (Tag* tag) { Tag* TagDirectory::getTag (int ID) const { - for (int i=0; igetID()==ID) return tags[i]; return NULL; @@ -205,7 +204,7 @@ Tag* TagDirectory::findTag (const char* name) const { else break; } } - for (int i=0; iisDirectory()){ TagDirectory *dir = tags[i]->getDirectory(); Tag* t=dir->findTag(name); @@ -215,14 +214,14 @@ Tag* TagDirectory::findTag (const char* name) const { } void TagDirectory::keepTag (int ID) { - for (int i=0; igetID()==ID) tags[i]->setKeep(true); } int TagDirectory::calculateSize () { int size = 2; // space to store the number of tags - for (int i=0; igetKeep()) size += 12 + tags[i]->calculateSize (); @@ -233,7 +232,7 @@ int TagDirectory::calculateSize () { TagDirectory* TagDirectory::clone (TagDirectory* parent) { TagDirectory* td = new TagDirectory (parent, attribs, order); - for (int i=0; itags.push_back (tags[i]->clone (td)); return td; } @@ -243,7 +242,7 @@ int TagDirectory::write (int start, unsigned char* buffer) { int size = calculateSize (); int tagnum = 0; int nondirspace = 0; - for (int i=0; igetKeep()) { tagnum++; if (!tags[i]->isDirectory()) @@ -255,7 +254,7 @@ int TagDirectory::write (int start, unsigned char* buffer) { sset2 (tagnum, buffer+start, order); pos += 2; int maxPos = start + size; - for (int i=0; igetKeep()) { if (!tags[i]->isDirectory()) nextValOffs = tags[i]->write (pos, nextValOffs, buffer); // pos: where to put the tag, dataoffset: the place where the value can be put. return: next data offset @@ -277,7 +276,7 @@ void TagDirectory::applyChange (std::string name, std::string value) { if (dp==std::string::npos) { Tag* t = NULL; - for (int i=0; inameToString()==fseg) { t = tags[i]; break; @@ -310,7 +309,7 @@ void TagDirectory::applyChange (std::string name, std::string value) { std::string basename = fseg.substr (0,dp1); Tag* t = NULL; int dirnum = -1; - for (int i=0; iisDirectory()) { for (int j=0; tags[i]->getDirectory(j); j++) { if (tags[i]->nameToString(j) == fseg) { @@ -652,7 +651,7 @@ defsubdirs: // allocate space directory = new TagDirectory*[sdcount+1]; // load directories - for (int j=0,i=0; jsubdirAttribs, getOrder()); @@ -833,12 +832,12 @@ void Tag::toString (char* buffer, int ofs) { return; } - int maxcount = 4; + size_t maxcount = 4; if (count<4) maxcount = count; strcpy (buffer, ""); - for (int i=0; i0) strcat (buffer, ", "); char* b = buffer + strlen(buffer); @@ -1390,7 +1389,7 @@ std::vector ExifManager::defTags; // forthis: the byte order will be taken from directory "forthis" const std::vector& ExifManager::getDefaultTIFFTags (TagDirectory* forthis) { - for (int i=0; iclone (NULL); + cl = (const_cast(root))->clone (NULL); else cl = new TagDirectory (NULL, ifdAttribs, INTEL); @@ -1462,8 +1460,7 @@ int ExifManager::createTIFFHeader (const TagDirectory* root, const rtengine::pro TagDirectory* cl; if (root) - //FIXME: static_cast needed here - cl = ((TagDirectory*)root)->clone (NULL); + cl = (const_cast(root))->clone (NULL); else cl = new TagDirectory (NULL, ifdAttribs, INTEL); diff --git a/rtexif/rtexif.h b/rtexif/rtexif.h index d77f4ec0d..020062c5d 100644 --- a/rtexif/rtexif.h +++ b/rtexif/rtexif.h @@ -364,5 +364,5 @@ extern const TagAttrib sonyAttribs[]; extern const TagAttrib sonyCameraSettingsAttribs[]; extern const TagAttrib sonyCameraSettingsAttribs2[]; extern const TagAttrib olympusAttribs[]; -}; +} #endif diff --git a/rtexif/sonyminoltaattribs.cc b/rtexif/sonyminoltaattribs.cc index 2ad827fa6..39c55fbd5 100644 --- a/rtexif/sonyminoltaattribs.cc +++ b/rtexif/sonyminoltaattribs.cc @@ -864,8 +864,7 @@ const TagAttrib sonyCameraSettingsAttribs2[]={ {0, 1, 0, 0, 63, "Rotation",&saRotation}, {0, 1, 0, 0, 84, "SonyImageSize",&saSonyImageSize}, {-1, 0, 0, 0, 0, "", NULL}}; - -}; +} #endif diff --git a/rtexif/stdattribs.cc b/rtexif/stdattribs.cc index c3330750f..64c7d8249 100644 --- a/rtexif/stdattribs.cc +++ b/rtexif/stdattribs.cc @@ -555,7 +555,6 @@ const TagAttrib iopAttribs[] = { {0, 0, 0, 0, 0xc761, "NoiseProfile", &stdInterpreter}, {0, 2, 0, 0, 0x00fe, "NewSubFileType", &stdInterpreter}, {-1, 0, 0, 0, 0, "", NULL}}; - -}; +} #endif diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index 8672503f4..f89c4a33b 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -19,7 +19,7 @@ #include #include #include -#include +#include "../rtengine/rt_math.h" #include "batchqueue.h" #include "multilangmgr.h" @@ -68,7 +68,7 @@ BatchQueue::~BatchQueue () // Reduce the max size of a thumb, since thumb is processed synchronously on adding to queue // leading to very long waiting when adding more images int BatchQueue::calcMaxThumbnailHeight() { - return min(options.maxThumbnailHeight, 200); + return std::min(options.maxThumbnailHeight, 200); } // Function for virtual override in thumbbrowser base @@ -92,7 +92,7 @@ void BatchQueue::addEntries ( std::vector &entries, bool head) for( std::vector::iterator entry = entries.begin(); entry != entries.end();entry++ ){ (*entry)->setParent (this); - (*entry)->resize (min(options.thumbSize, getMaxThumbnailHeight())); // batch queue might have smaller, restricted size + (*entry)->resize (std::min(options.thumbSize, getMaxThumbnailHeight())); // batch queue might have smaller, restricted size Glib::ustring tempFile = getTempFilenameForParams( (*entry)->filename ); // recovery save @@ -243,7 +243,7 @@ void BatchQueue::cancelItems (std::vector* items) { Glib::RWLock::WriterLock l(entryRW); #endif - for (int i=0; isize(); i++) { + for (size_t i=0; isize(); i++) { BatchQueueEntry* entry = (BatchQueueEntry*)(*items)[i]; if (entry->processing) continue; @@ -256,7 +256,7 @@ void BatchQueue::cancelItems (std::vector* items) { g_idle_add (cancelItemUI, entry); } } - for (int i=0; iselected = false; lastClicked = NULL; selected.clear (); @@ -301,7 +301,7 @@ void BatchQueue::tailItems (std::vector* items) { #ifdef WIN32 Glib::RWLock::WriterLock l(entryRW); #endif - for (int i=0; isize(); i++) { + for (size_t i=0; isize(); i++) { BatchQueueEntry* entry = (BatchQueueEntry*)(*items)[i]; if (entry->processing) continue; @@ -326,7 +326,7 @@ void BatchQueue::selectAll () { lastClicked = NULL; selected.clear (); - for (int i=0; iprocessing) continue; fd[i]->selected = true; @@ -468,7 +468,7 @@ Glib::ustring BatchQueue::calcAutoFileNameBase (const Glib::ustring& origFileNam std::vector pa; std::vector da; - for (int i=0; i=origFileName.size()) @@ -484,7 +484,7 @@ Glib::ustring BatchQueue::calcAutoFileNameBase (const Glib::ustring& origFileNam else pa.push_back (da[0]); - for (int i=1; i(data); params->listener->queueSizeChanged (params->qsize, params->queueEmptied); delete params; return 0; diff --git a/rtgui/batchqueueentry.cc b/rtgui/batchqueueentry.cc index fa84571c2..b9e961ad9 100644 --- a/rtgui/batchqueueentry.cc +++ b/rtgui/batchqueueentry.cc @@ -117,7 +117,7 @@ struct BQUpdateParam { int updateImageUIThread (void* data) { - BQUpdateParam* params = (BQUpdateParam*)data; + BQUpdateParam* params = static_cast(data); BatchQueueEntryIdleHelper* bqih = params->bqih; diff --git a/rtgui/batchtoolpanelcoord.cc b/rtgui/batchtoolpanelcoord.cc index d7a216055..09ac98a47 100644 --- a/rtgui/batchtoolpanelcoord.cc +++ b/rtgui/batchtoolpanelcoord.cc @@ -38,7 +38,7 @@ BatchToolPanelCoordinator::BatchToolPanelCoordinator (FilePanel* parent) : ToolP metadataPanel = 0; toiM = 0; - for (int i=0; isetBatchMode (true); } @@ -48,7 +48,7 @@ void BatchToolPanelCoordinator::selectionChanged (const std::vector& closeSession (); this->selected = selected; selFileNames.clear (); - for (int i=0; igetFileName ()); initSession (); } @@ -58,18 +58,18 @@ void BatchToolPanelCoordinator::closeSession (bool save) { pparamsEdited.set (false); - for (int i=0; iremoveThumbnailListener (this); if (somethingChanged && save) { // read new values from the gui - for (int i=0; iwrite (&pparams, &pparamsEdited); // combine with initial parameters and set ProcParams newParams; - for (int i=0; isetProcParams (newParams, NULL, BATCHEDITOR, true); } } - for (int i=0; iclearParamChanges (); } @@ -89,7 +89,7 @@ void BatchToolPanelCoordinator::initSession () { somethingChanged = false; initialPP.resize (selected.size()); - for (int i=0; igetProcParams (); selected[i]->applyAutoExp (initialPP[i]); selected[i]->addThumbnailListener (this); @@ -224,11 +224,11 @@ void BatchToolPanelCoordinator::initSession () { if (options.baBehav[ADDSET_RAWEXPOS_BLACKS]) pparams.raw.blackzero = pparams.raw.blackone = pparams.raw.blacktwo = pparams.raw.blackthree = 0; } - for (int i=0; isetDefaults (&pparams, &pparamsEdited); toolPanels[i]->read (&pparams, &pparamsEdited); } - for (int i=0; iprocParamsChanged (&pparams, rtengine::EvPhotoLoaded, M("BATCH_PROCESSING"), &pparamsEdited); } @@ -243,27 +243,27 @@ void BatchToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const G pparamsEdited.set (false); // read new values from the gui - for (int i=0; iwrite (&pparams, &pparamsEdited); // TODO: We may update the crop on coarse rotate events here, like in ToolPanelCoordinator::panelChanged if (event==rtengine::EvAutoExp || event==rtengine::EvClip) - for (int i=0; iapplyAutoExp (initialPP[i]); } if (event==rtengine::EvAutoDIST) { - for (int i=0; isetProcParams (newParams, NULL, BATCHEDITOR, false); } - for (int i=0; iprocParamsChanged (&pparams, event, descr, &pparamsEdited); } @@ -324,25 +324,25 @@ void BatchToolPanelCoordinator::profileChange (const rtengine::procparams::Part pparamsEdited = *paramsEdited; - for (int i=0; iread (&pparams, &pparamsEdited); somethingChanged = true; // read new values from the gui - for (int i=0; iwrite (&pparams, &pparamsEdited); // combine with initial parameters of each image and set ProcParams newParams; - for (int i=0; isetProcParams (newParams, NULL, BATCHEDITOR, false); } - for (int i=0; iprocParamsChanged (&pparams, event, descr, &pparamsEdited); } @@ -372,7 +372,7 @@ void BatchToolPanelCoordinator::spotWBselected (int x, int y, Thumbnail* thm) { // toolBar->setTool (TOOL_HAND); if (x>0 && y>0 && thm) { - for (int i=0; i(data); params->crop->setDimensions (params->x, params->y); delete params; return 0; diff --git a/rtgui/crophandler.cc b/rtgui/crophandler.cc index f9fc597ce..6abb7e1ba 100644 --- a/rtgui/crophandler.cc +++ b/rtgui/crophandler.cc @@ -168,7 +168,7 @@ int createpixbufs (void* data) { GThreadLock lock; - CropHandlerIdleHelper* chi = (CropHandlerIdleHelper*) data; + CropHandlerIdleHelper* chi = static_cast(data); if (chi->destroyed) { if (chi->pending == 1) delete chi; diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index dc36f5b4b..f59c804a3 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -16,14 +16,18 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ +#include + #include "cropwindow.h" #include "options.h" -#include #include "guiutils.h" #include "../rtengine/mytime.h" #include "imagearea.h" #include "cursormanager.h" #include "../rtengine/safegtk.h" +#include "../rtengine/rt_math.h" + +using namespace rtengine; struct ZoomStep { Glib::ustring label; @@ -758,25 +762,25 @@ void CropWindow::expose (Cairo::RefPtr cr) { currIndex = currWS+3*k + kh*pixWSRowStride; curL = 0.299*(currIndex)[0]+0.587*(currIndex)[1]+0.114*(currIndex)[2]; sum_L += curL; - sumsq_L += pow(curL,2); + sumsq_L += SQR(curL); // Band2 @ blur_radius2 if (kh>=-blur_radius2 && kh<=blur_radius2 && k>=-blur_radius2 && k<=blur_radius2){ sum_L2 += curL; - sumsq_L2 += pow(curL,2); + sumsq_L2 += SQR(curL); } } } //************* // averages - kernel_size= pow(2*blur_radius+1,2); // consider -1: Bessel's correction for the sample standard deviation (tried, did not make any visible difference) - kernel_size2= pow(2*blur_radius2+1,2); + kernel_size= SQR(2*blur_radius+1); // consider -1: Bessel's correction for the sample standard deviation (tried, did not make any visible difference) + kernel_size2= SQR(2*blur_radius2+1); avg_L = sum_L/kernel_size; avg_L2 = sum_L2/kernel_size2; - stdDev_L = sqrt(sumsq_L/kernel_size - pow(avg_L,2)); - stdDev_L2 = sqrt(sumsq_L2/kernel_size2 - pow(avg_L2,2)); + stdDev_L = sqrt(sumsq_L/kernel_size - SQR(avg_L)); + stdDev_L2 = sqrt(sumsq_L2/kernel_size2 - SQR(avg_L2)); //TODO: try to normalize by average L of the entire (preview) image diff --git a/rtgui/dirbrowser.cc b/rtgui/dirbrowser.cc index d9f05914a..3c5a7b972 100644 --- a/rtgui/dirbrowser.cc +++ b/rtgui/dirbrowser.cc @@ -209,7 +209,7 @@ void DirBrowser::row_expanded (const Gtk::TreeModel::iterator& iter, const Gtk:: else { std::sort (subDirs.begin(), subDirs.end()); - for (int i=0; iget_iter (path)->get_value (dtColumns.dirname); if (safe_file_test (dname, Glib::FILE_TEST_IS_DIR)) - for (int i=0; idirSelected (dname); } @@ -344,7 +344,7 @@ void DirBrowser::open (const Glib::ustring& dirname, const Glib::ustring& fileNa Gtk::TreePath path = expandToDir (absDirPath); dirtree->scroll_to_row (path); dirtree->get_selection()->select (path); - for (int i=0; idirSelected (absDirPath, Glib::build_filename (absDirPath, fileName)); } diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index cb7bc1ba3..7c07f8d9c 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -507,7 +507,7 @@ struct spsparams { int setProgressStateUIThread (void* data) { - spsparams* p = (spsparams*)data; + spsparams* p = static_cast(data); if (p->epih->destroyed) { if (p->epih->pending == 1) @@ -544,7 +544,7 @@ struct spparams { int setprogressStrUI( void *p ) { - spparams *s= (spparams*)p; + spparams *s= static_cast(p); if( ! s->str.empty() ) s->pProgress->set_text( M(s->str) ); @@ -635,7 +635,7 @@ void EditorPanel::displayError (Glib::ustring descr) { } int disperrorUI (void* data) { - errparams* p = (errparams*)data; + errparams* p = static_cast(data); if (p->epih->destroyed) { if (p->epih->pending == 1) diff --git a/rtgui/exifpanel.cc b/rtgui/exifpanel.cc index 828ef877c..fce35b62b 100644 --- a/rtgui/exifpanel.cc +++ b/rtgui/exifpanel.cc @@ -152,7 +152,7 @@ void ExifPanel::setImageData (const ImageMetaData* id) { exifTreeModel->clear (); const std::vector& defTags = ExifManager::getDefaultTIFFTags (NULL); - for (int i=0; inameToString() == "ImageWidth" || defTags[i]->nameToString() == "ImageHeight" || defTags[i]->nameToString() == "BitsPerSample") addTag (exifTreeModel->children(), defTags[i]->nameToString(), "?", SYSTEM, false); else @@ -198,8 +198,7 @@ Gtk::TreeModel::Children ExifPanel::addTag (const Gtk::TreeModel::Children& root void ExifPanel::addDirectory (const TagDirectory* dir, Gtk::TreeModel::Children root) { for (int i=0; igetCount(); i++) { - //FIXME: static_cast needed here - Tag* t = ((TagDirectory*)dir)->getTagByIndex (i); + Tag* t = (const_cast(dir))->getTagByIndex (i); if (t->getAttrib() && t->getAttrib()->action==SYSTEM) continue; if (t->isDirectory()) @@ -266,7 +265,7 @@ void ExifPanel::delIt (Gtk::TreeModel::iterator iter) { void ExifPanel::removePressed () { std::vector sel = exifTree->get_selection()->get_selected_rows(); - for (int i=0; iget_iter (sel[i])); exifSelectionChanged (); @@ -289,7 +288,7 @@ void ExifPanel::keepIt (Gtk::TreeModel::iterator iter) { void ExifPanel::keepPressed () { std::vector sel = exifTree->get_selection()->get_selected_rows(); - for (int i=0; iget_iter (sel[i])); exifSelectionChanged (); @@ -342,7 +341,7 @@ Gtk::TreeModel::iterator ExifPanel::resetIt (Gtk::TreeModel::iterator iter) { void ExifPanel::resetPressed () { std::vector sel = exifTree->get_selection()->get_selected_rows(); - for (int i=0; iget_iter (sel[i])); exifSelectionChanged (); diff --git a/rtgui/filebrowser.cc b/rtgui/filebrowser.cc index 491666c5c..af3fd6062 100644 --- a/rtgui/filebrowser.cc +++ b/rtgui/filebrowser.cc @@ -282,12 +282,12 @@ void FileBrowser::rightClicked (ThumbBrowserEntryBase* entry) { trash->set_sensitive (false); untrash->set_sensitive (false); - for (int i=0; i(selected[i]))->thumbnail->getStage()==1) { untrash->set_sensitive (true); break; } - for (int i=0; i(selected[i]))->thumbnail->getStage()==0) { trash->set_sensitive (true); break; @@ -302,7 +302,7 @@ void FileBrowser::rightClicked (ThumbBrowserEntryBase* entry) { int p = 0; Gtk::Menu* applmenu = Gtk::manage (new Gtk::Menu ()); std::vector profnames = profileStore.getProfileNames (); - for (int i=0; iattach (*mi, 0, 1, p, p+1); p++; mi->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::applyMenuItemActivated), profnames[i])); @@ -314,7 +314,7 @@ void FileBrowser::rightClicked (ThumbBrowserEntryBase* entry) { p = 0; Gtk::Menu* applpartmenu = Gtk::manage (new Gtk::Menu ()); //std::vector profnames = profileStore.getProfileNames (); // this is already created for submenu applmenu above - for (int i=0; iattach (*mi, 0, 1, p, p+1); p++; mi->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::applyPartialMenuItemActivated), profnames[i])); @@ -375,7 +375,7 @@ struct addparams { int AddEntryUIThread (void* data) { - addparams* ap = (addparams*) data; + addparams* ap = static_cast(data); FileBrowserIdleHelper* fbih = ap->fbih; if (fbih->destroyed) { @@ -491,7 +491,7 @@ void FileBrowser::close () { notifySelectionListener (); // The listener merges parameters with old values, so delete afterwards - for (int i=0; i mselected; - for (int i=0; i(selected[i])); if (!tbl || (m!=selall && mselected.empty()) ) @@ -543,7 +543,7 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) { if (m==open) { std::vector entries; - for (int i=0; ithumbnail); tbl->openRequested (entries); } @@ -572,7 +572,7 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) { #endif selected.clear (); - for (int i=0; iselected = true; selected.push_back (fd[i]); @@ -590,7 +590,7 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) { } else if (m==autoDF){ - for (int i=0; ithumbnail->getProcParams(); pp.raw.df_autoselect= true; pp.raw.dark_frame.clear(); @@ -607,7 +607,7 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) { else fc.set_filename( pp.raw.dark_frame ); if( fc.run() == Gtk::RESPONSE_APPLY ){ - for (int i=0; ithumbnail->getProcParams(); pp.raw.dark_frame= fc.get_filename(); pp.raw.df_autoselect= false; @@ -617,7 +617,7 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) { } }else if( m==thisIsDF){ 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; Glib::ustring destName = options.rtSettings.darkFramesPath+ "/" + file->get_basename(); @@ -629,7 +629,7 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) { } } else if (m==autoFF){ - for (int i=0; ithumbnail->getProcParams(); pp.raw.ff_AutoSelect= true; pp.raw.ff_file.clear(); @@ -647,7 +647,7 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) { else fc.set_filename( pp.raw.ff_file ); if( fc.run() == Gtk::RESPONSE_APPLY ){ - for (int i=0; ithumbnail->getProcParams(); pp.raw.ff_file= fc.get_filename(); pp.raw.ff_AutoSelect= false; @@ -658,7 +658,7 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) { } else if( m==thisIsFF){ 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; Glib::ustring destName = options.rtSettings.flatFieldsPath+ "/" + file->get_basename(); @@ -676,11 +676,11 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) { else if (m==partpasteprof) partPasteProfile (); else if (m==clearprof) { - for (int i=0; ithumbnail->clearProcParams (FILEBROWSER); queue_draw (); } else if (m==execcustprof) { - for (int i=0; ithumbnail->createProcParamsForUpdate (false, true); // Empty run to update the thumb @@ -688,12 +688,12 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) { mselected[i]->thumbnail->setProcParams (params, NULL, FILEBROWSER); } } else if (m==clearFromCache) { - for (int i=0; iclearFromCacheRequested (mselected, false); //queue_draw (); } else if (m==clearFromCacheFull) { - for (int i=0; iclearFromCacheRequested (mselected, true); //queue_draw (); } else if (miOpenDefaultViewer!=NULL && m==miOpenDefaultViewer) { @@ -836,7 +836,7 @@ void FileBrowser::applyMenuItemActivated (Glib::ustring ppname) { rtengine::procparams::PartialProfile* partProfile = profileStore.getProfile (ppname); if (partProfile->pparams && !selected.empty()) { - for (int i=0; i(selected[i]))->thumbnail->setProcParams (*partProfile->pparams, partProfile->pedited, FILEBROWSER); queue_draw (); } @@ -852,7 +852,7 @@ void FileBrowser::applyPartialMenuItemActivated (Glib::ustring ppname) { if (srcProfiles->pparams) { if (partialPasteDlg.run()==Gtk::RESPONSE_OK) { - for (int i=0; ithumbnail->createProcParamsForUpdate(false, false); // this can execute customprofilebuilder to generate param file rtengine::procparams::PartialProfile dstProfile(true); @@ -881,7 +881,7 @@ void FileBrowser::applyFilter (const BrowserFilter& filter) { Glib::RWLock::ReaderLock l(entryRW); // Don't make this a writer lock! #endif - for (int i=0; iselected ) { @@ -957,7 +957,7 @@ bool FileBrowser::checkFilter (ThumbBrowserEntryBase* entryb) { // true -> entry void FileBrowser::toTrashRequested (std::vector tbe) { - for (int i=0; ithumbnail->createProcParamsForUpdate(false, false); // this can execute customprofilebuilder to generate param file @@ -979,7 +979,7 @@ void FileBrowser::toTrashRequested (std::vector tbe) { void FileBrowser::fromTrashRequested (std::vector tbe) { - for (int i=0; ithumbnail->getStage()==0) @@ -998,7 +998,7 @@ void FileBrowser::fromTrashRequested (std::vector tbe) { void FileBrowser::rankingRequested (std::vector tbe, int rank) { - for (int i=0; ithumbnail->createProcParamsForUpdate(false, false); // this can execute customprofilebuilder to generate param file @@ -1017,7 +1017,7 @@ void FileBrowser::rankingRequested (std::vector tbe, int rank void FileBrowser::colorlabelRequested (std::vector tbe, int colorlabel) { - for (int i=0; ithumbnail->createProcParamsForUpdate(false, false); // this can execute customprofilebuilder to generate param file @@ -1063,7 +1063,7 @@ void FileBrowser::openNextImage () { #endif if (!fd.empty()) { - for (int i=fd.size()-1; i>=0; i--) + for (size_t i=fd.size()-1; i>0; i--) if (editedFiles.find (fd[i]->filename)!=editedFiles.end()) if (i entries; @@ -1086,7 +1086,7 @@ void FileBrowser::openPrevImage () { #endif if (!fd.empty()) { - for (int i=0; ifilename)!=editedFiles.end()) if (i>0 && tbl) { std::vector entries; @@ -1124,7 +1124,7 @@ void FileBrowser::notifySelectionListener () { if (tbl) { std::vector thm; - for (int i=0; i(selected[i]))->thumbnail); tbl->selectionChanged (thm); } diff --git a/rtgui/filebrowserentry.cc b/rtgui/filebrowserentry.cc index eba3c3731..c6058e25c 100644 --- a/rtgui/filebrowserentry.cc +++ b/rtgui/filebrowserentry.cc @@ -161,7 +161,7 @@ struct tiupdate { int updateImageUI (void* data) { - tiupdate* params = (tiupdate*)data; + tiupdate* params = static_cast(data); FileBrowserEntryIdleHelper* feih = params->feih; if (feih->destroyed) { diff --git a/rtgui/filecatalog.cc b/rtgui/filecatalog.cc index dc7be6d13..091174deb 100644 --- a/rtgui/filecatalog.cc +++ b/rtgui/filecatalog.cc @@ -20,7 +20,7 @@ #include #include #include -#include +#include "../rtengine/rt_math.h" #include "filecatalog.h" #include "filepanel.h" @@ -699,7 +699,7 @@ struct FCOIParams { }; int openRequestedUI (void* p) { - FCOIParams* params = (FCOIParams*)p; + FCOIParams* params = static_cast(p); params->catalog->_openImage (params->tmb); delete params; @@ -1020,7 +1020,7 @@ void FileCatalog::renameRequested (std::vector tbe) { continue; // if no extension is given, concatenate the extension of the original file if (nBaseName.find ('.')==nBaseName.npos) { - int lastdot = baseName.find_last_of ('.'); + size_t lastdot = baseName.find_last_of ('.'); nBaseName += "." + (lastdot!=Glib::ustring::npos ? baseName.substr (lastdot+1) : ""); } Glib::ustring nfname = Glib::build_filename (dirName, nBaseName); @@ -1339,7 +1339,7 @@ void FileCatalog::reparseDirectory () { // check if a new file has been added for (size_t i=0; i file) { return; Glib::RefPtr info = safe_query_file_info(file); if (info && info->get_file_type() != Gio::FILE_TYPE_DIRECTORY && (!info->is_hidden() || !options.fbShowHidden)) { - int lastdot = info->get_name().find_last_of ('.'); - if (options.is_extention_enabled(lastdot!=(int)Glib::ustring::npos ? info->get_name().substr (lastdot+1) : "")){ + size_t lastdot = info->get_name().find_last_of ('.'); + if (options.is_extention_enabled(lastdot!=Glib::ustring::npos ? info->get_name().substr (lastdot+1) : "")){ previewLoader->add (selectedDirectoryId,file->get_parse_name(),this); previewsToLoad++; } @@ -1407,8 +1407,8 @@ void FileCatalog::addAndOpenFile (const Glib::ustring& fname) { Glib::RefPtr info = safe_query_file_info(file); if( !info ) return; - int lastdot = info->get_name().find_last_of ('.'); - if (options.is_extention_enabled(lastdot!=(int)Glib::ustring::npos ? info->get_name().substr (lastdot+1) : "")){ + size_t lastdot = info->get_name().find_last_of ('.'); + if (options.is_extention_enabled(lastdot!=Glib::ustring::npos ? info->get_name().substr (lastdot+1) : "")){ // if supported, load thumbnail first Thumbnail* tmb = cacheMgr->getEntry (file->get_parse_name()); if (tmb) { diff --git a/rtgui/filterpanel.cc b/rtgui/filterpanel.cc index 3f0a03cbb..5c93c1015 100644 --- a/rtgui/filterpanel.cc +++ b/rtgui/filterpanel.cc @@ -300,19 +300,19 @@ ExifFilterSettings FilterPanel::getFilter () { efs.filterFiletype = enaFiletype->get_active (); std::vector sel = camera->get_selected (); - for (int i=0; iget_text (sel[i])); sel = expcomp->get_selected (); - for (int i=0; iget_text (sel[i])); sel = lens->get_selected (); - for (int i=0; iget_text (sel[i])); sel = filetype->get_selected (); - for (int i=0; iget_text (sel[i])); return efs; diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index 22624fe00..35555ff4f 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "../rtengine/rt_math.h" #include "guiutils.h" #include "options.h" @@ -50,7 +50,7 @@ void thumbInterp (const unsigned char* src, int sw, int sh, unsigned char* dst, Glib::ustring removeExtension (const Glib::ustring& filename) { Glib::ustring bname = Glib::path_get_basename(filename); - int lastdot = bname.find_last_of ('.'); + size_t lastdot = bname.find_last_of ('.'); if (lastdot!=bname.npos) return filename.substr (0, filename.size()-(bname.size()-lastdot)); else @@ -60,7 +60,7 @@ Glib::ustring removeExtension (const Glib::ustring& filename) { Glib::ustring getExtension (const Glib::ustring& filename) { Glib::ustring bname = Glib::path_get_basename(filename); - int lastdot = bname.find_last_of ('.'); + size_t lastdot = bname.find_last_of ('.'); if (lastdot!=bname.npos) return filename.substr (filename.size()-(bname.size()-lastdot)+1, filename.npos); else @@ -172,7 +172,7 @@ void drawCrop (Cairo::RefPtr cr, int imx, int imy, int imw, int } // Horizontals - for (int i=0; iset_source_rgb (1.0, 1.0, 1.0); cr->move_to (rectx1, recty1 + (recty2-recty1) * horiz_ratios[i]); cr->line_to (rectx2, recty1 + (recty2-recty1) * horiz_ratios[i]); @@ -188,7 +188,7 @@ void drawCrop (Cairo::RefPtr cr, int imx, int imy, int imw, int cr->set_dash (ds, 0); } // Verticals - for (int i=0; iset_source_rgb (1.0, 1.0, 1.0); cr->move_to (rectx1 + (rectx2-rectx1) * vert_ratios[i], recty1); cr->line_to (rectx1 + (rectx2-rectx1) * vert_ratios[i], recty2); @@ -388,7 +388,7 @@ bool MyHScale::on_scroll_event (GdkEventScroll* event) { MyFileChooserButton::MyFileChooserButton (const Glib::ustring& title, Gtk::FileChooserAction action) : Gtk::FileChooserButton(title, action) { set_size_request(20, -1); -}; +} // For an unknown reason (a bug ?), it doesn't work when action = FILE_CHOOSER_ACTION_SELECT_FOLDER ! bool MyFileChooserButton::on_scroll_event (GdkEventScroll* event) { diff --git a/rtgui/histogrampanel.cc b/rtgui/histogrampanel.cc index 828f9ea3f..eacac58b1 100644 --- a/rtgui/histogrampanel.cc +++ b/rtgui/histogrampanel.cc @@ -371,7 +371,7 @@ int histrgbupdate (void* data) { gdk_threads_enter (); - HistogramRGBAreaIdleHelper* harih = (HistogramRGBAreaIdleHelper*)data; + HistogramRGBAreaIdleHelper* harih = static_cast(data); if (harih->destroyed) { if (harih->pending == 1) @@ -533,7 +533,7 @@ void HistogramArea::updateOptions (bool r, bool g, bool b, bool l, bool raw) { int histupdateUI (void* data) { - HistogramAreaIdleHelper* haih = (HistogramAreaIdleHelper*)data; + HistogramAreaIdleHelper* haih = static_cast(data); if (haih->destroyed) { if (haih->pending == 1) diff --git a/rtgui/icmpanel.cc b/rtgui/icmpanel.cc index 7b278ec14..e849643e9 100644 --- a/rtgui/icmpanel.cc +++ b/rtgui/icmpanel.cc @@ -107,7 +107,7 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL), pack_start (*onames, Gtk::PACK_SHRINK, 4); std::vector wpnames = rtengine::getWorkingProfiles (); - for (int i=0; iappend_text (wpnames[i]); @@ -145,14 +145,14 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL), std::vector wpgamma = rtengine::getGamma (); - for (int i=0; iappend_text (wpgamma[i]); onames->append_text (M("TP_ICM_NOICM")); onames->set_active (0); std::vector opnames = iccStore->getOutputProfiles (); - for (int i=0; iappend_text (opnames[i]); wnames->set_active (0); diff --git a/rtgui/lwbuttonset.cc b/rtgui/lwbuttonset.cc index 9c391dc94..b024e0914 100644 --- a/rtgui/lwbuttonset.cc +++ b/rtgui/lwbuttonset.cc @@ -23,7 +23,7 @@ LWButtonSet::LWButtonSet () : aw(0), ah(0) { LWButtonSet::~LWButtonSet () { - for (int i=0; igetSize (bw, bh); w+= bw; @@ -56,7 +56,7 @@ void LWButtonSet::arrangeButtons (int x, int y, int w, int h) { int begx = x; int endx = x+w-1; - for (int i=0; igetSize (bw, bh); @@ -85,7 +85,7 @@ void LWButtonSet::arrangeButtons (int x, int y, int w, int h) { void LWButtonSet::move (int nx, int ny) { - for (int i=0; igetPosition (x, y); buttons[i]->setPosition (x+nx-ax, y+ny-ay); @@ -97,14 +97,14 @@ void LWButtonSet::move (int nx, int ny) { void LWButtonSet::redraw (Cairo::RefPtr context) { - for (int i=0; iredraw (context); } bool LWButtonSet::motionNotify (int x, int y) { bool res = false; - for (int i=0; imotionNotify (x, y); res = res || handled; } @@ -115,7 +115,7 @@ bool LWButtonSet::motionNotify (int x, int y) { bool LWButtonSet::pressNotify (int x, int y) { bool res = false; - for (int i=0; ipressNotify (x, y); res = res || handled; } @@ -125,7 +125,7 @@ bool LWButtonSet::pressNotify (int x, int y) { bool LWButtonSet::releaseNotify (int x, int y) { bool res = false; - for (int i=0; ireleaseNotify (x, y); res = res || handled; } @@ -134,7 +134,7 @@ bool LWButtonSet::releaseNotify (int x, int y) { bool LWButtonSet::inside (int x, int y) { - for (int i=0; iinside (x, y)) return true; return false; @@ -142,7 +142,7 @@ bool LWButtonSet::inside (int x, int y) { void LWButtonSet::setButtonListener (LWButtonListener* bl) { - for (int i=0; isetButtonListener (bl); } @@ -154,13 +154,13 @@ void LWButtonSet::getAllocatedDimensions (int& w, int& h) { void LWButtonSet::setColors (const Gdk::Color& bg, const Gdk::Color& fg) { - for (int i=0; isetColors (bg, fg); } Glib::ustring LWButtonSet::getToolTip (int x, int y) { - for (int i=0; igetToolTip (x, y); if (ttip!="") return ttip; diff --git a/rtgui/navigator.cc b/rtgui/navigator.cc index 6b5d81b94..f1d180ca7 100644 --- a/rtgui/navigator.cc +++ b/rtgui/navigator.cc @@ -23,9 +23,6 @@ #include "../rtengine/curves.h" #include "../rtengine/rt_math.h" -#define D50x 0.96422 -#define D50z 0.82521 - Navigator::Navigator () { set_label (M("MAIN_MSG_NAVIGATOR")); diff --git a/rtgui/options.h b/rtgui/options.h index 5bf6e134d..5f34dea6f 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -118,7 +118,7 @@ class Options { Glib::ustring customProfileBuilder; int editorToSendTo; int maxThumbnailHeight; - int maxCacheEntries; + std::size_t maxCacheEntries; ThFileType thumbnailFormat; int thumbInterp; // 0: nearest, 1: bilinear bool liveThumbnails; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index e71fba16d..b411e3557 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -218,7 +218,7 @@ void ParamsEdited::initFrom (const std::vector return; const ProcParams& p = src[0]; - for (int i=1; i > drives = vm->get_connected_drives (); - for (int j=0; j > volumes = drives[j]->get_volumes (); if (volumes.empty()) { Gtk::TreeModel::Row newrow = *(placesModel->append()); @@ -135,7 +135,7 @@ void PlacesBrowser::refreshPlacesList () { newrow[placesColumns.type] = 3; newrow[placesColumns.rowSeparator] = false; } - for (int i=0; i mount = volumes[i]->get_mount (); if (mount) { // placesed volumes Gtk::TreeModel::Row newrow = *(placesModel->append()); @@ -158,7 +158,7 @@ void PlacesBrowser::refreshPlacesList () { // volumes not belonging to drives std::vector > volumes = vm->get_volumes (); - for (int i=0; iget_drive ()) { Glib::RefPtr mount = volumes[i]->get_mount (); if (mount) { // placesed volumes @@ -189,7 +189,7 @@ void PlacesBrowser::refreshPlacesList () { std::sort (mounts.begin(), mounts.end(), compareMountByRoot); #endif - for (int i=0; iget_volume ()) { Gtk::TreeModel::Row newrow = *(placesModel->append()); newrow[placesColumns.label] = mounts[i]->get_name (); @@ -204,7 +204,7 @@ void PlacesBrowser::refreshPlacesList () { Gtk::TreeModel::Row newrow = *(placesModel->append()); newrow[placesColumns.rowSeparator] = true; } - for (int i=0; i hfile = Gio::File::create_for_path (options.favoriteDirs[i]); if (hfile && hfile->query_exists()) { Glib::RefPtr info = safe_query_file_info (hfile); @@ -247,7 +247,7 @@ void PlacesBrowser::selectionChanged () { if (iter) { if (iter->get_value (placesColumns.type)==2) { std::vector > volumes = vm->get_volumes (); - for (int i=0; iget_name () == iter->get_value (placesColumns.label)) { volumes[i]->mount (); break; @@ -255,7 +255,7 @@ void PlacesBrowser::selectionChanged () { } else if (iter->get_value (placesColumns.type)==3) { std::vector > drives = vm->get_connected_drives (); - for (int i=0; iget_name () == iter->get_value (placesColumns.label)) { drives[i]->poll_for_media (); break; @@ -277,7 +277,7 @@ void PlacesBrowser::addPressed () { return; // check if the dirname is already in the list. If yes, return. - for (int i=0; iappend_text (pnames[i]); iprofiles->append_text (pnames[i]); } @@ -481,7 +481,7 @@ Gtk::Widget* Preferences::getGeneralPanel () { std::vector langs; parseDir (argv0 + "/languages", langs, ""); - for (int i=0; iappend_text (langs[i]); } @@ -525,7 +525,7 @@ Gtk::Widget* Preferences::getGeneralPanel () { theme->set_active (0); std::vector themes; parseDir (argv0 + "/themes", themes, ".gtkrc"); - for (int i=0; iappend_text (themes[i]); Gtk::Label* fontlab = Gtk::manage( new Gtk::Label (M("PREFERENCES_SELECTFONT")+":") ); @@ -1033,7 +1033,7 @@ void Preferences::storePreferences () { moptions.parseExtensions.clear (); moptions.parseExtensionsEnabled.clear (); Gtk::TreeNodeChildren c = extensionModel->children (); - for (int i=0; iclear (); - for (int i=0; iappend()); row[extensionColumns.enabled] = moptions.parseExtensionsEnabled[i]; row[extensionColumns.ext] = moptions.parseExtensions[i]; @@ -1207,7 +1207,7 @@ void Preferences::fillPreferences () { addc.block (true); setc.block (true); if (moptions.baBehav.size() == ADDSET_PARAM_NUM) { - for (int i=0; ichildren().begin(); sections!=behModel->children().end(); sections++) for (Gtk::TreeIter adjs=sections->children().begin(); adjs!=sections->children().end(); adjs++) if (adjs->get_value (behavColumns.addsetid) == i) { @@ -1420,7 +1420,7 @@ void Preferences::useThemeChanged(){ void Preferences::addExtPressed () { Gtk::TreeNodeChildren c = extensionModel->children (); - for (int i=0; iget_text ()) return; diff --git a/rtgui/previewhandler.cc b/rtgui/previewhandler.cc index 51f44c602..a7d2b2081 100644 --- a/rtgui/previewhandler.cc +++ b/rtgui/previewhandler.cc @@ -29,7 +29,7 @@ PreviewHandler::PreviewHandler () : image(NULL) { pih->phandler = this; pih->destroyed = false; pih->pending = 0; -}; +} PreviewHandler::~PreviewHandler () { @@ -37,7 +37,7 @@ PreviewHandler::~PreviewHandler () { pih->destroyed = true; else delete pih; -}; +} //----------------previewimagelistener functions-------------------- @@ -49,7 +49,7 @@ struct iaimgpar { }; int setImageUI (void* data) { - iaimgpar* iap = (iaimgpar*)data; + iaimgpar* iap = static_cast(data); PreviewHandlerIdleHelper* pih = iap->pih; if (pih->destroyed) { @@ -95,7 +95,7 @@ void PreviewHandler::setImage (rtengine::IImage8* i, double scale, rtengine::pro int delImageUI (void* data) { - iaimgpar* iap = (iaimgpar*)data; + iaimgpar* iap = static_cast(data); PreviewHandlerIdleHelper* pih = iap->pih; if (pih->destroyed) { @@ -138,7 +138,7 @@ void PreviewHandler::delImage (IImage8* i) { int imageReadyUI (void* data) { - iaimgpar* iap = (iaimgpar*)data; + iaimgpar* iap = static_cast(data); PreviewHandlerIdleHelper* pih = iap->pih; if (pih->destroyed) { diff --git a/rtgui/profilepanel.cc b/rtgui/profilepanel.cc index 9744111bd..cb06d0c24 100644 --- a/rtgui/profilepanel.cc +++ b/rtgui/profilepanel.cc @@ -163,13 +163,13 @@ void ProfilePanel::save_clicked (GdkEventButton* event) { options.loadSaveProfilePath = Glib::path_get_dirname(fname); bool hasext = true; - int dotpos = fname.find_last_of ('.'); + size_t dotpos = fname.find_last_of ('.'); if (dotpos==Glib::ustring::npos) hasext = false; - int dirpos1 = fname.find_last_of ('/'); + size_t dirpos1 = fname.find_last_of ('/'); if (dirpos1!=Glib::ustring::npos && dirpos1>dotpos) hasext = false; - int dirpos2 = fname.find_last_of ('\\'); + size_t dirpos2 = fname.find_last_of ('\\'); if (dirpos2!=Glib::ustring::npos && dirpos2>dotpos) hasext = false; diff --git a/rtgui/profilestore.cc b/rtgui/profilestore.cc index 17f9b4720..9516a88d5 100644 --- a/rtgui/profilestore.cc +++ b/rtgui/profilestore.cc @@ -74,7 +74,7 @@ void ProfileStore::parseDir (const Glib::ustring& pdir) { Glib::ustring sname = *i; // ignore directories if (!safe_file_test (fname, Glib::FILE_TEST_IS_DIR)) { - int lastdot = sname.find_last_of ('.'); + size_t lastdot = sname.find_last_of ('.'); if (lastdot!=Glib::ustring::npos && lastdot<=sname.size()-4 && !sname.casefold().compare (lastdot, 4, paramFileExtension)) { if( options.rtSettings.verbose ) printf ("Processing file %s...\n", fname.c_str()); diff --git a/rtgui/renamedlg.cc b/rtgui/renamedlg.cc index 5fe4bb263..a53883ea7 100644 --- a/rtgui/renamedlg.cc +++ b/rtgui/renamedlg.cc @@ -86,7 +86,7 @@ void RenameDialog::fillTemplateList () { templateModel->clear (); - for (int i=0; iappend (); iter->set_value (templateColumns.tmplName, options.renameTemplates[i]); iter->set_value (templateColumns.rowSeparator, false); @@ -182,7 +182,7 @@ void RenameTemplateEditor::refreshTemplateList () { list->clear_items (); - for (int i=0; iappend_text (options.renameTemplates[i]); } @@ -198,7 +198,7 @@ void RenameTemplateEditor::addPressed () { void RenameTemplateEditor::delPressed () { std::vector sel = list->get_selected (); - for (int i=0; iget_text (sel[i]); std::vector::iterator f = std::find (options.renameTemplates.begin(), options.renameTemplates.end(), toDel); if (f!=options.renameTemplates.end()) diff --git a/rtgui/thumbbrowserbase.cc b/rtgui/thumbbrowserbase.cc index 53c5370fb..5c36ce330 100644 --- a/rtgui/thumbbrowserbase.cc +++ b/rtgui/thumbbrowserbase.cc @@ -15,7 +15,7 @@ * along with RawTherapee. If not, see . */ #include -#include +#include "../rtengine/rt_math.h" #include "thumbbrowserbase.h" #include "multilangmgr.h" @@ -58,7 +58,7 @@ ThumbBrowserBase::ThumbBrowserBase () } void ThumbBrowserBase::scrollChanged () { - for (int i=0; isetOffset ((int)(hscroll.get_value()), (int)(vscroll.get_value())); internal.setPosition ((int)(hscroll.get_value()), (int)(vscroll.get_value())); @@ -256,7 +256,7 @@ void ThumbBrowserBase::Internal::on_realize() bool ThumbBrowserBase::Internal::on_query_tooltip (int x, int y, bool keyboard_tooltip, const Glib::RefPtr& tooltip) { Glib::ustring ttip = ""; - for (int i=0; ifd.size(); i++) + for (size_t i=0; ifd.size(); i++) if (parent->fd[i]->drawable && parent->fd[i]->inside (x, y)) { ttip = parent->fd[i]->getToolTip (x, y); break; @@ -314,7 +314,7 @@ void ThumbBrowserBase::buttonPressed (int x, int y, int button, GdkEventType typ bool handled = false; { - for (int i=0; idrawable) { if (fd[i]->inside (x, y) && fd[i]->insideWindow (clx, cly, clw, clh)) fileDescr = fd[i]; @@ -338,18 +338,18 @@ void ThumbBrowserBase::buttonPressed (int x, int y, int button, GdkEventType typ } else { // find the start and the end of the selection interval - int startx = fd.size()-1; + size_t startx = fd.size()-1; if (lastClicked) { - for (; startx>=0; startx--) + for (; startx>0; startx--) if (fd[startx]==lastClicked) break; } else { - for (; startx>=0; startx--) + for (; startx>0; startx--) if (fd[startx]==selected[0]) break; } - int endx = 0; + size_t endx = 0; for (; endxselected = false; selected.clear (); // select thumbnails in the interval - for (int i=startx; i<=endx; i++) { + for (size_t i=startx; i<=endx; i++) { if (!fd[i]->filtered) { fd[i]->selected = true; selected.push_back (fd[i]); @@ -386,7 +386,7 @@ void ThumbBrowserBase::buttonPressed (int x, int y, int button, GdkEventType typ selectionChanged (); } else { - for (int i=0; iselected = false; selected.clear (); if (fileDescr) { @@ -399,7 +399,7 @@ void ThumbBrowserBase::buttonPressed (int x, int y, int button, GdkEventType typ } else if (fileDescr && button==3 && type==GDK_BUTTON_PRESS) { if (!fileDescr->selected) { - for (int i=0; iselected = false; selected.clear (); fileDescr->selected = true; @@ -424,7 +424,7 @@ bool ThumbBrowserBase::Internal::on_expose_event(GdkEventExpose* event) { // draw thumbnails Glib::RefPtr context = get_pango_context (); context->set_font_description (get_style()->get_font()); - for (int i=0; ifd.size(); i++) { + for (size_t i=0; ifd.size(); i++) { if (!parent->fd[i]->drawable || !parent->fd[i]->insideWindow (0, 0, w, h)) parent->fd[i]->updatepriority = false; else { @@ -440,7 +440,7 @@ bool ThumbBrowserBase::Internal::on_button_release_event (GdkEventButton* event) int w = get_width(); int h = get_height(); - for (int i=0; ifd.size(); i++) + for (size_t i=0; ifd.size(); i++) if (parent->fd[i]->drawable && parent->fd[i]->insideWindow (0, 0, w, h)) { parent->fd[i]->releaseNotify (event->button, event->type, event->state, (int)event->x, (int)event->y); } @@ -451,7 +451,7 @@ bool ThumbBrowserBase::Internal::on_motion_notify_event (GdkEventMotion* event) int w = get_width(); int h = get_height(); - for (int i=0; ifd.size(); i++) + for (size_t i=0; ifd.size(); i++) if (parent->fd[i]->drawable && parent->fd[i]->insideWindow (0, 0, w, h)) { #ifdef WIN32 //l.release(); // motionNotify calls the queue, which locks @@ -477,16 +477,15 @@ void ThumbBrowserBase::redraw () { void ThumbBrowserBase::zoomChanged (bool zoomIn) { int newHeight=0; - int i=0; int optThumbSize=getCurrentThumbSize(); if (zoomIn) - for (i=0; i optThumbSize) break; } else - for (i=options.thumbnailZoomRatios.size()-1; i>=0; i--) { + for (size_t i=options.thumbnailZoomRatios.size()-1; i>0; i--) { newHeight = (int)(options.thumbnailZoomRatios[i] * getMaxThumbnailHeight()); if (newHeight < optThumbSize) break; @@ -500,7 +499,7 @@ void ThumbBrowserBase::zoomChanged (bool zoomIn) { Glib::RWLock::WriterLock l(entryRW); #endif - for (int i=0; iresize (previewHeight); + for (size_t i=0; iresize (previewHeight); } redraw (); @@ -519,7 +518,7 @@ void ThumbBrowserBase::refreshThumbImages () { #endif int previewHeight = getCurrentThumbSize(); - for (int i=0; iresize (previewHeight); + for (size_t i=0; iresize (previewHeight); } redraw (); @@ -531,13 +530,13 @@ void ThumbBrowserBase::refreshQuickThumbImages () { Glib::RWLock::WriterLock l(entryRW); #endif - for (int i=0; irefreshQuickThumbnailImage (); + for (size_t i=0; irefreshQuickThumbnailImage (); } void ThumbBrowserBase::refreshEditedState (const std::set& efiles) { editedFiles = efiles; - for (int i=0; iframed = editedFiles.find (fd[i]->filename)!=editedFiles.end(); queue_draw (); @@ -560,7 +559,7 @@ void ThumbBrowserBase::enableTabMode(bool enable) { Glib::RWLock::WriterLock l(entryRW); #endif - for (int i=0; iresize (getCurrentThumbSize()); } @@ -600,7 +599,7 @@ int ThumbBrowserBase::getEffectiveHeight() { int h=hscroll.get_height() + 2; // have 2 pixels rounding error for scroll bars to appear // Filtered items do not change in size, so take a non-filtered - for (int i=0;ifiltered) { h+=fd[i]->getEffectiveHeight(); break; diff --git a/rtgui/thumbbrowserentrybase.cc b/rtgui/thumbbrowserentrybase.cc index 6d2af486a..bbbd79a60 100644 --- a/rtgui/thumbbrowserentrybase.cc +++ b/rtgui/thumbbrowserentrybase.cc @@ -128,7 +128,7 @@ void ThumbBrowserEntryBase::updateBackBuffer () { if (!bbIcons.empty()) { int iwidth = igap; int iheight = 0; - for (int i=0; iget_width() + igap; if (bbIcons[i]->get_height() > iheight) iheight = bbIcons[i]->get_height(); @@ -140,7 +140,7 @@ void ThumbBrowserEntryBase::updateBackBuffer () { cr->set_source_rgba (0, 0, 0, 0.75); cr->fill (); } - for (int i=0; idraw_pixbuf (gc_, bbIcons[i], 0, 0, istartx, istarty, bbIcons[i]->get_width(), bbIcons[i]->get_height(), Gdk::RGB_DITHER_NONE, 0, 0); istartx += bbIcons[i]->get_width() + igap; } diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index 917a494dc..7219df3fc 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -211,7 +211,7 @@ rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool retu } void Thumbnail::notifylisterners_procParamsChanged(int whoChangedIt){ - for (int i=0; iprocParamsChanged (this, whoChangedIt); } @@ -311,7 +311,7 @@ void Thumbnail::clearProcParams (int whoClearedIt) { safe_g_remove (fname_); } - for (int i=0; iprocParamsChanged (this, whoClearedIt); } @@ -351,7 +351,7 @@ void Thumbnail::setProcParams (const ProcParams& pp, ParamsEdited* pe, int whoCh if (updateCacheNow) updateCache (); - for (int i=0; iprocParamsChanged (this, whoChangedIt); } @@ -517,7 +517,7 @@ void Thumbnail::generateExifDateTimeStrings () { std::string dateFormat = options.dateFormat; std::ostringstream ostr; bool spec = false; - for (int i=0; iset_scrollable (); toolPanelNotebook->show_all (); - for (int i=0; isetListener (this); whitebalance->setWBProvider (this); @@ -223,7 +223,7 @@ void ToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const Glib:: int changeFlags=refreshmap[(int)event]; ProcParams* params = ipc->beginUpdateParams (); - for (int i=0; iwrite (params); // Compensate rotation on flip @@ -259,7 +259,7 @@ void ToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const Glib:: hasChanged = true; - for (int i=0; iprocParamsChanged (params, event, descr); } @@ -320,14 +320,14 @@ void ToolPanelCoordinator::profileChange (const PartialProfile *nparams, rtengi hasChanged = event != rtengine::EvProfileChangeNotification; - for (int i=0; iprocParamsChanged (params, event, descr); } void ToolPanelCoordinator::setDefaults (ProcParams* defparams) { if (defparams) - for (int i=0; isetDefaults (defparams); } @@ -370,7 +370,7 @@ void ToolPanelCoordinator::closeImage () { void ToolPanelCoordinator::readOptions () { crop->readOptions (); - for (int i=0; iset_expanded (options.tpOpen[i]); } @@ -379,7 +379,7 @@ void ToolPanelCoordinator::writeOptions () { crop->writeOptions (); options.tpOpen.clear (); - for (int i=0; iget_expanded ()); } @@ -519,7 +519,7 @@ void ToolPanelCoordinator::foldAllButOne (Gtk::Box* parent, FoldableToolPanel* o FoldableToolPanel* currentTP; - for (int i=0; i(toolPanels[i]); if (currentTP->getParent() == parent) { // Section in the same tab, we unfold it if it's not the one that has been clicked diff --git a/rtgui/zoompanel.h b/rtgui/zoompanel.h index f1a56da99..27bc0fa9e 100644 --- a/rtgui/zoompanel.h +++ b/rtgui/zoompanel.h @@ -12,7 +12,7 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + *l * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */