Subversion Repositories SvarDOS

Rev

Rev 2084 | Rev 2089 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2084 Rev 2086
Line 362... Line 362...
362
    unsigned short offset;
362
    unsigned short offset;
363
    matchlen = 16;
363
    matchlen = 16;
364
    if (len < matchlen) matchlen = len;
364
    if (len < matchlen) matchlen = len;
365
 
365
 
366
    for (; matchlen > 1; matchlen--) {
366
    for (; matchlen > 1; matchlen--) {
367
      /* start at offset - 4096 and try to match something */
367
      /* start at -matchlen and try to match something moving backward */
368
      offset = 4096;
368
      unsigned short maxoffset = 4096;
369
      if (offset > bytesprocessed) offset = bytesprocessed;
369
      if (maxoffset > bytesprocessed) maxoffset = bytesprocessed;
370
 
370
 
371
      for (; offset > matchlen; offset--) {
371
      for (offset = matchlen; offset <= maxoffset; offset++) {
372
        if (memcmp(src, src - offset, matchlen) == 0) {
372
        if (memcmp(src, src - offset, matchlen) == 0) {
373
          printf("Found match of %u bytes at offset -%u: '%c%c%c...'\n", matchlen, offset, src[0], src[1], src[2]);
373
          //printf("Found match of %u bytes at offset -%u: '%c%c%c...'\n", matchlen, offset, src[0], src[1], src[2]);
374
          goto FOUND;
374
          goto FOUND;
375
        }
375
        }
376
      }
376
      }
377
    }
377
    }
378
 
378