taglib-ruby 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +33 -0
  3. data/CHANGELOG.md +6 -0
  4. data/Gemfile +2 -0
  5. data/Guardfile +4 -2
  6. data/README.md +55 -35
  7. data/Rakefile +5 -5
  8. data/docs/taglib/aiff.rb +0 -3
  9. data/docs/taglib/base.rb +0 -4
  10. data/docs/taglib/flac.rb +1 -3
  11. data/docs/taglib/id3v2.rb +1 -1
  12. data/docs/taglib/mp4.rb +2 -4
  13. data/docs/taglib/mpeg.rb +0 -1
  14. data/docs/taglib/ogg.rb +0 -4
  15. data/docs/taglib/vorbis.rb +0 -1
  16. data/docs/taglib/wav.rb +0 -4
  17. data/ext/extconf_common.rb +24 -28
  18. data/ext/taglib_aiff/extconf.rb +2 -0
  19. data/ext/taglib_aiff/taglib_aiff_wrap.cxx +217 -178
  20. data/ext/taglib_base/extconf.rb +2 -0
  21. data/ext/taglib_base/includes.i +1 -0
  22. data/ext/taglib_base/taglib_base_wrap.cxx +233 -191
  23. data/ext/taglib_flac/extconf.rb +2 -0
  24. data/ext/taglib_flac/taglib_flac_wrap.cxx +228 -189
  25. data/ext/taglib_flac_picture/extconf.rb +2 -0
  26. data/ext/taglib_flac_picture/taglib_flac_picture_wrap.cxx +210 -168
  27. data/ext/taglib_id3v1/extconf.rb +2 -0
  28. data/ext/taglib_id3v1/taglib_id3v1_wrap.cxx +223 -182
  29. data/ext/taglib_id3v2/extconf.rb +2 -0
  30. data/ext/taglib_id3v2/taglib_id3v2_wrap.cxx +429 -407
  31. data/ext/taglib_mp4/extconf.rb +2 -0
  32. data/ext/taglib_mp4/taglib_mp4_wrap.cxx +295 -260
  33. data/ext/taglib_mpeg/extconf.rb +2 -0
  34. data/ext/taglib_mpeg/taglib_mpeg_wrap.cxx +243 -206
  35. data/ext/taglib_ogg/extconf.rb +2 -0
  36. data/ext/taglib_ogg/taglib_ogg_wrap.cxx +214 -171
  37. data/ext/taglib_vorbis/extconf.rb +2 -0
  38. data/ext/taglib_vorbis/taglib_vorbis_wrap.cxx +217 -178
  39. data/ext/taglib_wav/extconf.rb +2 -0
  40. data/ext/taglib_wav/taglib_wav_wrap.cxx +217 -178
  41. data/lib/taglib/aiff.rb +2 -0
  42. data/lib/taglib/base.rb +3 -1
  43. data/lib/taglib/flac.rb +2 -0
  44. data/lib/taglib/id3v1.rb +2 -0
  45. data/lib/taglib/id3v2.rb +2 -0
  46. data/lib/taglib/mp4.rb +10 -13
  47. data/lib/taglib/mpeg.rb +2 -0
  48. data/lib/taglib/ogg.rb +2 -0
  49. data/lib/taglib/version.rb +3 -1
  50. data/lib/taglib/vorbis.rb +2 -0
  51. data/lib/taglib/wav.rb +2 -1
  52. data/lib/taglib.rb +4 -3
  53. data/taglib-ruby.gemspec +164 -163
  54. data/tasks/docs_coverage.rake +10 -8
  55. data/tasks/ext.rake +26 -25
  56. data/tasks/gemspec_check.rake +6 -4
  57. data/tasks/swig.rake +10 -11
  58. data/test/aiff_examples_test.rb +8 -13
  59. data/test/aiff_file_test.rb +29 -29
  60. data/test/aiff_file_write_test.rb +19 -20
  61. data/test/base_test.rb +4 -2
  62. data/test/data/add-relative-volume.cpp +7 -3
  63. data/test/data/flac-create.cpp +15 -5
  64. data/test/data/get_picture_data.cpp +5 -1
  65. data/test/data/id3v1-create.cpp +6 -3
  66. data/test/data/mp4-create.cpp +12 -4
  67. data/test/data/vorbis-create.cpp +12 -5
  68. data/test/data/wav-create.cpp +18 -3
  69. data/test/file_test.rb +7 -5
  70. data/test/fileref_open_test.rb +12 -10
  71. data/test/fileref_properties_test.rb +6 -4
  72. data/test/fileref_write_test.rb +14 -13
  73. data/test/flac_file_test.rb +32 -27
  74. data/test/flac_file_write_test.rb +17 -18
  75. data/test/flac_picture_memory_test.rb +13 -17
  76. data/test/helper.rb +3 -1
  77. data/test/id3v1_genres_test.rb +14 -12
  78. data/test/id3v1_tag_test.rb +7 -5
  79. data/test/id3v2_frames_test.rb +34 -34
  80. data/test/id3v2_header_test.rb +14 -13
  81. data/test/id3v2_memory_test.rb +21 -20
  82. data/test/id3v2_relative_volume_test.rb +11 -9
  83. data/test/id3v2_tag_test.rb +16 -14
  84. data/test/id3v2_unicode_test.rb +12 -10
  85. data/test/id3v2_unknown_frames_test.rb +7 -5
  86. data/test/id3v2_write_test.rb +28 -29
  87. data/test/mp4_file_test.rb +27 -26
  88. data/test/mp4_file_write_test.rb +12 -13
  89. data/test/mp4_items_test.rb +78 -79
  90. data/test/mpeg_file_test.rb +32 -30
  91. data/test/tag_test.rb +5 -3
  92. data/test/unicode_filename_test.rb +7 -7
  93. data/test/vorbis_file_test.rb +14 -12
  94. data/test/vorbis_tag_test.rb +46 -44
  95. data/test/wav_examples_test.rb +8 -16
  96. data/test/wav_file_test.rb +29 -29
  97. data/test/wav_file_write_test.rb +22 -23
  98. metadata +19 -18
