mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-23 23:30:34 +03:00
Merge pull request #8717 from radarhere/none
Use Py_RETURN_NONE macro when possible
This commit is contained in:
commit
e4f2a4a291
|
@ -473,8 +473,7 @@ getpixel(Imaging im, ImagingAccess access, int x, int y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* unknown type */
|
/* unknown type */
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
@ -965,8 +964,7 @@ _convert2(ImagingObject *self, PyObject *args) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -1214,8 +1212,7 @@ _getpixel(ImagingObject *self, PyObject *args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->access == NULL) {
|
if (self->access == NULL) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return getpixel(self->image, self->access, x, y);
|
return getpixel(self->image, self->access, x, y);
|
||||||
|
@ -1417,8 +1414,7 @@ _paste(ImagingObject *self, PyObject *args) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -1691,8 +1687,7 @@ _putdata(ImagingObject *self, PyObject *args) {
|
||||||
|
|
||||||
Py_XDECREF(seq);
|
Py_XDECREF(seq);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -1752,8 +1747,7 @@ _putpalette(ImagingObject *self, PyObject *args) {
|
||||||
self->image->palette->size = palettesize * 8 / bits;
|
self->image->palette->size = palettesize * 8 / bits;
|
||||||
unpack(self->image->palette->palette, palette, self->image->palette->size);
|
unpack(self->image->palette->palette, palette, self->image->palette->size);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -1777,8 +1771,7 @@ _putpalettealpha(ImagingObject *self, PyObject *args) {
|
||||||
strcpy(self->image->palette->mode, "RGBA");
|
strcpy(self->image->palette->mode, "RGBA");
|
||||||
self->image->palette->palette[index * 4 + 3] = (UINT8)alpha;
|
self->image->palette->palette[index * 4 + 3] = (UINT8)alpha;
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -1805,8 +1798,7 @@ _putpalettealphas(ImagingObject *self, PyObject *args) {
|
||||||
self->image->palette->palette[i * 4 + 3] = (UINT8)values[i];
|
self->image->palette->palette[i * 4 + 3] = (UINT8)values[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -1842,8 +1834,7 @@ _putpixel(ImagingObject *self, PyObject *args) {
|
||||||
self->access->put_pixel(im, x, y, ink);
|
self->access->put_pixel(im, x, y, ink);
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -2010,8 +2001,7 @@ im_setmode(ImagingObject *self, PyObject *args) {
|
||||||
}
|
}
|
||||||
self->access = ImagingAccessNew(im);
|
self->access = ImagingAccessNew(im);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -2074,8 +2064,7 @@ _transform(ImagingObject *self, PyObject *args) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -2202,8 +2191,7 @@ _getbbox(ImagingObject *self, PyObject *args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ImagingGetBBox(self->image, bbox, alpha_only)) {
|
if (!ImagingGetBBox(self->image, bbox, alpha_only)) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Py_BuildValue("iiii", bbox[0], bbox[1], bbox[2], bbox[3]);
|
return Py_BuildValue("iiii", bbox[0], bbox[1], bbox[2], bbox[3]);
|
||||||
|
@ -2283,8 +2271,7 @@ _getextrema(ImagingObject *self) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -2347,8 +2334,7 @@ _fillband(ImagingObject *self, PyObject *args) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -2363,8 +2349,7 @@ _putband(ImagingObject *self, PyObject *args) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -2950,8 +2935,7 @@ _draw_arc(ImagingDrawObject *self, PyObject *args) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -2988,8 +2972,7 @@ _draw_bitmap(ImagingDrawObject *self, PyObject *args) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -3045,8 +3028,7 @@ _draw_chord(ImagingDrawObject *self, PyObject *args) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -3100,8 +3082,7 @@ _draw_ellipse(ImagingDrawObject *self, PyObject *args) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -3164,8 +3145,7 @@ _draw_lines(ImagingDrawObject *self, PyObject *args) {
|
||||||
|
|
||||||
free(xy);
|
free(xy);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -3196,8 +3176,7 @@ _draw_points(ImagingDrawObject *self, PyObject *args) {
|
||||||
|
|
||||||
free(xy);
|
free(xy);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* from outline.c */
|
/* from outline.c */
|
||||||
|
@ -3225,8 +3204,7 @@ _draw_outline(ImagingDrawObject *self, PyObject *args) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -3282,8 +3260,7 @@ _draw_pieslice(ImagingDrawObject *self, PyObject *args) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -3334,8 +3311,7 @@ _draw_polygon(ImagingDrawObject *self, PyObject *args) {
|
||||||
|
|
||||||
free(ixy);
|
free(ixy);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -3389,8 +3365,7 @@ _draw_rectangle(ImagingDrawObject *self, PyObject *args) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct PyMethodDef _draw_methods[] = {
|
static struct PyMethodDef _draw_methods[] = {
|
||||||
|
@ -3595,8 +3570,7 @@ _save_ppm(ImagingObject *self, PyObject *args) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
@ -3984,8 +3958,7 @@ _reset_stats(PyObject *self, PyObject *args) {
|
||||||
arena->stats_freed_blocks = 0;
|
arena->stats_freed_blocks = 0;
|
||||||
MUTEX_UNLOCK(&ImagingDefaultArena.mutex);
|
MUTEX_UNLOCK(&ImagingDefaultArena.mutex);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -4045,8 +4018,7 @@ _set_alignment(PyObject *self, PyObject *args) {
|
||||||
ImagingDefaultArena.alignment = alignment;
|
ImagingDefaultArena.alignment = alignment;
|
||||||
MUTEX_UNLOCK(&ImagingDefaultArena.mutex);
|
MUTEX_UNLOCK(&ImagingDefaultArena.mutex);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -4070,8 +4042,7 @@ _set_block_size(PyObject *self, PyObject *args) {
|
||||||
ImagingDefaultArena.block_size = block_size;
|
ImagingDefaultArena.block_size = block_size;
|
||||||
MUTEX_UNLOCK(&ImagingDefaultArena.mutex);
|
MUTEX_UNLOCK(&ImagingDefaultArena.mutex);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -4099,8 +4070,7 @@ _set_blocks_max(PyObject *self, PyObject *args) {
|
||||||
return ImagingError_MemoryError();
|
return ImagingError_MemoryError();
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -4115,8 +4085,7 @@ _clear_cache(PyObject *self, PyObject *args) {
|
||||||
ImagingMemoryClearCache(&ImagingDefaultArena, i);
|
ImagingMemoryClearCache(&ImagingDefaultArena, i);
|
||||||
MUTEX_UNLOCK(&ImagingDefaultArena.mutex);
|
MUTEX_UNLOCK(&ImagingDefaultArena.mutex);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
|
@ -654,8 +654,7 @@ cms_get_display_profile_win32(PyObject *self, PyObject *args) {
|
||||||
return PyUnicode_FromStringAndSize(filename, filename_size - 1);
|
return PyUnicode_FromStringAndSize(filename, filename_size - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -672,20 +671,17 @@ _profile_read_mlu(CmsProfileObject *self, cmsTagSignature info) {
|
||||||
wchar_t *buf;
|
wchar_t *buf;
|
||||||
|
|
||||||
if (!cmsIsTag(self->profile, info)) {
|
if (!cmsIsTag(self->profile, info)) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mlu = cmsReadTag(self->profile, info);
|
mlu = cmsReadTag(self->profile, info);
|
||||||
if (!mlu) {
|
if (!mlu) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
len = cmsMLUgetWide(mlu, lc, cc, NULL, 0);
|
len = cmsMLUgetWide(mlu, lc, cc, NULL, 0);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = malloc(len);
|
buf = malloc(len);
|
||||||
|
@ -723,14 +719,12 @@ _profile_read_signature(CmsProfileObject *self, cmsTagSignature info) {
|
||||||
unsigned int *sig;
|
unsigned int *sig;
|
||||||
|
|
||||||
if (!cmsIsTag(self->profile, info)) {
|
if (!cmsIsTag(self->profile, info)) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sig = (unsigned int *)cmsReadTag(self->profile, info);
|
sig = (unsigned int *)cmsReadTag(self->profile, info);
|
||||||
if (!sig) {
|
if (!sig) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return _profile_read_int_as_string(*sig);
|
return _profile_read_int_as_string(*sig);
|
||||||
|
@ -780,14 +774,12 @@ _profile_read_ciexyz(CmsProfileObject *self, cmsTagSignature info, int multi) {
|
||||||
cmsCIEXYZ *XYZ;
|
cmsCIEXYZ *XYZ;
|
||||||
|
|
||||||
if (!cmsIsTag(self->profile, info)) {
|
if (!cmsIsTag(self->profile, info)) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XYZ = (cmsCIEXYZ *)cmsReadTag(self->profile, info);
|
XYZ = (cmsCIEXYZ *)cmsReadTag(self->profile, info);
|
||||||
if (!XYZ) {
|
if (!XYZ) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
if (multi) {
|
if (multi) {
|
||||||
return _xyz3_py(XYZ);
|
return _xyz3_py(XYZ);
|
||||||
|
@ -801,14 +793,12 @@ _profile_read_ciexyy_triple(CmsProfileObject *self, cmsTagSignature info) {
|
||||||
cmsCIExyYTRIPLE *triple;
|
cmsCIExyYTRIPLE *triple;
|
||||||
|
|
||||||
if (!cmsIsTag(self->profile, info)) {
|
if (!cmsIsTag(self->profile, info)) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
triple = (cmsCIExyYTRIPLE *)cmsReadTag(self->profile, info);
|
triple = (cmsCIExyYTRIPLE *)cmsReadTag(self->profile, info);
|
||||||
if (!triple) {
|
if (!triple) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note: lcms does all the heavy lifting and error checking (nr of
|
/* Note: lcms does all the heavy lifting and error checking (nr of
|
||||||
|
@ -835,21 +825,18 @@ _profile_read_named_color_list(CmsProfileObject *self, cmsTagSignature info) {
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
|
|
||||||
if (!cmsIsTag(self->profile, info)) {
|
if (!cmsIsTag(self->profile, info)) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ncl = (cmsNAMEDCOLORLIST *)cmsReadTag(self->profile, info);
|
ncl = (cmsNAMEDCOLORLIST *)cmsReadTag(self->profile, info);
|
||||||
if (ncl == NULL) {
|
if (ncl == NULL) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
n = cmsNamedColorCount(ncl);
|
n = cmsNamedColorCount(ncl);
|
||||||
result = PyList_New(n);
|
result = PyList_New(n);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
|
@ -858,8 +845,7 @@ _profile_read_named_color_list(CmsProfileObject *self, cmsTagSignature info) {
|
||||||
str = PyUnicode_FromString(name);
|
str = PyUnicode_FromString(name);
|
||||||
if (str == NULL) {
|
if (str == NULL) {
|
||||||
Py_DECREF(result);
|
Py_DECREF(result);
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
PyList_SET_ITEM(result, i, str);
|
PyList_SET_ITEM(result, i, str);
|
||||||
}
|
}
|
||||||
|
@ -926,8 +912,7 @@ _is_intent_supported(CmsProfileObject *self, int clut) {
|
||||||
|
|
||||||
result = PyDict_New();
|
result = PyDict_New();
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
n = cmsGetSupportedIntents(INTENTS, intent_ids, intent_descs);
|
n = cmsGetSupportedIntents(INTENTS, intent_ids, intent_descs);
|
||||||
|
@ -957,8 +942,7 @@ _is_intent_supported(CmsProfileObject *self, int clut) {
|
||||||
Py_XDECREF(id);
|
Py_XDECREF(id);
|
||||||
Py_XDECREF(entry);
|
Py_XDECREF(entry);
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
PyDict_SetItem(result, id, entry);
|
PyDict_SetItem(result, id, entry);
|
||||||
Py_DECREF(id);
|
Py_DECREF(id);
|
||||||
|
@ -1042,8 +1026,7 @@ cms_profile_getattr_creation_date(CmsProfileObject *self, void *closure) {
|
||||||
|
|
||||||
result = cmsGetHeaderCreationDateTime(self->profile, &ct);
|
result = cmsGetHeaderCreationDateTime(self->profile, &ct);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return PyDateTime_FromDateAndTime(
|
return PyDateTime_FromDateAndTime(
|
||||||
|
@ -1141,8 +1124,7 @@ cms_profile_getattr_saturation_rendering_intent_gamut(
|
||||||
static PyObject *
|
static PyObject *
|
||||||
cms_profile_getattr_red_colorant(CmsProfileObject *self, void *closure) {
|
cms_profile_getattr_red_colorant(CmsProfileObject *self, void *closure) {
|
||||||
if (!cmsIsMatrixShaper(self->profile)) {
|
if (!cmsIsMatrixShaper(self->profile)) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
return _profile_read_ciexyz(self, cmsSigRedColorantTag, 0);
|
return _profile_read_ciexyz(self, cmsSigRedColorantTag, 0);
|
||||||
}
|
}
|
||||||
|
@ -1150,8 +1132,7 @@ cms_profile_getattr_red_colorant(CmsProfileObject *self, void *closure) {
|
||||||
static PyObject *
|
static PyObject *
|
||||||
cms_profile_getattr_green_colorant(CmsProfileObject *self, void *closure) {
|
cms_profile_getattr_green_colorant(CmsProfileObject *self, void *closure) {
|
||||||
if (!cmsIsMatrixShaper(self->profile)) {
|
if (!cmsIsMatrixShaper(self->profile)) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
return _profile_read_ciexyz(self, cmsSigGreenColorantTag, 0);
|
return _profile_read_ciexyz(self, cmsSigGreenColorantTag, 0);
|
||||||
}
|
}
|
||||||
|
@ -1159,8 +1140,7 @@ cms_profile_getattr_green_colorant(CmsProfileObject *self, void *closure) {
|
||||||
static PyObject *
|
static PyObject *
|
||||||
cms_profile_getattr_blue_colorant(CmsProfileObject *self, void *closure) {
|
cms_profile_getattr_blue_colorant(CmsProfileObject *self, void *closure) {
|
||||||
if (!cmsIsMatrixShaper(self->profile)) {
|
if (!cmsIsMatrixShaper(self->profile)) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
return _profile_read_ciexyz(self, cmsSigBlueColorantTag, 0);
|
return _profile_read_ciexyz(self, cmsSigBlueColorantTag, 0);
|
||||||
}
|
}
|
||||||
|
@ -1176,21 +1156,18 @@ cms_profile_getattr_media_white_point_temperature(
|
||||||
cmsBool result;
|
cmsBool result;
|
||||||
|
|
||||||
if (!cmsIsTag(self->profile, info)) {
|
if (!cmsIsTag(self->profile, info)) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XYZ = (cmsCIEXYZ *)cmsReadTag(self->profile, info);
|
XYZ = (cmsCIEXYZ *)cmsReadTag(self->profile, info);
|
||||||
if (XYZ == NULL || XYZ->X == 0) {
|
if (XYZ == NULL || XYZ->X == 0) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmsXYZ2xyY(&xyY, XYZ);
|
cmsXYZ2xyY(&xyY, XYZ);
|
||||||
result = cmsTempFromWhitePoint(&tempK, &xyY);
|
result = cmsTempFromWhitePoint(&tempK, &xyY);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
return PyFloat_FromDouble(tempK);
|
return PyFloat_FromDouble(tempK);
|
||||||
}
|
}
|
||||||
|
@ -1229,8 +1206,7 @@ cms_profile_getattr_red_primary(CmsProfileObject *self, void *closure) {
|
||||||
result = _calculate_rgb_primaries(self, &primaries);
|
result = _calculate_rgb_primaries(self, &primaries);
|
||||||
}
|
}
|
||||||
if (!result) {
|
if (!result) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return _xyz_py(&primaries.Red);
|
return _xyz_py(&primaries.Red);
|
||||||
|
@ -1245,8 +1221,7 @@ cms_profile_getattr_green_primary(CmsProfileObject *self, void *closure) {
|
||||||
result = _calculate_rgb_primaries(self, &primaries);
|
result = _calculate_rgb_primaries(self, &primaries);
|
||||||
}
|
}
|
||||||
if (!result) {
|
if (!result) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return _xyz_py(&primaries.Green);
|
return _xyz_py(&primaries.Green);
|
||||||
|
@ -1261,8 +1236,7 @@ cms_profile_getattr_blue_primary(CmsProfileObject *self, void *closure) {
|
||||||
result = _calculate_rgb_primaries(self, &primaries);
|
result = _calculate_rgb_primaries(self, &primaries);
|
||||||
}
|
}
|
||||||
if (!result) {
|
if (!result) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return _xyz_py(&primaries.Blue);
|
return _xyz_py(&primaries.Blue);
|
||||||
|
@ -1321,14 +1295,12 @@ cms_profile_getattr_icc_measurement_condition(CmsProfileObject *self, void *clos
|
||||||
const char *geo;
|
const char *geo;
|
||||||
|
|
||||||
if (!cmsIsTag(self->profile, info)) {
|
if (!cmsIsTag(self->profile, info)) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mc = (cmsICCMeasurementConditions *)cmsReadTag(self->profile, info);
|
mc = (cmsICCMeasurementConditions *)cmsReadTag(self->profile, info);
|
||||||
if (!mc) {
|
if (!mc) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mc->Geometry == 1) {
|
if (mc->Geometry == 1) {
|
||||||
|
@ -1362,14 +1334,12 @@ cms_profile_getattr_icc_viewing_condition(CmsProfileObject *self, void *closure)
|
||||||
cmsTagSignature info = cmsSigViewingConditionsTag;
|
cmsTagSignature info = cmsSigViewingConditionsTag;
|
||||||
|
|
||||||
if (!cmsIsTag(self->profile, info)) {
|
if (!cmsIsTag(self->profile, info)) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vc = (cmsICCViewingConditions *)cmsReadTag(self->profile, info);
|
vc = (cmsICCViewingConditions *)cmsReadTag(self->profile, info);
|
||||||
if (!vc) {
|
if (!vc) {
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Py_BuildValue(
|
return Py_BuildValue(
|
||||||
|
|
|
@ -1371,8 +1371,7 @@ font_setvarname(FontObject *self, PyObject *args) {
|
||||||
return geterror(error);
|
return geterror(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -1426,8 +1425,7 @@ font_setvaraxes(FontObject *self, PyObject *args) {
|
||||||
return geterror(error);
|
return geterror(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -192,8 +192,7 @@ _unop(PyObject *self, PyObject *args) {
|
||||||
|
|
||||||
unop(out, im1);
|
unop(out, im1);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -226,8 +225,7 @@ _binop(PyObject *self, PyObject *args) {
|
||||||
|
|
||||||
binop(out, im1, im2);
|
binop(out, im1, im2);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyMethodDef _functions[] = {
|
static PyMethodDef _functions[] = {
|
||||||
|
|
|
@ -37,8 +37,7 @@ _tkinit(PyObject *self, PyObject *args) {
|
||||||
/* This will bomb if interp is invalid... */
|
/* This will bomb if interp is invalid... */
|
||||||
TkImaging_Init(interp);
|
TkImaging_Init(interp);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyMethodDef functions[] = {
|
static PyMethodDef functions[] = {
|
||||||
|
|
|
@ -213,8 +213,7 @@ _setimage(ImagingDecoderObject *decoder, PyObject *args) {
|
||||||
Py_XDECREF(decoder->lock);
|
Py_XDECREF(decoder->lock);
|
||||||
decoder->lock = op;
|
decoder->lock = op;
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -231,8 +230,7 @@ _setfd(ImagingDecoderObject *decoder, PyObject *args) {
|
||||||
Py_XINCREF(fd);
|
Py_XINCREF(fd);
|
||||||
state->fd = fd;
|
state->fd = fd;
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
|
|
@ -85,8 +85,7 @@ _expose(ImagingDisplayObject *display, PyObject *args) {
|
||||||
|
|
||||||
ImagingExposeDIB(display->dib, hdc);
|
ImagingExposeDIB(display->dib, hdc);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -112,8 +111,7 @@ _draw(ImagingDisplayObject *display, PyObject *args) {
|
||||||
|
|
||||||
ImagingDrawDIB(display->dib, hdc, dst, src);
|
ImagingDrawDIB(display->dib, hdc, dst, src);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern Imaging
|
extern Imaging
|
||||||
|
@ -143,8 +141,7 @@ _paste(ImagingDisplayObject *display, PyObject *args) {
|
||||||
|
|
||||||
ImagingPasteDIB(display->dib, im, xy);
|
ImagingPasteDIB(display->dib, im, xy);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -190,8 +187,7 @@ _releasedc(ImagingDisplayObject *display, PyObject *args) {
|
||||||
|
|
||||||
ReleaseDC(window, dc);
|
ReleaseDC(window, dc);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -211,8 +207,7 @@ _frombytes(ImagingDisplayObject *display, PyObject *args) {
|
||||||
memcpy(display->dib->bits, buffer.buf, buffer.len);
|
memcpy(display->dib->bits, buffer.buf, buffer.len);
|
||||||
|
|
||||||
PyBuffer_Release(&buffer);
|
PyBuffer_Release(&buffer);
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -709,8 +704,7 @@ PyImaging_EventLoopWin32(PyObject *self, PyObject *args) {
|
||||||
}
|
}
|
||||||
Py_END_ALLOW_THREADS;
|
Py_END_ALLOW_THREADS;
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
|
@ -278,8 +278,7 @@ _setimage(ImagingEncoderObject *encoder, PyObject *args) {
|
||||||
Py_XDECREF(encoder->lock);
|
Py_XDECREF(encoder->lock);
|
||||||
encoder->lock = op;
|
encoder->lock = op;
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -296,8 +295,7 @@ _setfd(ImagingEncoderObject *encoder, PyObject *args) {
|
||||||
Py_XINCREF(fd);
|
Py_XINCREF(fd);
|
||||||
state->fd = fd;
|
state->fd = fd;
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
|
|
@ -1,72 +0,0 @@
|
||||||
/*
|
|
||||||
* The Python Imaging Library
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
* default exception handling
|
|
||||||
*
|
|
||||||
* This module is usually overridden by application code (e.g.
|
|
||||||
* _imaging.c for PIL's standard Python bindings). If you get
|
|
||||||
* linking errors, remove this file from your project/library.
|
|
||||||
*
|
|
||||||
* history:
|
|
||||||
* 1995-06-15 fl Created
|
|
||||||
* 1998-12-29 fl Minor tweaks
|
|
||||||
* 2003-09-13 fl Added ImagingEnter/LeaveSection()
|
|
||||||
*
|
|
||||||
* Copyright (c) 1997-2003 by Secret Labs AB.
|
|
||||||
* Copyright (c) 1995-2003 by Fredrik Lundh.
|
|
||||||
*
|
|
||||||
* See the README file for information on usage and redistribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "Imaging.h"
|
|
||||||
|
|
||||||
/* exception state */
|
|
||||||
|
|
||||||
void *
|
|
||||||
ImagingError_OSError(void) {
|
|
||||||
fprintf(stderr, "*** exception: file access error\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *
|
|
||||||
ImagingError_MemoryError(void) {
|
|
||||||
fprintf(stderr, "*** exception: out of memory\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *
|
|
||||||
ImagingError_ModeError(void) {
|
|
||||||
return ImagingError_ValueError("bad image mode");
|
|
||||||
}
|
|
||||||
|
|
||||||
void *
|
|
||||||
ImagingError_Mismatch(void) {
|
|
||||||
return ImagingError_ValueError("images don't match");
|
|
||||||
}
|
|
||||||
|
|
||||||
void *
|
|
||||||
ImagingError_ValueError(const char *message) {
|
|
||||||
if (!message) {
|
|
||||||
message = "exception: bad argument to function";
|
|
||||||
}
|
|
||||||
fprintf(stderr, "*** %s\n", message);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ImagingError_Clear(void) {
|
|
||||||
/* nop */;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* thread state */
|
|
||||||
|
|
||||||
void
|
|
||||||
ImagingSectionEnter(ImagingSectionCookie *cookie) {
|
|
||||||
/* pass */
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ImagingSectionLeave(ImagingSectionCookie *cookie) {
|
|
||||||
/* pass */
|
|
||||||
}
|
|
|
@ -609,10 +609,6 @@ ImagingLibTiffDecode(
|
||||||
extern int
|
extern int
|
||||||
ImagingLibTiffEncode(Imaging im, ImagingCodecState state, UINT8 *buffer, int bytes);
|
ImagingLibTiffEncode(Imaging im, ImagingCodecState state, UINT8 *buffer, int bytes);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LIBMPEG
|
|
||||||
extern int
|
|
||||||
ImagingMpegDecode(Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes);
|
|
||||||
#endif
|
|
||||||
extern int
|
extern int
|
||||||
ImagingMspDecode(Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes);
|
ImagingMspDecode(Imaging im, ImagingCodecState state, UINT8 *buffer, Py_ssize_t bytes);
|
||||||
extern int
|
extern int
|
||||||
|
|
|
@ -89,8 +89,7 @@ _outline_move(OutlineObject *self, PyObject *args) {
|
||||||
|
|
||||||
ImagingOutlineMove(self->outline, x0, y0);
|
ImagingOutlineMove(self->outline, x0, y0);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -102,8 +101,7 @@ _outline_line(OutlineObject *self, PyObject *args) {
|
||||||
|
|
||||||
ImagingOutlineLine(self->outline, x1, y1);
|
ImagingOutlineLine(self->outline, x1, y1);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -115,8 +113,7 @@ _outline_curve(OutlineObject *self, PyObject *args) {
|
||||||
|
|
||||||
ImagingOutlineCurve(self->outline, x1, y1, x2, y2, x3, y3);
|
ImagingOutlineCurve(self->outline, x1, y1, x2, y2, x3, y3);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -127,8 +124,7 @@ _outline_close(OutlineObject *self, PyObject *args) {
|
||||||
|
|
||||||
ImagingOutlineClose(self->outline);
|
ImagingOutlineClose(self->outline);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -140,8 +136,7 @@ _outline_transform(OutlineObject *self, PyObject *args) {
|
||||||
|
|
||||||
ImagingOutlineTransform(self->outline, a);
|
ImagingOutlineTransform(self->outline, a);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct PyMethodDef _outline_methods[] = {
|
static struct PyMethodDef _outline_methods[] = {
|
||||||
|
|
|
@ -415,8 +415,7 @@ path_map(PyPathObject *self, PyObject *args) {
|
||||||
}
|
}
|
||||||
self->mapping = 0;
|
self->mapping = 0;
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -528,8 +527,7 @@ path_transform(PyPathObject *self, PyObject *args) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct PyMethodDef methods[] = {
|
static struct PyMethodDef methods[] = {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user