/* * xDMS v1.3 - Portable DMS archive unpacker - Public Domain * Written by Andre Rodrigues de la Rocha * * Run Length Encoding decompression function used in most * modes after decompression by other algorithm * */ #include #include "cdata.h" #include "u_rle.h" USHORT Unpack_RLE(UCHAR *in, UCHAR *out, USHORT pklen1, USHORT origsize){ USHORT n; UCHAR a,b, *outend; UCHAR *inp = in + pklen1; outend = out+origsize; while (out inp) return 1; if (b == 0xff) { n = *in++; n = (USHORT)((n<<8) + *in++); } else n = b; if (out+n > outend) return 1; memset(out,a,(size_t) n); out += n; } } return 0; }