[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38386] trunk/blender/source/blender/ python/generic/bgl.c: Shuffle code so it compiles with MSVC too.

Nathan Letwory nathan at letworyinteractive.com
Thu Jul 14 10:20:19 CEST 2011


Revision: 38386
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38386
Author:   jesterking
Date:     2011-07-14 08:20:19 +0000 (Thu, 14 Jul 2011)
Log Message:
-----------
Shuffle code so it compiles with MSVC too. (Array of unknown size otherwise).

Modified Paths:
--------------
    trunk/blender/source/blender/python/generic/bgl.c

Modified: trunk/blender/source/blender/python/generic/bgl.c
===================================================================
--- trunk/blender/source/blender/python/generic/bgl.c	2011-07-14 07:03:33 UTC (rev 38385)
+++ trunk/blender/source/blender/python/generic/bgl.c	2011-07-14 08:20:19 UTC (rev 38386)
@@ -69,12 +69,45 @@
 };
 
 static void Buffer_dealloc(PyObject *self);
-static PyObject *Buffer_tolist(PyObject *self, void *arg);
-static PyObject *Buffer_dimensions(PyObject *self, void *arg);
 static PyObject *Buffer_repr(PyObject *self);
-static PyMethodDef Buffer_methods[];
-static PyGetSetDef Buffer_getseters[];
 
+static PyObject *Buffer_to_list(PyObject *self)
+{
+	int i, len= ((Buffer *)self)->dimensions[0];
+	PyObject *list= PyList_New(len);
+
+	for (i=0; i<len; i++) {
+		PyList_SET_ITEM(list, i, Buffer_item(self, i));
+	}
+
+	return list;
+}
+
+static PyObject *Buffer_dimensions(PyObject *self, void *UNUSED(arg))
+{
+	Buffer *buffer= (Buffer *) self;
+	PyObject *list= PyList_New(buffer->ndimensions);
+	int i;
+
+	for (i= 0; i<buffer->ndimensions; i++) {
+		PyList_SET_ITEM(list, i, PyLong_FromLong(buffer->dimensions[i]));
+	}
+
+	return list;
+}
+
+static PyMethodDef Buffer_methods[] = {
+	{"to_list", (PyCFunction)Buffer_to_list, METH_NOARGS,
+     "return the buffer as a list"},
+	{NULL, NULL, 0, NULL}
+};
+
+static PyGetSetDef Buffer_getseters[] = {
+	{(char *)"dimensions", (getter)Buffer_dimensions, NULL, NULL, NULL},
+	 {NULL, NULL, NULL, NULL, NULL}
+};
+
+
 PyTypeObject BGL_bufferType = {
 	PyVarObject_HEAD_INIT(NULL, 0)
 	"bgl.Buffer",               /*tp_name */
@@ -460,42 +493,7 @@
 	PyObject_DEL(self);
 }
 
-static PyObject *Buffer_to_list(PyObject *self)
-{
-	int i, len= ((Buffer *)self)->dimensions[0];
-	PyObject *list= PyList_New(len);
 
-	for (i=0; i<len; i++) {
-		PyList_SET_ITEM(list, i, Buffer_item(self, i));
-	}
-
-	return list;
-}
-
-static PyObject *Buffer_dimensions(PyObject *self, void *UNUSED(arg))
-{
-	Buffer *buffer= (Buffer *) self;
-	PyObject *list= PyList_New(buffer->ndimensions);
-	int i;
-
-	for (i= 0; i<buffer->ndimensions; i++) {
-		PyList_SET_ITEM(list, i, PyLong_FromLong(buffer->dimensions[i]));
-	}
-
-	return list;
-}
-
-static PyMethodDef Buffer_methods[] = {
-	{"to_list", (PyCFunction)Buffer_to_list, METH_NOARGS,
-     "return the buffer as a list"},
-	{NULL, NULL, 0, NULL}
-};
-
-static PyGetSetDef Buffer_getseters[] = {
-	{(char *)"dimensions", (getter)Buffer_dimensions, NULL, NULL, NULL},
-	 {NULL, NULL, NULL, NULL, NULL}
-};
-
 static PyObject *Buffer_repr(PyObject *self)
 {
 	PyObject *list= Buffer_to_list(self);




More information about the Bf-blender-cvs mailing list