< prev index next >
src/java.desktop/share/native/liblcms/cmsio0.c
Print this page
*** 28,38 ****
// file:
//
//---------------------------------------------------------------------------------
//
// Little Color Management System
! // Copyright (c) 1998-2017 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"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
--- 28,38 ----
// file:
//
//---------------------------------------------------------------------------------
//
// Little Color Management System
! // 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"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
*** 261,271 ****
return TRUE;
}
// Create a iohandler for memory block. AccessMode=='r' assumes the iohandler is going to read, and makes
// a copy of the memory block for letting user to free the memory after invoking open profile. In write
! // mode ("w"), Buffere points to the begin of memory block to be written.
cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromMem(cmsContext ContextID, void *Buffer, cmsUInt32Number size, const char* AccessMode)
{
cmsIOHANDLER* iohandler = NULL;
FILEMEM* fm = NULL;
--- 261,271 ----
return TRUE;
}
// Create a iohandler for memory block. AccessMode=='r' assumes the iohandler is going to read, and makes
// a copy of the memory block for letting user to free the memory after invoking open profile. In write
! // mode ("w"), Buffer points to the begin of memory block to be written.
cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromMem(cmsContext ContextID, void *Buffer, cmsUInt32Number size, const char* AccessMode)
{
cmsIOHANDLER* iohandler = NULL;
FILEMEM* fm = NULL;
*** 660,670 ****
*NewPos = i;
}
else {
// No, make a new one
-
if (Icc -> TagCount >= MAX_TABLE_TAG) {
cmsSignalError(Icc ->ContextID, cmsERROR_RANGE, "Too many tags (%d)", MAX_TABLE_TAG);
return FALSE;
}
--- 660,669 ----
*** 681,692 ****
{
_cmsICCPROFILE* Icc = (_cmsICCPROFILE*) (void*) hProfile;
return _cmsSearchTag(Icc, sig, FALSE) >= 0;
}
-
-
// Enforces that the profile version is per. spec.
// Operates on the big endian bytes from the profile.
// Called before converting to platform endianness.
// Byte 0 is BCD major version, so max 9.
// Byte 1 is 2 BCD digits, one per nibble.
--- 680,689 ----
*** 1594,1604 ****
BaseType = _cmsReadTypeBase(io);
if (BaseType == 0) goto Error;
if (!IsTypeSupported(TagDescriptor, BaseType)) goto Error;
! TagSize -= 8; // Alredy read by the type base logic
// Get type handler
TypeHandler = _cmsGetTagTypeHandler(Icc ->ContextID, BaseType);
if (TypeHandler == NULL) goto Error;
LocalTypeHandler = *TypeHandler;
--- 1591,1601 ----
BaseType = _cmsReadTypeBase(io);
if (BaseType == 0) goto Error;
if (!IsTypeSupported(TagDescriptor, BaseType)) goto Error;
! TagSize -= 8; // Already read by the type base logic
// Get type handler
TypeHandler = _cmsGetTagTypeHandler(Icc ->ContextID, BaseType);
if (TypeHandler == NULL) goto Error;
LocalTypeHandler = *TypeHandler;
*** 1629,1638 ****
--- 1626,1636 ----
char String[5];
_cmsTagSignature2String(String, sig);
cmsSignalError(Icc ->ContextID, cmsERROR_CORRUPTION_DETECTED, "'%s' Inconsistent number of items: expected %d, got %d",
String, TagDescriptor ->ElemCount, ElemCount);
+ goto Error;
}
// Return the data
_cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
*** 1825,1835 ****
_cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
return Icc ->TagSizes[i];
}
! // The data has been already read, or written. But wait!, maybe the user choosed to save as
// raw data. In this case, return the raw data directly
if (Icc ->TagSaveAsRaw[i]) {
if (data != NULL) {
--- 1823,1833 ----
_cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
return Icc ->TagSizes[i];
}
! // The data has been already read, or written. But wait!, maybe the user chose to save as
// raw data. In this case, return the raw data directly
if (Icc ->TagSaveAsRaw[i]) {
if (data != NULL) {
*** 1845,1855 ****
_cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
return Icc ->TagSizes[i];
}
! // Already readed, or previously set by cmsWriteTag(). We need to serialize that
// data to raw in order to maintain consistency.
_cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
Object = cmsReadTag(hProfile, sig);
if (!_cmsLockMutex(Icc->ContextID, Icc ->UsrMutex)) return 0;
--- 1843,1853 ----
_cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
return Icc ->TagSizes[i];
}
! // Already read, or previously set by cmsWriteTag(). We need to serialize that
// data to raw in order to maintain consistency.
_cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
Object = cmsReadTag(hProfile, sig);
if (!_cmsLockMutex(Icc->ContextID, Icc ->UsrMutex)) return 0;
< prev index next >