@@ -1,6 +1,6 @@
1
1
  /* ----------------------------------------------------------------------------
2
2
  * This file was automatically generated by SWIG (http://www.swig.org).
3
- * Version 3.0.7
3
+ * Version 4.0.2
4
4
  *
5
5
  * This file is not intended to be easily readable and contains a number of
6
6
  * coding conventions designed to improve portability and efficiency. Do not make
@@ -8,7 +8,11 @@
8
8
  * interface file instead.
9
9
  * ----------------------------------------------------------------------------- */
10
10
 
11
+
12
+ #ifndef SWIGRUBY
11
13
  #define SWIGRUBY
14
+ #endif
15
+
12
16
 
13
17
 
14
18
  #ifdef __cplusplus
@@ -101,9 +105,11 @@ template <typename T> T SwigValueInit() {
101
105
  #endif
102
106
 
103
107
  /* exporting methods */
104
- #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
105
- # ifndef GCC_HASCLASSVISIBILITY
106
- # define GCC_HASCLASSVISIBILITY
108
+ #if defined(__GNUC__)
109
+ # if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
110
+ # ifndef GCC_HASCLASSVISIBILITY
111
+ # define GCC_HASCLASSVISIBILITY
112
+ # endif
107
113
  # endif
108
114
  #endif
109
115
 
@@ -223,9 +229,11 @@ template <typename T> T SwigValueInit() {
223
229
  #endif
224
230
 
225
231
  /* exporting methods */
226
- #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
227
- # ifndef GCC_HASCLASSVISIBILITY
228
- # define GCC_HASCLASSVISIBILITY
232
+ #if defined(__GNUC__)
233
+ # if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
234
+ # ifndef GCC_HASCLASSVISIBILITY
235
+ # define GCC_HASCLASSVISIBILITY
236
+ # endif
229
237
  # endif
230
238
  #endif
231
239
 
@@ -323,6 +331,7 @@ template <typename T> T SwigValueInit() {
323
331
  /* Flags for pointer conversions */
324
332
  #define SWIG_POINTER_DISOWN 0x1
325
333
  #define SWIG_CAST_NEW_MEMORY 0x2
334
+ #define SWIG_POINTER_NO_NULL 0x4
326
335
 
327
336
  /* Flags for new pointer objects */
328
337
  #define SWIG_POINTER_OWN 0x1
@@ -775,16 +784,16 @@ SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
775
784
  char d = *(c++);
776
785
  unsigned char uu;
777
786
  if ((d >= '0') && (d <= '9'))
778
- uu = ((d - '0') << 4);
787
+ uu = (unsigned char)((d - '0') << 4);
779
788
  else if ((d >= 'a') && (d <= 'f'))
780
- uu = ((d - ('a'-10)) << 4);
789
+ uu = (unsigned char)((d - ('a'-10)) << 4);
781
790
  else
782
791
  return (char *) 0;
783
792
  d = *(c++);
784
793
  if ((d >= '0') && (d <= '9'))
785
- uu |= (d - '0');
794
+ uu |= (unsigned char)(d - '0');
786
795
  else if ((d >= 'a') && (d <= 'f'))
787
- uu |= (d - ('a'-10));
796
+ uu |= (unsigned char)(d - ('a'-10));
788
797
  else
789
798
  return (char *) 0;
790
799
  *u = uu;
@@ -961,42 +970,53 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
961
970
  #ifndef RSTRUCT_PTR
962
971
  # define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
963
972
  #endif
973
+ #ifndef RTYPEDDATA_P
974
+ # define RTYPEDDATA_P(x) (TYPE(x) != T_DATA)
975
+ #endif
964
976
 
965
977
 
966
978
 
967
979
  /*
968
- * Need to be very careful about how these macros are defined, especially
969
- * when compiling C++ code or C code with an ANSI C compiler.
980
+ * The following macros are used for providing the correct type of a
981
+ * function pointer to the Ruby C API.
982
+ * Starting with Ruby 2.7 (corresponding to RB_METHOD_DEFINITION_DECL being
983
+ * defined) these macros act transparently due to Ruby's moving away from
984
+ * ANYARGS and instead employing strict function signatures.
970
985
  *
971
- * VALUEFUNC(f) is a macro used to typecast a C function that implements
972
- * a Ruby method so that it can be passed as an argument to API functions
973
- * like rb_define_method() and rb_define_singleton_method().
986
+ * Note: In case of C (not C++) the macros are transparent even before
987
+ * Ruby 2.7 due to the fact that the Ruby C API used function declarators
988
+ * with empty parentheses, which allows for an unspecified number of
989
+ * arguments.
974
990
  *
975
- * VOIDFUNC(f) is a macro used to typecast a C function that implements
976
- * either the "mark" or "free" stuff for a Ruby Data object, so that it
977
- * can be passed as an argument to API functions like Data_Wrap_Struct()
991
+ * PROTECTFUNC(f) is used for the function pointer argument of the Ruby
992
+ * C API function rb_protect().
993
+ *
994
+ * VALUEFUNC(f) is used for the function pointer argument(s) of Ruby C API
995
+ * functions like rb_define_method() and rb_define_singleton_method().
996
+ *
997
+ * VOIDFUNC(f) is used to typecast a C function that implements either
998
+ * the "mark" or "free" stuff for a Ruby Data object, so that it can be
999
+ * passed as an argument to Ruby C API functions like Data_Wrap_Struct()
978
1000
  * and Data_Make_Struct().
1001
+ *
1002
+ * SWIG_RUBY_VOID_ANYARGS_FUNC(f) is used for the function pointer
1003
+ * argument(s) of Ruby C API functions like rb_define_virtual_variable().
1004
+ *
1005
+ * SWIG_RUBY_INT_ANYARGS_FUNC(f) is used for the function pointer
1006
+ * argument(s) of Ruby C API functions like st_foreach().
979
1007
  */
980
-
981
- #ifdef __cplusplus
982
- # ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
983
- # define PROTECTFUNC(f) ((VALUE (*)()) f)
984
- # define VALUEFUNC(f) ((VALUE (*)()) f)
985
- # define VOIDFUNC(f) ((void (*)()) f)
986
- # else
987
- # ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
988
- # define PROTECTFUNC(f) ((VALUE (*)()) f)
989
- # define VALUEFUNC(f) ((VALUE (*)()) f)
990
- # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
991
- # else /* These definitions should work for Ruby 1.7+ */
992
- # define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
993
- # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
994
- # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
995
- # endif
996
- # endif
1008
+ #if defined(__cplusplus) && !defined(RB_METHOD_DEFINITION_DECL)
1009
+ # define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
1010
+ # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
1011
+ # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
1012
+ # define SWIG_RUBY_VOID_ANYARGS_FUNC(f) ((void (*)(ANYARGS))(f))
1013
+ # define SWIG_RUBY_INT_ANYARGS_FUNC(f) ((int (*)(ANYARGS))(f))
997
1014
  #else
1015
+ # define PROTECTFUNC(f) (f)
998
1016
  # define VALUEFUNC(f) (f)
999
1017
  # define VOIDFUNC(f) (f)
1018
+ # define SWIG_RUBY_VOID_ANYARGS_FUNC(f) (f)
1019
+ # define SWIG_RUBY_INT_ANYARGS_FUNC(f) (f)
1000
1020
  #endif
1001
1021
 
1002
1022
  /* Don't use for expressions have side effect */
@@ -1184,7 +1204,7 @@ void Ruby_Format_OverloadedError(
1184
1204
  /* -----------------------------------------------------------------------------
1185
1205
  * rubytracking.swg
1186
1206
  *
1187
- * This file contains support for tracking mappings from
1207
+ * This file contains support for tracking mappings from
1188
1208
  * Ruby objects to C++ objects. This functionality is needed
1189
1209
  * to implement mark functions for Ruby's mark and sweep
1190
1210
  * garbage collector.
@@ -1194,6 +1214,11 @@ void Ruby_Format_OverloadedError(
1194
1214
  extern "C" {
1195
1215
  #endif
1196
1216
 
1217
+ #if !defined(ST_DATA_T_DEFINED)
1218
+ /* Needs to be explicitly included for Ruby 1.8 and earlier */
1219
+ #include <st.h>
1220
+ #endif
1221
+
1197
1222
  /* Ruby 1.8 actually assumes the first case. */
1198
1223
  #if SIZEOF_VOIDP == SIZEOF_LONG
1199
1224
  # define SWIG2NUM(v) LONG2NUM((unsigned long)v)
@@ -1205,109 +1230,69 @@ extern "C" {
1205
1230
  # error sizeof(void*) is not the same as long or long long
1206
1231
  #endif
1207
1232
 
1208
-
1209
- /* Global Ruby hash table to store Trackings from C/C++
1210
- structs to Ruby Objects.
1233
+ /* Global hash table to store Trackings from C/C++
1234
+ structs to Ruby Objects.
1211
1235
  */
1212
- static VALUE swig_ruby_trackings = Qnil;
1236
+ static st_table* swig_ruby_trackings = NULL;
1213
1237
 
1214
- /* Global variable that stores a reference to the ruby
1215
- hash table delete function. */
1216
- static ID swig_ruby_hash_delete;
1238
+ static VALUE swig_ruby_trackings_count(ID id, VALUE *var) {
1239
+ return SWIG2NUM(swig_ruby_trackings->num_entries);
1240
+ }
1217
1241
 
1218
- /* Setup a Ruby hash table to store Trackings */
1242
+
1243
+ /* Setup a hash table to store Trackings */
1219
1244
  SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
1220
- /* Create a ruby hash table to store Trackings from C++
1245
+ /* Create a hash table to store Trackings from C++
1221
1246
  objects to Ruby objects. */
1222
1247
 
1223
- /* Try to see if some other .so has already created a
1248
+ /* Try to see if some other .so has already created a
1224
1249
  tracking hash table, which we keep hidden in an instance var
1225
1250
  in the SWIG module.
1226
1251
  This is done to allow multiple DSOs to share the same
1227
1252
  tracking table.
1228
1253
  */
1229
- ID trackings_id = rb_intern( "@__trackings__" );
1254
+ VALUE trackings_value = Qnil;
1255
+ /* change the variable name so that we can mix modules
1256
+ compiled with older SWIG's - this used to be called "@__trackings__" */
1257
+ ID trackings_id = rb_intern( "@__safetrackings__" );
1230
1258
  VALUE verbose = rb_gv_get("VERBOSE");
1231
1259
  rb_gv_set("VERBOSE", Qfalse);
1232
- swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id );
1260
+ trackings_value = rb_ivar_get( _mSWIG, trackings_id );
1233
1261
  rb_gv_set("VERBOSE", verbose);
1234
1262
 
1235
- /* No, it hasn't. Create one ourselves */
1236
- if ( swig_ruby_trackings == Qnil )
1237
- {
1238
- swig_ruby_trackings = rb_hash_new();
1239
- rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings );
1240
- }
1241
-
1242
- /* Now store a reference to the hash table delete function
1243
- so that we only have to look it up once.*/
1244
- swig_ruby_hash_delete = rb_intern("delete");
1245
- }
1246
-
1247
- /* Get a Ruby number to reference a pointer */
1248
- SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
1249
- /* We cast the pointer to an unsigned long
1250
- and then store a reference to it using
1251
- a Ruby number object. */
1252
-
1253
- /* Convert the pointer to a Ruby number */
1254
- return SWIG2NUM(ptr);
1255
- }
1256
-
1257
- /* Get a Ruby number to reference an object */
1258
- SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
1259
- /* We cast the object to an unsigned long
1260
- and then store a reference to it using
1261
- a Ruby number object. */
1262
-
1263
- /* Convert the Object to a Ruby number */
1264
- return SWIG2NUM(object);
1265
- }
1266
-
1267
- /* Get a Ruby object from a previously stored reference */
1268
- SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
1269
- /* The provided Ruby number object is a reference
1270
- to the Ruby object we want.*/
1263
+ /* The trick here is that we have to store the hash table
1264
+ pointer in a Ruby variable. We do not want Ruby's GC to
1265
+ treat this pointer as a Ruby object, so we convert it to
1266
+ a Ruby numeric value. */
1267
+ if (trackings_value == Qnil) {
1268
+ /* No, it hasn't. Create one ourselves */
1269
+ swig_ruby_trackings = st_init_numtable();
1270
+ rb_ivar_set( _mSWIG, trackings_id, SWIG2NUM(swig_ruby_trackings) );
1271
+ } else {
1272
+ swig_ruby_trackings = (st_table*)NUM2SWIG(trackings_value);
1273
+ }
1271
1274
 
