summaryrefslogtreecommitdiffstats
path: root/Modules/imageop.c
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2008-06-09 04:58:54 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2008-06-09 04:58:54 (GMT)
commitdd96db63f689e2f0d8ae5a1436b3b3395eec7de5 (patch)
treeb2299acac9ce44fc488fc7b2ae2a44548cd5fbb8 /Modules/imageop.c
parente98839a1f48b2915f1cc747884e64f4d6e4c8e7a (diff)
downloadcpython-dd96db63f689e2f0d8ae5a1436b3b3395eec7de5.zip
cpython-dd96db63f689e2f0d8ae5a1436b3b3395eec7de5.tar.gz
cpython-dd96db63f689e2f0d8ae5a1436b3b3395eec7de5.tar.bz2
This reverts r63675 based on the discussion in this thread:
http://mail.python.org/pipermail/python-dev/2008-June/079988.html Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names in the spirit of 3.0 are available via a #define only. See the email thread.
Diffstat (limited to 'Modules/imageop.c')
-rw-r--r--Modules/imageop.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/Modules/imageop.c b/Modules/imageop.c
index 105bedc..f67cd60 100644
--- a/Modules/imageop.c
+++ b/Modules/imageop.c
@@ -54,7 +54,7 @@ imageop_backward_compatible(void)
return 1;
if (bcos == NULL) {
/* cache string object for future use */
- bcos = PyBytes_FromString("backward_compatible");
+ bcos = PyString_FromString("backward_compatible");
if (bcos == NULL)
return 1;
}
@@ -97,11 +97,11 @@ imageop_crop(PyObject *self, PyObject *args)
xstep = (newx1 < newx2)? 1 : -1;
ystep = (newy1 < newy2)? 1 : -1;
- rv = PyBytes_FromStringAndSize(NULL,
+ rv = PyString_FromStringAndSize(NULL,
(abs(newx2-newx1)+1)*(abs(newy2-newy1)+1)*size);
if ( rv == 0 )
return 0;
- ncp = (char *)PyBytes_AsString(rv);
+ ncp = (char *)PyString_AsString(rv);
nsp = (short *)ncp;
nlp = (Py_Int32 *)ncp;
newy2 += ystep;
@@ -150,10 +150,10 @@ imageop_scale(PyObject *self, PyObject *args)
return 0;
}
- rv = PyBytes_FromStringAndSize(NULL, newx*newy*size);
+ rv = PyString_FromStringAndSize(NULL, newx*newy*size);
if ( rv == 0 )
return 0;
- ncp = (char *)PyBytes_AsString(rv);
+ ncp = (char *)PyString_AsString(rv);
nsp = (short *)ncp;
nlp = (Py_Int32 *)ncp;
for( iy = 0; iy < newy; iy++ ) {
@@ -195,10 +195,10 @@ imageop_tovideo(PyObject *self, PyObject *args)
return 0;
}
- rv = PyBytes_FromStringAndSize(NULL, len);
+ rv = PyString_FromStringAndSize(NULL, len);
if ( rv == 0 )
return 0;
- ncp = (unsigned char *)PyBytes_AsString(rv);
+ ncp = (unsigned char *)PyString_AsString(rv);
if ( width == 1 ) {
memcpy(ncp, cp, maxx); /* Copy first line */
@@ -245,10 +245,10 @@ imageop_grey2mono(PyObject *self, PyObject *args)
return 0;
}
- rv = PyBytes_FromStringAndSize(NULL, (len+7)/8);
+ rv = PyString_FromStringAndSize(NULL, (len+7)/8);
if ( rv == 0 )
return 0;
- ncp = (unsigned char *)PyBytes_AsString(rv);
+ ncp = (unsigned char *)PyString_AsString(rv);
bit = 0x80;
ovalue = 0;
@@ -286,10 +286,10 @@ imageop_grey2grey4(PyObject *self, PyObject *args)
return 0;
}
- rv = PyBytes_FromStringAndSize(NULL, (len+1)/2);
+ rv = PyString_FromStringAndSize(NULL, (len+1)/2);
if ( rv == 0 )
return 0;
- ncp = (unsigned char *)PyBytes_AsString(rv);
+ ncp = (unsigned char *)PyString_AsString(rv);
pos = 0;
ovalue = 0;
for ( i=0; i < len; i++ ) {
@@ -325,10 +325,10 @@ imageop_grey2grey2(PyObject *self, PyObject *args)
return 0;
}
- rv = PyBytes_FromStringAndSize(NULL, (len+3)/4);
+ rv = PyString_FromStringAndSize(NULL, (len+3)/4);
if ( rv == 0 )
return 0;
- ncp = (unsigned char *)PyBytes_AsString(rv);
+ ncp = (unsigned char *)PyString_AsString(rv);
pos = 0;
ovalue = 0;
for ( i=0; i < len; i++ ) {
@@ -363,10 +363,10 @@ imageop_dither2mono(PyObject *self, PyObject *args)
return 0;
}
- rv = PyBytes_FromStringAndSize(NULL, (len+7)/8);
+ rv = PyString_FromStringAndSize(NULL, (len+7)/8);
if ( rv == 0 )
return 0;
- ncp = (unsigned char *)PyBytes_AsString(rv);
+ ncp = (unsigned char *)PyString_AsString(rv);
bit = 0x80;
ovalue = 0;
@@ -409,10 +409,10 @@ imageop_dither2grey2(PyObject *self, PyObject *args)
return 0;
}
- rv = PyBytes_FromStringAndSize(NULL, (len+3)/4);
+ rv = PyString_FromStringAndSize(NULL, (len+3)/4);
if ( rv == 0 )
return 0;
- ncp = (unsigned char *)PyBytes_AsString(rv);
+ ncp = (unsigned char *)PyString_AsString(rv);
pos = 1;
ovalue = 0;
for ( i=0; i < len; i++ ) {
@@ -449,10 +449,10 @@ imageop_mono2grey(PyObject *self, PyObject *args)
return 0;
}
- rv = PyBytes_FromStringAndSize(NULL, nlen);
+ rv = PyString_FromStringAndSize(NULL, nlen);
if ( rv == 0 )
return 0;
- ncp = (unsigned char *)PyBytes_AsString(rv);
+ ncp = (unsigned char *)PyString_AsString(rv);
bit = 0x80;
for ( i=0; i < nlen; i++ ) {
@@ -486,10 +486,10 @@ imageop_grey22grey(PyObject *self, PyObject *args)
return 0;
}
- rv = PyBytes_FromStringAndSize(NULL, nlen);
+ rv = PyString_FromStringAndSize(NULL, nlen);
if ( rv == 0 )
return 0;
- ncp = (unsigned char *)PyBytes_AsString(rv);
+ ncp = (unsigned char *)PyString_AsString(rv);
pos = 0;
for ( i=0; i < nlen; i++ ) {
@@ -522,10 +522,10 @@ imageop_grey42grey(PyObject *self, PyObject *args)
return 0;
}
- rv = PyBytes_FromStringAndSize(NULL, nlen);
+ rv = PyString_FromStringAndSize(NULL, nlen);
if ( rv == 0 )
return 0;
- ncp = (unsigned char *)PyBytes_AsString(rv);
+ ncp = (unsigned char *)PyString_AsString(rv);
pos = 0;
for ( i=0; i < nlen; i++ ) {
@@ -559,10 +559,10 @@ imageop_rgb2rgb8(PyObject *self, PyObject *args)
return 0;
}
- rv = PyBytes_FromStringAndSize(NULL, nlen);
+ rv = PyString_FromStringAndSize(NULL, nlen);
if ( rv == 0 )
return 0;
- ncp = (unsigned char *)PyBytes_AsString(rv);
+ ncp = (unsigned char *)PyString_AsString(rv);
for ( i=0; i < nlen; i++ ) {
/* Bits in source: aaaaaaaa BBbbbbbb GGGggggg RRRrrrrr */
@@ -603,10 +603,10 @@ imageop_rgb82rgb(PyObject *self, PyObject *args)
return 0;
}
- rv = PyBytes_FromStringAndSize(NULL, nlen*4);
+ rv = PyString_FromStringAndSize(NULL, nlen*4);
if ( rv == 0 )
return 0;
- ncp = (unsigned char *)PyBytes_AsString(rv);
+ ncp = (unsigned char *)PyString_AsString(rv);
for ( i=0; i < nlen; i++ ) {
/* Bits in source: RRRBBGGG
@@ -653,10 +653,10 @@ imageop_rgb2grey(PyObject *self, PyObject *args)
return 0;
}
- rv = PyBytes_FromStringAndSize(NULL, nlen);
+ rv = PyString_FromStringAndSize(NULL, nlen);
if ( rv == 0 )
return 0;
- ncp = (unsigned char *)PyBytes_AsString(rv);
+ ncp = (unsigned char *)PyString_AsString(rv);
for ( i=0; i < nlen; i++ ) {
if (backward_compatible) {
@@ -698,10 +698,10 @@ imageop_grey2rgb(PyObject *self, PyObject *args)
return 0;
}
- rv = PyBytes_FromStringAndSize(NULL, nlen*4);
+ rv = PyString_FromStringAndSize(NULL, nlen*4);
if ( rv == 0 )
return 0;
- ncp = (unsigned char *)PyBytes_AsString(rv);
+ ncp = (unsigned char *)PyString_AsString(rv);
for ( i=0; i < nlen; i++ ) {
value = *cp++;