Skip to content
Myr

Merge branch 'master' of https://github.com/Mojofreem/stb into working

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

authored by Sean Barrett · committed by Sean Barrett · parents 5583b62, 65ebe75 · 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
206 unmodified lines
207#include <stdlib.h> // stdlib could have min/max208#include <stdio.h> // need FILE209#include <string.h> // stb_define_hash needs memcpy/memset210#include <time.h> // stb_dirtree211#ifdef __MINGW32__212 #include <fcntl.h> // O_RDWR213#endif214215#ifdef STB_PERSONAL216 typedef int Bool;217 #define False 0
1203 unmodified lines
1421}14221423// tricky use of 4-bit table to identify 5 bit positions (note the '-1')1424// 3-bit table would require another tree level; 5-bit table wouldn't save one1422#ifdef _WIN321425#if defined(_WIN32) && !defined(__MINGW32__)1426#pragma warning(push)1427#pragma warning(disable: 4035) // disable warning about no return value1428int stb_log2_floor(unsigned int n)1429{
3646 unmodified lines
5076{5077 fwrite(&x, 4, 1, f);5078}50795077#ifdef _MSC_VER5080#if defined(_MSC_VER) || defined(__MINGW32__)5081 #define stb__stat _stat5082#else5083 #define stb__stat stat5084#endif
331 unmodified lines
5416 }5417 #else5418 {5419 strcpy(temp_full+p, "stmpXXXXXX");5420 #ifdef __MINGW32__5421 int fd = open(mktemp(temp_full), O_RDWR);5422 #else5417 int fd = mkstemp(temp_full);5423 int fd = mkstemp(temp_full);5424 #endif5425 if (fd == -1) return NULL;5426 f = fdopen(fd, mode);5427 if (f == NULL) {5428 unlink(temp_full);
1599 unmodified lines
7028 stb_tolower(dir_lower);7029 stb_sha1(sha, (unsigned char *) dir_lower, strlen(dir_lower));7030 strcpy(cache_file, cache_dir);7031 s = cache_file + strlen(cache_file);7025 if (s[-1] != '//' && s[-1] != '\\') *s++ = '/';7032 if (s[-1] != '/' && s[-1] != '\\') *s++ = '/';7033 strcpy(s, "dirtree_");7034 s += strlen(s);7035 for (i=0; i < 8; ++i) {7036 char *hex = "0123456789abcdef";
7089 unmodified lines