src/share/native/sun/java2d/cmm/lcms/cmsio0.c
Print this page
*** 155,173 ****
FILEMEM* ResData = (FILEMEM*) Icc ->stream;
if (size == 0) return TRUE;
if (ResData != NULL)
! CopyMemory(ResData ->Block + Icc ->UsedSpace, Ptr, size);
Icc->UsedSpace += size;
return TRUE;
}
static
BOOL MemoryClose(struct _lcms_iccprofile_struct* Icc)
{
FILEMEM* ResData = (FILEMEM*) Icc ->stream;
if (ResData ->FreeBlockOnClose) {
--- 155,190 ----
FILEMEM* ResData = (FILEMEM*) Icc ->stream;
if (size == 0) return TRUE;
if (ResData != NULL)
! CopyMemory(ResData ->Block + ResData ->Pointer, Ptr, size);
+ ResData->Pointer += size;
Icc->UsedSpace += size;
return TRUE;
}
static
+ BOOL MemoryGrow(struct _lcms_iccprofile_struct* Icc, size_t size)
+ {
+ FILEMEM* ResData = (FILEMEM*) Icc->stream;
+
+ void* newBlock = realloc(ResData->Block, ResData->Size + size);
+
+ if (!newBlock) {
+ return FALSE;
+ }
+ ResData->Block = newBlock;
+ ResData->Size += size;
+ return TRUE;
+ }
+
+
+ static
BOOL MemoryClose(struct _lcms_iccprofile_struct* Icc)
{
FILEMEM* ResData = (FILEMEM*) Icc ->stream;
if (ResData ->FreeBlockOnClose) {
*** 237,246 ****
--- 254,270 ----
return (fwrite(Ptr, size, 1, (FILE*) Icc->stream) == 1);
}
static
+ BOOL FileGrow(struct _lcms_iccprofile_struct* Icc, size_t size)
+ {
+ return TRUE;
+ }
+
+
+ static
BOOL FileClose(struct _lcms_iccprofile_struct* Icc)
{
return fclose((FILE*) Icc ->stream);
}
*** 380,389 ****
--- 404,414 ----
NewIcc ->Read = FileRead;
NewIcc ->Seek = FileSeek;
NewIcc ->Tell = FileTell;
NewIcc ->Close = FileClose;
+ NewIcc ->Grow = FileGrow;
NewIcc ->Write = NULL;
NewIcc ->IsWrite = FALSE;
*** 417,427 ****
NewIcc ->Read = MemoryRead;
NewIcc ->Seek = MemorySeek;
NewIcc ->Tell = MemoryTell;
NewIcc ->Close = MemoryClose;
! NewIcc ->Write = NULL;
NewIcc ->IsWrite = FALSE;
return NewIcc;
--- 442,453 ----
NewIcc ->Read = MemoryRead;
NewIcc ->Seek = MemorySeek;
NewIcc ->Tell = MemoryTell;
NewIcc ->Close = MemoryClose;
! NewIcc ->Grow = MemoryGrow;
! NewIcc ->Write = MemoryWrite;
NewIcc ->IsWrite = FALSE;
return NewIcc;