Fixing some undefined behaviour part 2, Issue 2277

This commit is contained in:
Ingo
2014-03-14 20:43:28 +01:00
parent 52dc794af2
commit e7904ae515
3 changed files with 19 additions and 15 deletions

View File

@@ -525,10 +525,10 @@ void ImProcFunctions::transformLuminanceOnly (Imagefloat* original, Imagefloat*
for (int y=0; y<transformed->height; y++) { for (int y=0; y<transformed->height; y++) {
double vig_y_d = (double) (y + cy) - vig_h2 ; double vig_y_d = (double) (y + cy) - vig_h2 ;
for (int x=0; x<transformed->width; x++) { for (int x=0; x<transformed->width; x++) {
double vig_x_d = (double) (x + cx) - vig_w2 ;
double r = sqrt(vig_x_d*vig_x_d + vig_y_d*vig_y_d);
double factor = 1.0; double factor = 1.0;
if (applyVignetting) { if (applyVignetting) {
double vig_x_d = (double) (x + cx) - vig_w2 ;
double r = sqrt(vig_x_d*vig_x_d + vig_y_d*vig_y_d);
if(darkening) if(darkening)
factor /= std::max(v + mul * tanh (b*(maxRadius-r) / maxRadius), 0.001); factor /= std::max(v + mul * tanh (b*(maxRadius-r) / maxRadius), 0.001);
else else

View File

@@ -860,7 +860,10 @@ class SALensIDInterpreter : public IntLensInterpreter< int > {
double *liArray = NULL; double *liArray = NULL;
if (lensInfoTag) if (lensInfoTag)
liArray = lensInfoTag->toDoubleArray(); liArray = lensInfoTag->toDoubleArray();
return guess( lensID, focalLength, maxApertureAtFocal, liArray); std::string retval = guess( lensID, focalLength, maxApertureAtFocal, liArray);
if(liArray)
delete [] liArray;
return retval;
} }
}; };
SALensIDInterpreter saLensIDInterpreter; SALensIDInterpreter saLensIDInterpreter;

View File

@@ -49,6 +49,7 @@ class SaveFormat {
int tiffBits; int tiffBits;
bool tiffUncompressed; bool tiffUncompressed;
bool saveParams; bool saveParams;
SaveFormat () : format("jpg"), jpegQuality(90), jpegSubSamp(2), pngCompression(6), pngBits(8), tiffBits(8), tiffUncompressed(true), saveParams(true) {};
}; };
enum ThFileType {FT_Invalid=-1, FT_None=0, FT_Raw=1, FT_Jpeg=2, FT_Tiff=3, FT_Png=4, FT_Custom=5, FT_Tiff16=6, FT_Png16=7, FT_Custom16=8}; enum ThFileType {FT_Invalid=-1, FT_None=0, FT_Raw=1, FT_Jpeg=2, FT_Tiff=3, FT_Png=4, FT_Custom=5, FT_Tiff16=6, FT_Png16=7, FT_Custom16=8};