stb: Update to upstream stb_truetype 1.17 and stb_vorbis 1.11
Also fix documented OpenSSL version, it was updated to 1.0.2l in
67305d1b0a
.
This commit is contained in:
parent
ee1d0179c5
commit
560fc0f199
3 changed files with 1477 additions and 128 deletions
6
thirdparty/README.md
vendored
6
thirdparty/README.md
vendored
|
@ -247,18 +247,18 @@ Collection of single-file libraries used in Godot components.
|
|||
* License: zlib
|
||||
- `stb_truetype.h`
|
||||
* Upstream: https://github.com/nothings/stb
|
||||
* Version: 1.11
|
||||
* Version: 1.17
|
||||
* License: Public Domain (Unlicense) or MIT
|
||||
- `stb_vorbis.c`
|
||||
* Upstream: https://github.com/nothings/stb
|
||||
* Version: 1.09
|
||||
* Version: 1.11
|
||||
* License: Public Domain (Unlicense) or MIT
|
||||
|
||||
|
||||
## openssl
|
||||
|
||||
- Upstream: https://www.openssl.org
|
||||
- Version: 1.0.2h
|
||||
- Version: 1.0.2l
|
||||
- License: OpenSSL license / BSD-like
|
||||
|
||||
Files extracted from the upstream source:
|
||||
|
|
1485
thirdparty/misc/stb_truetype.h
vendored
1485
thirdparty/misc/stb_truetype.h
vendored
File diff suppressed because it is too large
Load diff
114
thirdparty/misc/stb_vorbis.c
vendored
114
thirdparty/misc/stb_vorbis.c
vendored
|
@ -1,4 +1,4 @@
|
|||
// Ogg Vorbis audio decoder - v1.09 - public domain
|
||||
// Ogg Vorbis audio decoder - v1.11 - public domain
|
||||
// http://nothings.org/stb_vorbis/
|
||||
//
|
||||
// Original version written by Sean Barrett in 2007.
|
||||
|
@ -9,12 +9,7 @@
|
|||
//
|
||||
// LICENSE
|
||||
//
|
||||
// This software is dual-licensed to the public domain and under the following
|
||||
// license: you are granted a perpetual, irrevocable license to copy, modify,
|
||||
// publish, and distribute this file as you see fit.
|
||||
//
|
||||
// No warranty for any purpose is expressed or implied by the author (nor
|
||||
// by RAD Game Tools). Report bugs and send enhancements to the author.
|
||||
// See end of file for license information.
|
||||
//
|
||||
// Limitations:
|
||||
//
|
||||
|
@ -34,9 +29,11 @@
|
|||
// Bernhard Wodo Evan Balster alxprd@github
|
||||
// Tom Beaumont Ingo Leitgeb Nicolas Guillemot
|
||||
// Phillip Bennefall Rohit Thiago Goulart
|
||||
// manxorist@github saga musix
|
||||
// manxorist@github saga musix github:infatum
|
||||
//
|
||||
// Partial history:
|
||||
// 1.11 - 2017/07/23 - fix MinGW compilation
|
||||
// 1.10 - 2017/03/03 - more robust seeking; fix negative ilog(); clear error in open_memory
|
||||
// 1.09 - 2016/04/04 - back out 'truncation of last frame' fix from previous version
|
||||
// 1.08 - 2016/04/02 - warnings; setup memory leaks; truncation of last frame
|
||||
// 1.07 - 2015/01/16 - fixes for crashes on invalid files; warning fixes; const
|
||||
|
@ -275,7 +272,7 @@ extern int stb_vorbis_seek(stb_vorbis *f, unsigned int sample_number);
|
|||
// do not need to seek to EXACTLY the target sample when using get_samples_*,
|
||||
// you can also use seek_frame().
|
||||
|
||||
extern void stb_vorbis_seek_start(stb_vorbis *f);
|
||||
extern int stb_vorbis_seek_start(stb_vorbis *f);
|
||||
// this function is equivalent to stb_vorbis_seek(f,0)
|
||||
|
||||
extern unsigned int stb_vorbis_stream_length_in_samples(stb_vorbis *f);
|
||||
|
@ -555,7 +552,7 @@ enum STBVorbisError
|
|||
#include <math.h>
|
||||
|
||||
// find definition of alloca if it's not in stdlib.h:
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#if defined(__linux__) || defined(__linux) || defined(__EMSCRIPTEN__)
|
||||
|
@ -580,6 +577,7 @@ enum STBVorbisError
|
|||
#undef __forceinline
|
||||
#endif
|
||||
#define __forceinline
|
||||
#define alloca __builtin_alloca
|
||||
#elif !defined(_MSC_VER)
|
||||
#if __GNUC__
|
||||
#define __forceinline inline
|
||||
|
@ -986,17 +984,18 @@ static int ilog(int32 n)
|
|||
{
|
||||
static signed char log2_4[16] = { 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4 };
|
||||
|
||||
if (n < 0) return 0; // signed n returns 0
|
||||
|
||||
// 2 compares if n < 16, 3 compares otherwise (4 if signed or n > 1<<29)
|
||||
if (n < (1 << 14))
|
||||
if (n < (1 << 4)) return 0 + log2_4[n ];
|
||||
else if (n < (1 << 9)) return 5 + log2_4[n >> 5];
|
||||
if (n < (1 << 4)) return 0 + log2_4[n ];
|
||||
else if (n < (1 << 9)) return 5 + log2_4[n >> 5];
|
||||
else return 10 + log2_4[n >> 10];
|
||||
else if (n < (1 << 24))
|
||||
if (n < (1 << 19)) return 15 + log2_4[n >> 15];
|
||||
if (n < (1 << 19)) return 15 + log2_4[n >> 15];
|
||||
else return 20 + log2_4[n >> 20];
|
||||
else if (n < (1 << 29)) return 25 + log2_4[n >> 25];
|
||||
else if (n < (1 << 31)) return 30 + log2_4[n >> 30];
|
||||
else return 0; // signed n returns 0
|
||||
else if (n < (1 << 29)) return 25 + log2_4[n >> 25];
|
||||
else return 30 + log2_4[n >> 30];
|
||||
}
|
||||
|
||||
#ifndef M_PI
|
||||
|
@ -1269,13 +1268,13 @@ static void neighbors(uint16 *x, int n, int *plow, int *phigh)
|
|||
// this has been repurposed so y is now the original index instead of y
|
||||
typedef struct
|
||||
{
|
||||
uint16 x,y;
|
||||
} Point;
|
||||
uint16 x,id;
|
||||
} stbv__floor_ordering;
|
||||
|
||||
static int STBV_CDECL point_compare(const void *p, const void *q)
|
||||
{
|
||||
Point *a = (Point *) p;
|
||||
Point *b = (Point *) q;
|
||||
stbv__floor_ordering *a = (stbv__floor_ordering *) p;
|
||||
stbv__floor_ordering *b = (stbv__floor_ordering *) q;
|
||||
return a->x < b->x ? -1 : a->x > b->x;
|
||||
}
|
||||
|
||||
|
@ -3484,11 +3483,13 @@ static int vorbis_finish_frame(stb_vorbis *f, int len, int left, int right)
|
|||
return right - left;
|
||||
}
|
||||
|
||||
static void vorbis_pump_first_frame(stb_vorbis *f)
|
||||
static int vorbis_pump_first_frame(stb_vorbis *f)
|
||||
{
|
||||
int len, right, left;
|
||||
if (vorbis_decode_packet(f, &len, &left, &right))
|
||||
int len, right, left, res;
|
||||
res = vorbis_decode_packet(f, &len, &left, &right);
|
||||
if (res)
|
||||
vorbis_finish_frame(f, len, left, right);
|
||||
return res;
|
||||
}
|
||||
|
||||
#ifndef STB_VORBIS_NO_PUSHDATA_API
|
||||
|
@ -3871,7 +3872,7 @@ static int start_decoder(vorb *f)
|
|||
g->book_list[j] = get_bits(f,8);
|
||||
return error(f, VORBIS_feature_not_supported);
|
||||
} else {
|
||||
Point p[31*8+2];
|
||||
stbv__floor_ordering p[31*8+2];
|
||||
Floor1 *g = &f->floor_config[i].floor1;
|
||||
int max_class = -1;
|
||||
g->partitions = get_bits(f, 5);
|
||||
|
@ -3907,11 +3908,11 @@ static int start_decoder(vorb *f)
|
|||
// precompute the sorting
|
||||
for (j=0; j < g->values; ++j) {
|
||||
p[j].x = g->Xlist[j];
|
||||
p[j].y = j;
|
||||
p[j].id = j;
|
||||
}
|
||||
qsort(p, g->values, sizeof(p[0]), point_compare);
|
||||
for (j=0; j < g->values; ++j)
|
||||
g->sorted_order[j] = (uint8) p[j].y;
|
||||
g->sorted_order[j] = (uint8) p[j].id;
|
||||
// precompute the neighbors
|
||||
for (j=2; j < g->values; ++j) {
|
||||
int low,hi;
|
||||
|
@ -4615,8 +4616,9 @@ static int seek_to_sample_coarse(stb_vorbis *f, uint32 sample_number)
|
|||
|
||||
// starting from the start is handled differently
|
||||
if (sample_number <= left.last_decoded_sample) {
|
||||
stb_vorbis_seek_start(f);
|
||||
return 1;
|
||||
if (stb_vorbis_seek_start(f))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (left.page_end != right.page_start) {
|
||||
|
@ -4717,7 +4719,10 @@ static int seek_to_sample_coarse(stb_vorbis *f, uint32 sample_number)
|
|||
skip(f, f->segments[i]);
|
||||
|
||||
// start decoding (optimizable - this frame is generally discarded)
|
||||
vorbis_pump_first_frame(f);
|
||||
if (!vorbis_pump_first_frame(f))
|
||||
return 0;
|
||||
if (f->current_loc > sample_number)
|
||||
return error(f, VORBIS_seek_failed);
|
||||
return 1;
|
||||
|
||||
error:
|
||||
|
@ -4808,14 +4813,14 @@ int stb_vorbis_seek(stb_vorbis *f, unsigned int sample_number)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void stb_vorbis_seek_start(stb_vorbis *f)
|
||||
int stb_vorbis_seek_start(stb_vorbis *f)
|
||||
{
|
||||
if (IS_PUSH_MODE(f)) { error(f, VORBIS_invalid_api_mixing); return; }
|
||||
if (IS_PUSH_MODE(f)) { return error(f, VORBIS_invalid_api_mixing); }
|
||||
set_file_offset(f, f->first_audio_page_offset);
|
||||
f->previous_length = 0;
|
||||
f->first_decode = TRUE;
|
||||
f->next_seg = -1;
|
||||
vorbis_pump_first_frame(f);
|
||||
return vorbis_pump_first_frame(f);
|
||||
}
|
||||
|
||||
unsigned int stb_vorbis_stream_length_in_samples(stb_vorbis *f)
|
||||
|
@ -4980,6 +4985,7 @@ stb_vorbis * stb_vorbis_open_memory(const unsigned char *data, int len, int *err
|
|||
if (f) {
|
||||
*f = p;
|
||||
vorbis_pump_first_frame(f);
|
||||
if (error) *error = VORBIS__no_error;
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
@ -5345,6 +5351,7 @@ int stb_vorbis_get_samples_float(stb_vorbis *f, int channels, float **buffer, in
|
|||
#endif // STB_VORBIS_NO_PULLDATA_API
|
||||
|
||||
/* Version history
|
||||
1.10 - 2017/03/03 - more robust seeking; fix negative ilog(); clear error in open_memory
|
||||
1.09 - 2016/04/04 - back out 'avoid discarding last frame' fix from previous version
|
||||
1.08 - 2016/04/02 - fixed multiple warnings; fix setup memory leaks;
|
||||
avoid discarding last frame of audio data
|
||||
|
@ -5397,3 +5404,46 @@ int stb_vorbis_get_samples_float(stb_vorbis *f, int channels, float **buffer, in
|
|||
*/
|
||||
|
||||
#endif // STB_VORBIS_HEADER_ONLY
|
||||
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
This software is available under 2 licenses -- choose whichever you prefer.
|
||||
------------------------------------------------------------------------------
|
||||
ALTERNATIVE A - MIT License
|
||||
Copyright (c) 2017 Sean Barrett
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
------------------------------------------------------------------------------
|
||||
ALTERNATIVE B - Public Domain (www.unlicense.org)
|
||||
This is free and unencumbered software released into the public domain.
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
|
||||
software, either in source code form or as a compiled binary, for any purpose,
|
||||
commercial or non-commercial, and by any means.
|
||||
In jurisdictions that recognize copyright laws, the author or authors of this
|
||||
software dedicate any and all copyright interest in the software to the public
|
||||
domain. We make this dedication for the benefit of the public at large and to
|
||||
the detriment of our heirs and successors. We intend this dedication to be an
|
||||
overt act of relinquishment in perpetuity of all present and future rights to
|
||||
this software under copyright law.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue