--- old/src/java.desktop/share/native/liblcms/cmsplugin.c 2020-08-27 15:57:47.126103035 -0700 +++ new/src/java.desktop/share/native/liblcms/cmsplugin.c 2020-08-27 15:57:46.894103039 -0700 @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2017 Marti Maria Saguer +// Copyright (c) 1998-2020 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"), @@ -62,7 +62,7 @@ // Little-Endian to Big-Endian -// Adjust a word value after being readed/ before being written from/to an ICC profile +// Adjust a word value after being read/ before being written from/to an ICC profile cmsUInt16Number CMSEXPORT _cmsAdjustEndianess16(cmsUInt16Number Word) { #ifndef CMS_USE_BIG_ENDIAN @@ -128,8 +128,8 @@ _cmsAssert(Result != NULL); # ifdef CMS_DONT_USE_INT64 - (*Result)[0] = QWord[0]; - (*Result)[1] = QWord[1]; + (*Result)[0] = (*QWord)[0]; + (*Result)[1] = (*QWord)[1]; # else *Result = *QWord; # endif @@ -216,6 +216,8 @@ return TRUE; #elif defined (__BORLANDC__) return TRUE; + #elif !defined(_MSC_VER) && (defined(__STDC_VERSION__) && __STDC_VERSION__ < 199901L) + return TRUE; #else // fpclassify() required by C99 (only provided by MSVC >= 1800, VS2013 onwards) @@ -702,15 +704,21 @@ return &globalContext; // Search + _cmsEnterCriticalSectionPrimitive(&_cmsContextPoolHeadMutex); + for (ctx = _cmsContextPoolHead; ctx != NULL; ctx = ctx ->Next) { // Found it? - if (id == ctx) - return ctx; // New-style context, + if (id == ctx) + { + _cmsLeaveCriticalSectionPrimitive(&_cmsContextPoolHeadMutex); + return ctx; // New-style context + } } + _cmsLeaveCriticalSectionPrimitive(&_cmsContextPoolHeadMutex); return &globalContext; } @@ -799,6 +807,7 @@ // See the comments regarding locking in lcms2_internal.h // for an explanation of why we need the following code. +#ifndef CMS_NO_PTHREADS #ifdef CMS_IS_WINDOWS_ #ifndef CMS_RELY_ON_WINDOWS_STATIC_MUTEX_INIT { @@ -820,6 +829,7 @@ } #endif #endif +#endif _cmsInstallAllocFunctions(_cmsFindMemoryPlugin(Plugin), &fakeContext.DefaultMemoryManager); @@ -943,25 +953,6 @@ } -/* -static -struct _cmsContext_struct* FindPrev(struct _cmsContext_struct* id) -{ - struct _cmsContext_struct* prev; - - // Search for previous - for (prev = _cmsContextPoolHead; - prev != NULL; - prev = prev ->Next) - { - if (prev ->Next == id) - return prev; - } - - return NULL; // List is empty or only one element! -} -*/ - // Frees any resources associated with the given context, // and destroys the context placeholder. // The ContextID can no longer be used in any THR operation.