Update decoder

This commit is contained in:
Sean Barrett
2020-06-21 22:23:26 -04:00
committed by Wengier
parent 95d14646cb
commit d483891365

View File

@@ -7,7 +7,6 @@
Documentation: http://nothings.org/stb/stb_h.html
Unit tests: http://nothings.org/stb/stb.c
============================================================================
You MUST
@@ -22,9 +21,9 @@
All other files should just #include "stb.h" without the #define.
============================================================================
Version History
2.36 various fixes
2.35 fix clang-cl issues with swprintf
2.34 fix warnings
2.33 more fixes to random numbers
@@ -200,6 +199,7 @@ CREDITS
github:infatum
Dave Butler (Croepha)
Ethan Lee (flibitijibibo)
Brian Collins
*/
#include <stdarg.h>
@@ -2008,7 +2008,7 @@ char *stb_trimwhite(char *s)
char *stb_strncpy(char *s, char *t, int n)
{
stb_p_strncpy_s(s,n+1,t,n);
s[n-1] = 0;
s[n] = 0;
return s;
}
@@ -2439,7 +2439,7 @@ static char *stb__splitpath_raw(char *buffer, char *path, int flag)
} else {
x = f2;
if (flag & STB_EXT_NO_PERIOD)
if (buffer[x] == '.')
if (path[x] == '.')
++x;
}
@@ -2455,9 +2455,8 @@ static char *stb__splitpath_raw(char *buffer, char *path, int flag)
if (!buffer) return NULL;
}
if (len) { stb_p_strcpy_s(buffer, sizeof(buffer), "./"); return buffer; }
stb_p_strncpy_s(buffer, sizeof(buffer),path+x, y-x);
buffer[y-x] = 0;
if (len) { stb_p_strcpy_s(buffer, 3, "./"); return buffer; }
stb_strncpy(buffer, path+(int)x, (int)(y-x));
return buffer;
}
@@ -3209,13 +3208,13 @@ typedef struct
#define stb_arr_addn(a,n) (stb_arr__addn((a),n),(a)+stb_arr_len(a)-(n))
// add N new uninitialized elements starting at index 'i'
#define stb_arr_insertn(a,i,n) (stb__arr_insertn((void **) &(a), sizeof(*a), i, n))
#define stb_arr_insertn(a,i,n) (stb__arr_insertn((void **) &(a), sizeof(*a), (i), (n)))
// insert an element at i
#define stb_arr_insert(a,i,v) (stb__arr_insertn((void **) &(a), sizeof(*a), i, 1), ((a)[i] = v))
#define stb_arr_insert(a,i,v) (stb__arr_insertn((void **) &(a), sizeof(*a), (i), (1)), ((a)[i] = v))
// delete N elements from the middle starting at index 'i'
#define stb_arr_deleten(a,i,n) (stb__arr_deleten((void **) &(a), sizeof(*a), i, n))
#define stb_arr_deleten(a,i,n) (stb__arr_deleten((void **) &(a), sizeof(*a), (i), (n)))
// delete the i'th element
#define stb_arr_delete(a,i) stb_arr_deleten(a,i,1)
@@ -3564,6 +3563,7 @@ unsigned int stb_hash_number(unsigned int hash)
#endif
#ifdef STB_PERFECT_HASH
//////////////////////////////////////////////////////////////////////////////
//
// Perfect hashing for ints/pointers
@@ -3860,6 +3860,7 @@ int stb_ischar(char c, char *set)
return tables[z >> 3][(unsigned char) c] & bit[z & 7];
}
#endif
#endif
//////////////////////////////////////////////////////////////////////////////
@@ -10038,6 +10039,7 @@ int stb_lex(stb_matcher *m, char *str, int *len)
return stb__matcher_dfa(m, str, len);
}
#ifdef STB_PERFECT_HASH
int stb_regex(char *regex, char *str)
{
static stb_perfect p;
@@ -10081,7 +10083,7 @@ int stb_regex(char *regex, char *str)
}
return stb_matcher_find(matchers[(int) mapping[z]], str);
}
#endif
#endif // STB_DEFINE