[Lcms-user] Compile error on cmsOpenProfileFromMem() call
An ICC-based CMM for color management
Brought to you by:
mm2
|
From: Hal V. E. <hv...@as...> - 2009-03-03 04:34:34
|
I am having trouble getting the following code to build on my system. This is
for use in a Qt app and is supposed to get the X11 _ICC_PROFILE atom for the
display where the main app widget is located and pass it back to the caller.
The problem I am having is that the line that reads:
profile = cmsOpenProfileFromMem(buff, nitems);
will not compile and I am getting the following error message:
viewer.cpp:266: error: invalid conversion from 'void*' to'void**'
I am certain that it is complaining about the first parameter and I have not
been able to figure out what the compiler wants. This is using gcc 4.3.1 and
lcms 1.17.
I am sure that it is something simple that I am just not seeing. Can anyone
spot what I am doing wrong?
----------------- code -------------------------------------
#include <lcms.h>
#include <QtGui/QDesktopWidget>
#include <QtGui/QX11Info>
#include <X11/Xlib.h>
#include <limits.h>
#include <X11/Xatom.h>
cmsHPROFILE Viewer::getProfileAtom ()
{
Atom icc_atom = 0;
Atom type = 0;
int format;
QString atStr;
unsigned long nitems = 0;
unsigned long bytes_after = 0;
LPVOID buff;
cmsHPROFILE *profile = NULL;
QDesktopWidget* desktop = new QDesktopWidget();
if (desktop -> numScreens() == 1 || desktop -> screenNumber(this) == 0)
atStr = "_ICC_PROFILE";
else
atStr = QString("_ICC_PROFILE_%1").arg(desktop -> screenNumber(this));
icc_atom = XInternAtom( QX11Info::display (),
atStr.toLatin1(),
False );
if( XGetWindowProperty ( QX11Info::display (),
QX11Info::appRootWindow(-1),
icc_atom, 0, INT_MAX, False,
XA_CARDINAL, &type, &format,
&nitems, &bytes_after,
(unsigned char **) &buff) == Success)
{
// this is the line that throws the compiler error.
profile = cmsOpenProfileFromMem(buff, nitems);
XFree (buff);
qDebug("Got X11 _ICC_PROFILE Atom");
return profile;
}
else
{
qDebug("No profile, will use sRGB");
return NULL;
}
}
---------------- end code ------------------------------
FYI the rest of the code appears to be working. I tested this by commenting
out the line that will not compile and looking at the nitems variable which is
the size of the X11 atom and it is the same size as the files for the profiles
I have loaded into my X11 _ICC_PROFILE atoms on my dual screen xinerama
system. This code probably will need additional work to run on an XRandR 1.2
system.
Hal
|