Minor tweaks, mostly to comments.

This commit is contained in:
Andy McFadden 2002-10-08 23:56:38 +00:00
parent 656b2b0a33
commit 87c6550f15
5 changed files with 37 additions and 4 deletions

View File

@ -8,7 +8,11 @@
*
* This compression format is totally unsupported on the Apple II. This
* is provided primarily for the benefit of Apple II emulators that want
* a better storage format for disk images than SHK+LZW or a ZIP.
* a better storage format for disk images than SHK+LZW or a ZIP file.
*
* This code was developed and tested with ZLIB_VERSION "1.1.3". It is
* expected to work with any version >= 1.1.3 and < 2.x. Please visit
* http://www.zlib.org/ for more information.
*/
#include "NufxLibPriv.h"

View File

@ -1287,6 +1287,7 @@ Nu_TruncateOpenFile(FILE* fp, long length)
return errno ? errno : -1;
return kNuErrNone;
#else
/* not fatal; return this to indicate that it's an unsupported operation */
return kNuErrInternal;
#endif
}

View File

@ -72,11 +72,14 @@ $(STATIC_PRODUCT): $(OBJS)
$(AR) $@ $(OBJS)
@RANLIB@ $@
# BUG: we probably want -fPIC -D_REENTRANT on the compile lines for this.
# BUG: for Linux we may want -Wl,-soname,libnufx.so.1 on the link line.
$(SHARED_PRODUCT): $(OBJS)
-rm -f $(STATIC_PRODUCT) $(SHARED_PRODUCT)
$(CC) @SHARE_FLAGS@ -o $@ $(OBJS) @LIBS@
# the build date is approximate, the build flags are accurate
# The build date is approximate, the build flags are accurate so long
# as they were changed by touching the makefile.
Version.c: Version.c.in Makefile
(sed -e "s/BUILT/`date`/" -e "s/OPTFLAGS/$(OPT)/" < Version.c.in > Version.c)

View File

@ -90,3 +90,19 @@ add the appropriate goodies. (Seems to me you'd always want this on, but
for some reason Solaris makes you take an extra step, so I'm not going to
define it by default.)
Legalese
========
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -683,6 +683,10 @@ bail:
* Compress "srcLen" bytes into SQ format, from "pStraw" to "fp".
*
* This requires two passes through the input.
*
* Bit of trivia: "sq3" on the Apple II self-destructs if you hand
* it an empty file. "xsq" works fine, creating an empty tree that
* "xusq" unpacks.
*/
NuError
Nu_CompressHuffmanSQ(NuArchive* pArchive, NuStraw* pStraw, FILE* fp,
@ -905,6 +909,7 @@ Nu_ExpandHuffmanSQ(NuArchive* pArchive, const NuRecord* pRecord,
#endif
short nodeCount;
int i, inrep;
uchar lastc = 0;
err = Nu_AllocCompressionBufferIFN(pArchive);
if (err != kNuErrNone)
@ -915,7 +920,12 @@ Nu_ExpandHuffmanSQ(NuArchive* pArchive, const NuRecord* pRecord,
usqState.dataPtr = pArchive->compBuf;
compRemaining = pThread->thCompThreadEOF;
if (compRemaining < 8) {
#ifdef FULL_SQ_HEADER
if (compRemaining < 8)
#else
if (compRemaining < 3)
#endif
{
err = kNuErrBadData;
Nu_ReportError(NU_BLOB, err, "thread too short to be valid SQ data");
goto bail;
@ -1007,7 +1017,6 @@ Nu_ExpandHuffmanSQ(NuArchive* pArchive, const NuRecord* pRecord,
inrep = false;
while (1) {
int val;
uchar lastc;
if (usqState.dataInBuffer < 65 && compRemaining) {
/*