Implement the rest of #14; close #14

This commit is contained in:
Alcaro
2018-09-17 12:14:34 +02:00
parent 242a0bc9ac
commit 49851a2972
3 changed files with 11 additions and 8 deletions

View File

@@ -6,10 +6,12 @@
#include "flips.h"
#include "crc32.h"
//get rid of dependencies on libstdc++, they eat 200KB on Windows
#ifdef __MINGW32__
//get rid of dependencies on libstdc++, they waste 200KB on this platform
void* operator new(size_t n) { return malloc(n); } // forget allocation failures, let them segfault.
void operator delete(void * p) { free(p); }
extern "C" void __cxa_pure_virtual() { while(1); }
extern "C" void __cxa_pure_virtual() { abort(); }
#endif
//TODO: delete
@@ -449,7 +451,8 @@ config::~config()
{
LPWSTR data = this->flatten();
//puts(data);
filewrite::write(this->filename, (struct mem){ (uint8_t*)data, wcslen(data)*sizeof(WCHAR) });
struct mem m = { (uint8_t*)data, wcslen(data)*sizeof(WCHAR) };
filewrite::write(this->filename, m);
free(data);
free(this->filename);
}

View File

@@ -48,7 +48,7 @@ public:
virtual size_t len() = 0;
virtual const uint8_t * ptr() = 0;
struct mem get() { return (struct mem){ (uint8_t*)ptr(), len() }; }
struct mem get() { struct mem m = { (uint8_t*)ptr(), len() }; return m; }
virtual ~filemap() {}
};

View File

@@ -1,5 +1,6 @@
::This script creates a heavily optimized binary. For debugging, you're better off using 'mingw32-make'.
::Feel free to point this elsewhere.
call "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat"
::call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat"
::call "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat"
@@ -25,13 +26,12 @@ if exist flips.exe goto h
::/TP - force C++ because void foo(int bar = 0); is syntax error in C
::/MT - use static msvcrt
::/GL - LTCG
::/openmp - enable OpenMP
::cl /c /Oy /Oi /Os /Ox /EHs-c- /Gz /D_CRT_SECURE_NO_WARNINGS /WX /wd4700 /nologo /TP /MT /GL *.cpp *.c
rem /openmp
::/openmp - enable OpenMP (adds an extra DLL, so let's not)
cl /c /Oy /Oi /Os /Ox /EHs-c- /Gz /D_CRT_SECURE_NO_WARNINGS /WX /wd4700 /nologo /TP /MT /GL /Imsvc ^
/DUSE_DIVSUFSORT /Ilibdivsufsort-2.0.1\include /DHAVE_CONFIG_H libdivsufsort-2.0.1\lib\*.c ^
*.c *.cpp
rc /nologo flips.rc
::rc doesn't have a /nologo, just let it spam
rc flips.rc
link /LTCG /nologo *.obj /subsystem:windows flips.res user32.lib gdi32.lib comctl32.lib shell32.lib comdlg32.lib advapi32.lib /out:flips.exe