tests: 64-bit fixes, fix typo in image tests
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 · parent 27460c2 · Browse files · 3 files·+16 added−10 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+16 added−10 removed
- tests:+16 added−10 removed
Provenance
- Commit
a28a6b1- Tree
3bef0e9- Author
Sean Barrett <sean@nothings.org>- Committer
Sean Barrett <sean@nothings.org>- Parent
27460c2
3 files changed+16 added−10 removed
modified:tests/image_test.c+1 added-1 removed
82 unmodified lines83 int res;84 int w2,h2,n2;85 unsigned char *data;86 printf("%s\n", argv[i]);87- res = stbi_info(argv[1], &w2, &h2, &n2);87+ res = stbi_info(argv[i], &w2, &h2, &n2);88 data = stbi_load(argv[i], &w, &h, &n, 4); if (data) free(data); else printf("Failed &n\n");89 data = stbi_load(argv[i], &w, &h, 0, 1); if (data) free(data); else printf("Failed 1\n");90 data = stbi_load(argv[i], &w, &h, 0, 2); if (data) free(data); else printf("Failed 2\n");91 data = stbi_load(argv[i], &w, &h, 0, 3); if (data) free(data); else printf("Failed 3\n");75 unmodified linesmodified:tests/stb_cpp.cpp+2 added-1 removed
1 #define WIN32_MEAN_AND_LEAN2 #define WIN32_LEAN_AND_MEAN3 //#include <windows.h>4 #include <conio.h>5-#define STB_STUA5 #define STB_DEFINE6+#ifndef _M_AMD647 #define STB_NPTR8+#endif9 #define STB_ONLY10 #include "stb.h"11 //#include "stb_file.h"12 71 unmodified linesmodified:tests/stb.c+13 added-8 removed
11 unmodified lines12 #ifdef _WIN3213 #include <crtdbg.h>14 #endif15 16-#define STB_STUA16 //#define STB_FASTMALLOC17 #ifdef _DEBUG18 #define STB_MALLOC_WRAPPER_DEBUG19 #endif20+#ifndef _M_AMD6421 #define STB_NPTR22+#endif23 #define STB_DEFINE24 #include "stb.h"25 26 //#include "stb_file.h"92 unmodified lines119 120 return;121 }122 122-123+#ifdef STB_STUA124 void test_script(void)125 {126 stua_run_script(127 "var g = (2+3)*5 + 3*(2+1) + ((7)); \n"65 unmodified lines193 " sprint(-5); \n"194 " // final comment with no newline"195 );196 }197+#endif198 199 #ifdef STB_THREADS200 extern void __stdcall Sleep(unsigned long);201 2053 unmodified lines2255 2256 void do_compressor(int argc,char**argv)2257 {2258 char *p;2259+ size_t slen;2260 int len;2261 2262 int window;2263 if (argc == 2) {2261- p = stb_file(argv[1], &len);2264+ p = stb_file(argv[1], &slen);2265+ len = (int) slen;2266 if (p) {2267 int dlen, clen = stb_compress_tofile("data/dummy.bin", p, len);2268 char *q = stb_decompress_fromfile("data/dummy.bin", &dlen);2269 11 unmodified lines2281 }2282 2283 window = atoi(argv[1]);2284 if (window && argc == 4) {2281- p = stb_file(argv[3], &len);2285+ p = stb_file(argv[3], &slen);2286+ len = (int) slen;2287 if (p) {2288 stb_compress_hashsize(window);2289 stb_compress_tofile(argv[2], p, len);2290 }219 unmodified lines2510 }2511 stb_bitset_unioneq_changed(out, first[symbol], symset);2512 }2513 2509-#define Item(p,c,t) ((void *) (((t) << 18) + ((c) << 12) + ((p) << 2)))2510-#define ItemProd(i) ((((uint32) (i)) >> 2) & 1023)2511-#define ItemCursor(i) ((((uint32) (i)) >> 12) & 63)2512-#define ItemLookahead(i) (((uint32) (i)) >> 18)2514+#define Item(p,c,t) ((void *) (size_t) (((t) << 18) + ((c) << 12) + ((p) << 2)))2515+#define ItemProd(i) ((((uint32) (size_t) (i)) >> 2) & 1023)2516+#define ItemCursor(i) ((((uint32) (size_t) (i)) >> 12) & 63)2517+#define ItemLookahead(i) (((uint32) (size_t) (i)) >> 18)2518 2519 static void pc(stb_ps *p)2520 {2521 }807 unmodified lines