clang-tidy: readability-misleading-indentation
authorColin Clark <colin.clark@cclark.uk>
Tue, 6 Feb 2024 11:06:19 +0000 (11:06 +0000)
committerColin Clark <colin.clark@cclark.uk>
Tue, 6 Feb 2024 11:06:19 +0000 (11:06 +0000)
- Fix warnings identified by this flag
- Remove the exclude from .clang-tidy file

.clang-tidy
src/bar-gps.cc
src/bar-keywords.cc
src/image-load.cc
src/img-view.cc
src/similar.cc
src/view-file/view-file-list.cc

index 8e25cfc..fda57e8 100644 (file)
@@ -51,12 +51,12 @@ Checks: >
   -readability-implicit-bool-conversion,
   -readability-isolate-declaration,
   -readability-magic-numbers,
-  -readability-misleading-indentation,
   -readability-named-parameter,
   -readability-qualified-auto,
   -readability-simplify-boolean-expr,
   -readability-suspicious-call-argument,
   -readability-uppercase-literal-suffix
 
+
 ExtraArgs: [-Wno-unknown-warning-option, -Wno-unused-lambda-capture, -Wno-unused-but-set-variable]
 WarningsAsErrors: "*"
index 203fa29..7f5295c 100644 (file)
@@ -327,7 +327,7 @@ static gboolean bar_pane_gps_marker_keypress_cb(GtkWidget *widget, ClutterButton
                         * If not, call the thumb_loader to generate a thumbnail and update the marker later in the
                         * thumb_loader callback
                         */
-                        if (fd->thumb_pixbuf != nullptr)
+                       if (fd->thumb_pixbuf != nullptr)
                                {
                                actor = gtk_clutter_texture_new();
                                gtk_clutter_texture_set_from_pixbuf(GTK_CLUTTER_TEXTURE(actor), fd->thumb_pixbuf, nullptr);
@@ -501,7 +501,7 @@ static gboolean bar_pane_gps_create_markers_cb(gpointer data)
                        champlain_bounding_box_get_center(pgd->bbox, &latitude, &longitude);
                        champlain_view_go_to(CHAMPLAIN_VIEW(pgd->gps_view), latitude, longitude);
                        }
-                else if (pgd->num_added > 1)
+               else if (pgd->num_added > 1)
                        {
                        champlain_view_ensure_visible(CHAMPLAIN_VIEW(pgd->gps_view), pgd->bbox, TRUE);
                        }
index 58d8581..793e091 100644 (file)
@@ -922,13 +922,13 @@ static void bar_pane_keywords_edit_dialog(PaneKeywordsData *pkd, gboolean edit_e
        gboolean is_keyword = TRUE;
 
 
-        if (edit_existing && pkd->click_tpath)
+       if (edit_existing && pkd->click_tpath)
                {
                GtkTreeModel *model;
                GtkTreeIter iter;
                model = gtk_tree_view_get_model(GTK_TREE_VIEW(pkd->keyword_treeview));
 
-               if (gtk_tree_model_get_iter(model, &iter, pkd->click_tpath))
+               if (gtk_tree_model_get_iter(model, &iter, pkd->click_tpath))
                        {
                        gtk_tree_model_get(model, &iter, FILTER_KEYWORD_COLUMN_NAME, &name,
                                                         FILTER_KEYWORD_COLUMN_IS_KEYWORD, &is_keyword, -1);
index 6901d54..da06b41 100644 (file)
@@ -656,145 +656,146 @@ static void image_loader_setup_loader(ImageLoader *il)
                image_loader_backend_set_external(&il->backend);
                }
        else
-
-#ifdef HAVE_FFMPEGTHUMBNAILER
-       if (il->fd->format_class == FORMAT_CLASS_VIDEO)
                {
-               DEBUG_1("Using custom ffmpegthumbnailer loader");
-               image_loader_backend_set_ft(&il->backend);
-               }
-       else
+#ifdef HAVE_FFMPEGTHUMBNAILER
+               if (il->fd->format_class == FORMAT_CLASS_VIDEO)
+                       {
+                       DEBUG_1("Using custom ffmpegthumbnailer loader");
+                       image_loader_backend_set_ft(&il->backend);
+                       }
+               else
 #endif
 #ifdef HAVE_PDF
-       if (il->bytes_total >= 4 &&
-           (memcmp(il->mapped_file + 0, "%PDF", 4) == 0))
-               {
-               DEBUG_1("Using custom pdf loader");
-               image_loader_backend_set_pdf(&il->backend);
-               }
-       else
+               if (il->bytes_total >= 4 &&
+                   (memcmp(il->mapped_file + 0, "%PDF", 4) == 0))
+                       {
+                       DEBUG_1("Using custom pdf loader");
+                       image_loader_backend_set_pdf(&il->backend);
+                       }
+               else
 #endif
 #ifdef HAVE_HEIF
-       if (il->bytes_total >= 12 &&
-               ((memcmp(il->mapped_file + 4, "ftypheic", 8) == 0) ||
-               (memcmp(il->mapped_file + 4, "ftypheix", 8) == 0) ||
-               (memcmp(il->mapped_file + 4, "ftypmsf1", 8) == 0) ||
-               (memcmp(il->mapped_file + 4, "ftypmif1", 8) == 0) ||
-               (memcmp(il->mapped_file + 4, "ftypavif", 8) == 0)))
-               {
-               DEBUG_1("Using custom heif loader");
-               image_loader_backend_set_heif(&il->backend);
-               }
-       else
-#endif
-#ifdef HAVE_WEBP
-       if (il->bytes_total >= 12 &&
-               (memcmp(il->mapped_file, "RIFF", 4) == 0) &&
-               (memcmp(il->mapped_file + 8, "WEBP", 4) == 0))
-               {
-               DEBUG_1("Using custom webp loader");
-               image_loader_backend_set_webp(&il->backend);
-               }
-       else
+               if (il->bytes_total >= 12 &&
+                       ((memcmp(il->mapped_file + 4, "ftypheic", 8) == 0) ||
+                       (memcmp(il->mapped_file + 4, "ftypheix", 8) == 0) ||
+                       (memcmp(il->mapped_file + 4, "ftypmsf1", 8) == 0) ||
+                       (memcmp(il->mapped_file + 4, "ftypmif1", 8) == 0) ||
+                       (memcmp(il->mapped_file + 4, "ftypavif", 8) == 0)))
+                       {
+                       DEBUG_1("Using custom heif loader");
+                       image_loader_backend_set_heif(&il->backend);
+                       }
+               else
+       #endif
+       #ifdef HAVE_WEBP
+               if (il->bytes_total >= 12 &&
+                       (memcmp(il->mapped_file, "RIFF", 4) == 0) &&
+                       (memcmp(il->mapped_file + 8, "WEBP", 4) == 0))
+                       {
+                       DEBUG_1("Using custom webp loader");
+                       image_loader_backend_set_webp(&il->backend);
+                       }
+               else
 #endif
 #ifdef HAVE_DJVU
-       if (il->bytes_total >= 16 &&
-               (memcmp(il->mapped_file, "AT&TFORM", 8) == 0) &&
-               (memcmp(il->mapped_file + 12, "DJV", 3) == 0))
-               {
-               DEBUG_1("Using custom djvu loader");
-               image_loader_backend_set_djvu(&il->backend);
-               }
-       else
+               if (il->bytes_total >= 16 &&
+                       (memcmp(il->mapped_file, "AT&TFORM", 8) == 0) &&
+                       (memcmp(il->mapped_file + 12, "DJV", 3) == 0))
+                       {
+                       DEBUG_1("Using custom djvu loader");
+                       image_loader_backend_set_djvu(&il->backend);
+                       }
+               else
 #endif
 #ifdef HAVE_JPEG
-       if (il->bytes_total >= 2 && il->mapped_file[0] == 0xff && il->mapped_file[1] == 0xd8)
-               {
-               DEBUG_1("Using custom jpeg loader");
-               image_loader_backend_set_jpeg(&il->backend);
-               }
+               if (il->bytes_total >= 2 && il->mapped_file[0] == 0xff && il->mapped_file[1] == 0xd8)
+                       {
+                       DEBUG_1("Using custom jpeg loader");
+                       image_loader_backend_set_jpeg(&il->backend);
+                       }
 #ifndef HAVE_RAW
-       else
-       if (il->bytes_total >= 11 &&
-               (memcmp(il->mapped_file + 4, "ftypcrx", 7) == 0) &&
-               (memcmp(il->mapped_file + 64, "CanonCR3", 8) == 0))
-               {
-               DEBUG_1("Using custom cr3 loader");
-               image_loader_backend_set_cr3(&il->backend);
-               }
+               else
+               if (il->bytes_total >= 11 &&
+                       (memcmp(il->mapped_file + 4, "ftypcrx", 7) == 0) &&
+                       (memcmp(il->mapped_file + 64, "CanonCR3", 8) == 0))
+                       {
+                       DEBUG_1("Using custom cr3 loader");
+                       image_loader_backend_set_cr3(&il->backend);
+                       }
 #endif
-       else
+               else
 #endif
 #ifdef HAVE_TIFF
-       if (il->bytes_total >= 10 &&
-           (memcmp(il->mapped_file, "MM\0*", 4) == 0 ||
-            memcmp(il->mapped_file, "MM\0+\0\x08\0\0", 8) == 0 ||
-            memcmp(il->mapped_file, "II+\0\x08\0\0\0", 8) == 0 ||
-            memcmp(il->mapped_file, "II*\0", 4) == 0))
-               {
-               DEBUG_1("Using custom tiff loader");
-               image_loader_backend_set_tiff(&il->backend);
-               }
-       else
+               if (il->bytes_total >= 10 &&
+                   (memcmp(il->mapped_file, "MM\0*", 4) == 0 ||
+                    memcmp(il->mapped_file, "MM\0+\0\x08\0\0", 8) == 0 ||
+                    memcmp(il->mapped_file, "II+\0\x08\0\0\0", 8) == 0 ||
+                    memcmp(il->mapped_file, "II*\0", 4) == 0))
+                       {
+                       DEBUG_1("Using custom tiff loader");
+                       image_loader_backend_set_tiff(&il->backend);
+                       }
+               else
 #endif
-       if (il->bytes_total >= 3 && il->mapped_file[0] == 0x44 && il->mapped_file[1] == 0x44 && il->mapped_file[2] == 0x53)
-               {
-               DEBUG_1("Using dds loader");
-               image_loader_backend_set_dds(&il->backend);
-               }
-       else
-       if (il->bytes_total >= 6 &&
-               (memcmp(il->mapped_file, "8BPS\0\x01", 6) == 0))
-               {
-               DEBUG_1("Using custom psd loader");
-               image_loader_backend_set_psd(&il->backend);
-               }
-       else
+               if (il->bytes_total >= 3 && il->mapped_file[0] == 0x44 && il->mapped_file[1] == 0x44 && il->mapped_file[2] == 0x53)
+                       {
+                       DEBUG_1("Using dds loader");
+                       image_loader_backend_set_dds(&il->backend);
+                       }
+               else
+               if (il->bytes_total >= 6 &&
+                       (memcmp(il->mapped_file, "8BPS\0\x01", 6) == 0))
+                       {
+                       DEBUG_1("Using custom psd loader");
+                       image_loader_backend_set_psd(&il->backend);
+                       }
+               else
 #ifdef HAVE_J2K
-       if (il->bytes_total >= 12 &&
-               (memcmp(il->mapped_file, "\0\0\0\x0CjP\x20\x20\x0D\x0A\x87\x0A", 12) == 0))
-               {
-               DEBUG_1("Using custom j2k loader");
-               image_loader_backend_set_j2k(&il->backend);
-               }
-       else
+               if (il->bytes_total >= 12 &&
+                       (memcmp(il->mapped_file, "\0\0\0\x0CjP\x20\x20\x0D\x0A\x87\x0A", 12) == 0))
+                       {
+                       DEBUG_1("Using custom j2k loader");
+                       image_loader_backend_set_j2k(&il->backend);
+                       }
+               else
 #endif
 #ifdef HAVE_JPEGXL
-       if (il->bytes_total >= 12 &&
-               (memcmp(il->mapped_file, "\0\0\0\x0C\x4A\x58\x4C\x20\x0D\x0A\x87\x0A", 12) == 0))
-               {
-               DEBUG_1("Using custom jpeg xl loader");
-               image_loader_backend_set_jpegxl(&il->backend);
-               }
-       else
-       if (il->bytes_total >= 2 &&
-               (memcmp(il->mapped_file, "\xFF\x0A", 2) == 0))
-               {
-               DEBUG_1("Using custom jpeg xl loader");
-               image_loader_backend_set_jpegxl(&il->backend);
-               }
-       else
+               if (il->bytes_total >= 12 &&
+                       (memcmp(il->mapped_file, "\0\0\0\x0C\x4A\x58\x4C\x20\x0D\x0A\x87\x0A", 12) == 0))
+                       {
+                       DEBUG_1("Using custom jpeg xl loader");
+                       image_loader_backend_set_jpegxl(&il->backend);
+                       }
+               else
+               if (il->bytes_total >= 2 &&
+                       (memcmp(il->mapped_file, "\xFF\x0A", 2) == 0))
+                       {
+                       DEBUG_1("Using custom jpeg xl loader");
+                       image_loader_backend_set_jpegxl(&il->backend);
+                       }
+               else
 #endif
-       if ((il->bytes_total == 6144 || il->bytes_total == 6912) &&
-               (file_extension_match(il->fd->path, ".scr")))
-               {
-               DEBUG_1("Using custom zxscr loader");
-               image_loader_backend_set_zxscr(&il->backend);
-               }
-       else
-       if (il->fd->format_class == FORMAT_CLASS_COLLECTION)
-               {
-               DEBUG_1("Using custom collection loader");
-               image_loader_backend_set_collection(&il->backend);
-               }
-       else
-       if (g_strcmp0(strrchr(il->fd->path, '.'), ".svgz") == 0)
-               {
-               DEBUG_1("Using custom svgz loader");
-               image_loader_backend_set_svgz(&il->backend);
+               if ((il->bytes_total == 6144 || il->bytes_total == 6912) &&
+                       (file_extension_match(il->fd->path, ".scr")))
+                       {
+                       DEBUG_1("Using custom zxscr loader");
+                       image_loader_backend_set_zxscr(&il->backend);
+                       }
+               else
+               if (il->fd->format_class == FORMAT_CLASS_COLLECTION)
+                       {
+                       DEBUG_1("Using custom collection loader");
+                       image_loader_backend_set_collection(&il->backend);
+                       }
+               else
+               if (g_strcmp0(strrchr(il->fd->path, '.'), ".svgz") == 0)
+                       {
+                       DEBUG_1("Using custom svgz loader");
+                       image_loader_backend_set_svgz(&il->backend);
+                       }
+               else
+                       image_loader_backend_set_default(&il->backend);
                }
-       else
-               image_loader_backend_set_default(&il->backend);
 
        il->loader = static_cast<void **>(il->backend.loader_new(image_loader_area_updated_cb, image_loader_size_cb, image_loader_area_prepared_cb, il));
 
index 3e1884b..c50a0e8 100644 (file)
@@ -657,7 +657,7 @@ static void button_cb(ImageWindow *imd, GdkEventButton *event, gpointer data)
        switch (event->button)
                {
                case MOUSE_BUTTON_LEFT:
-                       if (options->image_l_click_archive && imd->image_fd->format_class == FORMAT_CLASS_ARCHIVE)
+                       if (options->image_l_click_archive && imd->image_fd->format_class == FORMAT_CLASS_ARCHIVE)
                                {
                                dest_dir = open_archive(imd->image_fd);
                                if (dest_dir)
@@ -671,7 +671,7 @@ static void button_cb(ImageWindow *imd, GdkEventButton *event, gpointer data)
                                        warning_dialog(_("Cannot open archive file"), _("See the Log Window"), GQ_ICON_DIALOG_WARNING, nullptr);
                                        }
                                }
-                       else if (options->image_l_click_video && options->image_l_click_video_editor && imd->image_fd->format_class == FORMAT_CLASS_VIDEO)
+                       else if (options->image_l_click_video && options->image_l_click_video_editor && imd->image_fd->format_class == FORMAT_CLASS_VIDEO)
                                {
                                start_editor_from_file(options->image_l_click_video_editor, imd->image_fd);
                                }
index bd090ca..62a39ae 100644 (file)
@@ -213,7 +213,7 @@ void image_sim_fill_data(ImageSimilarityData *sd, GdkPixbuf *pixbuf)
        for (ys = 0; ys < 32; ys++)
                {
                if (y_small) j = static_cast<gdouble>(h) / 32 * ys;
-                       else y_inc = mround(static_cast<gdouble>(h_left)/(32-ys));
+               else y_inc = mround(static_cast<gdouble>(h_left)/(32-ys));
                i = 0;
 
                w_left = w;
@@ -225,7 +225,7 @@ void image_sim_fill_data(ImageSimilarityData *sd, GdkPixbuf *pixbuf)
                        guchar *xpos;
 
                        if (x_small) i = static_cast<gdouble>(w) / 32 * xs;
-                               else x_inc = mround(static_cast<gdouble>(w_left)/(32-xs));
+                       else x_inc = mround(static_cast<gdouble>(w_left)/(32-xs));
                        xy_inc = x_inc * y_inc;
                        r = g = b = 0;
                        xpos = pix + (i * p_step);
index 8e25849..a65e3df 100644 (file)
@@ -1895,12 +1895,12 @@ gboolean vflist_refresh(ViewFile *vf)
                ret = filelist_read(vf->dir_fd, &vf->list, nullptr);
 
                if (vf->marks_enabled)
-                       {
-                       // When marks are enabled, lock FileDatas so that we don't end up re-parsing XML
-                       // each time a mark is changed.
-                       file_data_lock_list(vf->list);
-                       }
-               else
+                       {
+                       // When marks are enabled, lock FileDatas so that we don't end up re-parsing XML
+                       // each time a mark is changed.
+                       file_data_lock_list(vf->list);
+                       }
+               else
                        {
                        /** @FIXME only do this when needed (aka when we just switched from */
                        /** @FIXME marks-enabled to marks-disabled) */