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.
pull/3/head
Jonathan Westhues 2013-12-08 00:32:50 -08:00
parent 1bc73c4a75
commit f4916f9ee4
3 changed files with 9 additions and 7 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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) {