mixed 8ch tabs + spaces -> 4 space indent

This commit is contained in:
Eric Soroos 2013-12-13 15:13:43 -08:00
parent 954d1ae435
commit 631612edc6

36
map.c
View File

@ -66,7 +66,7 @@ PyImaging_MapperNew(const char* filename, int readonly)
mapper = PyObject_New(ImagingMapperObject, &ImagingMapperType);
if (mapper == NULL)
return NULL;
return NULL;
mapper->base = NULL;
mapper->size = mapper->offset = 0;
@ -94,7 +94,7 @@ PyImaging_MapperNew(const char* filename, int readonly)
PAGE_READONLY,
0, 0, NULL);
if (mapper->hMap == (HANDLE)-1) {
CloseHandle(mapper->hFile);
CloseHandle(mapper->hFile);
PyErr_SetString(PyExc_IOError, "cannot map file");
PyObject_Del(mapper);
return NULL;
@ -116,11 +116,11 @@ mapping_dealloc(ImagingMapperObject* mapper)
{
#ifdef WIN32
if (mapper->base != 0)
UnmapViewOfFile(mapper->base);
UnmapViewOfFile(mapper->base);
if (mapper->hMap != (HANDLE)-1)
CloseHandle(mapper->hMap);
CloseHandle(mapper->hMap);
if (mapper->hFile != (HANDLE)-1)
CloseHandle(mapper->hFile);
CloseHandle(mapper->hFile);
mapper->base = 0;
mapper->hMap = mapper->hFile = (HANDLE)-1;
#endif
@ -137,7 +137,7 @@ mapping_read(ImagingMapperObject* mapper, PyObject* args)
int size = -1;
if (!PyArg_ParseTuple(args, "|i", &size))
return NULL;
return NULL;
/* check size */
if (size < 0 || mapper->offset + size > mapper->size)
@ -147,7 +147,7 @@ mapping_read(ImagingMapperObject* mapper, PyObject* args)
buf = PyBytes_FromStringAndSize(NULL, size);
if (!buf)
return NULL;
return NULL;
if (size > 0) {
memcpy(PyBytes_AsString(buf), mapper->base + mapper->offset, size);
@ -163,7 +163,7 @@ mapping_seek(ImagingMapperObject* mapper, PyObject* args)
int offset;
int whence = 0;
if (!PyArg_ParseTuple(args, "i|i", &offset, &whence))
return NULL;
return NULL;
switch (whence) {
case 0: /* SEEK_SET */
@ -208,7 +208,7 @@ mapping_readimage(ImagingMapperObject* mapper, PyObject* args)
int orientation;
if (!PyArg_ParseTuple(args, "s(ii)ii", &mode, &xsize, &ysize,
&stride, &orientation))
return NULL;
return NULL;
if (stride <= 0) {
/* FIXME: maybe we should call ImagingNewPrologue instead */
@ -259,13 +259,13 @@ static struct PyMethodDef methods[] = {
};
static PyTypeObject ImagingMapperType = {
PyVarObject_HEAD_INIT(NULL, 0)
"ImagingMapper", /*tp_name*/
sizeof(ImagingMapperObject), /*tp_size*/
0, /*tp_itemsize*/
/* methods */
(destructor)mapping_dealloc, /*tp_dealloc*/
0, /*tp_print*/
PyVarObject_HEAD_INIT(NULL, 0)
"ImagingMapper", /*tp_name*/
sizeof(ImagingMapperObject), /*tp_size*/
0, /*tp_itemsize*/
/* methods */
(destructor)mapping_dealloc, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
@ -297,7 +297,7 @@ PyImaging_Mapper(PyObject* self, PyObject* args)
{
char* filename;
if (!PyArg_ParseTuple(args, "s", &filename))
return NULL;
return NULL;
return (PyObject*) PyImaging_MapperNew(filename, 1);
}
@ -338,7 +338,7 @@ PyImaging_MapBuffer(PyObject* self, PyObject* args)
if (!PyArg_ParseTuple(args, "O(ii)sOn(sii)", &target, &xsize, &ysize,
&codec, &bbox, &offset, &mode, &stride, &ystep))
return NULL;
return NULL;
if (!PyImaging_CheckBuffer(target)) {
PyErr_SetString(PyExc_TypeError, "expected string or buffer");