python: Make swig bindings python independent.

This commit is contained in:
José Fonseca 2009-03-26 11:29:59 +00:00
parent d18c2ee3d5
commit bb84ce7159
2 changed files with 8 additions and 10 deletions

View file

@ -37,7 +37,6 @@
%{
#include <stdio.h>
#include <Python.h>
#include "pipe/p_screen.h"
#include "pipe/p_context.h"
@ -58,7 +57,7 @@
%}
%include "typemaps.i"
%include "exception.i"
%include "cstring.i"
%include "carrays.i"

View file

@ -347,16 +347,15 @@
assert(p_atomic_read(&$self->reference.count) > 0);
if(offset > $self->size) {
PyErr_SetString(PyExc_ValueError, "offset must be smaller than buffer size");
return;
}
if(offset > $self->size)
SWIG_exception(SWIG_ValueError, "offset must be smaller than buffer size");
if(offset + LENGTH > $self->size) {
PyErr_SetString(PyExc_ValueError, "data length must fit inside the buffer");
return;
}
if(offset + LENGTH > $self->size)
SWIG_exception(SWIG_ValueError, "data length must fit inside the buffer");
pipe_buffer_write(screen, $self, offset, LENGTH, STRING);
fail:
return;
}
};