[xiph-cvs] cvs commit: ogg-python/src general.c general.h pyoggpacket.c
Andrew Catham Master of Python
andrew at xiph.org
Mon May 14 08:33:12 PDT 2001
andrew 01/05/14 08:33:12
Modified: . ChangeLog setup.py
include/pyogg pyogg.h
src general.c general.h pyoggpacket.c
Log:
2001-05-14 Andrew Chatham <andrew.chatham at duke.edu>
* setup.py : Bumped to version 0.3
* src/general.c (arg_to_64): Changed to arg_to_int64. Removed
DECREF and changed calling convention and return value. Also
moved to <pyogg/pyogg.h> so it can be shared with vorbis-python
* src/general.h: Fixed preprocessor warnings
* src/pyoggpacket.c (py_ogg_packet_setattr): Changed to arg_to_int64
Revision Changes Path
1.5 +11 -0 ogg-python/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/ogg-python/ChangeLog,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ChangeLog 2001/05/02 01:49:10 1.4
+++ ChangeLog 2001/05/14 15:33:11 1.5
@@ -1,3 +1,14 @@
+2001-05-14 Andrew Chatham <andrew.chatham at duke.edu>
+ * setup.py : Bumped to version 0.3
+
+ * src/general.c (arg_to_64): Changed to arg_to_int64. Removed
+ DECREF and changed calling convention and return value. Also
+ moved to <pyogg/pyogg.h> so it can be shared with vorbis-python
+
+ * src/general.h: Fixed preprocessor warnings
+
+ * src/pyoggpacket.c (py_ogg_packet_setattr): Changed to arg_to_int64
+
2001-05-01 Mike Coleman <mkc at mathdogs.com>
* test/oggtail.py: new script to show off some of ogg module
1.2 +1 -1 ogg-python/setup.py
Index: setup.py
===================================================================
RCS file: /usr/local/cvsroot/ogg-python/setup.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- setup.py 2001/02/06 03:18:19 1.1
+++ setup.py 2001/05/14 15:33:11 1.2
@@ -11,7 +11,7 @@
from distutils.extension import Extension
VERSION_MAJOR = 0
-VERSION_MINOR = 2
+VERSION_MINOR = 3
pyogg_version = str(VERSION_MAJOR) + "." + str(VERSION_MINOR)
def get_setup():
1.2 +7 -0 ogg-python/include/pyogg/pyogg.h
Index: pyogg.h
===================================================================
RCS file: /usr/local/cvsroot/ogg-python/include/pyogg/pyogg.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- pyogg.h 2001/02/06 03:18:19 1.1
+++ pyogg.h 2001/05/14 15:33:11 1.2
@@ -18,6 +18,13 @@
PyObject *(*ogg_packet_from_packet)(ogg_packet *op);
} ogg_module_info;
+/*
+ Function to convert Long Python objects into an ogg_int64 value.
+ Returns 0 on failure (a Python error will be set)
+*/
+int arg_to_int64(PyObject *longobj, ogg_int64_t *val);
+
+
#endif // __PYOGG_H__
1.2 +8 -11 ogg-python/src/general.c
Index: general.c
===================================================================
RCS file: /usr/local/cvsroot/ogg-python/src/general.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- general.c 2001/02/06 03:18:19 1.1
+++ general.c 2001/05/14 15:33:11 1.2
@@ -1,4 +1,5 @@
#include "general.h"
+#include <pyogg/pyogg.h>
#include <ogg/ogg.h>
/*
@@ -8,22 +9,18 @@
*/
/* Simple function to turn an object into an ogg_int64_t. Returns 0 on
- * an error, so you need to use PyErr_Occurred() after calling it. It
- * DECREFS the argument in the function. */
+ * an error. Does not DECREF the argument */
-ogg_int64_t
-arg_to_64(PyObject *longobj)
+int
+arg_to_int64(PyObject *longobj, ogg_int64_t *val)
{
- ogg_int64_t val = 0;
-
if(PyLong_Check(longobj))
- val = PyLong_AsLongLong(longobj);
+ *val = PyLong_AsLongLong(longobj);
else if (PyInt_Check(longobj))
- val = PyInt_AsLong(longobj);
+ *val = PyInt_AsLong(longobj);
else {
- Py_DECREF(longobj);
PyErr_SetString(PyExc_TypeError, "Argument must be int or long");
+ return 0;
}
- Py_DECREF(longobj);
- return val;
+ return 1;
}
1.2 +1 -3 ogg-python/src/general.h
Index: general.h
===================================================================
RCS file: /usr/local/cvsroot/ogg-python/src/general.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- general.h 2001/02/06 03:18:19 1.1
+++ general.h 2001/05/14 15:33:11 1.2
@@ -9,9 +9,7 @@
#define PY_UNICODE (PY_VERSION_HEX >= 0x01060000)
-ogg_int64_t arg_to_64(PyObject *longobj);
-
-#define FDEF(x) static PyObject *py_##x##(PyObject *self, PyObject *args); \
+#define FDEF(x) static PyObject *py_##x(PyObject *self, PyObject *args); \
static char py_##x##_doc[] =
#endif /* __GENERAL_H__ */
1.3 +3 -3 ogg-python/src/pyoggpacket.c
Index: pyoggpacket.c
===================================================================
RCS file: /usr/local/cvsroot/ogg-python/src/pyoggpacket.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pyoggpacket.c 2001/05/02 01:49:10 1.2
+++ pyoggpacket.c 2001/05/14 15:33:11 1.3
@@ -73,10 +73,10 @@
static int
py_ogg_packet_setattr(PyObject *self, char *name, PyObject *value)
{
+ ogg_int64_t v;
+
if (strcmp(name, "granulepos") == 0) {
- ogg_int64_t v = arg_to_64(value);
- PyObject *err = PyErr_Occurred();
- if (err)
+ if (!arg_to_int64(value, &v))
return -1;
PY_OGG_PACKET(self)->granulepos = v;
return 0;
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list