Lines Matching refs:iohandler
48 cmsUInt32Number NULLRead(cmsIOHANDLER* iohandler, void *Buffer, cmsUInt32Number size, cmsUInt32Numb… in NULLRead() argument
50 FILENULL* ResData = (FILENULL*) iohandler ->stream; in NULLRead()
60 cmsBool NULLSeek(cmsIOHANDLER* iohandler, cmsUInt32Number offset) in NULLSeek() argument
62 FILENULL* ResData = (FILENULL*) iohandler ->stream; in NULLSeek()
69 cmsUInt32Number NULLTell(cmsIOHANDLER* iohandler) in NULLTell() argument
71 FILENULL* ResData = (FILENULL*) iohandler ->stream; in NULLTell()
76 cmsBool NULLWrite(cmsIOHANDLER* iohandler, cmsUInt32Number size, const void *Ptr) in NULLWrite() argument
78 FILENULL* ResData = (FILENULL*) iohandler ->stream; in NULLWrite()
81 if (ResData ->Pointer > iohandler->UsedSpace) in NULLWrite()
82 iohandler->UsedSpace = ResData ->Pointer; in NULLWrite()
90 cmsBool NULLClose(cmsIOHANDLER* iohandler) in NULLClose() argument
92 FILENULL* ResData = (FILENULL*) iohandler ->stream; in NULLClose()
94 _cmsFree(iohandler ->ContextID, ResData); in NULLClose()
95 _cmsFree(iohandler ->ContextID, iohandler); in NULLClose()
102 struct _cms_io_handler* iohandler = NULL; in cmsOpenIOhandlerFromNULL() local
105 iohandler = (struct _cms_io_handler*) _cmsMallocZero(ContextID, sizeof(struct _cms_io_handler)); in cmsOpenIOhandlerFromNULL()
106 if (iohandler == NULL) return NULL; in cmsOpenIOhandlerFromNULL()
113 iohandler ->ContextID = ContextID; in cmsOpenIOhandlerFromNULL()
114 iohandler ->stream = (void*) fm; in cmsOpenIOhandlerFromNULL()
115 iohandler ->UsedSpace = 0; in cmsOpenIOhandlerFromNULL()
116 iohandler ->ReportedSize = 0; in cmsOpenIOhandlerFromNULL()
117 iohandler ->PhysicalFile[0] = 0; in cmsOpenIOhandlerFromNULL()
119 iohandler ->Read = NULLRead; in cmsOpenIOhandlerFromNULL()
120 iohandler ->Seek = NULLSeek; in cmsOpenIOhandlerFromNULL()
121 iohandler ->Close = NULLClose; in cmsOpenIOhandlerFromNULL()
122 iohandler ->Tell = NULLTell; in cmsOpenIOhandlerFromNULL()
123 iohandler ->Write = NULLWrite; in cmsOpenIOhandlerFromNULL()
125 return iohandler; in cmsOpenIOhandlerFromNULL()
128 if (iohandler) _cmsFree(ContextID, iohandler); in cmsOpenIOhandlerFromNULL()
147 cmsUInt32Number MemoryRead(struct _cms_io_handler* iohandler, void *Buffer, cmsUInt32Number size, c… in MemoryRead() argument
149 FILEMEM* ResData = (FILEMEM*) iohandler ->stream; in MemoryRead()
156 …cmsSignalError(iohandler ->ContextID, cmsERROR_READ, "Read from memory error. Got %d bytes, block … in MemoryRead()
170 cmsBool MemorySeek(struct _cms_io_handler* iohandler, cmsUInt32Number offset) in MemorySeek() argument
172 FILEMEM* ResData = (FILEMEM*) iohandler ->stream; in MemorySeek()
175 … cmsSignalError(iohandler ->ContextID, cmsERROR_SEEK, "Too few data; probably corrupted profile"); in MemorySeek()
185 cmsUInt32Number MemoryTell(struct _cms_io_handler* iohandler) in MemoryTell() argument
187 FILEMEM* ResData = (FILEMEM*) iohandler ->stream; in MemoryTell()
196 cmsBool MemoryWrite(struct _cms_io_handler* iohandler, cmsUInt32Number size, const void *Ptr) in MemoryWrite() argument
198 FILEMEM* ResData = (FILEMEM*) iohandler ->stream; in MemoryWrite()
212 if (ResData ->Pointer > iohandler->UsedSpace) in MemoryWrite()
213 iohandler->UsedSpace = ResData ->Pointer; in MemoryWrite()
220 cmsBool MemoryClose(struct _cms_io_handler* iohandler) in MemoryClose() argument
222 FILEMEM* ResData = (FILEMEM*) iohandler ->stream; in MemoryClose()
226 if (ResData ->Block) _cmsFree(iohandler ->ContextID, ResData ->Block); in MemoryClose()
229 _cmsFree(iohandler ->ContextID, ResData); in MemoryClose()
230 _cmsFree(iohandler ->ContextID, iohandler); in MemoryClose()
240 cmsIOHANDLER* iohandler = NULL; in cmsOpenIOhandlerFromMem() local
245 iohandler = (cmsIOHANDLER*) _cmsMallocZero(ContextID, sizeof(cmsIOHANDLER)); in cmsOpenIOhandlerFromMem()
246 if (iohandler == NULL) return NULL; in cmsOpenIOhandlerFromMem()
263 _cmsFree(ContextID, iohandler); in cmsOpenIOhandlerFromMem()
273 iohandler -> ReportedSize = size; in cmsOpenIOhandlerFromMem()
284 iohandler -> ReportedSize = 0; in cmsOpenIOhandlerFromMem()
292 iohandler ->ContextID = ContextID; in cmsOpenIOhandlerFromMem()
293 iohandler ->stream = (void*) fm; in cmsOpenIOhandlerFromMem()
294 iohandler ->UsedSpace = 0; in cmsOpenIOhandlerFromMem()
295 iohandler ->PhysicalFile[0] = 0; in cmsOpenIOhandlerFromMem()
297 iohandler ->Read = MemoryRead; in cmsOpenIOhandlerFromMem()
298 iohandler ->Seek = MemorySeek; in cmsOpenIOhandlerFromMem()
299 iohandler ->Close = MemoryClose; in cmsOpenIOhandlerFromMem()
300 iohandler ->Tell = MemoryTell; in cmsOpenIOhandlerFromMem()
301 iohandler ->Write = MemoryWrite; in cmsOpenIOhandlerFromMem()
303 return iohandler; in cmsOpenIOhandlerFromMem()
307 if (iohandler) _cmsFree(ContextID, iohandler); in cmsOpenIOhandlerFromMem()
315 cmsUInt32Number FileRead(cmsIOHANDLER* iohandler, void *Buffer, cmsUInt32Number size, cmsUInt32Numb… in FileRead() argument
317 … cmsUInt32Number nReaded = (cmsUInt32Number) fread(Buffer, size, count, (FILE*) iohandler->stream); in FileRead()
320 …cmsSignalError(iohandler ->ContextID, cmsERROR_FILE, "Read error. Got %d bytes, block should be of… in FileRead()
329 cmsBool FileSeek(cmsIOHANDLER* iohandler, cmsUInt32Number offset) in FileSeek() argument
331 if (fseek((FILE*) iohandler ->stream, (long) offset, SEEK_SET) != 0) { in FileSeek()
333 cmsSignalError(iohandler ->ContextID, cmsERROR_FILE, "Seek error; probably corrupted file"); in FileSeek()
342 cmsUInt32Number FileTell(cmsIOHANDLER* iohandler) in FileTell() argument
344 return (cmsUInt32Number) ftell((FILE*)iohandler ->stream); in FileTell()
349 cmsBool FileWrite(cmsIOHANDLER* iohandler, cmsUInt32Number size, const void* Buffer) in FileWrite() argument
353 iohandler->UsedSpace += size; in FileWrite()
354 return (fwrite(Buffer, size, 1, (FILE*) iohandler->stream) == 1); in FileWrite()
359 cmsBool FileClose(cmsIOHANDLER* iohandler) in FileClose() argument
361 if (fclose((FILE*) iohandler ->stream) != 0) return FALSE; in FileClose()
362 _cmsFree(iohandler ->ContextID, iohandler); in FileClose()
369 cmsIOHANDLER* iohandler = NULL; in cmsOpenIOhandlerFromFile() local
376 iohandler = (cmsIOHANDLER*) _cmsMallocZero(ContextID, sizeof(cmsIOHANDLER)); in cmsOpenIOhandlerFromFile()
377 if (iohandler == NULL) return NULL; in cmsOpenIOhandlerFromFile()
384 _cmsFree(ContextID, iohandler); in cmsOpenIOhandlerFromFile()
392 _cmsFree(ContextID, iohandler); in cmsOpenIOhandlerFromFile()
397 iohandler -> ReportedSize = (cmsUInt32Number) fileLen; in cmsOpenIOhandlerFromFile()
403 _cmsFree(ContextID, iohandler); in cmsOpenIOhandlerFromFile()
407 iohandler -> ReportedSize = 0; in cmsOpenIOhandlerFromFile()
411 _cmsFree(ContextID, iohandler); in cmsOpenIOhandlerFromFile()
416 iohandler ->ContextID = ContextID; in cmsOpenIOhandlerFromFile()
417 iohandler ->stream = (void*) fm; in cmsOpenIOhandlerFromFile()
418 iohandler ->UsedSpace = 0; in cmsOpenIOhandlerFromFile()
421 strncpy(iohandler -> PhysicalFile, FileName, sizeof(iohandler -> PhysicalFile)-1); in cmsOpenIOhandlerFromFile()
422 iohandler -> PhysicalFile[sizeof(iohandler -> PhysicalFile)-1] = 0; in cmsOpenIOhandlerFromFile()
424 iohandler ->Read = FileRead; in cmsOpenIOhandlerFromFile()
425 iohandler ->Seek = FileSeek; in cmsOpenIOhandlerFromFile()
426 iohandler ->Close = FileClose; in cmsOpenIOhandlerFromFile()
427 iohandler ->Tell = FileTell; in cmsOpenIOhandlerFromFile()
428 iohandler ->Write = FileWrite; in cmsOpenIOhandlerFromFile()
430 return iohandler; in cmsOpenIOhandlerFromFile()
436 cmsIOHANDLER* iohandler = NULL; in cmsOpenIOhandlerFromStream() local
446 iohandler = (cmsIOHANDLER*) _cmsMallocZero(ContextID, sizeof(cmsIOHANDLER)); in cmsOpenIOhandlerFromStream()
447 if (iohandler == NULL) return NULL; in cmsOpenIOhandlerFromStream()
449 iohandler -> ContextID = ContextID; in cmsOpenIOhandlerFromStream()
450 iohandler -> stream = (void*) Stream; in cmsOpenIOhandlerFromStream()
451 iohandler -> UsedSpace = 0; in cmsOpenIOhandlerFromStream()
452 iohandler -> ReportedSize = (cmsUInt32Number) fileSize; in cmsOpenIOhandlerFromStream()
453 iohandler -> PhysicalFile[0] = 0; in cmsOpenIOhandlerFromStream()
455 iohandler ->Read = FileRead; in cmsOpenIOhandlerFromStream()
456 iohandler ->Seek = FileSeek; in cmsOpenIOhandlerFromStream()
457 iohandler ->Close = FileClose; in cmsOpenIOhandlerFromStream()
458 iohandler ->Tell = FileTell; in cmsOpenIOhandlerFromStream()
459 iohandler ->Write = FileWrite; in cmsOpenIOhandlerFromStream()
461 return iohandler; in cmsOpenIOhandlerFromStream()