Skip to content
Myr

Tweaked to enable compilation under MinGW.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Liam Chasteen · committed by Liam Chasteen · parent b53c08a · Browse files · 1 file+11 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+11 added−4 removed

  • other:+11 added−4 removed

1 file+11 added−4 removed

modified:stb.h+11 added-4 removed
188 unmodified lines
189#include <stdlib.h> // stdlib could have min/max190#include <stdio.h> // need FILE191#include <string.h> // stb_define_hash needs memcpy/memset192#include <time.h> // stb_dirtree193#ifdef __MINGW32__194 #include <fcntl.h> // O_RDWR195#endif196197#ifdef STB_PERSONAL198 typedef int Bool;199 #define False 0
1197 unmodified lines
1397}13981399// tricky use of 4-bit table to identify 5 bit positions (note the '-1')1400// 3-bit table would require another tree level; 5-bit table wouldn't save one1398#ifdef _WIN321401#if defined(_WIN32) && !defined(__MINGW32__)1402#pragma warning(push)1403#pragma warning(disable: 4035) // disable warning about no return value1404int stb_log2_floor(unsigned int n)1405{
3645 unmodified lines
5051{5052 fwrite(&x, 4, 1, f);5053}50545052#ifdef _MSC_VER5055#if defined(_MSC_VER) || defined(__MINGW32__)5056 #define stb__stat _stat5057#else5058 #define stb__stat stat5059#endif
331 unmodified lines
5391 }5392 #else5393 {5394 strcpy(temp_full+p, "stmpXXXXXX");5395 #ifdef __MINGW32__5396 int fd = open(mktemp(temp_full), O_RDWR);5397 #else5392 int fd = mkstemp(temp_full);5398 int fd = mkstemp(temp_full);5399 #endif5400 if (fd == -1) return NULL;5401 f = fdopen(fd, mode);5402 if (f == NULL) {5403 unlink(temp_full);
1590 unmodified lines
6994 stb_tolower(dir_lower);6995 stb_sha1(sha, (unsigned char *) dir_lower, strlen(dir_lower));6996 strcpy(cache_file, cache_dir);6997 s = cache_file + strlen(cache_file);6991 if (s[-1] != '//' && s[-1] != '\\') *s++ = '/';6998 if (s[-1] != '/' && s[-1] != '\\') *s++ = '/';6999 strcpy(s, "dirtree_");7000 s += strlen(s);7001 for (i=0; i < 8; ++i) {7002 char *hex = "0123456789abcdef";
7091 unmodified lines