tests: 64-bit fixes, fix typo in image tests

This commit is contained in:
Sean Barrett 2019-02-07 04:42:32 -08:00
parent 27460c23a6
commit a28a6b126b
3 changed files with 16 additions and 10 deletions

View File

@ -84,7 +84,7 @@ int main(int argc, char **argv)
int w2,h2,n2;
unsigned char *data;
printf("%s\n", argv[i]);
res = stbi_info(argv[1], &w2, &h2, &n2);
res = stbi_info(argv[i], &w2, &h2, &n2);
data = stbi_load(argv[i], &w, &h, &n, 4); if (data) free(data); else printf("Failed &n\n");
data = stbi_load(argv[i], &w, &h, 0, 1); if (data) free(data); else printf("Failed 1\n");
data = stbi_load(argv[i], &w, &h, 0, 2); if (data) free(data); else printf("Failed 2\n");

View File

@ -13,12 +13,13 @@
#include <crtdbg.h>
#endif
#define STB_STUA
//#define STB_FASTMALLOC
#ifdef _DEBUG
#define STB_MALLOC_WRAPPER_DEBUG
#endif
#ifndef _M_AMD64
#define STB_NPTR
#endif
#define STB_DEFINE
#include "stb.h"
@ -119,7 +120,7 @@ void test_classes(void)
return;
}
#ifdef STB_STUA
void test_script(void)
{
stua_run_script(
@ -193,6 +194,7 @@ void test_script(void)
" // final comment with no newline"
);
}
#endif
#ifdef STB_THREADS
extern void __stdcall Sleep(unsigned long);
@ -2254,11 +2256,13 @@ void test_packed_floats(void)
void do_compressor(int argc,char**argv)
{
char *p;
size_t slen;
int len;
int window;
if (argc == 2) {
p = stb_file(argv[1], &len);
p = stb_file(argv[1], &slen);
len = (int) slen;
if (p) {
int dlen, clen = stb_compress_tofile("data/dummy.bin", p, len);
char *q = stb_decompress_fromfile("data/dummy.bin", &dlen);
@ -2278,7 +2282,8 @@ void do_compressor(int argc,char**argv)
window = atoi(argv[1]);
if (window && argc == 4) {
p = stb_file(argv[3], &len);
p = stb_file(argv[3], &slen);
len = (int) slen;
if (p) {
stb_compress_hashsize(window);
stb_compress_tofile(argv[2], p, len);
@ -2506,10 +2511,10 @@ void first_for_prod_plus_sym(stb_bitset **first, stb_bitset *out, short *prod, i
stb_bitset_unioneq_changed(out, first[symbol], symset);
}
#define Item(p,c,t) ((void *) (((t) << 18) + ((c) << 12) + ((p) << 2)))
#define ItemProd(i) ((((uint32) (i)) >> 2) & 1023)
#define ItemCursor(i) ((((uint32) (i)) >> 12) & 63)
#define ItemLookahead(i) (((uint32) (i)) >> 18)
#define Item(p,c,t) ((void *) (size_t) (((t) << 18) + ((c) << 12) + ((p) << 2)))
#define ItemProd(i) ((((uint32) (size_t) (i)) >> 2) & 1023)
#define ItemCursor(i) ((((uint32) (size_t) (i)) >> 12) & 63)
#define ItemLookahead(i) (((uint32) (size_t) (i)) >> 18)
static void pc(stb_ps *p)
{

View File

@ -2,9 +2,10 @@
#define WIN32_LEAN_AND_MEAN
//#include <windows.h>
#include <conio.h>
#define STB_STUA
#define STB_DEFINE
#ifndef _M_AMD64
#define STB_NPTR
#endif
#define STB_ONLY
#include "stb.h"
//#include "stb_file.h"