diff --git a/jffs2extract.c b/jffs2extract.c index 8fadca5..1f9ea3f 100644 --- a/jffs2extract.c +++ b/jffs2extract.c @@ -92,6 +92,38 @@ void visit(char *o, size_t size, const char *path, int verbose, visitor visitor) /* writes file node into buffer, to the proper position. */ /* reading all valid nodes in version order reconstructs the file. */ +static int jffs2_rtime_decompress(unsigned char *data_in, + unsigned char *cpage_out, + uint32_t srclen, uint32_t destlen) +{ + short positions[256]; + int outpos = 0; + int pos=0; + memset(positions,0,sizeof(positions)); + while (outpos= outpos) { + while(repeat) { + cpage_out[outpos++] = cpage_out[backoffs++]; + repeat--; + } + } else { + memcpy(&cpage_out[outpos],&cpage_out[backoffs],repeat); + outpos+=repeat; + } + } + } + return 0; +} + /* b - buffer bsize - buffer size @@ -126,6 +158,12 @@ void putblock(char *b, size_t bsize, size_t * rsize, bzero(b + je32_to_cpu(n->offset), dlen); break; + case JFFS2_COMPR_RTIME: + jffs2_rtime_decompress((unsigned char *) ((char *) n) + sizeof(struct jffs2_raw_inode), + (unsigned char *) (b + je32_to_cpu(n->offset)), + je32_to_cpu(n->csize), je32_to_cpu(n->dsize)); + break; + /* [DYN]RUBIN support required! */ default: