121 lines
3.8 KiB
Text
121 lines
3.8 KiB
Text
$NetBSD: patch-aa,v 1.5 2012/02/07 09:04:56 obache Exp $
|
|
|
|
* Fix for LP64 on python > 2.4.
|
|
* `strchr' for `const char*' may return `const char*'.
|
|
|
|
--- pyid3lib.cc.orig 2003-02-16 23:50:20.000000000 +0000
|
|
+++ pyid3lib.cc
|
|
@@ -10,6 +10,17 @@
|
|
#include <id3/id3lib_frame.h>
|
|
#include <id3/tag.h>
|
|
|
|
+#if defined(PY_MAJOR_VERSION) && PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 5
|
|
+typedef int Py_ssize_t;
|
|
+typedef intargfunc ssizeargfunc;
|
|
+typedef intintargfunc ssizessizeargfunc;
|
|
+typedef intobjargproc ssizeobjargproc;
|
|
+typedef intintobjargproc ssizessizeobjargproc;
|
|
+#define LENFUNC inquiry
|
|
+#else
|
|
+#define LENFUNC lenfunc
|
|
+#endif
|
|
+
|
|
typedef struct
|
|
{
|
|
PyObject_HEAD
|
|
@@ -61,11 +72,11 @@ static PyObject* dict_from_frame( ID3_Fr
|
|
static ID3_Frame* frame_from_dict( PyObject* dict );
|
|
static ID3_Frame* frame_from_dict( ID3_FrameID fid, PyObject* dict );
|
|
|
|
-static int id3_length( ID3Object* self );
|
|
-static PyObject* id3_item( ID3Object* self, int index );
|
|
-static PyObject* id3_slice( ID3Object* self, int start, int end );
|
|
-static int id3_ass_item( ID3Object* self, int index, PyObject* dict );
|
|
-static int id3_ass_slice( ID3Object* self, int start, int end, PyObject* dict );
|
|
+static Py_ssize_t id3_length( ID3Object* self );
|
|
+static PyObject* id3_item( ID3Object* self, Py_ssize_t index );
|
|
+static PyObject* id3_slice( ID3Object* self, Py_ssize_t start, Py_ssize_t end );
|
|
+static int id3_ass_item( ID3Object* self, Py_ssize_t index, PyObject* dict );
|
|
+static int id3_ass_slice( ID3Object* self, Py_ssize_t start, Py_ssize_t end, PyObject* dict );
|
|
static int id3_contains( ID3Object* self, PyObject* other );
|
|
|
|
static PyObject* id3_append( ID3Object* self, PyObject* args );
|
|
@@ -80,13 +91,13 @@ static PyObject* frameid_lookup = NULL;
|
|
|
|
|
|
static PySequenceMethods tag_as_sequence = {
|
|
- (inquiry)id3_length,
|
|
+ (LENFUNC)id3_length,
|
|
NULL,
|
|
NULL,
|
|
- (intargfunc)id3_item,
|
|
- (intintargfunc)id3_slice,
|
|
- (intobjargproc)id3_ass_item,
|
|
- (intintobjargproc)id3_ass_slice,
|
|
+ (ssizeargfunc)id3_item,
|
|
+ (ssizessizeargfunc)id3_slice,
|
|
+ (ssizeobjargproc)id3_ass_item,
|
|
+ (ssizessizeobjargproc)id3_ass_slice,
|
|
(objobjproc)id3_contains,
|
|
NULL,
|
|
NULL,
|
|
@@ -236,12 +247,12 @@ static PyObject* id3iter_iternext( ID3It
|
|
//
|
|
/////////////////
|
|
|
|
-static int id3_length( ID3Object* self )
|
|
+static Py_ssize_t id3_length( ID3Object* self )
|
|
{
|
|
return self->size;
|
|
}
|
|
|
|
-static PyObject* id3_item( ID3Object* self, int index )
|
|
+static PyObject* id3_item( ID3Object* self, Py_ssize_t index )
|
|
{
|
|
if ( index < 0 )
|
|
index += self->size;
|
|
@@ -255,7 +266,7 @@ static PyObject* id3_item( ID3Object* se
|
|
return dict_from_frame( self->frames[index] );
|
|
}
|
|
|
|
-static PyObject* id3_slice( ID3Object* self, int start, int end )
|
|
+static PyObject* id3_slice( ID3Object* self, Py_ssize_t start, Py_ssize_t end )
|
|
{
|
|
PyObject* result;
|
|
int i;
|
|
@@ -284,7 +295,7 @@ static PyObject* id3_slice( ID3Object* s
|
|
}
|
|
|
|
|
|
-static int id3_ass_item( ID3Object* self, int index, PyObject* dict )
|
|
+static int id3_ass_item( ID3Object* self, Py_ssize_t index, PyObject* dict )
|
|
{
|
|
ID3_Frame* newframe;
|
|
|
|
@@ -382,7 +393,7 @@ static ID3_Frame** frames_from_dictseq(
|
|
return NULL;
|
|
}
|
|
|
|
-static int id3_ass_slice( ID3Object* self, int start, int end, PyObject* dictseq )
|
|
+static int id3_ass_slice( ID3Object* self, Py_ssize_t start, Py_ssize_t end, PyObject* dictseq )
|
|
{
|
|
int i, n;
|
|
int newsize;
|
|
@@ -824,7 +835,7 @@ static ID3_Frame* frame_from_dict( PyObj
|
|
static ID3_Frame* frame_from_dict( ID3_FrameID fid, PyObject* dict )
|
|
{
|
|
char* data;
|
|
- int size;
|
|
+ Py_ssize_t size;
|
|
|
|
ID3_Field* field;
|
|
ID3_FieldID flid;
|
|
@@ -1013,7 +1024,7 @@ static PyObject* id3_getattr( ID3Object*
|
|
{
|
|
ID3_Frame* frame;
|
|
const char* str;
|
|
- char* slash;
|
|
+ const char* slash;
|
|
ID3_Field* fld;
|
|
int i;
|
|
|