Use binary units for sizes, not decimal values.
authorMarcel Pol <marcel@timelord.nl>
Wed, 10 Mar 2021 12:47:33 +0000 (13:47 +0100)
committerMarcel Pol <marcel@timelord.nl>
Wed, 10 Mar 2021 12:47:33 +0000 (13:47 +0100)
KiB = 1024 bytes
MiB = 1024 * 1024 bytes
GiB = 1024 * 1024 * 1024 bytes

Please be aware, I am no C programmer. I also saw some use of Mb and mb,
which might indicate Megabit.
Please double check if my assumptions are correct.

Reference:
https://en.wikipedia.org/wiki/Byte#Multiple-byte_units

If the desire is to use decimal units like KB, MB and GB,
the code would need to be changed to use 1000 for kilo.
That is way over my head and not a good task for me.

src/filedata.c
src/pixbuf-renderer.c
src/pixbuf-renderer.h
src/preferences.c
src/renderer-tiles.c
src/trash.c

index d89ea3b..69c4917 100644 (file)
@@ -113,16 +113,16 @@ gchar *text_from_size_abrev(gint64 size)
                }
        if (size < (gint64)1048576)
                {
-               return g_strdup_printf(_("%.1f K"), (gdouble)size / 1024.0);
+               return g_strdup_printf(_("%.1f KiB"), (gdouble)size / 1024.0);
                }
        if (size < (gint64)1073741824)
                {
-               return g_strdup_printf(_("%.1f MB"), (gdouble)size / 1048576.0);
+               return g_strdup_printf(_("%.1f MiB"), (gdouble)size / 1048576.0);
                }
 
        /* to avoid overflowing the gdouble, do division in two steps */
        size /= 1048576;
-       return g_strdup_printf(_("%.1f GB"), (gdouble)size / 1024.0);
+       return g_strdup_printf(_("%.1f GiB"), (gdouble)size / 1024.0);
 }
 
 /* note: returned string is valid until next call to text_from_time() */
index d8d5219..8833516 100644 (file)
@@ -279,7 +279,7 @@ static void pixbuf_renderer_class_init(PixbufRendererClass *class)
        g_object_class_install_property(gobject_class,
                                        PROP_CACHE_SIZE_DISPLAY,
                                        g_param_spec_uint("cache_display",
-                                                         "Display cache size MB",
+                                                         "Display cache size MiB",
                                                          NULL,
                                                          0,
                                                          128,
index 7e1ede3..fc1c404 100644 (file)
@@ -36,7 +36,7 @@
  */
 #define PR_MIN_SCALE_SIZE 8
 
-/* default size of tile cache (mb) */
+/* default size of tile cache (MiB) */
 #define PR_CACHE_SIZE_DEFAULT 8
 
 /* round A up/down to integer count of B */
index 83be44d..74d689d 100644 (file)
@@ -2074,7 +2074,7 @@ static void config_tab_general(GtkWidget *notebook)
 
        group = pref_group_new(vbox, FALSE, _("Image loading and caching"), GTK_ORIENTATION_VERTICAL);
 
-       pref_spin_new_int(group, _("Decoded image cache size (Mb):"), NULL,
+       pref_spin_new_int(group, _("Decoded image cache size (MiB):"), NULL,
                          0, 99999, 1, options->image.image_cache_max, &c_options->image.image_cache_max);
        pref_checkbox_new_int(group, _("Preload next image"),
                              options->image.enable_read_ahead, &c_options->image.enable_read_ahead);
@@ -3313,7 +3313,7 @@ static void config_tab_behavior(GtkWidget *notebook)
        pref_checkbox_link_sensitivity(ct_button, hbox);
 
        pref_spacer(hbox, PREF_PAD_INDENT - PREF_PAD_GAP);
-       spin = pref_spin_new_int(hbox, _("Maximum size:"), _("MB"),
+       spin = pref_spin_new_int(hbox, _("Maximum size:"), _("MiB"),
                                 0, 2048, 1, options->file_ops.safe_delete_folder_maxsize, &c_options->file_ops.safe_delete_folder_maxsize);
        gtk_widget_set_tooltip_markup(spin, _("Set to 0 for unlimited size"));
        button = pref_button_new(NULL, NULL, _("View"), FALSE,
index cc0483a..893a424 100644 (file)
@@ -123,7 +123,7 @@ struct _RendererTiles
        RendererFuncs f;
        PixbufRenderer *pr;
 
-       gint tile_cache_max;            /* max mb to use for offscreen buffer */
+       gint tile_cache_max;            /* max MiB to use for offscreen buffer */
 
        gint tile_width;
        gint tile_height;
index 0bd3aea..b3aecfc 100644 (file)
@@ -207,7 +207,7 @@ gchar *file_util_safe_delete_status(void)
                        {
                        gchar *buf2;
                        if (options->file_ops.safe_delete_folder_maxsize > 0)
-                               buf2 = g_strdup_printf(_(" (max. %d MB)"), options->file_ops.safe_delete_folder_maxsize);
+                               buf2 = g_strdup_printf(_(" (max. %d MiB)"), options->file_ops.safe_delete_folder_maxsize);
                        else
                                buf2 = g_strdup("");