[Digikam-devel] extragear/graphics/digikam/libs/dimg/filters
Francisco J. Cruz
fj.cruz at supercable.es
Mon Apr 3 09:34:34 BST 2006
SVN commit 525900 by fjcruz:
As lcms doc suggests and so IccTransform class uses cmsErrorAction(LCMS_ERROR_SHOW), we have to capture the return value of functions like cmsOpenProfile.....
In this way, digiKam is not aborted if there is an error from lcms.
CCMAIL:digikam-devel at kde.org
M +42 -0 icctransform.cpp
--- trunk/extragear/graphics/digikam/libs/dimg/filters/icctransform.cpp #525899:525900
@@ -167,8 +167,21 @@
inprofile = cmsOpenProfileFromFile(QFile::encodeName( d->input_profile ), "r");
}
+ if (inprofile == NULL)
+ {
+ kdDebug() << "Error: Input profile is NULL" << endl;
+ return;
+ }
+
outprofile = cmsOpenProfileFromFile(QFile::encodeName( d->output_profile ), "r");
+ if (outprofile == NULL)
+ {
+ kdDebug() << "Error: Output profile is NULL" << endl;
+ cmsCloseProfile(inprofile);
+ return;
+ }
+
if (!d->do_proof_profile)
{
if (image.sixteenBit())
@@ -266,6 +279,14 @@
{
proofprofile = cmsOpenProfileFromFile(QFile::encodeName( d->proof_profile ), "r");
+ if (proofprofile == NULL)
+ {
+ kdDebug() << "Error: Input profile is NULL" << endl;
+ cmsCloseProfile(inprofile);
+ cmsCloseProfile(outprofile);
+ return;
+ }
+
if (image.sixteenBit())
{
if (image.hasAlpha())
@@ -383,9 +404,22 @@
inprofile = cmsOpenProfileFromFile(QFile::encodeName( d->input_profile ), "r");
}
+ if (inprofile == NULL)
+ {
+ kdDebug() << "Error: Input profile is NULL" << endl;
+ return;
+ }
+
outprofile = cmsOpenProfileFromFile(QFile::encodeName( d->output_profile ),
"r");
+ if (outprofile == NULL)
+ {
+ kdDebug() << "Error: Output profile is NULL" << endl;
+ cmsCloseProfile(inprofile);
+ return;
+ }
+
if (useBPC)
{
transformFlags |= cmsFLAGS_WHITEBLACKCOMPENSATION;
@@ -486,6 +520,14 @@
{
proofprofile = cmsOpenProfileFromFile(QFile::encodeName( d->proof_profile ), "r");
+ if (proofprofile == NULL)
+ {
+ kdDebug() << "Error: Input profile is NULL" << endl;
+ cmsCloseProfile(inprofile);
+ cmsCloseProfile(outprofile);
+ return;
+ }
+
transformFlags |= cmsFLAGS_SOFTPROOFING;
if (checkGamut)
{
More information about the Digikam-devel
mailing list