Skip to content

Commit 60fbe53

Browse files
authored
Merge pull request #120 from robinst/fix-txxx-constructor-overload
Fix UserTextIdentificationFrame constructor
2 parents 698b4ad + 018bc42 commit 60fbe53

File tree

4 files changed

+39
-41
lines changed

4 files changed

+39
-41
lines changed

ext/taglib_base/taglib_base.i

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ namespace TagLib {
9696
tmp = ruby_array_to_taglib_string_list($input);
9797
$1 = &tmp;
9898
}
99+
%typemap(typecheck, precedence=SWIG_TYPECHECK_LIST) TagLib::StringList {
100+
$1 = TYPE($input) == T_ARRAY ? 1 : 0;
101+
}
99102
%apply TagLib::StringList { TagLib::StringList &, const TagLib::StringList & };
100103

101104
%typemap(out) TagLib::FileName {

ext/taglib_id3v2/taglib_id3v2_wrap.cxx

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,15 +1872,14 @@ int SWIG_Ruby_arity( VALUE proc, int minimal )
18721872
#define SWIGTYPE_p_TagLib__ID3v2__UserTextIdentificationFrame swig_types[25]
18731873
#define SWIGTYPE_p_TagLib__ID3v2__UserUrlLinkFrame swig_types[26]
18741874
#define SWIGTYPE_p_TagLib__ListT_TagLib__ID3v2__Frame_p_t swig_types[27]
1875-
#define SWIGTYPE_p_TagLib__StringList swig_types[28]
1876-
#define SWIGTYPE_p_TagLib__Tag swig_types[29]
1877-
#define SWIGTYPE_p_char swig_types[30]
1878-
#define SWIGTYPE_p_unsigned_char swig_types[31]
1879-
#define SWIGTYPE_p_unsigned_int swig_types[32]
1880-
#define SWIGTYPE_p_unsigned_long swig_types[33]
1881-
#define SWIGTYPE_p_wchar_t swig_types[34]
1882-
static swig_type_info *swig_types[36];
1883-
static swig_module_info swig_module = {swig_types, 35, 0, 0, 0, 0};
1875+
#define SWIGTYPE_p_TagLib__Tag swig_types[28]
1876+
#define SWIGTYPE_p_char swig_types[29]
1877+
#define SWIGTYPE_p_unsigned_char swig_types[30]
1878+
#define SWIGTYPE_p_unsigned_int swig_types[31]
1879+
#define SWIGTYPE_p_unsigned_long swig_types[32]
1880+
#define SWIGTYPE_p_wchar_t swig_types[33]
1881+
static swig_type_info *swig_types[35];
1882+
static swig_module_info swig_module = {swig_types, 34, 0, 0, 0, 0};
18841883
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
18851884
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
18861885

@@ -9250,9 +9249,9 @@ SWIGINTERN VALUE _wrap_new_UserTextIdentificationFrame(int nargs, VALUE *args, V
92509249
int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
92519250
_v = SWIG_CheckState(res);
92529251
if (_v) {
9253-
void *vptr = 0;
9254-
int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_TagLib__StringList, SWIG_POINTER_NO_NULL);
9255-
_v = SWIG_CheckState(res);
9252+
{
9253+
_v = TYPE(argv[1]) == T_ARRAY ? 1 : 0;
9254+
}
92569255
if (_v) {
92579256
return _wrap_new_UserTextIdentificationFrame__SWIG_4(nargs, args, self);
92589257
}
@@ -9263,9 +9262,9 @@ SWIGINTERN VALUE _wrap_new_UserTextIdentificationFrame(int nargs, VALUE *args, V
92639262
int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
92649263
_v = SWIG_CheckState(res);
92659264
if (_v) {
9266-
void *vptr = 0;
9267-
int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_TagLib__StringList, SWIG_POINTER_NO_NULL);
9268-
_v = SWIG_CheckState(res);
9265+
{
9266+
_v = TYPE(argv[1]) == T_ARRAY ? 1 : 0;
9267+
}
92699268
if (_v) {
92709269
{
92719270
int res = SWIG_AsVal_int(argv[2], NULL);
@@ -10707,7 +10706,6 @@ static swig_type_info _swigt__p_TagLib__ID3v2__UrlLinkFrame = {"_p_TagLib__ID3v2
1070710706
static swig_type_info _swigt__p_TagLib__ID3v2__UserTextIdentificationFrame = {"_p_TagLib__ID3v2__UserTextIdentificationFrame", "TagLib::ID3v2::UserTextIdentificationFrame *", 0, 0, (void*)0, 0};
1070810707
static swig_type_info _swigt__p_TagLib__ID3v2__UserUrlLinkFrame = {"_p_TagLib__ID3v2__UserUrlLinkFrame", "TagLib::ID3v2::UserUrlLinkFrame *", 0, 0, (void*)0, 0};
1070910708
static swig_type_info _swigt__p_TagLib__ListT_TagLib__ID3v2__Frame_p_t = {"_p_TagLib__ListT_TagLib__ID3v2__Frame_p_t", "TagLib::ID3v2::FrameList *|TagLib::List< TagLib::ID3v2::Frame * > *", 0, 0, (void*)0, 0};
10710-
static swig_type_info _swigt__p_TagLib__StringList = {"_p_TagLib__StringList", "TagLib::StringList *", 0, 0, (void*)0, 0};
1071110709
static swig_type_info _swigt__p_TagLib__Tag = {"_p_TagLib__Tag", "TagLib::Tag *", 0, 0, (void*)0, 0};
1071210710
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
1071310711
static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "TagLib::uchar *|unsigned char *", 0, 0, (void*)0, 0};
@@ -10744,7 +10742,6 @@ static swig_type_info *swig_type_initial[] = {
1074410742
&_swigt__p_TagLib__ID3v2__UserTextIdentificationFrame,
1074510743
&_swigt__p_TagLib__ID3v2__UserUrlLinkFrame,
1074610744
&_swigt__p_TagLib__ListT_TagLib__ID3v2__Frame_p_t,
10747-
&_swigt__p_TagLib__StringList,
1074810745
&_swigt__p_TagLib__Tag,
1074910746
&_swigt__p_char,
1075010747
&_swigt__p_unsigned_char,
@@ -10781,7 +10778,6 @@ static swig_cast_info _swigc__p_TagLib__ID3v2__UrlLinkFrame[] = { {&_swigt__p_T
1078110778
static swig_cast_info _swigc__p_TagLib__ID3v2__UserTextIdentificationFrame[] = { {&_swigt__p_TagLib__ID3v2__UserTextIdentificationFrame, 0, 0, 0},{0, 0, 0, 0}};
1078210779
static swig_cast_info _swigc__p_TagLib__ID3v2__UserUrlLinkFrame[] = { {&_swigt__p_TagLib__ID3v2__UserUrlLinkFrame, 0, 0, 0},{0, 0, 0, 0}};
1078310780
static swig_cast_info _swigc__p_TagLib__ListT_TagLib__ID3v2__Frame_p_t[] = { {&_swigt__p_TagLib__ListT_TagLib__ID3v2__Frame_p_t, 0, 0, 0},{0, 0, 0, 0}};
10784-
static swig_cast_info _swigc__p_TagLib__StringList[] = { {&_swigt__p_TagLib__StringList, 0, 0, 0},{0, 0, 0, 0}};
1078510781
static swig_cast_info _swigc__p_TagLib__Tag[] = { {&_swigt__p_TagLib__ID3v2__Tag, _p_TagLib__ID3v2__TagTo_p_TagLib__Tag, 0, 0}, {&_swigt__p_TagLib__Tag, 0, 0, 0},{0, 0, 0, 0}};
1078610782
static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
1078710783
static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
@@ -10818,7 +10814,6 @@ static swig_cast_info *swig_cast_initial[] = {
1081810814
_swigc__p_TagLib__ID3v2__UserTextIdentificationFrame,
1081910815
_swigc__p_TagLib__ID3v2__UserUrlLinkFrame,
1082010816
_swigc__p_TagLib__ListT_TagLib__ID3v2__Frame_p_t,
10821-
_swigc__p_TagLib__StringList,
1082210817
_swigc__p_TagLib__Tag,
1082310818
_swigc__p_char,
1082410819
_swigc__p_unsigned_char,

ext/taglib_mp4/taglib_mp4_wrap.cxx

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,15 +1858,14 @@ int SWIG_Ruby_arity( VALUE proc, int minimal )
18581858
#define SWIGTYPE_p_TagLib__MP4__Properties swig_types[8]
18591859
#define SWIGTYPE_p_TagLib__MP4__Tag swig_types[9]
18601860
#define SWIGTYPE_p_TagLib__MapT_TagLib__String_TagLib__MP4__Item_t swig_types[10]
1861-
#define SWIGTYPE_p_TagLib__StringList swig_types[11]
1862-
#define SWIGTYPE_p_TagLib__Tag swig_types[12]
1863-
#define SWIGTYPE_p_char swig_types[13]
1864-
#define SWIGTYPE_p_unsigned_char swig_types[14]
1865-
#define SWIGTYPE_p_unsigned_int swig_types[15]
1866-
#define SWIGTYPE_p_unsigned_long swig_types[16]
1867-
#define SWIGTYPE_p_wchar_t swig_types[17]
1868-
static swig_type_info *swig_types[19];
1869-
static swig_module_info swig_module = {swig_types, 18, 0, 0, 0, 0};
1861+
#define SWIGTYPE_p_TagLib__Tag swig_types[11]
1862+
#define SWIGTYPE_p_char swig_types[12]
1863+
#define SWIGTYPE_p_unsigned_char swig_types[13]
1864+
#define SWIGTYPE_p_unsigned_int swig_types[14]
1865+
#define SWIGTYPE_p_unsigned_long swig_types[15]
1866+
#define SWIGTYPE_p_wchar_t swig_types[16]
1867+
static swig_type_info *swig_types[18];
1868+
static swig_module_info swig_module = {swig_types, 17, 0, 0, 0, 0};
18701869
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
18711870
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
18721871

@@ -3998,15 +3997,6 @@ SWIGINTERN VALUE _wrap_new_Item(int nargs, VALUE *args, VALUE self) {
39983997
return _wrap_new_Item__SWIG_1(nargs, args, self);
39993998
}
40003999
}
4001-
if (argc == 1) {
4002-
int _v;
4003-
void *vptr = 0;
4004-
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_TagLib__StringList, SWIG_POINTER_NO_NULL);
4005-
_v = SWIG_CheckState(res);
4006-
if (_v) {
4007-
return _wrap_new_Item__SWIG_8(nargs, args, self);
4008-
}
4009-
}
40104000
if (argc == 1) {
40114001
int _v;
40124002
void *vptr = 0;
@@ -4065,6 +4055,15 @@ SWIGINTERN VALUE _wrap_new_Item(int nargs, VALUE *args, VALUE self) {
40654055
return _wrap_new_Item__SWIG_5(nargs, args, self);
40664056
}
40674057
}
4058+
if (argc == 1) {
4059+
int _v;
4060+
{
4061+
_v = TYPE(argv[0]) == T_ARRAY ? 1 : 0;
4062+
}
4063+
if (_v) {
4064+
return _wrap_new_Item__SWIG_8(nargs, args, self);
4065+
}
4066+
}
40684067
if (argc == 1) {
40694068
int _v;
40704069
{
@@ -5223,7 +5222,6 @@ static swig_type_info _swigt__p_TagLib__MP4__Item = {"_p_TagLib__MP4__Item", "Ta
52235222
static swig_type_info _swigt__p_TagLib__MP4__Properties = {"_p_TagLib__MP4__Properties", "TagLib::MP4::Properties *", 0, 0, (void*)0, 0};
52245223
static swig_type_info _swigt__p_TagLib__MP4__Tag = {"_p_TagLib__MP4__Tag", "TagLib::MP4::Tag *", 0, 0, (void*)0, 0};
52255224
static swig_type_info _swigt__p_TagLib__MapT_TagLib__String_TagLib__MP4__Item_t = {"_p_TagLib__MapT_TagLib__String_TagLib__MP4__Item_t", "TagLib::Map< TagLib::String,TagLib::MP4::Item > *|TagLib::MP4::ItemListMap *|TagLib::MP4::ItemMap *", 0, 0, (void*)0, 0};
5226-
static swig_type_info _swigt__p_TagLib__StringList = {"_p_TagLib__StringList", "TagLib::StringList *", 0, 0, (void*)0, 0};
52275225
static swig_type_info _swigt__p_TagLib__Tag = {"_p_TagLib__Tag", "TagLib::Tag *", 0, 0, (void*)0, 0};
52285226
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
52295227
static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "TagLib::uchar *|unsigned char *", 0, 0, (void*)0, 0};
@@ -5243,7 +5241,6 @@ static swig_type_info *swig_type_initial[] = {
52435241
&_swigt__p_TagLib__MP4__Properties,
52445242
&_swigt__p_TagLib__MP4__Tag,
52455243
&_swigt__p_TagLib__MapT_TagLib__String_TagLib__MP4__Item_t,
5246-
&_swigt__p_TagLib__StringList,
52475244
&_swigt__p_TagLib__Tag,
52485245
&_swigt__p_char,
52495246
&_swigt__p_unsigned_char,
@@ -5263,7 +5260,6 @@ static swig_cast_info _swigc__p_TagLib__MP4__Item[] = { {&_swigt__p_TagLib__MP4
52635260
static swig_cast_info _swigc__p_TagLib__MP4__Properties[] = { {&_swigt__p_TagLib__MP4__Properties, 0, 0, 0},{0, 0, 0, 0}};
52645261
static swig_cast_info _swigc__p_TagLib__MP4__Tag[] = { {&_swigt__p_TagLib__MP4__Tag, 0, 0, 0},{0, 0, 0, 0}};
52655262
static swig_cast_info _swigc__p_TagLib__MapT_TagLib__String_TagLib__MP4__Item_t[] = { {&_swigt__p_TagLib__MapT_TagLib__String_TagLib__MP4__Item_t, 0, 0, 0},{0, 0, 0, 0}};
5266-
static swig_cast_info _swigc__p_TagLib__StringList[] = { {&_swigt__p_TagLib__StringList, 0, 0, 0},{0, 0, 0, 0}};
52675263
static swig_cast_info _swigc__p_TagLib__Tag[] = { {&_swigt__p_TagLib__Tag, 0, 0, 0}, {&_swigt__p_TagLib__MP4__Tag, _p_TagLib__MP4__TagTo_p_TagLib__Tag, 0, 0},{0, 0, 0, 0}};
52685264
static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
52695265
static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
@@ -5283,7 +5279,6 @@ static swig_cast_info *swig_cast_initial[] = {
52835279
_swigc__p_TagLib__MP4__Properties,
52845280
_swigc__p_TagLib__MP4__Tag,
52855281
_swigc__p_TagLib__MapT_TagLib__String_TagLib__MP4__Item_t,
5286-
_swigc__p_TagLib__StringList,
52875282
_swigc__p_TagLib__Tag,
52885283
_swigc__p_char,
52895284
_swigc__p_unsigned_char,

test/id3v2_frames_test.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ class TestID3v2Frames < Test::Unit::TestCase
173173
should 'have field_list' do
174174
assert_equal ['MusicBrainz Album Id', '992dc19a-5631-40f5-b252-fbfedbc328a9'], @txxx_frame.field_list
175175
end
176+
177+
should 'constructor with all arguments should work' do
178+
frame = TagLib::ID3v2::UserTextIdentificationFrame.new("UserFrame", ["Some User Text"], TagLib::String::UTF8)
179+
assert_equal ["UserFrame", "Some User Text"], frame.field_list
180+
end
176181
end
177182

178183
teardown do

0 commit comments

Comments
 (0)