1272
- /* Convert the Ruby number to a Ruby object */
1273
- return NUM2SWIG(reference);
1275
+ rb_define_virtual_variable("SWIG_TRACKINGS_COUNT",
1276
+ VALUEFUNC(swig_ruby_trackings_count),
1277
+ SWIG_RUBY_VOID_ANYARGS_FUNC((rb_gvar_setter_t*)NULL));
1274
1278
  }
1275
1279
 
1276
1280
  /* Add a Tracking from a C/C++ struct to a Ruby object */
1277
1281
  SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
1278
- /* In a Ruby hash table we store the pointer and
1279
- the associated Ruby object. The trick here is
1280
- that we cannot store the Ruby object directly - if
1281
- we do then it cannot be garbage collected. So
1282
- instead we typecast it as a unsigned long and
1283
- convert it to a Ruby number object.*/
1284
-
1285
- /* Get a reference to the pointer as a Ruby number */
1286
- VALUE key = SWIG_RubyPtrToReference(ptr);
1287
-
1288
- /* Get a reference to the Ruby object as a Ruby number */
1289
- VALUE value = SWIG_RubyObjectToReference(object);
1290
-
1291
1282
  /* Store the mapping to the global hash table. */
1292
- rb_hash_aset(swig_ruby_trackings, key, value);
1283
+ st_insert(swig_ruby_trackings, (st_data_t)ptr, object);
1293
1284
  }
1294
1285
 
1295
1286
  /* Get the Ruby object that owns the specified C/C++ struct */
1296
1287
  SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
1297
- /* Get a reference to the pointer as a Ruby number */
1298
- VALUE key = SWIG_RubyPtrToReference(ptr);
1299
-
1300
1288
  /* Now lookup the value stored in the global hash table */
1301
- VALUE value = rb_hash_aref(swig_ruby_trackings, key);
1302
-
1303
- if (value == Qnil) {
1304
- /* No object exists - return nil. */
1289
+ VALUE value;
1290
+
1291
+ if (st_lookup(swig_ruby_trackings, (st_data_t)ptr, &value)) {
1292
+ return value;
1293
+ } else {
1305
1294
  return Qnil;
1306
1295
  }
1307
- else {
1308
- /* Convert this value to Ruby object */
1309
- return SWIG_RubyReferenceToObject(value);
1310
- }
1311
1296
  }
1312
1297
 
1313
1298
  /* Remove a Tracking from a C/C++ struct to a Ruby object. It
@@ -1315,25 +1300,39 @@ SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
1315
1300
  since the same memory address may be reused later to create
1316
1301
  a new object. */
1317
1302
  SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
1318
- /* Get a reference to the pointer as a Ruby number */
1319
- VALUE key = SWIG_RubyPtrToReference(ptr);
1320
-
1321
- /* Delete the object from the hash table by calling Ruby's
1322
- do this we need to call the Hash.delete method.*/
1323
- rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
1303
+ /* Delete the object from the hash table */
1304
+ st_delete(swig_ruby_trackings, (st_data_t *)&ptr, NULL);
1324
1305
  }
