diff --git a/Buzz_inc.h b/Buzz_inc.h index 1775020..c619e99 100644 --- a/Buzz_inc.h +++ b/Buzz_inc.h @@ -85,5 +85,3 @@ int never_fail; #include "macros.h" // Collected Macros #define random brandom -#undef NULL -#define NULL 0 diff --git a/ChangeLog b/ChangeLog index ed8a0de..997d537 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-02-08 Krzysztof Kosciuszkiewicz + + * V127 + + * Hunted down file descriptor leak + + * Removed NULL redefinition + 2007-02-08 Krzysztof Kosciuszkiewicz * V126 @@ -5,7 +13,7 @@ * Added SimpleHdr and SimpleHdrW to gamedata.c, changed rest of code to use new interface - * Taken care about nasty bug related to structure packing and order of + * Taken care of a nasty bug related to structure packing and order of includes * Changed level of indentation for preprocessor macros to 0 diff --git a/TODO b/TODO index 4dd2798..5d9da12 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,7 @@ Organize this TODO file +Find the reason behind segfault in EndPict() in endgame.c + autosave on a mission failure, replay mission doesn't show the explosion diff --git a/admin.c b/admin.c index 9336c6b..eafa264 100644 --- a/admin.c +++ b/admin.c @@ -861,16 +861,15 @@ save_game (char *name) if ((outf = sOpen (name, "wb", 1)) == NULL) { printf ("save_game: can't create %s\n", name); - return; + goto cleanup; } size = fread_dyn(&buf, &buflen, inf); + fclose(inf); + inf = NULL; if (size < 0) { perror("save_game"); - fclose (inf); - if (&buf) - free(&buf); - return; + goto cleanup; } hdr.compSize = size; @@ -882,8 +881,12 @@ save_game (char *name) if (size >= 0) fwrite(buf, size, 1, outf); else + { perror("save_game"); - fclose (inf); + goto cleanup; + } + fclose(inf); + inf = NULL; } if ((inf = sOpen ("EVENT.TMP", "rb", 1)) != NULL) { @@ -891,12 +894,21 @@ save_game (char *name) if (size >= 0) fwrite(buf, size, 1, outf); else + { perror("save_game"); - fclose (inf); + goto cleanup; + } + fclose(inf); + inf = NULL; } - fclose (outf); - free(buf); +cleanup: + if (outf) + fclose(outf); + if (inf) + fclose(inf); + if (buf) + free(buf); } char GetBlockName(char *Nam) diff --git a/budget.c b/budget.c index ca0c70b..0d82fb4 100644 --- a/budget.c +++ b/budget.c @@ -454,10 +454,10 @@ void DrawVText(char got) if (strncmp(&buf[0],"THIS CONCLUDES OUR NEWS",23)==0) grSetColor(11); if (strncmp(&buf[0],"CHECK INTEL",11)==0) grSetColor(11); - while(buf[0]!='x'&& buf[0]!=NULL) {DispChr(buf[0]);buf++;}; + while(buf[0]!='x'&& buf[0]!='\0') {DispChr(buf[0]);buf++;}; yy+=7; buf++; - if (*buf==NULL) i=9; + if (*buf=='\0') i=9; } return; diff --git a/checkin2 b/checkin2 index c9e13b4..05c6567 100755 --- a/checkin2 +++ b/checkin2 @@ -37,11 +37,17 @@ fi msg=`cat ChangeLog | sed -n -e "1{h;n}; /^[0-9]/{x;p}; /\<$lasttag\>/Q; /^[0-9]/!H"` +if [ $# -ne 0 ] ; then + # correct me if I'm wrong - it does not hurt to have same argument + # twice in cvs commit... + set -- "$@" $required_commits +fi + # diffstat output generation diffstat=`which diffstat 2>&1` echo "prev tag $lasttag; new tag $newtag" -if [ -e "$diffstat" ] +if [ -x "$diffstat" ] then echo "=== diffstat output ===" cvs diff -r $lasttag "$@" | $diffstat -w 70 @@ -59,12 +65,6 @@ then exit 1 fi -if [ $# -ne 0 ] ; then - # correct me if I'm wrong - it does not hurt to have same argument - # twice in cvs commit... - set -- "$@" $required_commits -fi - cvs -z9 commit -R -m "$msg" "$@" if [ $? != 0 ] then diff --git a/endgame.c b/endgame.c index 030a2a3..31b5320 100644 --- a/endgame.c +++ b/endgame.c @@ -701,6 +701,7 @@ void SpecialEnd(void) void EndPict(int x,int y,char poff,unsigned char coff) { + /* XXX: game crashes in this function */ PatchHdr P; GXHEADER local,local2; unsigned int j; diff --git a/future.c b/future.c index 8e4bac6..d60cccc 100644 --- a/future.c +++ b/future.c @@ -995,7 +995,7 @@ void MissionName(int val,int xx,int yy,int len) for (i=0;i<50;i++) { if (j>len && Mis.Name[i]==' ') {yy+=7;j=0;grMoveTo(xx,yy);} else DispChr(Mis.Name[i]); - j++;if (Mis.Name[i]==NULL) break; + j++;if (Mis.Name[i]=='\0') break; }; return; } diff --git a/mis_c.c b/mis_c.c index f3520fa..1a9fdcd 100644 --- a/mis_c.c +++ b/mis_c.c @@ -908,7 +908,7 @@ char FailureMode(char plr,int prelim,char *text) for (i=0;i<200;i++) { if (j>40 && text[i]==' ') {k+=7;j=0;grMoveTo(12,k);} else DispChr(text[i]); - j++;if (text[i]==NULL) break; + j++;if (text[i]=='\0') break; }; diff --git a/news.c b/news.c index c683512..e98b7e0 100644 --- a/news.c +++ b/news.c @@ -506,14 +506,14 @@ DrawNText(char plr, char got) if (strncmp(&buf[0], "CHECK THE TRACKING STATION", 26) == 0) grSetColor((plr == 0) ? 9 : 7); - while (buf[0] != 'x' && buf[0] != NULL) + while (buf[0] != 'x' && buf[0] != '\0') { DispChr(buf[0]); buf++; }; yy += 9; buf++; - if (*buf == NULL) + if (*buf == '\0') i = 9; } diff --git a/version.c b/version.c index 026933d..64cceae 100644 --- a/version.c +++ b/version.c @@ -1,2 +1,2 @@ -126 +127