[net.micro.amiga] HACK bug fixes

walton%DEImos.Caltech.Edu@Hamlet.Caltech.Edu (03/28/86)

From: walton%DEImos.Caltech.Edu@Hamlet.Caltech.Edu

I have been moving HACK to my Aztec C compiler, and found and fixed some
bugs.  The non-Amiga-specific stuff was thoroughly LINTed, and had no
problems.  I made the following general changes:
(1) Made sure that malloc() was declared as returning char * wherever
    it was used.
(2) Surrounded all references to signal() and <signal.h> with #if UNIX
    preprocessor statements.
(3) Changed structure-valued functions to void-valued, and rewrote them
    to expect a pointer to a structure as an argument.  Aztec C V3.20a
    doesn't allow functions to return structures by value.

A few days ago, someone posted a message to the effect that commenting
out FreeDiskObject in hack.icon.c stopped the game from crashing the system
when you saved a game.  The problem is not in that call, but in the previous
one.  The line
       if ( (object = PutDiskObject(name, object)) == NULL)
should be
       if (! PutDiskObject(name, object))
since PutDiskObject returns a short flag (1 for success, 0 for failure)
which clobbered the value of the pointer object, which was then handed to
FreeDiskObject, causing the crash.

Steve Walton			 ARPA:	walton%deimos@hamlet.caltech.edu
Caltech Solar Astronomy          BITNET:swalton@caltech.bitnet
Physics DECNET: DEIMOS::WALTON	 UUCP: your guess is as good as mine...