1325
1306
 
1326
1307
  /* This is a helper method that unlinks a Ruby object from its
1327
1308
  underlying C++ object. This is needed if the lifetime of the
1328
- Ruby object is longer than the C++ object */
1309
+ Ruby object is longer than the C++ object. */
1329
1310
  SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
1330
1311
  VALUE object = SWIG_RubyInstanceFor(ptr);
1331
1312
 
1332
1313
  if (object != Qnil) {
1314
+ // object might have the T_ZOMBIE type, but that's just
1315
+ // because the GC has flagged it as such for a deferred
1316
+ // destruction. Until then, it's still a T_DATA object.
1333
1317
  DATA_PTR(object) = 0;
1334
1318
  }
1335
1319
  }
1336
1320
 
1321
+ /* This is a helper method that iterates over all the trackings
1322
+ passing the C++ object pointer and its related Ruby object
1323
+ to the passed callback function. */
1324
+
1325
+ /* Proxy method to abstract the internal trackings datatype */
1326
+ static int swig_ruby_internal_iterate_callback(st_data_t ptr, st_data_t obj, st_data_t meth) {
1327
+ ((void (*) (void *, VALUE))meth)((void *)ptr, (VALUE)obj);
1328
+ return ST_CONTINUE;
1329
+ }
1330
+
1331
+ SWIGRUNTIME void SWIG_RubyIterateTrackings( void(*meth)(void* ptr, VALUE obj) ) {
1332
+ st_foreach(swig_ruby_trackings,
1333
+ SWIG_RUBY_INT_ANYARGS_FUNC(swig_ruby_internal_iterate_callback),
1334
+ (st_data_t)meth);
1335
+ }
1337
1336
 
1338
1337
  #ifdef __cplusplus
1339
1338
  }
@@ -1392,7 +1391,7 @@ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
1392
1391
  #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1393
1392
  #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Ruby_NewPointerObj(ptr, type, flags)
1394
1393
  #define SWIG_AcquirePtr(ptr, own) SWIG_Ruby_AcquirePtr(ptr, own)
1395
- #define swig_owntype ruby_owntype
1394
+ #define swig_owntype swig_ruby_owntype
1396
1395
 
1397
1396
  /* for raw packed data */
1398
1397
  #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
@@ -1549,10 +1548,11 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
1549
1548
  swig_class *sklass;
1550
1549
  VALUE klass;
1551
1550
  VALUE obj;
