Fix #3619 and some minor clean-ups

This commit is contained in:
Flössie 2017-01-22 19:28:46 +01:00
parent 3f62b14703
commit 4649e1306f
6 changed files with 25 additions and 20 deletions

View File

@ -909,8 +909,11 @@ int ImageIO::loadPPMFromMemory(const char* buffer, int width, int height, bool s
int ImageIO::savePNG (Glib::ustring fname, int compression, volatile int bps)
{
if (getW() < 1 || getH() < 1) {
return IMIO_HEADERERROR;
}
FILE *file = g_fopen_withBinaryAndLock (fname);
FILE* const file = g_fopen_withBinaryAndLock (fname);
if (!file) {
return IMIO_CANNOTWRITEFILE;
@ -1003,8 +1006,11 @@ int ImageIO::savePNG (Glib::ustring fname, int compression, volatile int bps)
// Quality 0..100, subsampling: 1=low quality, 2=medium, 3=high
int ImageIO::saveJPEG (Glib::ustring fname, int quality, int subSamp)
{
if (getW() < 1 || getH() < 1) {
return IMIO_HEADERERROR;
}
FILE *file = g_fopen_withBinaryAndLock (fname);
FILE* const file = g_fopen_withBinaryAndLock (fname);
if (!file) {
return IMIO_CANNOTWRITEFILE;
@ -1190,6 +1196,9 @@ int ImageIO::saveJPEG (Glib::ustring fname, int quality, int subSamp)
int ImageIO::saveTIFF (Glib::ustring fname, int bps, bool uncompressed)
{
if (getW() < 1 || getH() < 1) {
return IMIO_HEADERERROR;
}
//TODO: Handling 32 bits floating point output images!
bool writeOk = true;

View File

@ -117,22 +117,19 @@ int StdImageSource::load (const Glib::ustring &fname, bool batch)
switch (sFormat) {
case (IIOSF_UNSIGNED_CHAR): {
Image8 *img_8 = new Image8 ();
img = img_8;
img = new Image8;
break;
}
case (IIOSF_UNSIGNED_SHORT): {
Image16 *img_16 = new Image16 ();
img = img_16;
img = new Image16;
break;
}
case (IIOSF_LOGLUV24):
case (IIOSF_LOGLUV32):
case (IIOSF_FLOAT): {
Imagefloat *img_float = new Imagefloat ();
img = img_float;
img = new Imagefloat;
break;
}

View File

@ -27,9 +27,10 @@
class CropPanelListener
{
public:
virtual void cropSelectRequested () {}
virtual ~CropPanelListener() = default;
virtual void cropSelectRequested() = 0;
};
class CropRatio
@ -42,7 +43,6 @@ public:
class Crop : public ToolParamBlock, public CropGUIListener, public FoldableToolPanel, public rtengine::SizeListener
{
protected:
Gtk::CheckButton* fixr;
MyComboBoxText* ratio;
@ -70,7 +70,6 @@ protected:
std::vector<CropRatio> cropratio;
public:
Crop ();
void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited = nullptr);

View File

@ -284,8 +284,8 @@ const ProfileStoreEntry* ProfileStore::findEntryFromFullPathU(Glib::ustring path
if (
lastdot_pos != Glib::ustring::npos
&& lastdot_pos <= casefolded_path.size() - 4
&& !casefolded_path.compare(lastdot_pos, 4, paramFileExtension))
{
&& !casefolded_path.compare(lastdot_pos, 4, paramFileExtension)
) {
// removing the extension
// now use dot position without casefold()
path = path.substr(0, path.find_last_of('.'));