stb.h swprintf fix
This commit is contained in:
parent
a81422cd80
commit
b1a0089c4b
59
stb.h
59
stb.h
@ -1,4 +1,4 @@
|
|||||||
/* stb.h - v2.28 - Sean's Tool Box -- public domain -- http://nothings.org/stb.h
|
/* stb.h - v2.29 - Sean's Tool Box -- public domain -- http://nothings.org/stb.h
|
||||||
no warranty is offered or implied; use this code at your own risk
|
no warranty is offered or implied; use this code at your own risk
|
||||||
|
|
||||||
This is a single header file with a bunch of useful utilities
|
This is a single header file with a bunch of useful utilities
|
||||||
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
Version History
|
Version History
|
||||||
|
|
||||||
|
2.29 attempt to fix use of swprintf()
|
||||||
2.28 various new functionality
|
2.28 various new functionality
|
||||||
2.27 test _WIN32 not WIN32 in STB_THREADS
|
2.27 test _WIN32 not WIN32 in STB_THREADS
|
||||||
2.26 various warning & bugfixes
|
2.26 various warning & bugfixes
|
||||||
@ -173,9 +174,7 @@ Parenthesized items have since been removed.
|
|||||||
|
|
||||||
LICENSE
|
LICENSE
|
||||||
|
|
||||||
This software is dual-licensed to the public domain and under the following
|
See end of file for license information.
|
||||||
license: you are granted a perpetual, irrevocable license to copy, modify,
|
|
||||||
publish, and distribute this file as you see fit.
|
|
||||||
|
|
||||||
CREDITS
|
CREDITS
|
||||||
|
|
||||||
@ -6948,10 +6947,19 @@ static void stb__dirtree_scandir(char *path, time_t last_time, stb_dirtree *acti
|
|||||||
if (stb__showfile) printf("<");
|
if (stb__showfile) printf("<");
|
||||||
|
|
||||||
has_slash = (path[0] && path[strlen(path)-1] == '/');
|
has_slash = (path[0] && path[strlen(path)-1] == '/');
|
||||||
|
|
||||||
|
// @TODO: do this concatenation without using swprintf to avoid this mess:
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER < 1400
|
||||||
if (has_slash)
|
if (has_slash)
|
||||||
swprintf(full_path, L"%s*", stb__from_utf8(path));
|
swprintf(full_path, L"%s*", stb__from_utf8(path));
|
||||||
else
|
else
|
||||||
swprintf(full_path, L"%s/*", stb__from_utf8(path));
|
swprintf(full_path, L"%s/*", stb__from_utf8(path));
|
||||||
|
#else
|
||||||
|
if (has_slash)
|
||||||
|
swprintf(full_path, 1024, L"%s*", stb__from_utf8(path));
|
||||||
|
else
|
||||||
|
swprintf(full_path, 1024, L"%s/*", stb__from_utf8(path));
|
||||||
|
#endif
|
||||||
|
|
||||||
// it's possible this directory is already present: that means it was in the
|
// it's possible this directory is already present: that means it was in the
|
||||||
// cache, but its parent wasn't... in that case, we're done with it
|
// cache, but its parent wasn't... in that case, we're done with it
|
||||||
@ -14268,10 +14276,49 @@ void stua_run_script(char *s)
|
|||||||
stua_gc(1);
|
stua_gc(1);
|
||||||
}
|
}
|
||||||
#endif // STB_DEFINE
|
#endif // STB_DEFINE
|
||||||
|
|
||||||
#endif // STB_STUA
|
#endif // STB_STUA
|
||||||
|
|
||||||
|
|
||||||
#undef STB_EXTERN
|
#undef STB_EXTERN
|
||||||
#endif // STB_INCLUDE_STB_H
|
#endif // STB_INCLUDE_STB_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
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 New Issue
Block a user