1552
-
1551
+
1553
1552
  if (!ptr)
1554
1553
  return Qnil;
1555
-
1554
+
1555
+ assert(type);
1556
1556
  if (type->clientdata) {
1557
1557
  sklass = (swig_class *) type->clientdata;
1558
1558
 
@@ -1560,7 +1560,7 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
1560
1560
  track = sklass->trackObjects;
1561
1561
  if (track) {
1562
1562
  obj = SWIG_RubyInstanceFor(ptr);
1563
-
1563
+
1564
1564
  /* Check the object's type and make sure it has the correct type.
1565
1565
  It might not in cases where methods do things like
1566
1566
  downcast methods. */
@@ -1592,7 +1592,7 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
1592
1592
  obj = Data_Wrap_Struct(klass, 0, 0, ptr);
1593
1593
  }
1594
1594
  rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
1595
-
1595
+
1596
1596
  return obj;
1597
1597
  }
1598
1598
 
@@ -1612,26 +1612,30 @@ SWIGRUNTIMEINLINE char *
1612
1612
  SWIG_Ruby_MangleStr(VALUE obj)
1613
1613
  {
1614
1614
  VALUE stype = rb_iv_get(obj, "@__swigtype__");
1615
+ if (NIL_P(stype))
1616
+ return NULL;
1615
1617
  return StringValuePtr(stype);
1616
1618
  }
1617
1619
 
1618
1620
  /* Acquire a pointer value */
1619
- typedef void (*ruby_owntype)(void*);
1620
-
1621
- SWIGRUNTIME ruby_owntype
1622
- SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) {
1623
- if (obj) {
1624
- ruby_owntype oldown = RDATA(obj)->dfree;
1625
- RDATA(obj)->dfree = own;
1626
- return oldown;
1627
- } else {
1628
- return 0;
1621
+ typedef struct {
1622
+ void (*datafree)(void *);
1623
+ int own;
1624
+ } swig_ruby_owntype;
1625
+
1626
+ SWIGRUNTIME swig_ruby_owntype
1627
+ SWIG_Ruby_AcquirePtr(VALUE obj, swig_ruby_owntype own) {
1628
+ swig_ruby_owntype oldown = {0, 0};
1629
+ if (TYPE(obj) == T_DATA && !RTYPEDDATA_P(obj)) {
1630
+ oldown.datafree = RDATA(obj)->dfree;
1631
+ RDATA(obj)->dfree = own.datafree;
1629
1632
  }
1633
+ return oldown;
1630
1634
  }
1631
1635
 
1632
1636
  /* Convert a pointer value */
1633
1637
  SWIGRUNTIME int
1634
- SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own)
1638
+ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, swig_ruby_owntype *own)
1635
1639
  {
1636
1640
  char *c;
1637
1641
  swig_cast_info *tc;
@@ -1639,16 +1643,20 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags,
1639
1643
 
1640
1644
  /* Grab the pointer */
1641
1645
  if (NIL_P(obj)) {
1642
- *ptr = 0;
1643
- return SWIG_OK;
1646
+ if (ptr)
1647
+ *ptr = 0;
1648
+ return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
1644
1649
  } else {
1645
- if (TYPE(obj) != T_DATA) {
1650
+ if (TYPE(obj) != T_DATA || (TYPE(obj) == T_DATA && RTYPEDDATA_P(obj))) {
1646
1651
  return SWIG_ERROR;
1647
1652
  }
1648
1653
  Data_Get_Struct(obj, void, vptr);
1649
1654
  }
1650
1655
 
1651
- if (own) *own = RDATA(obj)->dfree;
1656
+ if (own) {
1657
+ own->datafree = RDATA(obj)->dfree;
1658
+ own->own = 0;
1659
+ }
1652
1660
 
1653
1661
  /* Check to see if the input object is giving up ownership
1654
1662
  of the underlying C struct or C++ object. If so then we
@@ -1683,8 +1691,6 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags,
1683
1691
  /* The object has already been deleted */
1684
1692
  return SWIG_ObjectPreviouslyDeletedError;
1685
1693
  }
1686
- *ptr = vptr;
1687
- return SWIG_OK;
1688
1694
  }
1689
1695
  }
1690
1696
  if ((c = SWIG_MangleStr(obj)) == NULL) {
@@ -1694,12 +1700,23 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags,
1694
1700
  if (!tc) {
1695
1701
  return SWIG_ERROR;
1696
1702
  } else {
1697
- int newmemory = 0;
1698
- *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
1699
- assert(!newmemory); /* newmemory handling not yet implemented */
1703
+ if (ptr) {
1704
+ if (tc->type == ty) {
1705
+ *ptr = vptr;
1706
+ } else {
1707
+ int newmemory = 0;
1708
+ *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
1709
+ if (newmemory == SWIG_CAST_NEW_MEMORY) {
1710
+ assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
1711
+ if (own)
1712
+ own->own = own->own | SWIG_CAST_NEW_MEMORY;
1713
+ }
1714
+ }
1715
+ }
1700
1716
  }
1701
1717
  } else {
1702
- *ptr = vptr;
1718
+ if (ptr)
1719
+ *ptr = vptr;
1703
1720
  }
