Skip to content

Commit

Permalink
Use static_cast instead of the C style cast
Browse files Browse the repository at this point in the history
It is safer.
static_cast syntax was made to be ugly and easy to spot.
  • Loading branch information
luis-pereira authored and PCMan committed Dec 21, 2016
1 parent ba8b99d commit 73c9645
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pcmanfm/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,10 @@ void Application::setWallpaper(QString path, QString modeString) {
// convert mode string to value
for(std::size_t i = 0; i < G_N_ELEMENTS(valid_wallpaper_modes); ++i) {
if(modeString == valid_wallpaper_modes[i]) {
mode = (DesktopWindow::WallpaperMode)i;
// We don't take safety checks because valid_wallpaper_modes[] is
// defined in this function and we can clearly see that it does not
// overflow.
mode = static_cast<DesktopWindow::WallpaperMode>(i);
if(mode != settings_.wallpaperMode())
changed = true;
break;
Expand Down

0 comments on commit 73c9645

Please sign in to comment.