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++) {
double vig_y_d = (double) (y + cy) - vig_h2 ;
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;
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)
factor /= std::max(v + mul * tanh (b*(maxRadius-r) / maxRadius), 0.001);
else

View File

@@ -860,7 +860,10 @@ class SALensIDInterpreter : public IntLensInterpreter< int > {
double *liArray = NULL;
if (lensInfoTag)
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;

View File

@@ -38,18 +38,19 @@
// Profile name to use for internal values' profile
#define DEFPROFILE_INTERNAL "Neutral"
class SaveFormat {
public:
Glib::ustring format;
int pngBits;
int pngCompression;
int jpegQuality;
int jpegSubSamp; // 1=best compression, 3=best quality
int tiffBits;
bool tiffUncompressed;
bool saveParams;
};
class SaveFormat {
public:
Glib::ustring format;
int pngBits;
int pngCompression;
int jpegQuality;
int jpegSubSamp; // 1=best compression, 3=best quality
int tiffBits;
bool tiffUncompressed;
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 PPLoadLocation {PLL_Cache=0, PLL_Input=1};