1704
1721
 
1705
1722
  return SWIG_OK;
@@ -1725,7 +1742,7 @@ SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
1725
1742
  return rb_str_new2(result);
1726
1743
  }
1727
1744
 
1728
- /* Convert a packed value value */
1745
+ /* Convert a packed pointer value */
1729
1746
  SWIGRUNTIME int
1730
1747
  SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
1731
1748
  swig_cast_info *tc;
@@ -1856,7 +1873,7 @@ static VALUE mOgg;
1856
1873
  #define SWIG_RUBY_THREAD_END_BLOCK
1857
1874
 
1858
1875
 
1859
- #define SWIGVERSION 0x030007
1876
+ #define SWIGVERSION 0x040002
1860
1877
  #define SWIG_VERSION SWIGVERSION
1861
1878
 
1862
1879
 
@@ -1877,6 +1894,8 @@ using namespace TagLib;
1877
1894
 
1878
1895
  #include <taglib/tstring.h>
1879
1896
  #include <taglib/tstringlist.h>
1897
+ #include <taglib/tbytevector.h>
1898
+ #include <taglib/tbytevectorlist.h>
1880
1899
  #include <taglib/tfile.h>
1881
1900
 
1882
1901
  #if defined(HAVE_RUBY_ENCODING_H) && HAVE_RUBY_ENCODING_H
@@ -1946,6 +1965,28 @@ TagLib::StringList ruby_array_to_taglib_string_list(VALUE ary) {
1946
1965
  return result;
1947
1966
  }
1948
1967
 
