Am 13.02.2014 17:51, schrieb marti.ma...@littlecms.com:
> Still, the issue continues to be in how to differentiate cmsContext
> from user data. If we could fix that, then compatibility would
> be kept.

Just an idea:

typedef struct {
  const char type_[8];
  // more members here
  void * user_data;
} cmsContext;

cmsContext c = {"lcms2.6", NULL};

cmsContext * cmsTakeContext( cmsStruct ptr )
{
  cmsContext * c = ptr->context;
  if(sizeof(*c) > 8 && memcmp(c->type_, "lcms2.6", 8) == 0)
    return c->user_data;
  else
    return c;
}

The above example comes with some computational cost. But you can skip
this check with lcms-3.0 in the future.

Alternatively a enum might be fine too. Obviously there remains a risk
that a four byte type identifier might fit by accident to the four bytes
enum, and thus above function returns a wrong pointer.

kind regards
Kai-Uwe

------------------------------------------------------------------------------
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

Reply via email to