marti.ma...@littlecms.com wrote: > Yep, that is how actually works, and this is the source of all pain. > What I really need is a sort function that given a pointer, would guess > if this points to a cmsContext internal structure or to used supplied > data.
If the assumption is that the context is always a pointer, and if the cmsContext is issued by lcms, then the only reliable way to do it is for lcms to keep track of the addresses it's issued. One approach would be to allocate them in blocks, and then match against block ranges. Another would be to use a hash list, and check whether each one is in the list. Naturally the allocate & check code has to be multi-thread safe, etc. If the context doesn't have to be a pointer (ie. if the client can invent any bit combination it likes), then there is no 100% reliable way of identifying a cmsContext. The best you could do is play roulette and hope that the client doesn't happen to use a bit combination that matches the lcms cmsContext pointer values. If the client code has to be changed anyway to use the new cmsContext (ie. to get one and then supply it to each function call), then another approach would be to use different function names for the cmsContext, ie. cmsCreate_sRGBProfileLCX() etc., so that the _THR functions can remain unchanged, and internally there is then no doubt about what sort of context it is. Graeme Gill. ------------------------------------------------------------------------------ Android apps run on BlackBerry 10 Introducing the new BlackBerry 10.2.1 Runtime for Android apps. Now with support for Jelly Bean, Bluetooth, Mapview and more. Get your Android app in front of a whole new audience. Start now. http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk _______________________________________________ Lcms-user mailing list Lcms-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lcms-user