Skip to content

Commit

Permalink
Drop redundant HAVE_LCMS2 flag
Browse files Browse the repository at this point in the history
lcms required version is >=2.0.
Remove obsolete color_man_lib_init().
  • Loading branch information
qarkai authored and caclark committed Feb 11, 2025
1 parent a395933 commit e77c150
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 54 deletions.
3 changes: 0 additions & 3 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@
/* color profiles with lcms */
#mesondefine HAVE_LCMS

/* Define to enable use of lcms2 */
#mesondefine HAVE_LCMS2

/* Define to enable use of maps */
#mesondefine HAVE_LIBCHAMPLAIN

Expand Down
1 change: 0 additions & 1 deletion doxygen.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2433,7 +2433,6 @@ PREDEFINED = DEBUG=1 \
HAVE_JPEG=1 \
HAVE_JPEGXL=1 \
HAVE_LCMS=1 \
HAVE_LCMS2=1 \
HAVE_LIBCHAMPLAIN=1 \
HAVE_LIBCHAMPLAIN_GTK=1 \
HAVE_LUA=1 \
Expand Down
2 changes: 0 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,13 @@ else
endif

conf_data.set('HAVE_LCMS', 0)
conf_data.set('HAVE_LCMS2', 0)
lcms_dep = []
req_version = '>=2.0'
option = get_option('cms')
if not option.disabled()
lcms_dep = dependency('lcms2', version : req_version, required : get_option('cms'))
if lcms_dep.found()
conf_data.set('HAVE_LCMS', 1)
conf_data.set('HAVE_LCMS2', 1)
summary({'cms' : ['color management supported:', true]}, section : 'Configuration', bool_yn : true)
else
summary({'cms' : ['lcms2' + req_version + ' not found - color management supported:', false]}, section : 'Configuration', bool_yn : true)
Expand Down
1 change: 0 additions & 1 deletion scripts/geeqie.cppcheck
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
<define name="HAVE_JPEG"/>
<define name="HAVE_JPEGXL"/>
<define name="HAVE_LCMS"/>
<define name="HAVE_LCMS2"/>
<define name="HAVE_LIBCHAMPLAIN"/>
<define name="HAVE_LIBCHAMPLAIN_GTK"/>
<define name="HAVE_LUA"/>
Expand Down
8 changes: 1 addition & 7 deletions src/color-man-heif.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,7 @@
#include <vector>

#include <glib-object.h>

#if HAVE_LCMS2
# include <lcms2.h>
#else
# include <lcms.h>
#endif

#include <lcms2.h>
#include <libheif/heif_cxx.h>

namespace
Expand Down
33 changes: 2 additions & 31 deletions src/color-man.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,7 @@
#include <cstring>

#include <glib-object.h>

#if HAVE_LCMS2
# include <lcms2.h>
#else
# include <lcms.h>
#endif
#include <lcms2.h>

#include "image.h"
#include "intl.h"
Expand All @@ -61,18 +56,6 @@ struct ColorManCache {
};


static void color_man_lib_init()
{
static gboolean init_done = FALSE;

if (init_done) return;
init_done = TRUE;

#if !HAVE_LCMS2
cmsErrorAction(LCMS_ERROR_IGNORE);
#endif
}

static cmsHPROFILE color_man_create_adobe_comp()
{
/* ClayRGB1998 is AdobeRGB compatible */
Expand Down Expand Up @@ -161,8 +144,6 @@ static ColorManCache *color_man_cache_new(ColorManProfileType in_type, const gch
{
ColorManCache *cc;

color_man_lib_init();

cc = g_new0(ColorManCache, 1);
cc->refcount = 1;

Expand Down Expand Up @@ -382,15 +363,11 @@ static gchar *color_man_get_profile_name(ColorManProfileType type, cmsHPROFILE p
case COLOR_PROFILE_FILE:
if (profile)
{
#if HAVE_LCMS2
char buffer[20];
buffer[0] = '\0';
cmsGetProfileInfoASCII(profile, cmsInfoDescription, "en", "US", buffer, 20);
buffer[19] = '\0'; /* Just to be sure */
return g_strdup(buffer);
#else
return g_strdup(cmsTakeProductName(profile));
#endif
}
return g_strdup(_("Custom profile"));
break;
Expand Down Expand Up @@ -434,19 +411,13 @@ const gchar *get_profile_name(const guchar *profile_data, guint profile_len)
cmsHPROFILE profile = cmsOpenProfileFromMem(profile_data, profile_len);
if (!profile) return nullptr;

#if HAVE_LCMS2
static cmsUInt8Number profileID[17];
memset(profileID, 0, sizeof(profileID));

cmsGetHeaderProfileID(profile, profileID);
auto *name = reinterpret_cast<gchar *>(profileID);
#else
auto *name = (gchar *) cmsTakeProductName(profile);
#endif

cmsCloseProfile(profile);

return name;
return reinterpret_cast<gchar *>(profileID);
}

#else /* define HAVE_LCMS */
Expand Down
11 changes: 2 additions & 9 deletions src/preferences.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@
#endif

#if HAVE_LCMS
#if HAVE_LCMS2
#include <lcms2.h>
#else
#include <lcms.h>
#endif
# include <lcms2.h>
#endif

#include <pango/pango.h>
Expand Down Expand Up @@ -302,9 +298,6 @@ static gboolean accel_apply_cb(GtkTreeModel *model, GtkTreePath *, GtkTreeIter *
static void config_window_apply()
{
gboolean refresh = FALSE;
#if HAVE_LCMS2
int i = 0;
#endif

config_entry_to_option(safe_delete_path_entry, &options->file_ops.safe_delete_path, remove_trailing_slash);

Expand Down Expand Up @@ -525,7 +518,7 @@ static void config_window_apply()
#endif

#if HAVE_LCMS
for (i = 0; i < COLOR_PROFILE_INPUTS; i++)
for (int i = 0; i < COLOR_PROFILE_INPUTS; i++)
{
config_entry_to_option(color_profile_input_name_entry[i], &options->color_profile.input_name[i], nullptr);
config_entry_to_option(color_profile_input_file_entry[i], &options->color_profile.input_file[i], nullptr);
Expand Down

0 comments on commit e77c150

Please sign in to comment.