gosu 1.4.5.pre1 → 1.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/dependencies/SDL/include/SDL.h +1 -0
  3. data/dependencies/SDL/include/SDL_assert.h +4 -2
  4. data/dependencies/SDL/include/SDL_atomic.h +20 -0
  5. data/dependencies/SDL/include/SDL_audio.h +40 -4
  6. data/dependencies/SDL/include/SDL_blendmode.h +4 -6
  7. data/dependencies/SDL/include/SDL_clipboard.h +47 -0
  8. data/dependencies/SDL/include/SDL_config.h +71 -45
  9. data/dependencies/SDL/include/SDL_cpuinfo.h +39 -4
  10. data/dependencies/SDL/include/SDL_egl.h +59 -9
  11. data/dependencies/SDL/include/SDL_endian.h +34 -3
  12. data/dependencies/SDL/include/SDL_events.h +32 -1
  13. data/dependencies/SDL/include/SDL_filesystem.h +5 -1
  14. data/dependencies/SDL/include/SDL_gamecontroller.h +78 -5
  15. data/dependencies/SDL/include/SDL_guid.h +100 -0
  16. data/dependencies/SDL/include/SDL_hints.h +645 -43
  17. data/dependencies/SDL/include/SDL_joystick.h +127 -7
  18. data/dependencies/SDL/include/SDL_keyboard.h +38 -1
  19. data/dependencies/SDL/include/SDL_keycode.h +6 -1
  20. data/dependencies/SDL/include/SDL_log.h +2 -2
  21. data/dependencies/SDL/include/SDL_main.h +42 -2
  22. data/dependencies/SDL/include/SDL_metal.h +2 -1
  23. data/dependencies/SDL/include/SDL_mouse.h +12 -1
  24. data/dependencies/SDL/include/SDL_opengl.h +0 -51
  25. data/dependencies/SDL/include/SDL_opengl_glext.h +2260 -231
  26. data/dependencies/SDL/include/SDL_opengles2_gl2.h +374 -339
  27. data/dependencies/SDL/include/SDL_opengles2_gl2ext.h +3479 -1496
  28. data/dependencies/SDL/include/SDL_opengles2_gl2platform.h +6 -9
  29. data/dependencies/SDL/include/SDL_opengles2_khrplatform.h +43 -14
  30. data/dependencies/SDL/include/SDL_platform.h +32 -6
  31. data/dependencies/SDL/include/SDL_rect.h +154 -2
  32. data/dependencies/SDL/include/SDL_render.h +46 -17
  33. data/dependencies/SDL/include/SDL_revision.h +6 -1
  34. data/dependencies/SDL/include/SDL_rwops.h +1 -15
  35. data/dependencies/SDL/include/SDL_scancode.h +46 -21
  36. data/dependencies/SDL/include/SDL_sensor.h +24 -3
  37. data/dependencies/SDL/include/SDL_stdinc.h +119 -8
  38. data/dependencies/SDL/include/SDL_surface.h +3 -1
  39. data/dependencies/SDL/include/SDL_system.h +66 -6
  40. data/dependencies/SDL/include/SDL_syswm.h +2 -0
  41. data/dependencies/SDL/include/SDL_test_common.h +1 -0
  42. data/dependencies/SDL/include/SDL_test_font.h +90 -3
  43. data/dependencies/SDL/include/SDL_thread.h +3 -3
  44. data/dependencies/SDL/include/SDL_touch.h +8 -0
  45. data/dependencies/SDL/include/SDL_version.h +19 -3
  46. data/dependencies/SDL/include/SDL_video.h +71 -9
  47. data/dependencies/SDL/include/begin_code.h +4 -4
  48. data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
  49. data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
  50. data/dependencies/SDL_sound/SDL_sound.c +210 -71
  51. data/dependencies/SDL_sound/SDL_sound.h +1 -1
  52. data/dependencies/SDL_sound/SDL_sound_coreaudio.c +111 -168
  53. data/dependencies/SDL_sound/SDL_sound_flac.c +0 -6
  54. data/dependencies/SDL_sound/SDL_sound_internal.h +27 -5
  55. data/dependencies/SDL_sound/SDL_sound_modplug.c +20 -8
  56. data/dependencies/SDL_sound/SDL_sound_mp3.c +11 -7
  57. data/dependencies/SDL_sound/SDL_sound_raw.c +1 -1
  58. data/dependencies/SDL_sound/SDL_sound_shn.c +1 -5
  59. data/dependencies/SDL_sound/SDL_sound_voc.c +1 -1
  60. data/dependencies/SDL_sound/SDL_sound_vorbis.c +2 -4
  61. data/dependencies/SDL_sound/SDL_sound_wav.c +44 -20
  62. data/dependencies/SDL_sound/dr_flac.h +237 -95
  63. data/dependencies/SDL_sound/dr_mp3.h +46 -33
  64. data/dependencies/SDL_sound/libmodplug/fastmix.c +53 -39
  65. data/dependencies/SDL_sound/libmodplug/libmodplug.h +0 -12
  66. data/dependencies/SDL_sound/libmodplug/load_669.c +37 -32
  67. data/dependencies/SDL_sound/libmodplug/load_amf.c +57 -44
  68. data/dependencies/SDL_sound/libmodplug/load_ams.c +127 -100
  69. data/dependencies/SDL_sound/libmodplug/load_dbm.c +40 -37
  70. data/dependencies/SDL_sound/libmodplug/load_dmf.c +61 -49
  71. data/dependencies/SDL_sound/libmodplug/load_dsm.c +18 -13
  72. data/dependencies/SDL_sound/libmodplug/load_far.c +31 -24
  73. data/dependencies/SDL_sound/libmodplug/load_gdm.c +27 -21
  74. data/dependencies/SDL_sound/libmodplug/load_it.c +106 -91
  75. data/dependencies/SDL_sound/libmodplug/load_mdl.c +43 -35
  76. data/dependencies/SDL_sound/libmodplug/load_med.c +66 -52
  77. data/dependencies/SDL_sound/libmodplug/load_mod.c +30 -26
  78. data/dependencies/SDL_sound/libmodplug/load_mt2.c +61 -50
  79. data/dependencies/SDL_sound/libmodplug/load_mtm.c +23 -17
  80. data/dependencies/SDL_sound/libmodplug/load_okt.c +18 -16
  81. data/dependencies/SDL_sound/libmodplug/load_psm.c +44 -32
  82. data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -14
  83. data/dependencies/SDL_sound/libmodplug/load_s3m.c +59 -53
  84. data/dependencies/SDL_sound/libmodplug/load_stm.c +23 -18
  85. data/dependencies/SDL_sound/libmodplug/load_ult.c +33 -29
  86. data/dependencies/SDL_sound/libmodplug/load_xm.c +64 -57
  87. data/dependencies/SDL_sound/libmodplug/mmcmp.c +2 -1
  88. data/dependencies/SDL_sound/libmodplug/snd_dsp.c +30 -20
  89. data/dependencies/SDL_sound/libmodplug/snd_flt.c +6 -4
  90. data/dependencies/SDL_sound/libmodplug/snd_fx.c +91 -65
  91. data/dependencies/SDL_sound/libmodplug/sndfile.c +91 -66
  92. data/dependencies/SDL_sound/libmodplug/sndmix.c +58 -35
  93. data/dependencies/SDL_sound/stb_vorbis.h +14 -9
  94. data/dependencies/mojoAL/mojoal.c +41 -24
  95. data/dependencies/utf8proc/utf8proc.c +1 -1
  96. data/dependencies/utf8proc/utf8proc.h +1 -1
  97. data/dependencies/utf8proc/utf8proc_data.h +3366 -3184
  98. data/lib/SDL2.dll +0 -0
  99. data/lib64/SDL2.dll +0 -0
  100. data/src/Window.cpp +3 -0
  101. metadata +5 -4
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  FLAC audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file.
3
- dr_flac - v0.12.37 - 2022-02-12
3
+ dr_flac - v0.12.39 - 2022-09-17
4
4
 
5
5
  David Reid - mackron@gmail.com
6
6
 
@@ -210,6 +210,9 @@ Build Options
210
210
  #define DR_FLAC_NO_SIMD
211
211
  Disables SIMD optimizations (SSE on x86/x64 architectures, NEON on ARM architectures). Use this if you are having compatibility issues with your compiler.
212
212
 
213
+ #define DR_FLAC_NO_WCHAR
214
+ Disables all functions ending with `_w`. Use this if your compiler does not provide wchar.h. Not required if DR_FLAC_NO_STDIO is also defined.
215
+
213
216
 
214
217
 
215
218
  Notes
@@ -232,7 +235,7 @@ extern "C" {
232
235
 
233
236
  #define DRFLAC_VERSION_MAJOR 0
234
237
  #define DRFLAC_VERSION_MINOR 12
235
- #define DRFLAC_VERSION_REVISION 37
238
+ #define DRFLAC_VERSION_REVISION 39
236
239
  #define DRFLAC_VERSION_STRING DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MAJOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MINOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_REVISION)
237
240
 
238
241
  #include <stddef.h> /* For size_t. */
@@ -383,15 +386,13 @@ typedef enum
383
386
  drflac_seek_origin_current
384
387
  } drflac_seek_origin;
385
388
 
386
- /* Packing is important on this structure because we map this directly to the raw data within the SEEKTABLE metadata block. */
387
- #pragma pack(2)
389
+ /* The order of members in this structure is important because we map this directly to the raw data within the SEEKTABLE metadata block. */
388
390
  typedef struct
389
391
  {
390
392
  drflac_uint64 firstPCMFrame;
391
393
  drflac_uint64 flacFrameOffset; /* The offset from the first byte of the header of the first frame. */
392
394
  drflac_uint16 pcmFrameCount;
393
395
  } drflac_seekpoint;
394
- #pragma pack()
395
396
 
396
397
  typedef struct
397
398
  {
@@ -1280,15 +1281,13 @@ typedef struct
1280
1281
  const char* pRunningData;
1281
1282
  } drflac_cuesheet_track_iterator;
1282
1283
 
1283
- /* Packing is important on this structure because we map this directly to the raw data within the CUESHEET metadata block. */
1284
- #pragma pack(4)
1284
+ /* The order of members here is important because we map this directly to the raw data within the CUESHEET metadata block. */
1285
1285
  typedef struct
1286
1286
  {
1287
1287
  drflac_uint64 offset;
1288
1288
  drflac_uint8 index;
1289
1289
  drflac_uint8 reserved[3];
1290
1290
  } drflac_cuesheet_track_index;
1291
- #pragma pack()
1292
1291
 
1293
1292
  typedef struct
1294
1293
  {
@@ -1363,9 +1362,15 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat
1363
1362
  I am using "__inline__" only when we're compiling in strict ANSI mode.
1364
1363
  */
1365
1364
  #if defined(__STRICT_ANSI__)
1366
- #define DRFLAC_INLINE __inline__ __attribute__((always_inline))
1365
+ #define DRFLAC_GNUC_INLINE_HINT __inline__
1366
+ #else
1367
+ #define DRFLAC_GNUC_INLINE_HINT inline
1368
+ #endif
1369
+
1370
+ #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)) || defined(__clang__)
1371
+ #define DRFLAC_INLINE DRFLAC_GNUC_INLINE_HINT __attribute__((always_inline))
1367
1372
  #else
1368
- #define DRFLAC_INLINE inline __attribute__((always_inline))
1373
+ #define DRFLAC_INLINE DRFLAC_GNUC_INLINE_HINT
1369
1374
  #endif
1370
1375
  #elif defined(__WATCOMC__)
1371
1376
  #define DRFLAC_INLINE __inline
@@ -1509,9 +1514,7 @@ static DRFLAC_INLINE drflac_bool32 drflac_has_sse41(void)
1509
1514
  {
1510
1515
  #if defined(DRFLAC_SUPPORT_SSE41)
1511
1516
  #if (defined(DRFLAC_X64) || defined(DRFLAC_X86)) && !defined(DRFLAC_NO_SSE41)
1512
- #if defined(DRFLAC_X64)
1513
- return DRFLAC_TRUE; /* 64-bit targets always support SSE4.1. */
1514
- #elif (defined(_M_IX86_FP) && _M_IX86_FP == 2) || defined(__SSE4_1__)
1517
+ #if defined(__SSE4_1__) || defined(__AVX__)
1515
1518
  return DRFLAC_TRUE; /* If the compiler is allowed to freely generate SSE41 code we can assume support. */
1516
1519
  #else
1517
1520
  #if defined(DRFLAC_NO_CPUID)
@@ -1576,18 +1579,21 @@ static DRFLAC_INLINE drflac_bool32 drflac_has_sse41(void)
1576
1579
  extern __inline drflac_uint64 _watcom_bswap64(drflac_uint64);
1577
1580
  #pragma aux _watcom_bswap16 = \
1578
1581
  "xchg al, ah" \
1579
- parm [ax] \
1580
- modify [ax];
1582
+ parm [ax] \
1583
+ value [ax] \
1584
+ modify nomemory;
1581
1585
  #pragma aux _watcom_bswap32 = \
1582
- "bswap eax" \
1583
- parm [eax] \
1584
- modify [eax];
1586
+ "bswap eax" \
1587
+ parm [eax] \
1588
+ value [eax] \
1589
+ modify nomemory;
1585
1590
  #pragma aux _watcom_bswap64 = \
1586
1591
  "bswap eax" \
1587
1592
  "bswap edx" \
1588
1593
  "xchg eax,edx" \
1589
1594
  parm [eax edx] \
1590
- modify [eax edx];
1595
+ value [eax edx] \
1596
+ modify nomemory;
1591
1597
  #endif
1592
1598
 
1593
1599
 
@@ -1688,6 +1694,10 @@ typedef drflac_int32 drflac_result;
1688
1694
  #define DRFLAC_CHANNEL_ASSIGNMENT_RIGHT_SIDE 9
1689
1695
  #define DRFLAC_CHANNEL_ASSIGNMENT_MID_SIDE 10
1690
1696
 
1697
+ #define DRFLAC_SEEKPOINT_SIZE_IN_BYTES 18
1698
+ #define DRFLAC_CUESHEET_TRACK_SIZE_IN_BYTES 36
1699
+ #define DRFLAC_CUESHEET_TRACK_INDEX_SIZE_IN_BYTES 12
1700
+
1691
1701
  #define drflac_align(x, a) ((((x) + (a) - 1) / (a)) * (a))
1692
1702
 
1693
1703
 
@@ -2690,6 +2700,10 @@ static drflac_bool32 drflac__find_and_seek_to_next_sync_code(drflac_bs* bs)
2690
2700
  #if defined(__WATCOMC__) && defined(__386__)
2691
2701
  #define DRFLAC_IMPLEMENT_CLZ_WATCOM
2692
2702
  #endif
2703
+ #ifdef __MRC__
2704
+ #include <intrinsics.h>
2705
+ #define DRFLAC_IMPLEMENT_CLZ_MRC
2706
+ #endif
2693
2707
 
2694
2708
  static DRFLAC_INLINE drflac_uint32 drflac__clz_software(drflac_cache_t x)
2695
2709
  {
@@ -2730,6 +2744,8 @@ static DRFLAC_INLINE drflac_bool32 drflac__is_lzcnt_supported(void)
2730
2744
  /* Fast compile time check for ARM. */
2731
2745
  #if defined(DRFLAC_HAS_LZCNT_INTRINSIC) && defined(DRFLAC_ARM) && (defined(__ARM_ARCH) && __ARM_ARCH >= 5)
2732
2746
  return DRFLAC_TRUE;
2747
+ #elif defined(__MRC__)
2748
+ return DRFLAC_TRUE;
2733
2749
  #else
2734
2750
  /* If the compiler itself does not support the intrinsic then we'll need to return false. */
2735
2751
  #ifdef DRFLAC_HAS_LZCNT_INTRINSIC
@@ -2839,6 +2855,15 @@ static DRFLAC_INLINE drflac_uint32 drflac__clz_msvc(drflac_cache_t x)
2839
2855
 
2840
2856
  #ifdef DRFLAC_IMPLEMENT_CLZ_WATCOM
2841
2857
  static __inline drflac_uint32 drflac__clz_watcom (drflac_uint32);
2858
+ #ifdef DRFLAC_IMPLEMENT_CLZ_WATCOM_LZCNT
2859
+ /* Use the LZCNT instruction (only available on some processors since the 2010s). */
2860
+ #pragma aux drflac__clz_watcom_lzcnt = \
2861
+ "db 0F3h, 0Fh, 0BDh, 0C0h" /* lzcnt eax, eax */ \
2862
+ parm [eax] \
2863
+ value [eax] \
2864
+ modify nomemory;
2865
+ #else
2866
+ /* Use the 386+-compatible implementation. */
2842
2867
  #pragma aux drflac__clz_watcom = \
2843
2868
  "bsr eax, eax" \
2844
2869
  "xor eax, 31" \
@@ -2846,6 +2871,7 @@ static __inline drflac_uint32 drflac__clz_watcom (drflac_uint32);
2846
2871
  value [eax] \
2847
2872
  modify exact [eax] nomemory;
2848
2873
  #endif
2874
+ #endif
2849
2875
 
2850
2876
  static DRFLAC_INLINE drflac_uint32 drflac__clz(drflac_cache_t x)
2851
2877
  {
@@ -2857,8 +2883,12 @@ static DRFLAC_INLINE drflac_uint32 drflac__clz(drflac_cache_t x)
2857
2883
  {
2858
2884
  #ifdef DRFLAC_IMPLEMENT_CLZ_MSVC
2859
2885
  return drflac__clz_msvc(x);
2886
+ #elif defined(DRFLAC_IMPLEMENT_CLZ_WATCOM_LZCNT)
2887
+ return drflac__clz_watcom_lzcnt(x);
2860
2888
  #elif defined(DRFLAC_IMPLEMENT_CLZ_WATCOM)
2861
2889
  return (x == 0) ? sizeof(x)*8 : drflac__clz_watcom(x);
2890
+ #elif defined(__MRC__)
2891
+ return __cntlzw(x);
2862
2892
  #else
2863
2893
  return drflac__clz_software(x);
2864
2894
  #endif
@@ -4420,7 +4450,7 @@ static drflac_bool32 drflac__decode_samples_with_residual__rice__neon_32(drflac_
4420
4450
 
4421
4451
  const drflac_uint32 t[2] = {0x00000000, 0xFFFFFFFF};
4422
4452
 
4423
- riceParamMask = ~((~0UL) << riceParam);
4453
+ riceParamMask = (drflac_uint32)~((~0UL) << riceParam);
4424
4454
  riceParamMask128 = vdupq_n_u32(riceParamMask);
4425
4455
 
4426
4456
  riceParam128 = vdupq_n_s32(riceParam);
@@ -4606,10 +4636,13 @@ static drflac_bool32 drflac__decode_samples_with_residual__rice__neon_64(drflac_
4606
4636
  int32x4_t riceParam128;
4607
4637
  int64x1_t shift64;
4608
4638
  uint32x4_t one128;
4639
+ int64x2_t prediction128 = { 0 };
4640
+ uint32x4_t zeroCountPart128;
4641
+ uint32x4_t riceParamPart128;
4609
4642
 
4610
4643
  const drflac_uint32 t[2] = {0x00000000, 0xFFFFFFFF};
4611
4644
 
4612
- riceParamMask = ~((~0UL) << riceParam);
4645
+ riceParamMask = (drflac_uint32)~((~0UL) << riceParam);
4613
4646
  riceParamMask128 = vdupq_n_u32(riceParamMask);
4614
4647
 
4615
4648
  riceParam128 = vdupq_n_s32(riceParam);
@@ -4686,10 +4719,6 @@ static drflac_bool32 drflac__decode_samples_with_residual__rice__neon_64(drflac_
4686
4719
 
4687
4720
  /* For this version we are doing one sample at a time. */
4688
4721
  while (pDecodedSamples < pDecodedSamplesEnd) {
4689
- int64x2_t prediction128;
4690
- uint32x4_t zeroCountPart128;
4691
- uint32x4_t riceParamPart128;
4692
-
4693
4722
  if (!drflac__read_rice_parts_x1(bs, riceParam, &zeroCountParts[0], &riceParamParts[0]) ||
4694
4723
  !drflac__read_rice_parts_x1(bs, riceParam, &zeroCountParts[1], &riceParamParts[1]) ||
4695
4724
  !drflac__read_rice_parts_x1(bs, riceParam, &zeroCountParts[2], &riceParamParts[2]) ||
@@ -6437,7 +6466,7 @@ static void drflac__free_from_callbacks(void* p, const drflac_allocation_callbac
6437
6466
  }
6438
6467
 
6439
6468
 
6440
- static drflac_bool32 drflac__read_and_decode_metadata(drflac_read_proc onRead, drflac_seek_proc onSeek, drflac_meta_proc onMeta, void* pUserData, void* pUserDataMD, drflac_uint64* pFirstFramePos, drflac_uint64* pSeektablePos, drflac_uint32* pSeektableSize, drflac_allocation_callbacks* pAllocationCallbacks)
6469
+ static drflac_bool32 drflac__read_and_decode_metadata(drflac_read_proc onRead, drflac_seek_proc onSeek, drflac_meta_proc onMeta, void* pUserData, void* pUserDataMD, drflac_uint64* pFirstFramePos, drflac_uint64* pSeektablePos, drflac_uint32* pSeekpointCount, drflac_allocation_callbacks* pAllocationCallbacks)
6441
6470
  {
6442
6471
  /*
6443
6472
  We want to keep track of the byte position in the stream of the seektable. At the time of calling this function we know that
@@ -6497,32 +6526,37 @@ static drflac_bool32 drflac__read_and_decode_metadata(drflac_read_proc onRead, d
6497
6526
  seektableSize = blockSize;
6498
6527
 
6499
6528
  if (onMeta) {
6529
+ drflac_uint32 seekpointCount;
6500
6530
  drflac_uint32 iSeekpoint;
6501
6531
  void* pRawData;
6502
6532
 
6503
- pRawData = drflac__malloc_from_callbacks(blockSize, pAllocationCallbacks);
6533
+ seekpointCount = blockSize/DRFLAC_SEEKPOINT_SIZE_IN_BYTES;
6534
+
6535
+ pRawData = drflac__malloc_from_callbacks(seekpointCount * sizeof(drflac_seekpoint), pAllocationCallbacks);
6504
6536
  if (pRawData == NULL) {
6505
6537
  return DRFLAC_FALSE;
6506
6538
  }
6507
6539
 
6508
- if (onRead(pUserData, pRawData, blockSize) != blockSize) {
6509
- drflac__free_from_callbacks(pRawData, pAllocationCallbacks);
6510
- return DRFLAC_FALSE;
6511
- }
6540
+ /* We need to read seekpoint by seekpoint and do some processing. */
6541
+ for (iSeekpoint = 0; iSeekpoint < seekpointCount; ++iSeekpoint) {
6542
+ drflac_seekpoint* pSeekpoint = (drflac_seekpoint*)pRawData + iSeekpoint;
6512
6543
 
6513
- metadata.pRawData = pRawData;
6514
- metadata.rawDataSize = blockSize;
6515
- metadata.data.seektable.seekpointCount = blockSize/sizeof(drflac_seekpoint);
6516
- metadata.data.seektable.pSeekpoints = (const drflac_seekpoint*)pRawData;
6544
+ if (onRead(pUserData, pSeekpoint, DRFLAC_SEEKPOINT_SIZE_IN_BYTES) != DRFLAC_SEEKPOINT_SIZE_IN_BYTES) {
6545
+ drflac__free_from_callbacks(pRawData, pAllocationCallbacks);
6546
+ return DRFLAC_FALSE;
6547
+ }
6517
6548
 
6518
- /* Endian swap. */
6519
- for (iSeekpoint = 0; iSeekpoint < metadata.data.seektable.seekpointCount; ++iSeekpoint) {
6520
- drflac_seekpoint* pSeekpoint = (drflac_seekpoint*)pRawData + iSeekpoint;
6549
+ /* Endian swap. */
6521
6550
  pSeekpoint->firstPCMFrame = drflac__be2host_64(pSeekpoint->firstPCMFrame);
6522
6551
  pSeekpoint->flacFrameOffset = drflac__be2host_64(pSeekpoint->flacFrameOffset);
6523
6552
  pSeekpoint->pcmFrameCount = drflac__be2host_16(pSeekpoint->pcmFrameCount);
6524
6553
  }
6525
6554
 
6555
+ metadata.pRawData = pRawData;
6556
+ metadata.rawDataSize = blockSize;
6557
+ metadata.data.seektable.seekpointCount = seekpointCount;
6558
+ metadata.data.seektable.pSeekpoints = (const drflac_seekpoint*)pRawData;
6559
+
6526
6560
  onMeta(pUserDataMD, &metadata);
6527
6561
 
6528
6562
  drflac__free_from_callbacks(pRawData, pAllocationCallbacks);
@@ -6607,9 +6641,15 @@ static drflac_bool32 drflac__read_and_decode_metadata(drflac_read_proc onRead, d
6607
6641
  void* pRawData;
6608
6642
  const char* pRunningData;
6609
6643
  const char* pRunningDataEnd;
6644
+ size_t bufferSize;
6610
6645
  drflac_uint8 iTrack;
6611
6646
  drflac_uint8 iIndex;
6647
+ void* pTrackData;
6612
6648
 
6649
+ /*
6650
+ This needs to be loaded in two passes. The first pass is used to calculate the size of the memory allocation
6651
+ we need for storing the necessary data. The second pass will fill that buffer with usable data.
6652
+ */
6613
6653
  pRawData = drflac__malloc_from_callbacks(blockSize, pAllocationCallbacks);
6614
6654
  if (pRawData == NULL) {
6615
6655
  return DRFLAC_FALSE;
@@ -6630,38 +6670,91 @@ static drflac_bool32 drflac__read_and_decode_metadata(drflac_read_proc onRead, d
6630
6670
  metadata.data.cuesheet.leadInSampleCount = drflac__be2host_64(*(const drflac_uint64*)pRunningData); pRunningData += 8;
6631
6671
  metadata.data.cuesheet.isCD = (pRunningData[0] & 0x80) != 0; pRunningData += 259;
6632
6672
  metadata.data.cuesheet.trackCount = pRunningData[0]; pRunningData += 1;
6633
- metadata.data.cuesheet.pTrackData = pRunningData;
6673
+ metadata.data.cuesheet.pTrackData = NULL; /* Will be filled later. */
6634
6674
 
6635
- /* Check that the cuesheet tracks are valid before passing it to the callback */
6636
- for (iTrack = 0; iTrack < metadata.data.cuesheet.trackCount; ++iTrack) {
6637
- drflac_uint8 indexCount;
6638
- drflac_uint32 indexPointSize;
6675
+ /* Pass 1: Calculate the size of the buffer for the track data. */
6676
+ {
6677
+ const char* pRunningDataSaved = pRunningData; /* Will be restored at the end in preparation for the second pass. */
6639
6678
 
6640
- if (pRunningDataEnd - pRunningData < 36) {
6641
- drflac__free_from_callbacks(pRawData, pAllocationCallbacks);
6642
- return DRFLAC_FALSE;
6679
+ bufferSize = metadata.data.cuesheet.trackCount * DRFLAC_CUESHEET_TRACK_SIZE_IN_BYTES;
6680
+
6681
+ for (iTrack = 0; iTrack < metadata.data.cuesheet.trackCount; ++iTrack) {
6682
+ drflac_uint8 indexCount;
6683
+ drflac_uint32 indexPointSize;
6684
+
6685
+ if (pRunningDataEnd - pRunningData < DRFLAC_CUESHEET_TRACK_SIZE_IN_BYTES) {
6686
+ drflac__free_from_callbacks(pRawData, pAllocationCallbacks);
6687
+ return DRFLAC_FALSE;
6688
+ }
6689
+
6690
+ /* Skip to the index point count */
6691
+ pRunningData += 35;
6692
+
6693
+ indexCount = pRunningData[0];
6694
+ pRunningData += 1;
6695
+
6696
+ bufferSize += indexCount * sizeof(drflac_cuesheet_track_index);
6697
+
6698
+ /* Quick validation check. */
6699
+ indexPointSize = indexCount * DRFLAC_CUESHEET_TRACK_INDEX_SIZE_IN_BYTES;
6700
+ if (pRunningDataEnd - pRunningData < (drflac_int64)indexPointSize) {
6701
+ drflac__free_from_callbacks(pRawData, pAllocationCallbacks);
6702
+ return DRFLAC_FALSE;
6703
+ }
6704
+
6705
+ pRunningData += indexPointSize;
6643
6706
  }
6644
6707
 
6645
- /* Skip to the index point count */
6646
- pRunningData += 35;
6647
- indexCount = pRunningData[0]; pRunningData += 1;
6648
- indexPointSize = indexCount * sizeof(drflac_cuesheet_track_index);
6649
- if (pRunningDataEnd - pRunningData < (drflac_int64)indexPointSize) {
6708
+ pRunningData = pRunningDataSaved;
6709
+ }
6710
+
6711
+ /* Pass 2: Allocate a buffer and fill the data. Validation was done in the step above so can be skipped. */
6712
+ {
6713
+ char* pRunningTrackData;
6714
+
6715
+ pTrackData = drflac__malloc_from_callbacks(bufferSize, pAllocationCallbacks);
6716
+ if (pTrackData == NULL) {
6650
6717
  drflac__free_from_callbacks(pRawData, pAllocationCallbacks);
6651
6718
  return DRFLAC_FALSE;
6652
6719
  }
6653
6720
 
6654
- /* Endian swap. */
6655
- for (iIndex = 0; iIndex < indexCount; ++iIndex) {
6656
- drflac_cuesheet_track_index* pTrack = (drflac_cuesheet_track_index*)pRunningData;
6657
- pRunningData += sizeof(drflac_cuesheet_track_index);
6658
- pTrack->offset = drflac__be2host_64(pTrack->offset);
6721
+ pRunningTrackData = (char*)pTrackData;
6722
+
6723
+ for (iTrack = 0; iTrack < metadata.data.cuesheet.trackCount; ++iTrack) {
6724
+ drflac_uint8 indexCount;
6725
+
6726
+ DRFLAC_COPY_MEMORY(pRunningTrackData, pRunningData, DRFLAC_CUESHEET_TRACK_SIZE_IN_BYTES);
6727
+ pRunningData += DRFLAC_CUESHEET_TRACK_SIZE_IN_BYTES-1; /* Skip forward, but not beyond the last byte in the CUESHEET_TRACK block which is the index count. */
6728
+ pRunningTrackData += DRFLAC_CUESHEET_TRACK_SIZE_IN_BYTES-1;
6729
+
6730
+ /* Grab the index count for the next part. */
6731
+ indexCount = pRunningData[0];
6732
+ pRunningData += 1;
6733
+ pRunningTrackData += 1;
6734
+
6735
+ /* Extract each track index. */
6736
+ for (iIndex = 0; iIndex < indexCount; ++iIndex) {
6737
+ drflac_cuesheet_track_index* pTrackIndex = (drflac_cuesheet_track_index*)pRunningTrackData;
6738
+
6739
+ DRFLAC_COPY_MEMORY(pRunningTrackData, pRunningData, DRFLAC_CUESHEET_TRACK_INDEX_SIZE_IN_BYTES);
6740
+ pRunningData += DRFLAC_CUESHEET_TRACK_INDEX_SIZE_IN_BYTES;
6741
+ pRunningTrackData += sizeof(drflac_cuesheet_track_index);
6742
+
6743
+ pTrackIndex->offset = drflac__be2host_64(pTrackIndex->offset);
6744
+ }
6659
6745
  }
6746
+
6747
+ metadata.data.cuesheet.pTrackData = pTrackData;
6660
6748
  }
6661
6749
 
6750
+ /* The original data is no longer needed. */
6751
+ drflac__free_from_callbacks(pRawData, pAllocationCallbacks);
6752
+ pRawData = NULL;
6753
+
6662
6754
  onMeta(pUserDataMD, &metadata);
6663
6755
 
6664
- drflac__free_from_callbacks(pRawData, pAllocationCallbacks);
6756
+ drflac__free_from_callbacks(pTrackData, pAllocationCallbacks);
6757
+ pTrackData = NULL;
6665
6758
  }
6666
6759
  } break;
6667
6760
 
@@ -6700,7 +6793,7 @@ static drflac_bool32 drflac__read_and_decode_metadata(drflac_read_proc onRead, d
6700
6793
  drflac__free_from_callbacks(pRawData, pAllocationCallbacks);
6701
6794
  return DRFLAC_FALSE;
6702
6795
  }
6703
- metadata.data.picture.mime = pRunningData; pRunningData += metadata.data.picture.mimeLength;
6796
+ metadata.data.picture.mime = pRunningData; pRunningData += metadata.data.picture.mimeLength;
6704
6797
  metadata.data.picture.descriptionLength = drflac__be2host_32_ptr_unaligned(pRunningData); pRunningData += 4;
6705
6798
 
6706
6799
  /* Need space for the rest of the block */
@@ -6708,7 +6801,7 @@ static drflac_bool32 drflac__read_and_decode_metadata(drflac_read_proc onRead, d
6708
6801
  drflac__free_from_callbacks(pRawData, pAllocationCallbacks);
6709
6802
  return DRFLAC_FALSE;
6710
6803
  }
6711
- metadata.data.picture.description = pRunningData; pRunningData += metadata.data.picture.descriptionLength;
6804
+ metadata.data.picture.description = pRunningData; pRunningData += metadata.data.picture.descriptionLength;
6712
6805
  metadata.data.picture.width = drflac__be2host_32_ptr_unaligned(pRunningData); pRunningData += 4;
6713
6806
  metadata.data.picture.height = drflac__be2host_32_ptr_unaligned(pRunningData); pRunningData += 4;
6714
6807
  metadata.data.picture.colorDepth = drflac__be2host_32_ptr_unaligned(pRunningData); pRunningData += 4;
@@ -6791,9 +6884,9 @@ static drflac_bool32 drflac__read_and_decode_metadata(drflac_read_proc onRead, d
6791
6884
  }
6792
6885
  }
6793
6886
 
6794
- *pSeektablePos = seektablePos;
6795
- *pSeektableSize = seektableSize;
6796
- *pFirstFramePos = runningFilePos;
6887
+ *pSeektablePos = seektablePos;
6888
+ *pSeekpointCount = seektableSize / DRFLAC_SEEKPOINT_SIZE_IN_BYTES;
6889
+ *pFirstFramePos = runningFilePos;
6797
6890
 
6798
6891
  return DRFLAC_TRUE;
6799
6892
  }
@@ -7823,11 +7916,11 @@ static drflac* drflac_open_with_metadata_private(drflac_read_proc onRead, drflac
7823
7916
  drflac_uint32 wholeSIMDVectorCountPerChannel;
7824
7917
  drflac_uint32 decodedSamplesAllocationSize;
7825
7918
  #ifndef DR_FLAC_NO_OGG
7826
- drflac_oggbs oggbs;
7919
+ drflac_oggbs* pOggbs = NULL;
7827
7920
  #endif
7828
7921
  drflac_uint64 firstFramePos;
7829
7922
  drflac_uint64 seektablePos;
7830
- drflac_uint32 seektableSize;
7923
+ drflac_uint32 seekpointCount;
7831
7924
  drflac_allocation_callbacks allocationCallbacks;
7832
7925
  drflac* pFlac;
7833
7926
 
@@ -7881,18 +7974,21 @@ static drflac* drflac_open_with_metadata_private(drflac_read_proc onRead, drflac
7881
7974
  /* There's additional data required for Ogg streams. */
7882
7975
  if (init.container == drflac_container_ogg) {
7883
7976
  allocationSize += sizeof(drflac_oggbs);
7884
- }
7885
7977
 
7886
- DRFLAC_ZERO_MEMORY(&oggbs, sizeof(oggbs));
7887
- if (init.container == drflac_container_ogg) {
7888
- oggbs.onRead = onRead;
7889
- oggbs.onSeek = onSeek;
7890
- oggbs.pUserData = pUserData;
7891
- oggbs.currentBytePos = init.oggFirstBytePos;
7892
- oggbs.firstBytePos = init.oggFirstBytePos;
7893
- oggbs.serialNumber = init.oggSerial;
7894
- oggbs.bosPageHeader = init.oggBosHeader;
7895
- oggbs.bytesRemainingInPage = 0;
7978
+ pOggbs = (drflac_oggbs*)drflac__malloc_from_callbacks(sizeof(*pOggbs), &allocationCallbacks);
7979
+ if (pOggbs == NULL) {
7980
+ return NULL; /*DRFLAC_OUT_OF_MEMORY;*/
7981
+ }
7982
+
7983
+ DRFLAC_ZERO_MEMORY(pOggbs, sizeof(*pOggbs));
7984
+ pOggbs->onRead = onRead;
7985
+ pOggbs->onSeek = onSeek;
7986
+ pOggbs->pUserData = pUserData;
7987
+ pOggbs->currentBytePos = init.oggFirstBytePos;
7988
+ pOggbs->firstBytePos = init.oggFirstBytePos;
7989
+ pOggbs->serialNumber = init.oggSerial;
7990
+ pOggbs->bosPageHeader = init.oggBosHeader;
7991
+ pOggbs->bytesRemainingInPage = 0;
7896
7992
  }
7897
7993
  #endif
7898
7994
 
@@ -7901,9 +7997,9 @@ static drflac* drflac_open_with_metadata_private(drflac_read_proc onRead, drflac
7901
7997
  consist of only a single heap allocation. To this, the size of the seek table needs to be known, which we determine when reading
7902
7998
  and decoding the metadata.
7903
7999
  */
7904
- firstFramePos = 42; /* <-- We know we are at byte 42 at this point. */
7905
- seektablePos = 0;
7906
- seektableSize = 0;
8000
+ firstFramePos = 42; /* <-- We know we are at byte 42 at this point. */
8001
+ seektablePos = 0;
8002
+ seekpointCount = 0;
7907
8003
  if (init.hasMetadataBlocks) {
7908
8004
  drflac_read_proc onReadOverride = onRead;
7909
8005
  drflac_seek_proc onSeekOverride = onSeek;
@@ -7913,20 +8009,26 @@ static drflac* drflac_open_with_metadata_private(drflac_read_proc onRead, drflac
7913
8009
  if (init.container == drflac_container_ogg) {
7914
8010
  onReadOverride = drflac__on_read_ogg;
7915
8011
  onSeekOverride = drflac__on_seek_ogg;
7916
- pUserDataOverride = (void*)&oggbs;
8012
+ pUserDataOverride = (void*)pOggbs;
7917
8013
  }
7918
8014
  #endif
7919
8015
 
7920
- if (!drflac__read_and_decode_metadata(onReadOverride, onSeekOverride, onMeta, pUserDataOverride, pUserDataMD, &firstFramePos, &seektablePos, &seektableSize, &allocationCallbacks)) {
8016
+ if (!drflac__read_and_decode_metadata(onReadOverride, onSeekOverride, onMeta, pUserDataOverride, pUserDataMD, &firstFramePos, &seektablePos, &seekpointCount, &allocationCallbacks)) {
8017
+ #ifndef DR_FLAC_NO_OGG
8018
+ drflac__free_from_callbacks(pOggbs, &allocationCallbacks);
8019
+ #endif
7921
8020
  return NULL;
7922
8021
  }
7923
8022
 
7924
- allocationSize += seektableSize;
8023
+ allocationSize += seekpointCount * sizeof(drflac_seekpoint);
7925
8024
  }
7926
8025
 
7927
8026
 
7928
8027
  pFlac = (drflac*)drflac__malloc_from_callbacks(allocationSize, &allocationCallbacks);
7929
8028
  if (pFlac == NULL) {
8029
+ #ifndef DR_FLAC_NO_OGG
8030
+ drflac__free_from_callbacks(pOggbs, &allocationCallbacks);
8031
+ #endif
7930
8032
  return NULL;
7931
8033
  }
7932
8034
 
@@ -7936,8 +8038,12 @@ static drflac* drflac_open_with_metadata_private(drflac_read_proc onRead, drflac
7936
8038
 
7937
8039
  #ifndef DR_FLAC_NO_OGG
7938
8040
  if (init.container == drflac_container_ogg) {
7939
- drflac_oggbs* pInternalOggbs = (drflac_oggbs*)((drflac_uint8*)pFlac->pDecodedSamples + decodedSamplesAllocationSize + seektableSize);
7940
- *pInternalOggbs = oggbs;
8041
+ drflac_oggbs* pInternalOggbs = (drflac_oggbs*)((drflac_uint8*)pFlac->pDecodedSamples + decodedSamplesAllocationSize + (seekpointCount * sizeof(drflac_seekpoint)));
8042
+ DRFLAC_COPY_MEMORY(pInternalOggbs, pOggbs, sizeof(*pOggbs));
8043
+
8044
+ /* At this point the pOggbs object has been handed over to pInternalOggbs and can be freed. */
8045
+ drflac__free_from_callbacks(pOggbs, &allocationCallbacks);
8046
+ pOggbs = NULL;
7941
8047
 
7942
8048
  /* The Ogg bistream needs to be layered on top of the original bitstream. */
7943
8049
  pFlac->bs.onRead = drflac__on_read_ogg;
@@ -7961,7 +8067,7 @@ static drflac* drflac_open_with_metadata_private(drflac_read_proc onRead, drflac
7961
8067
  {
7962
8068
  /* If we have a seektable we need to load it now, making sure we move back to where we were previously. */
7963
8069
  if (seektablePos != 0) {
7964
- pFlac->seekpointCount = seektableSize / sizeof(*pFlac->pSeekpoints);
8070
+ pFlac->seekpointCount = seekpointCount;
7965
8071
  pFlac->pSeekpoints = (drflac_seekpoint*)((drflac_uint8*)pFlac->pDecodedSamples + decodedSamplesAllocationSize);
7966
8072
 
7967
8073
  DRFLAC_ASSERT(pFlac->bs.onSeek != NULL);
@@ -7969,18 +8075,20 @@ static drflac* drflac_open_with_metadata_private(drflac_read_proc onRead, drflac
7969
8075
 
7970
8076
  /* Seek to the seektable, then just read directly into our seektable buffer. */
7971
8077
  if (pFlac->bs.onSeek(pFlac->bs.pUserData, (int)seektablePos, drflac_seek_origin_start)) {
7972
- if (pFlac->bs.onRead(pFlac->bs.pUserData, pFlac->pSeekpoints, seektableSize) == seektableSize) {
7973
- /* Endian swap. */
7974
- drflac_uint32 iSeekpoint;
7975
- for (iSeekpoint = 0; iSeekpoint < pFlac->seekpointCount; ++iSeekpoint) {
8078
+ drflac_uint32 iSeekpoint;
8079
+
8080
+ for (iSeekpoint = 0; iSeekpoint < seekpointCount; iSeekpoint += 1) {
8081
+ if (pFlac->bs.onRead(pFlac->bs.pUserData, pFlac->pSeekpoints + iSeekpoint, DRFLAC_SEEKPOINT_SIZE_IN_BYTES) == DRFLAC_SEEKPOINT_SIZE_IN_BYTES) {
8082
+ /* Endian swap. */
7976
8083
  pFlac->pSeekpoints[iSeekpoint].firstPCMFrame = drflac__be2host_64(pFlac->pSeekpoints[iSeekpoint].firstPCMFrame);
7977
8084
  pFlac->pSeekpoints[iSeekpoint].flacFrameOffset = drflac__be2host_64(pFlac->pSeekpoints[iSeekpoint].flacFrameOffset);
7978
8085
  pFlac->pSeekpoints[iSeekpoint].pcmFrameCount = drflac__be2host_16(pFlac->pSeekpoints[iSeekpoint].pcmFrameCount);
8086
+ } else {
8087
+ /* Failed to read the seektable. Pretend we don't have one. */
8088
+ pFlac->pSeekpoints = NULL;
8089
+ pFlac->seekpointCount = 0;
8090
+ break;
7979
8091
  }
7980
- } else {
7981
- /* Failed to read the seektable. Pretend we don't have one. */
7982
- pFlac->pSeekpoints = NULL;
7983
- pFlac->seekpointCount = 0;
7984
8092
  }
7985
8093
 
7986
8094
  /* We need to seek back to where we were. If this fails it's a critical error. */
@@ -8029,7 +8137,9 @@ static drflac* drflac_open_with_metadata_private(drflac_read_proc onRead, drflac
8029
8137
 
8030
8138
  #ifndef DR_FLAC_NO_STDIO
8031
8139
  #include <stdio.h>
8140
+ #ifndef DR_FLAC_NO_WCHAR
8032
8141
  #include <wchar.h> /* For wcslen(), wcsrtombs() */
8142
+ #endif
8033
8143
 
8034
8144
  /* drflac_result_from_errno() is only used for fopen() and wfopen() so putting it inside DR_WAV_NO_STDIO for now. If something else needs this later we can move it out. */
8035
8145
  #include <errno.h>
@@ -8495,6 +8605,7 @@ fallback, so if you notice your compiler not detecting this properly I'm happy t
8495
8605
  #endif
8496
8606
  #endif
8497
8607
 
8608
+ #ifndef DR_FLAC_NO_WCHAR
8498
8609
  static drflac_result drflac_wfopen(FILE** ppFile, const wchar_t* pFilePath, const wchar_t* pOpenMode, const drflac_allocation_callbacks* pAllocationCallbacks)
8499
8610
  {
8500
8611
  if (ppFile != NULL) {
@@ -8523,10 +8634,23 @@ static drflac_result drflac_wfopen(FILE** ppFile, const wchar_t* pFilePath, cons
8523
8634
  }
8524
8635
  #else
8525
8636
  /*
8526
- Use fopen() on anything other than Windows. Requires a conversion. This is annoying because fopen() is locale specific. The only real way I can
8527
- think of to do this is with wcsrtombs(). Note that wcstombs() is apparently not thread-safe because it uses a static global mbstate_t object for
8528
- maintaining state. I've checked this with -std=c89 and it works, but if somebody get's a compiler error I'll look into improving compatibility.
8637
+ Use fopen() on anything other than Windows. Requires a conversion. This is annoying because
8638
+ fopen() is locale specific. The only real way I can think of to do this is with wcsrtombs(). Note
8639
+ that wcstombs() is apparently not thread-safe because it uses a static global mbstate_t object for
8640
+ maintaining state. I've checked this with -std=c89 and it works, but if somebody get's a compiler
8641
+ error I'll look into improving compatibility.
8529
8642
  */
8643
+
8644
+ /*
8645
+ Some compilers don't support wchar_t or wcsrtombs() which we're using below. In this case we just
8646
+ need to abort with an error. If you encounter a compiler lacking such support, add it to this list
8647
+ and submit a bug report and it'll be added to the library upstream.
8648
+ */
8649
+ #if defined(__DJGPP__)
8650
+ {
8651
+ /* Nothing to do here. This will fall through to the error check below. */
8652
+ }
8653
+ #else
8530
8654
  {
8531
8655
  mbstate_t mbs;
8532
8656
  size_t lenMB;
@@ -8568,6 +8692,7 @@ static drflac_result drflac_wfopen(FILE** ppFile, const wchar_t* pFilePath, cons
8568
8692
 
8569
8693
  drflac__free_from_callbacks(pFilePathMB, pAllocationCallbacks);
8570
8694
  }
8695
+ #endif
8571
8696
 
8572
8697
  if (*ppFile == NULL) {
8573
8698
  return DRFLAC_ERROR;
@@ -8576,6 +8701,7 @@ static drflac_result drflac_wfopen(FILE** ppFile, const wchar_t* pFilePath, cons
8576
8701
 
8577
8702
  return DRFLAC_SUCCESS;
8578
8703
  }
8704
+ #endif
8579
8705
 
8580
8706
  static size_t drflac__on_read_stdio(void* pUserData, void* bufferOut, size_t bytesToRead)
8581
8707
  {
@@ -8608,6 +8734,7 @@ DRFLAC_API drflac* drflac_open_file(const char* pFileName, const drflac_allocati
8608
8734
  return pFlac;
8609
8735
  }
8610
8736
 
8737
+ #ifndef DR_FLAC_NO_WCHAR
8611
8738
  DRFLAC_API drflac* drflac_open_file_w(const wchar_t* pFileName, const drflac_allocation_callbacks* pAllocationCallbacks)
8612
8739
  {
8613
8740
  drflac* pFlac;
@@ -8625,6 +8752,7 @@ DRFLAC_API drflac* drflac_open_file_w(const wchar_t* pFileName, const drflac_all
8625
8752
 
8626
8753
  return pFlac;
8627
8754
  }
8755
+ #endif
8628
8756
 
8629
8757
  DRFLAC_API drflac* drflac_open_file_with_metadata(const char* pFileName, drflac_meta_proc onMeta, void* pUserData, const drflac_allocation_callbacks* pAllocationCallbacks)
8630
8758
  {
@@ -8644,6 +8772,7 @@ DRFLAC_API drflac* drflac_open_file_with_metadata(const char* pFileName, drflac_
8644
8772
  return pFlac;
8645
8773
  }
8646
8774
 
8775
+ #ifndef DR_FLAC_NO_WCHAR
8647
8776
  DRFLAC_API drflac* drflac_open_file_with_metadata_w(const wchar_t* pFileName, drflac_meta_proc onMeta, void* pUserData, const drflac_allocation_callbacks* pAllocationCallbacks)
8648
8777
  {
8649
8778
  drflac* pFlac;
@@ -8661,6 +8790,7 @@ DRFLAC_API drflac* drflac_open_file_with_metadata_w(const wchar_t* pFileName, dr
8661
8790
 
8662
8791
  return pFlac;
8663
8792
  }
8793
+ #endif
8664
8794
  #endif /* DR_FLAC_NO_STDIO */
8665
8795
 
8666
8796
  static size_t drflac__on_read_memory(void* pUserData, void* bufferOut, size_t bytesToRead)
@@ -11928,6 +12058,18 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat
11928
12058
  /*
11929
12059
  REVISION HISTORY
11930
12060
  ================
12061
+ v0.12.39 - 2022-09-17
12062
+ - Fix compilation with DJGPP.
12063
+ - Fix compilation error with Visual Studio 2019 and the ARM build.
12064
+ - Fix an error with SSE 4.1 detection.
12065
+ - Add support for disabling wchar_t with DR_WAV_NO_WCHAR.
12066
+ - Improve compatibility with compilers which lack support for explicit struct packing.
12067
+ - Improve compatibility with low-end and embedded hardware by reducing the amount of stack
12068
+ allocation when loading an Ogg encapsulated file.
12069
+
12070
+ v0.12.38 - 2022-04-10
12071
+ - Fix compilation error on older versions of GCC.
12072
+
11931
12073
  v0.12.37 - 2022-02-12
11932
12074
  - Improve ARM detection.
11933
12075