From f20b84fe595cfe27b8b10e84248d8c94e26f8d20 Mon Sep 17 00:00:00 2001 From: Marti Maria Date: Tue, 17 Mar 2015 12:19:51 +0100 Subject: Added a version retrieval function --- ChangeLog | 1 + doc/LittleCMS2.7 API.pdf | Bin 1064667 -> 1005579 bytes doc/src.zip | Bin 2448289 -> 2454530 bytes include/lcms2.h | 6 +++++- src/cmserr.c | 9 ++++++++- src/lcms2.def | 1 + testbed/testcms2.c | 7 ++++++- 7 files changed, 21 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index b36e5ac..dd0b3c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -159,6 +159,7 @@ Added license for iccjpeg.c Added a project for VS2013 Fixed wrong handling of extra channels in some formatters. Added an option in transicc for working in bounded mode +Added a version retrieval function ----------------------- 2.7 Maintenance release diff --git a/doc/LittleCMS2.7 API.pdf b/doc/LittleCMS2.7 API.pdf index 930eb7f..611ee8b 100755 Binary files a/doc/LittleCMS2.7 API.pdf and b/doc/LittleCMS2.7 API.pdf differ diff --git a/doc/src.zip b/doc/src.zip index 129726e..13f3aeb 100755 Binary files a/doc/src.zip and b/doc/src.zip differ diff --git a/include/lcms2.h b/include/lcms2.h index e5080e7..a0421d8 100644 --- a/include/lcms2.h +++ b/include/lcms2.h @@ -23,7 +23,7 @@ // //--------------------------------------------------------------------------------- // -// Version 2.7rc2 +// Version 2.7 // #ifndef _lcms2_H @@ -1001,6 +1001,10 @@ typedef struct { } cmsICCViewingConditions; +// Get LittleCMS version (for shared objects) ----------------------------------------------------------------------------- + +CMSAPI int CMSEXPORT cmsGetEncodedCMMversion(void); + // Support of non-standard functions -------------------------------------------------------------------------------------- CMSAPI int CMSEXPORT cmsstrcasecmp(const char* s1, const char* s2); diff --git a/src/cmserr.c b/src/cmserr.c index 29516db..512ae07 100644 --- a/src/cmserr.c +++ b/src/cmserr.c @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2012 Marti Maria Saguer +// Copyright (c) 1998-2015 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -25,6 +25,13 @@ #include "lcms2_internal.h" + +// This function is here to help applications to prevent mixing lcms versions on header and shared objects. +int CMSEXPORT cmsGetEncodedCMMversion(void) +{ + return LCMS_VERSION; +} + // I am so tired about incompatibilities on those functions that here are some replacements // that hopefully would be fully portable. diff --git a/src/lcms2.def b/src/lcms2.def index a6fb54d..c5e8603 100644 --- a/src/lcms2.def +++ b/src/lcms2.def @@ -340,3 +340,4 @@ _cmsDestroyMutex = _cmsDestroyMutex _cmsLockMutex = _cmsLockMutex _cmsUnlockMutex = _cmsUnlockMutex cmsGetProfileIOhandler = cmsGetProfileIOhandler +cmsGetEncodedCMMversion = cmsGetEncodedCMMversion diff --git a/testbed/testcms2.c b/testbed/testcms2.c index 5584f6e..1469fb3 100644 --- a/testbed/testcms2.c +++ b/testbed/testcms2.c @@ -8165,7 +8165,6 @@ void PrintSupportedIntents(void) int main(int argc, char* argv[]) { - cmsInt32Number Exhaustive = 0; cmsInt32Number DoSpeedTests = 1; cmsInt32Number DoCheckTests = 1; @@ -8176,6 +8175,11 @@ int main(int argc, char* argv[]) _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif + // First of all, check for the right header + if (cmsGetEncodedCMMversion() != LCMS_VERSION) { + Die("Oops, you are mixing header and shared lib!\nHeader version reports to be '%d' and shared lib '%d'\n", LCMS_VERSION, cmsGetEncodedCMMversion()); + } + printf("LittleCMS %2.2f test bed %s %s\n\n", LCMS_VERSION / 1000.0, __DATE__, __TIME__); if ((argc == 2) && strcmp(argv[1], "--exhaustive") == 0) { @@ -8190,6 +8194,7 @@ int main(int argc, char* argv[]) printf("done.\n"); #endif + printf("Installing debug memory plug-in ... "); cmsPlugin(&DebugMemHandler); printf("done.\n"); -- cgit v1.2.1