mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 18:26:17 +03:00
Error handling has changed, methods return null on error
This commit is contained in:
parent
0043a22c23
commit
c592845bd4
|
@ -24,7 +24,7 @@ http://www.cazabon.com\n\
|
|||
"
|
||||
|
||||
#include "Python.h"
|
||||
#include "lcms.h"
|
||||
#include "lcms2.h"
|
||||
#include "Imaging.h"
|
||||
#include "py3.h"
|
||||
|
||||
|
@ -37,11 +37,12 @@ http://www.cazabon.com\n\
|
|||
#include <wingdi.h>
|
||||
#endif
|
||||
|
||||
#define PYCMSVERSION "0.1.0 pil"
|
||||
#define PYCMSVERSION "1.0.0 pil"
|
||||
|
||||
/* version history */
|
||||
|
||||
/*
|
||||
1.0.0 pil Integrating littleCMS2
|
||||
0.1.0 pil integration & refactoring
|
||||
0.0.2 alpha: Minor updates, added interfaces to littleCMS features, Jan 6, 2003
|
||||
- fixed some memory holes in how transforms/profiles were created and passed back to Python
|
||||
|
@ -107,8 +108,6 @@ cms_profile_open(PyObject* self, PyObject* args)
|
|||
if (!PyArg_ParseTuple(args, "s:profile_open", &sProfile))
|
||||
return NULL;
|
||||
|
||||
cmsErrorAction(LCMS_ERROR_IGNORE);
|
||||
|
||||
hProfile = cmsOpenProfileFromFile(sProfile, "r");
|
||||
if (!hProfile) {
|
||||
PyErr_SetString(PyExc_IOError, "cannot open profile file");
|
||||
|
@ -133,8 +132,6 @@ cms_profile_fromstring(PyObject* self, PyObject* args)
|
|||
return NULL;
|
||||
#endif
|
||||
|
||||
cmsErrorAction(LCMS_ERROR_IGNORE);
|
||||
|
||||
hProfile = cmsOpenProfileFromMem(pProfile, nProfile);
|
||||
if (!hProfile) {
|
||||
PyErr_SetString(PyExc_IOError, "cannot open profile from string");
|
||||
|
@ -273,8 +270,6 @@ _buildTransform(cmsHPROFILE hInputProfile, cmsHPROFILE hOutputProfile, char *sIn
|
|||
{
|
||||
cmsHTRANSFORM hTransform;
|
||||
|
||||
cmsErrorAction(LCMS_ERROR_IGNORE);
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
|
||||
/* create the transform */
|
||||
|
@ -297,8 +292,6 @@ _buildProofTransform(cmsHPROFILE hInputProfile, cmsHPROFILE hOutputProfile, cmsH
|
|||
{
|
||||
cmsHTRANSFORM hTransform;
|
||||
|
||||
cmsErrorAction(LCMS_ERROR_IGNORE);
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
|
||||
/* create the transform */
|
||||
|
@ -336,8 +329,6 @@ buildTransform(PyObject *self, PyObject *args) {
|
|||
if (!PyArg_ParseTuple(args, "O!O!ss|ii:buildTransform", &CmsProfile_Type, &pInputProfile, &CmsProfile_Type, &pOutputProfile, &sInMode, &sOutMode, &iRenderingIntent, &cmsFLAGS))
|
||||
return NULL;
|
||||
|
||||
cmsErrorAction(LCMS_ERROR_IGNORE);
|
||||
|
||||
transform = _buildTransform(pInputProfile->profile, pOutputProfile->profile, sInMode, sOutMode, iRenderingIntent, cmsFLAGS);
|
||||
|
||||
if (!transform)
|
||||
|
@ -363,8 +354,6 @@ buildProofTransform(PyObject *self, PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, "O!O!O!ss|iii:buildProofTransform", &CmsProfile_Type, &pInputProfile, &CmsProfile_Type, &pOutputProfile, &CmsProfile_Type, &pProofProfile, &sInMode, &sOutMode, &iRenderingIntent, &iProofIntent, &cmsFLAGS))
|
||||
return NULL;
|
||||
|
||||
cmsErrorAction(LCMS_ERROR_IGNORE);
|
||||
|
||||
transform = _buildProofTransform(pInputProfile->profile, pOutputProfile->profile, pProofProfile->profile, sInMode, sOutMode, iRenderingIntent, iProofIntent, cmsFLAGS);
|
||||
|
||||
if (!transform)
|
||||
|
@ -390,8 +379,6 @@ cms_transform_apply(CmsTransformObject *self, PyObject *args)
|
|||
im = (Imaging) idIn;
|
||||
imOut = (Imaging) idOut;
|
||||
|
||||
cmsErrorAction(LCMS_ERROR_IGNORE);
|
||||
|
||||
result = pyCMSdoTransform(im, imOut, self->transform);
|
||||
|
||||
return Py_BuildValue("i", result);
|
||||
|
@ -412,8 +399,6 @@ createProfile(PyObject *self, PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, "s|i:createProfile", &sColorSpace, &iColorTemp))
|
||||
return NULL;
|
||||
|
||||
cmsErrorAction(LCMS_ERROR_IGNORE);
|
||||
|
||||
if (strcmp(sColorSpace, "LAB") == 0) {
|
||||
if (iColorTemp > 0) {
|
||||
result = cmsWhitePointFromTemp(iColorTemp, whitePoint);
|
||||
|
|
Loading…
Reference in New Issue
Block a user