mirror of https://github.com/nothings/stb.git
Merge branch 'master' of https://github.com/Mojofreem/stb into working
This commit is contained in:
commit
9438a74f83
15
stb.h
15
stb.h
|
@ -208,6 +208,9 @@ Fixes:
|
||||||
#include <stdio.h> // need FILE
|
#include <stdio.h> // need FILE
|
||||||
#include <string.h> // stb_define_hash needs memcpy/memset
|
#include <string.h> // stb_define_hash needs memcpy/memset
|
||||||
#include <time.h> // stb_dirtree
|
#include <time.h> // stb_dirtree
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
#include <fcntl.h> // O_RDWR
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef STB_PERSONAL
|
#ifdef STB_PERSONAL
|
||||||
typedef int Bool;
|
typedef int Bool;
|
||||||
|
@ -1419,7 +1422,7 @@ int stb_is_pow2(unsigned int n)
|
||||||
|
|
||||||
// tricky use of 4-bit table to identify 5 bit positions (note the '-1')
|
// tricky use of 4-bit table to identify 5 bit positions (note the '-1')
|
||||||
// 3-bit table would require another tree level; 5-bit table wouldn't save one
|
// 3-bit table would require another tree level; 5-bit table wouldn't save one
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable: 4035) // disable warning about no return value
|
#pragma warning(disable: 4035) // disable warning about no return value
|
||||||
int stb_log2_floor(unsigned int n)
|
int stb_log2_floor(unsigned int n)
|
||||||
|
@ -5074,7 +5077,7 @@ void stb_fwrite32(FILE *f, stb_uint32 x)
|
||||||
fwrite(&x, 4, 1, f);
|
fwrite(&x, 4, 1, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
#define stb__stat _stat
|
#define stb__stat _stat
|
||||||
#else
|
#else
|
||||||
#define stb__stat stat
|
#define stb__stat stat
|
||||||
|
@ -5414,7 +5417,11 @@ FILE * stb_fopen(char *filename, char *mode)
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
strcpy(temp_full+p, "stmpXXXXXX");
|
strcpy(temp_full+p, "stmpXXXXXX");
|
||||||
int fd = mkstemp(temp_full);
|
#ifdef __MINGW32__
|
||||||
|
int fd = open(mktemp(temp_full), O_RDWR);
|
||||||
|
#else
|
||||||
|
int fd = mkstemp(temp_full);
|
||||||
|
#endif
|
||||||
if (fd == -1) return NULL;
|
if (fd == -1) return NULL;
|
||||||
f = fdopen(fd, mode);
|
f = fdopen(fd, mode);
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
|
@ -7022,7 +7029,7 @@ stb_dirtree *stb_dirtree_get_dir(char *dir, char *cache_dir)
|
||||||
stb_sha1(sha, (unsigned char *) dir_lower, strlen(dir_lower));
|
stb_sha1(sha, (unsigned char *) dir_lower, strlen(dir_lower));
|
||||||
strcpy(cache_file, cache_dir);
|
strcpy(cache_file, cache_dir);
|
||||||
s = cache_file + strlen(cache_file);
|
s = cache_file + strlen(cache_file);
|
||||||
if (s[-1] != '//' && s[-1] != '\\') *s++ = '/';
|
if (s[-1] != '/' && s[-1] != '\\') *s++ = '/';
|
||||||
strcpy(s, "dirtree_");
|
strcpy(s, "dirtree_");
|
||||||
s += strlen(s);
|
s += strlen(s);
|
||||||
for (i=0; i < 8; ++i) {
|
for (i=0; i < 8; ++i) {
|
||||||
|
|
Loading…
Reference in New Issue