diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 4170021ea..40c2de0bd 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -5396,7 +5396,7 @@ void ImProcFunctions::getAutoExp (const LUTu &histogram, int histcompr, double octile[count] += histogram[j]; if (octile[count] > sum / 8.f || (count == 7 && octile[count] > sum / 16.f)) { - octile[count] = xlog (1. + (float)j) / log (2.f); + octile[count] = xlog (1. + j) / log (2.f); count++;// = min(count+1,7); } } @@ -5409,7 +5409,7 @@ void ImProcFunctions::getAutoExp (const LUTu &histogram, int histcompr, double octile[count] += histogram[j]; if (octile[count] > sum / 8.f || (count == 7 && octile[count] > sum / 16.f)) { - octile[count] = xlog (1. + (float)j) / log (2.f); + octile[count] = xlog (1. + j) / log (2.f); count++;// = min(count+1,7); } } diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index 0b2f5de14..8b4583877 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -147,7 +147,7 @@ int BatchQueue::getThumbnailHeight () return std::max(std::min(options.thumbSizeQueue, 200), 10); } -void BatchQueue::rightClicked (ThumbBrowserEntryBase* entry) +void BatchQueue::rightClicked () { pmenu.popup (3, this->eventTime); } diff --git a/rtgui/batchqueue.h b/rtgui/batchqueue.h index f0289faa4..5cde37748 100644 --- a/rtgui/batchqueue.h +++ b/rtgui/batchqueue.h @@ -74,7 +74,7 @@ public: void error(const Glib::ustring& descr) override; rtengine::ProcessingJob* imageReady(rtengine::IImagefloat* img) override; - void rightClicked (ThumbBrowserEntryBase* entry) override; + void rightClicked () override; void doubleClicked (ThumbBrowserEntryBase* entry) override; bool keyPressed (GdkEventKey* event) override; void buttonPressed (LWButton* button, int actionCode, void* actionData) override; diff --git a/rtgui/extprog.cc b/rtgui/extprog.cc index fc6e06f72..e7d0988fb 100644 --- a/rtgui/extprog.cc +++ b/rtgui/extprog.cc @@ -137,43 +137,47 @@ bool ExtProgStore::searchProgram (const Glib::ustring& name, action.name = name; action.target = (allowRaw ? 1 : 2); + auto& filePath = action.filePathEXE; + if (maxVer > 0) { for (auto ver = maxVer; ver >= 0; ver--) { - auto filePath = progFilesDir + "\\" + Glib::ustring::compose(exePath, ver); + filePath = progFilesDir + "\\" + Glib::ustring::compose(exePath, ver); - if (Glib::file_test (filePath, Glib::FILE_TEST_EXISTS)) { + if (Glib::file_test(filePath, Glib::FILE_TEST_EXISTS)) { break; } - if (!exePath86.empty ()) { + if (!exePath86.empty()) { filePath = progFilesDirx86 + "\\" + Glib::ustring::compose(exePath86, ver); - if (Glib::file_test (filePath, Glib::FILE_TEST_EXISTS)) { + if (Glib::file_test(filePath, Glib::FILE_TEST_EXISTS)) { break; } } + filePath.clear(); } } else { do { - auto filePath = progFilesDir + "\\" + exePath; + filePath = progFilesDir + "\\" + exePath; - if (Glib::file_test (filePath, Glib::FILE_TEST_EXISTS)) { + if (Glib::file_test(filePath, Glib::FILE_TEST_EXISTS)) { break; } - if (!exePath86.empty ()) { + if (!exePath86.empty()) { filePath = progFilesDirx86 + "\\" + exePath86; - if (Glib::file_test (filePath, Glib::FILE_TEST_EXISTS)) { + if (Glib::file_test(filePath, Glib::FILE_TEST_EXISTS)) { break; } } + filePath.clear(); } while (false); } diff --git a/rtgui/filebrowser.cc b/rtgui/filebrowser.cc index d774cdb28..caa60ebbc 100644 --- a/rtgui/filebrowser.cc +++ b/rtgui/filebrowser.cc @@ -90,41 +90,36 @@ ThumbBrowserEntryBase* selectOriginalEntry (ThumbBrowserEntryBase* original, Thu void findOriginalEntries (const std::vector& entries) { - typedef std::vector EntryVector; - typedef EntryVector::const_iterator EntryIterator; - typedef std::map BasenameMap; - typedef BasenameMap::const_iterator BasenameIterator; - // Sort all entries into buckets by basename without extension - BasenameMap byBasename; + std::map> byBasename; - for (EntryIterator entry = entries.begin (); entry != entries.end (); ++entry) { - const Glib::ustring basename = Glib::path_get_basename ((*entry)->filename.lowercase()); + for (const auto entry : entries) { + const auto basename = Glib::path_get_basename(entry->filename.lowercase()); - const Glib::ustring::size_type pos = basename.find_last_of ('.'); - if (pos >= basename.length () - 1) { - (*entry)->setOriginal (nullptr); + const auto pos = basename.find_last_of('.'); + if (pos >= basename.length() - 1) { + entry->setOriginal(nullptr); continue; } - const Glib::ustring withoutExtension = basename.substr (0, pos); + const auto withoutExtension = basename.substr(0, pos); - byBasename[withoutExtension].push_back (*entry); + byBasename[withoutExtension].push_back(entry); } // Find the original image for each bucket - for (BasenameIterator bucket = byBasename.begin (); bucket != byBasename.end (); ++bucket) { - const EntryVector& lentries = bucket->second; + for (const auto& bucket : byBasename) { + const auto& lentries = bucket.second; ThumbBrowserEntryBase* original = nullptr; // Select the most likely original in a first pass... - for (EntryIterator entry = lentries.begin (); entry != lentries.end (); ++entry) { - original = selectOriginalEntry (original, *entry); + for (const auto entry : lentries) { + original = selectOriginalEntry(original, entry); } // ...and link all other images to it in a second pass. - for (EntryIterator entry = lentries.begin (); entry != lentries.end (); ++entry) { - (*entry)->setOriginal (*entry != original ? original : nullptr); + for (const auto entry : lentries) { + entry->setOriginal(entry != original ? original : nullptr); } } } @@ -487,7 +482,7 @@ FileBrowser::~FileBrowser () delete[] amiExtProg; } -void FileBrowser::rightClicked (ThumbBrowserEntryBase* entry) +void FileBrowser::rightClicked () { { diff --git a/rtgui/filebrowser.h b/rtgui/filebrowser.h index b941ea9df..fe4877a31 100644 --- a/rtgui/filebrowser.h +++ b/rtgui/filebrowser.h @@ -174,7 +174,7 @@ public: void buttonPressed (LWButton* button, int actionCode, void* actionData) override; void redrawNeeded (LWButton* button) override; bool checkFilter (ThumbBrowserEntryBase* entry) const override; - void rightClicked (ThumbBrowserEntryBase* entry) override; + void rightClicked () override; void doubleClicked (ThumbBrowserEntryBase* entry) override; bool keyPressed (GdkEventKey* event) override; diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index 7051dbeea..02a28607f 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -948,19 +948,19 @@ bool MyScrolledWindow::on_scroll_event (GdkEventScroll* event) double step = adjust->get_step_increment(); if (event->direction == GDK_SCROLL_DOWN) { - double value2 = rtengine::min(value + step, upperBound); + const double value2 = rtengine::min(value + step, upperBound); if (value2 != value) { scroll->set_value(value2); } } else if (event->direction == GDK_SCROLL_UP) { - double value2 = rtengine::max(value - step, lowerBound); + const double value2 = rtengine::max(value - step, lowerBound); if (value2 != value) { scroll->set_value(value2); } } else if (event->direction == GDK_SCROLL_SMOOTH) { - double value2 = rtengine::LIM(value + event->delta_y * step, lowerBound, upperBound); + const double value2 = rtengine::LIM(value + event->delta_y * step, lowerBound, upperBound); if (value2 != value) { scroll->set_value(value2); diff --git a/rtgui/lockablecolorpicker.cc b/rtgui/lockablecolorpicker.cc index a544ea991..071847424 100644 --- a/rtgui/lockablecolorpicker.cc +++ b/rtgui/lockablecolorpicker.cc @@ -289,7 +289,7 @@ void LockableColorPicker::getImagePosition (rtengine::Coord &imgPos) const imgPos = position; } -void LockableColorPicker::getScreenPosition (rtengine::Coord &screenPos) +void LockableColorPicker::getScreenPosition (rtengine::Coord &screenPos) const { if (cropWindow) { cropWindow->imageCoordToScreen(position.x, position.y, screenPos.x, screenPos.y); diff --git a/rtgui/lockablecolorpicker.h b/rtgui/lockablecolorpicker.h index 7f320f8b6..77d2e8e9f 100644 --- a/rtgui/lockablecolorpicker.h +++ b/rtgui/lockablecolorpicker.h @@ -80,7 +80,7 @@ public: void setPosition (const rtengine::Coord &newPos); void setRGB (const float R, const float G, const float B, const float previewR, const float previewG, const float previewB); void getImagePosition (rtengine::Coord &imgPos) const; - void getScreenPosition (rtengine::Coord &screenPos); + void getScreenPosition (rtengine::Coord &screenPos) const; Size getSize () const; bool isOver (int x, int y); void setValidity (Validity isValid); diff --git a/rtgui/progressconnector.h b/rtgui/progressconnector.h index 45575177f..f4d1d8f7e 100644 --- a/rtgui/progressconnector.h +++ b/rtgui/progressconnector.h @@ -79,8 +79,8 @@ class ProgressConnector static int emitEndSignalUI (void* data) { - sigc::signal0* lopEnd = (sigc::signal0*) data; - int r = lopEnd->emit (); + const sigc::signal0* lopEnd = reinterpret_cast*>(data); + const int r = lopEnd->emit (); delete lopEnd; return r; diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index 6d338f388..5ab3ab85d 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -44,7 +44,7 @@ extern unsigned char initialGdkScale; static gboolean osx_should_quit_cb (GtkosxApplication *app, gpointer data) { - RTWindow *rtWin = static_cast(data); + RTWindow * const rtWin = static_cast(data); return rtWin->on_delete_event (0); } diff --git a/rtgui/thumbbrowserbase.cc b/rtgui/thumbbrowserbase.cc index c9329cf91..5f75ab413 100644 --- a/rtgui/thumbbrowserbase.cc +++ b/rtgui/thumbbrowserbase.cc @@ -967,7 +967,7 @@ void ThumbBrowserBase::buttonPressed (int x, int y, int button, GdkEventType typ } MYWRITERLOCK_RELEASE(l); - rightClicked (fileDescr); + rightClicked (); } } // end of MYWRITERLOCK(l, entryRW); diff --git a/rtgui/thumbbrowserbase.h b/rtgui/thumbbrowserbase.h index d6bafaf69..b4caac0a9 100644 --- a/rtgui/thumbbrowserbase.h +++ b/rtgui/thumbbrowserbase.h @@ -225,7 +225,7 @@ public: { return true; } - virtual void rightClicked (ThumbBrowserEntryBase* entry) {} + virtual void rightClicked () = 0; virtual void doubleClicked (ThumbBrowserEntryBase* entry) {} virtual bool keyPressed (GdkEventKey* event) { diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index fc1df1b4b..bcf578143 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -590,7 +590,7 @@ void Thumbnail::decreaseRef () cachemgr->closeThumbnail (this); } -int Thumbnail::getThumbnailWidth (const int &h, const rtengine::procparams::ProcParams *pparams) const +int Thumbnail::getThumbnailWidth (const int h, const rtengine::procparams::ProcParams *pparams) const { int tw_ = tw; int th_ = th; diff --git a/rtgui/thumbnail.h b/rtgui/thumbnail.h index 7e466bf07..c22c80cea 100644 --- a/rtgui/thumbnail.h +++ b/rtgui/thumbnail.h @@ -119,7 +119,7 @@ public: // unsigned char* getThumbnailImage (int &w, int &h, int fixwh=1); // fixwh = 0: fix w and calculate h, =1: fix h and calculate w rtengine::IImage8* processThumbImage (const rtengine::procparams::ProcParams& pparams, int h, double& scale); rtengine::IImage8* upgradeThumbImage (const rtengine::procparams::ProcParams& pparams, int h, double& scale); - int getThumbnailWidth (const int &h, const rtengine::procparams::ProcParams *pparams = nullptr) const; + int getThumbnailWidth (int h, const rtengine::procparams::ProcParams *pparams = nullptr) const; void getFinalSize (const rtengine::procparams::ProcParams& pparams, int& w, int& h); void getOriginalSize (int& w, int& h);