Example #1
0
int DecompressorLZS::unpackLZS() {
	uint16 offs = 0;
	uint32 clen;

	while (!isFinished()) {
		if (getBitsMSB(1)) { // Compressed bytes follow
			if (getBitsMSB(1)) { // Seven bit offset follows
				offs = getBitsMSB(7);
				if (!offs) // This is the end marker - a 7 bit offset of zero
					break;
				if (!(clen = getCompLen())) {
					warning("lzsDecomp: length mismatch");
					return SCI_ERROR_DECOMPRESSION_ERROR;
				}
				copyComp(offs, clen);
			} else { // Eleven bit offset follows
				offs = getBitsMSB(11);
				if (!(clen = getCompLen())) {
					warning("lzsDecomp: length mismatch");
					return SCI_ERROR_DECOMPRESSION_ERROR;
				}
				copyComp(offs, clen);
			}
		} else // Literal byte follows
			putByte(getByteMSB());
	} // end of while ()
	return _dwWrote == _szUnpacked ? 0 : SCI_ERROR_DECOMPRESSION_ERROR;
}
Example #2
0
#endif

	/* 1. Make sure both names start or don't start with a path delimiter */
	if(isPathDelim(*fnam)) {
		if(!isPathDelim(*pattern))
			DBG_RETURN_I( 0)
		while(isPathDelim(*++fnam));
		while(isPathDelim(*++pattern));
	}
	else if(isPathDelim(*pattern))
		DBG_RETURN_I( 0)
	/* Both names point to a non-path delimiter character */

	/* 2. break up the next path component */
	do {
		c1 = copyComp(n1, &fnam);
		c2 = copyComp(n2, &pattern);

		if(c1 != c2 || !(*matchfct)(n1, n2))
			DBG_RETURN_I( 0)

		if(c1 == '/') {		/* slash / backslash */
			/* skip multiple path component delimiters */
			while(isPathDelim(*fnam)) ++fnam;
			while(isPathDelim(*pattern)) ++pattern;
		}
	} while(c1);

	DBG_RETURN_I( 1)
}