1968
+ VALUE taglib_bytevectorlist_to_ruby_array(const TagLib::ByteVectorList & list) {
1969
+ VALUE ary = rb_ary_new2(list.size());
1970
+ for (TagLib::ByteVectorList::ConstIterator it = list.begin(); it != list.end(); it++) {
1971
+ VALUE s = taglib_bytevector_to_ruby_string(*it);
1972
+ rb_ary_push(ary, s);
1973
+ }
1974
+ return ary;
1975
+ }
1976
+
1977
+ TagLib::ByteVectorList ruby_array_to_taglib_bytevectorlist(VALUE ary) {
1978
+ TagLib::ByteVectorList result = TagLib::ByteVectorList();
1979
+ if (NIL_P(ary)) {
1980
+ return result;
1981
+ }
1982
+ for (long i = 0; i < RARRAY_LEN(ary); i++) {
1983
+ VALUE e = rb_ary_entry(ary, i);
1984
+ TagLib::ByteVector s = ruby_string_to_taglib_bytevector(e);
1985
+ result.append(s);
1986
+ }
1987
+ return result;
1988
+ }
1989
+
1949
1990
  VALUE taglib_filename_to_ruby_string(TagLib::FileName filename) {
1950
1991
  VALUE result;
1951
1992
  #ifdef _WIN32
@@ -2009,15 +2050,16 @@ VALUE taglib_flac_picturelist_to_ruby_array(const TagLib::List<TagLib::FLAC::Pic
2009
2050
 
2010
2051
 
2011
2052
  SWIGINTERN VALUE
2012
- SWIG_ruby_failed(void)
2053
+ SWIG_ruby_failed(VALUE SWIGUNUSEDPARM(arg1), VALUE SWIGUNUSEDPARM(arg2))
2013
2054
  {
2014
2055
  return Qnil;
2015
2056
  }
2016
2057
 
2017
2058
 
2018
- /*@SWIG:/usr/local/share/swig/3.0.7/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2019
- SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
2059
+ /*@SWIG:/usr/local/Cellar/swig/4.0.2/share/swig/4.0.2/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2060
+ SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE arg)
2020
2061
  {
2062
+ VALUE *args = (VALUE *)arg;
2021
2063
  VALUE obj = args[0];
2022
2064
  VALUE type = TYPE(obj);
2023
2065
  unsigned long *res = (unsigned long *)(args[1]);
@@ -2035,7 +2077,7 @@ SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val)
2035
2077
  VALUE a[2];
2036
2078
  a[0] = obj;
2037
2079
  a[1] = (VALUE)(&v);
2038
- if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
2080
+ if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
2039
2081
  if (val) *val = v;
2040
2082
  return SWIG_OK;
2041
2083
  }
@@ -2082,7 +2124,7 @@ SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
2082
2124
  if (cptr) {
2083
2125
  if (alloc) {
2084
2126
  if (*alloc == SWIG_NEWOBJ) {
2085
- *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
2127
+ *cptr = reinterpret_cast< char* >(memcpy(new char[size], cstr, sizeof(char)*(size)));
2086
2128
  } else {
2087
2129
  *cptr = cstr;
2088
2130
  *alloc = SWIG_OLDOBJ;
@@ -2134,9 +2176,10 @@ SWIG_From_unsigned_SS_int (unsigned int value)
2134
2176
  }
2135
2177
 
2136
2178
 
2137
- /*@SWIG:/usr/local/share/swig/3.0.7/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2138
- SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
2179
+ /*@SWIG:/usr/local/Cellar/swig/4.0.2/share/swig/4.0.2/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2180
+ SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE arg)
2139
2181
  {
2182
+ VALUE *args = (VALUE *)arg;
2140
2183
  VALUE obj = args[0];
2141
2184
  VALUE type = TYPE(obj);
2142
2185
  long *res = (long *)(args[1]);
@@ -2154,7 +2197,7 @@ SWIG_AsVal_long (VALUE obj, long* val)
2154
2197
  VALUE a[2];
2155
2198
  a[0] = obj;
2156
2199
  a[1] = (VALUE)(&v);
2157
- if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
2200
+ if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2LONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
2158
2201
  if (val) *val = v;
2159
2202
  return SWIG_OK;
2160
2203
  }
@@ -2214,7 +2257,8 @@ SWIG_AsVal_bool (VALUE obj, bool *val)
2214
2257
  static swig_class SwigClassFile;
2215
2258
 
2216
2259
  SWIGINTERN void
2217
- free_TagLib_Ogg_File(TagLib::Ogg::File *arg1) {
2260
+ free_TagLib_Ogg_File(void *self) {
2261
+ TagLib::Ogg::File *arg1 = (TagLib::Ogg::File *)self;
2218
2262
  SWIG_RubyRemoveTracking(arg1);
2219
2263
  delete arg1;
2220
2264
  }
@@ -2378,22 +2422,20 @@ fail:
2378
2422
  }
2379
2423
 
2380
2424
 
2381
- #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2382
2425
  SWIGINTERN VALUE
2383
- _wrap_XiphComment_allocate(VALUE self) {
2426
+ #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2427
+ _wrap_XiphComment_allocate(VALUE self)
2384
2428
  #else
2385
- SWIGINTERN VALUE
2386
- _wrap_XiphComment_allocate(int argc, VALUE *argv, VALUE self) {
2429
+ _wrap_XiphComment_allocate(int argc, VALUE *argv, VALUE self)
2387
2430
  #endif
2388
-
2389
-
2390
- VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_TagLib__Ogg__XiphComment);
2431
+ {
2432
+ VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_TagLib__Ogg__XiphComment);
2391
2433
  #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2392
- rb_obj_call_init(vresult, argc, argv);
2434
+ rb_obj_call_init(vresult, argc, argv);
2393
2435
  #endif
2394
- return vresult;
2395
- }
2396
-
2436
+ return vresult;
2437
+ }
2438
+
2397
2439
 
2398
2440
  SWIGINTERN VALUE
2399
2441
  _wrap_new_XiphComment__SWIG_1(int argc, VALUE *argv, VALUE self) {
@@ -2449,7 +2491,8 @@ fail:
2449
2491
 
2450
2492
 
2451
2493
  SWIGINTERN void
2452
- free_TagLib_Ogg_XiphComment(TagLib::Ogg::XiphComment *arg1) {
2494
+ free_TagLib_Ogg_XiphComment(void *self) {
2495
+ TagLib::Ogg::XiphComment *arg1 = (TagLib::Ogg::XiphComment *)self;
2453
2496
  SWIG_RubyRemoveTracking(arg1);
2454
2497
  delete arg1;
2455
2498
  }
@@ -3718,7 +3761,7 @@ SWIG_InitializeModule(void *clientdata) {
3718
3761
 
3719
3762
  /* Now work on filling in swig_module.types */
3720
3763
  #ifdef SWIGRUNTIME_DEBUG
3721
- printf("SWIG_InitializeModule: size %d\n", swig_module.size);
3764
+ printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module.size);
3722
3765
  #endif
3723
3766
  for (i = 0; i < swig_module.size; ++i) {
3724
3767
  swig_type_info *type = 0;
@@ -3726,7 +3769,7 @@ SWIG_InitializeModule(void *clientdata) {
3726
3769
  swig_cast_info *cast;
3727
3770
 
3728
3771
  #ifdef SWIGRUNTIME_DEBUG
3729
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
3772
+ printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
3730
3773
  #endif
3731
3774
 
3732
3775
  /* if there is another module already loaded */
@@ -3802,7 +3845,7 @@ SWIG_InitializeModule(void *clientdata) {
3802
3845
  for (i = 0; i < swig_module.size; ++i) {
3803
3846
  int j = 0;
3804
3847
  swig_cast_info *cast = swig_module.cast_initial[i];
3805
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
3848
+ printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
3806
3849
  while (cast->type) {
3807
3850
  printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
3808
3851
  cast++;