~ubuntu-branches/ubuntu/oneiric/hexer/oneiric

« back to all changes in this revision

Viewing changes to regex.c

  • Committer: Bazaar Package Importer
  • Author(s): Peter Pentchev
  • Date: 2011-07-13 22:55:48 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110713225548-q2ht47h04hl821cx
Tags: 0.1.7-1
* New upstream release:
  - fix searching for octets > 127.  Closes: #633508
* Depend on the unversioned libncurses-dev virtual package.
* Bump Standards-Version to 3.9.2 with no changes.
* Update the copyright file to the latest DEP 5 candidate format and
  fix the DEP 5 URL after the Alioth migration.
* Specify Multi-Arch: foreign for the binary package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 */
17
17
 
18
18
/* Copyright (c) 1995,1996 Sascha Demetrio
19
 
 * Copyright (c) 2009, 2010 Peter Pentchev
 
19
 * Copyright (c) 2009 - 2011 Peter Pentchev
20
20
 * All rights reserved.
21
21
 *
22
22
 * Redistribution and use in source and binary forms, with or without
482
482
  if (rx_size && position >= rx_size) position = rx_size - 1;
483
483
  while (position < end && position >= begin) {
484
484
    if (rx_start >= 0)
485
 
      while (*bp != rx_start && position < end) {
 
485
      while (*bp != (char)rx_start && position < end) {
486
486
        if (*rx_interrupt) {
487
487
          rx_error = (int)E_interrupt;
488
488
          *rx_interrupt = 0;
555
555
        ++p, ++bp;
556
556
        break;
557
557
      case CHAR:
558
 
        if (*bp++ != *pp++) goto fail;
 
558
        if (*bp++ != (char)*pp++) goto fail;
559
559
        ++p;
560
560
        break;
561
561
      case STRING:
562
562
        operand = *pp++; /* length of the string. */
563
563
        if (rx_size && p + operand > rx_size) goto fail;
564
564
        /* if (memcmp(bp, pp, operand)) goto fail; */
565
 
        for (; operand; --operand) if (*pp++ != *bp++) goto fail;
 
565
        for (; operand; --operand) if ((char)*pp++ != *bp++) goto fail;
566
566
        /*
567
567
        pp += operand;
568
568
        bp += operand;
571
571
        break;
572
572
      case ANY_OF:
573
573
        operand = *pp++; /* number of characters */
574
 
        for (i = 0; i < operand && *bp > *pp; ++pp, ++i);
575
 
        if (*bp != *pp) goto fail;
 
574
        for (i = 0; i < operand && *bp > (char)*pp; ++pp, ++i);
 
575
        if (*bp != (char)*pp) goto fail;
576
576
        pp += operand - i;
577
577
        ++p, ++bp;
578
578
        break;
579
579
      case ANY_BUT:
580
580
        operand = *pp++; /* number of characters */
581
 
        for (i = 0; i < operand && *bp > *pp; ++pp, ++i);
582
 
        if (*bp == *pp) goto fail;
 
581
        for (i = 0; i < operand && *bp > (char)*pp; ++pp, ++i);
 
582
        if (*bp == (char)*pp) goto fail;
583
583
        if (rx_special_nl && *bp == '\n') goto fail;
584
584
        pp += operand - i;
585
585
        ++p, ++bp;