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;
@@ -1851,7 +1868,7 @@ static VALUE mFLAC;
1851
1868
  #define SWIG_RUBY_THREAD_END_BLOCK
1852
1869
 
1853
1870
 
1854
- #define SWIGVERSION 0x030007
1871
+ #define SWIGVERSION 0x040002
1855
1872
  #define SWIG_VERSION SWIGVERSION
1856
1873
 
1857
1874
 
@@ -1868,6 +1885,8 @@ static VALUE mFLAC;
1868
1885
 
1869
1886
  #include <taglib/tstring.h>
1870
1887
  #include <taglib/tstringlist.h>
1888
+ #include <taglib/tbytevector.h>
1889
+ #include <taglib/tbytevectorlist.h>
1871
1890
  #include <taglib/tfile.h>
1872
1891
 
1873
1892
  #if defined(HAVE_RUBY_ENCODING_H) && HAVE_RUBY_ENCODING_H
@@ -1937,6 +1956,28 @@ TagLib::StringList ruby_array_to_taglib_string_list(VALUE ary) {
1937
1956
  return result;
1938
1957
  }
1939
1958
 
1959
+ VALUE taglib_bytevectorlist_to_ruby_array(const TagLib::ByteVectorList & list) {
1960
+ VALUE ary = rb_ary_new2(list.size());
1961
+ for (TagLib::ByteVectorList::ConstIterator it = list.begin(); it != list.end(); it++) {
1962
+ VALUE s = taglib_bytevector_to_ruby_string(*it);
1963
+ rb_ary_push(ary, s);
1964
+ }
1965
+ return ary;
1966
+ }
1967
+
1968
+ TagLib::ByteVectorList ruby_array_to_taglib_bytevectorlist(VALUE ary) {
1969
+ TagLib::ByteVectorList result = TagLib::ByteVectorList();
1970
+ if (NIL_P(ary)) {
1971
+ return result;
1972
+ }
1973
+ for (long i = 0; i < RARRAY_LEN(ary); i++) {
1974
+ VALUE e = rb_ary_entry(ary, i);
1975
+ TagLib::ByteVector s = ruby_string_to_taglib_bytevector(e);
1976
+ result.append(s);
1977
+ }
1978
+ return result;
1979
+ }
1980
+
1940
1981
  VALUE taglib_filename_to_ruby_string(TagLib::FileName filename) {
1941
1982
  VALUE result;
1942
1983
  #ifdef _WIN32
@@ -2031,7 +2072,7 @@ SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
2031
2072
  if (cptr) {
2032
2073
  if (alloc) {
2033
2074
  if (*alloc == SWIG_NEWOBJ) {
2034
- *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
2075
+ *cptr = reinterpret_cast< char* >(memcpy(new char[size], cstr, sizeof(char)*(size)));
2035
2076
  } else {
2036
2077
  *cptr = cstr;
2037
2078
  *alloc = SWIG_OLDOBJ;
@@ -2060,15 +2101,16 @@ SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
2060
2101
 
2061
2102
 
2062
2103
  SWIGINTERN VALUE
2063
- SWIG_ruby_failed(void)
2104
+ SWIG_ruby_failed(VALUE SWIGUNUSEDPARM(arg1), VALUE SWIGUNUSEDPARM(arg2))
2064
2105
  {
2065
2106
  return Qnil;
2066
2107
  }
2067
2108
 
2068
2109
 
2069
- /*@SWIG:/usr/local/share/swig/3.0.7/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2070
- SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
2110
+ /*@SWIG:/usr/local/Cellar/swig/4.0.2/share/swig/4.0.2/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2111
+ SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE arg)
2071
2112
  {
2113
+ VALUE *args = (VALUE *)arg;
2072
2114
  VALUE obj = args[0];
2073
2115
  VALUE type = TYPE(obj);
2074
2116
  long *res = (long *)(args[1]);
@@ -2086,7 +2128,7 @@ SWIG_AsVal_long (VALUE obj, long* val)
2086
2128
  VALUE a[2];
2087
2129
  a[0] = obj;
2088
2130
  a[1] = (VALUE)(&v);
2089
- if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
2131
+ if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2LONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) {
2090
2132
  if (val) *val = v;
2091
2133
  return SWIG_OK;
2092
2134
  }
@@ -2120,7 +2162,8 @@ SWIG_From_bool (bool value)
2120
2162
  static swig_class SwigClassMetadataBlock;
2121
2163
 
2122
2164
  SWIGINTERN void
2123
- free_TagLib_FLAC_MetadataBlock(TagLib::FLAC::MetadataBlock *arg1) {
2165
+ free_TagLib_FLAC_MetadataBlock(void *self) {
2166
+ TagLib::FLAC::MetadataBlock *arg1 = (TagLib::FLAC::MetadataBlock *)self;
2124
2167
  SWIG_RubyRemoveTracking(arg1);
2125
2168
  delete arg1;
2126
2169
  }
@@ -2167,22 +2210,20 @@ fail:
2167
2210
  }
2168
2211
 
2169
2212
 
2170
- #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2171
2213
  SWIGINTERN VALUE
2172
- _wrap_Picture_allocate(VALUE self) {
2214
+ #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2215
+ _wrap_Picture_allocate(VALUE self)
2173
2216
  #else
2174
- SWIGINTERN VALUE
2175
- _wrap_Picture_allocate(int argc, VALUE *argv, VALUE self) {
2217
+ _wrap_Picture_allocate(int argc, VALUE *argv, VALUE self)
2176
2218
  #endif
2177
-
2178
-
2179
- VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_TagLib__FLAC__Picture);
2219
+ {
2220
+ VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_TagLib__FLAC__Picture);
2180
2221
  #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2181
- rb_obj_call_init(vresult, argc, argv);
2222
+ rb_obj_call_init(vresult, argc, argv);
2182
2223
  #endif
2183
- return vresult;
2184
- }
2185
-
2224
+ return vresult;
2225
+ }
2226
+
2186
2227
 
2187
2228
  SWIGINTERN VALUE
2188
2229
  _wrap_new_Picture__SWIG_1(int argc, VALUE *argv, VALUE self) {
@@ -2238,7 +2279,8 @@ fail:
2238
2279
 
2239
2280
 
2240
2281
  SWIGINTERN void
2241
- free_TagLib_FLAC_Picture(TagLib::FLAC::Picture *arg1) {
2282
+ free_TagLib_FLAC_Picture(void *self) {
2283
+ TagLib::FLAC::Picture *arg1 = (TagLib::FLAC::Picture *)self;
2242
2284
  SWIG_RubyRemoveTracking(arg1);
2243
2285
  delete arg1;
2244
2286
  }
@@ -2870,7 +2912,7 @@ SWIG_InitializeModule(void *clientdata) {
2870
2912
 
2871
2913
  /* Now work on filling in swig_module.types */
2872
2914
  #ifdef SWIGRUNTIME_DEBUG
2873
- printf("SWIG_InitializeModule: size %d\n", swig_module.size);
2915
+ printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module.size);
2874
2916
  #endif
2875
2917
  for (i = 0; i < swig_module.size; ++i) {
2876
2918
  swig_type_info *type = 0;
@@ -2878,7 +2920,7 @@ SWIG_InitializeModule(void *clientdata) {
2878
2920
  swig_cast_info *cast;
2879
2921
 
2880
2922
  #ifdef SWIGRUNTIME_DEBUG
2881
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2923
+ printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
2882
2924
  #endif
2883
2925
 
2884
2926
  /* if there is another module already loaded */
@@ -2954,7 +2996,7 @@ SWIG_InitializeModule(void *clientdata) {
2954
2996
  for (i = 0; i < swig_module.size; ++i) {
2955
2997
  int j = 0;
2956
2998
  swig_cast_info *cast = swig_module.cast_initial[i];
2957
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2999
+ printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
2958
3000
  while (cast->type) {
2959
3001
  printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
2960
3002
  cast++;