From f4916f9ee472922c34eee65571c9655a17bde064 Mon Sep 17 00:00:00 2001 From: Jonathan Westhues Date: Sun, 8 Dec 2013 00:32:50 -0800 Subject: [PATCH] Compare ((char *)p)[0] against '\0', not (char *)p. Also make the library example compile again under MSVC, and make the perl scripts to build the image tables work. --- Makefile.msvc | 7 ++++--- exposed/lib.cpp | 1 + src/file.cpp | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Makefile.msvc b/Makefile.msvc index 7fe38c24..3869721c 100644 --- a/Makefile.msvc +++ b/Makefile.msvc @@ -101,7 +101,8 @@ all: $(OBJDIR)\solvespace.exe @echo solvespace.exe clean: - -rmdir /s /q $(OBJDIR) + -del /Q obj\* + -rmdir $(OBJDIR) $(OBJDIR)\solvespace.exe: $(SSOBJS) $(SRFOBJS) $(W32OBJS) $(RES) $(CXX) $(DEFINES) $(CXXFLAGS) /Fe$(OBJDIR)\solvespace.exe $(SSOBJS) $(SRFOBJS) $(W32OBJS) $(RES) $(LIBS) @@ -132,10 +133,10 @@ $(OBJDIR)\toolbar.obj: src\icons.h !IFDEF PERL src\icons.h: src\icons\*.png src\png2c.pl - $(PERL) src\png2c.pl $@ src\icons-proto.h + $(PERL) src\png2c.pl $@ src\icons-proto.h src src\bitmapextra.table.h: src\icons\*.png src\pngchar2c.pl - $(PERL) src\pngchar2c.pl >$@.tmp + $(PERL) src\pngchar2c.pl src >$@.tmp move /y $@.tmp $@ !ELSE IF EXIST(src\built) diff --git a/exposed/lib.cpp b/exposed/lib.cpp index aa4721ff..a2c58e33 100644 --- a/exposed/lib.cpp +++ b/exposed/lib.cpp @@ -25,6 +25,7 @@ void CnfFreezeInt(uint32_t v, const char *name) uint32_t CnfThawInt(uint32_t v, const char *name) { abort(); + return 0; } void DoMessageBox(const char *str, int rows, int cols, bool error) diff --git a/src/file.cpp b/src/file.cpp index fbdff6c6..ff8dc36f 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -220,10 +220,10 @@ void SolveSpace::SaveUsingTable(int type) { int fmt = SAVED[i].fmt; union SAVEDptr *p = (union SAVEDptr *)SAVED[i].ptr; // Any items that aren't specified are assumed to be zero - if(fmt == 'N' && p->N.str == '\0') continue; - if(fmt == 'd' && p->d == 0) continue; - if(fmt == 'f' && EXACT(p->f == 0.0)) continue; - if(fmt == 'x' && p->x == 0) continue; + if(fmt == 'N' && p->N.str[0] == '\0') continue; + if(fmt == 'd' && p->d == 0) continue; + if(fmt == 'f' && EXACT(p->f == 0.0)) continue; + if(fmt == 'x' && p->x == 0) continue; fprintf(fh, "%s=", SAVED[i].desc); switch(fmt) {