OK, the patch at the end of this message should fix most of the problems
people have seen with the 3.2.0b4-031801 snapshot. I still cannot
reproduce Alexander Cohen's bug with HtRegexList:

http://sourceforge.net/tracker/index.php?func=detail&aid=405277&group_id=4593&atid=104593

I am still looking through the code based on his backtrace and will try to
solve the problem.

-Geoff

Index: htlib/HtRegexList.cc
===================================================================
RCS file: /cvsroot/htdig/htdig/htlib/Attic/HtRegexList.cc,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -c -3 -p -r1.1.2.4 -r1.1.2.5
*** htlib/HtRegexList.cc        2001/03/17 20:34:46     1.1.2.4
--- htlib/HtRegexList.cc        2001/03/19 17:35:55     1.1.2.5
***************
*** 9,15 ****
  // or the GNU General Public License version 2 or later 
  // <http://www.gnu.org/copyleft/gpl.html>
  //
! // $Id: HtRegexList.cc,v 1.1.2.4 2001/03/17 20:34:46 ghutchis Exp $
  //
  
  #ifdef HAVE_CONFIG_H
--- 9,15 ----
  // or the GNU General Public License version 2 or later 
  // <http://www.gnu.org/copyleft/gpl.html>
  //
! // $Id: HtRegexList.cc,v 1.1.2.5 2001/03/19 17:35:55 ghutchis Exp $
  //
  
  #ifdef HAVE_CONFIG_H
*************** const String &HtRegexList::lastError()
*** 44,52 ****
  int
  HtRegexList::setEscaped(StringList &list, int case_sensitive)
  {
    String  *str;
    String  transformedLimits, currentPattern, prevPattern;
!   HtRegex *limit;
  
    list.Start_Get();
    while ((str = (String *) list.Get_Next()))
--- 44,58 ----
  int
  HtRegexList::setEscaped(StringList &list, int case_sensitive)
  {
+   if (list.Count() == 0)
+     {
+       compiled = TRUE;
+       return TRUE;
+     }
+ 
    String  *str;
    String  transformedLimits, currentPattern, prevPattern;
!   HtRegex *limit = new HtRegex;
  
    list.Start_Get();
    while ((str = (String *) list.Get_Next()))
*************** HtRegexList::setEscaped(StringList &list
*** 68,79 ****
        if (!currentPattern.empty())
        currentPattern << "|";
        currentPattern << transformedLimits;
- 
        if (!limit->set(currentPattern.get(), case_sensitive))
        {
          if (prevPattern.empty()) // we haven't set anything yet!
            {
                lastErrorMessage = limit->lastError();
                return FALSE;
            }
          limit->set(prevPattern.get(), case_sensitive); // Go back a step
--- 74,85 ----
        if (!currentPattern.empty())
        currentPattern << "|";
        currentPattern << transformedLimits;
        if (!limit->set(currentPattern.get(), case_sensitive))
        {
          if (prevPattern.empty()) // we haven't set anything yet!
            {
                lastErrorMessage = limit->lastError();
+               compiled = 0;
                return FALSE;
            }
          limit->set(prevPattern.get(), case_sensitive); // Go back a step
*************** HtRegexList::setEscaped(StringList &list
*** 83,89 ****
        }
        prevPattern = currentPattern;
      }
!     return TRUE;
  }
  
  int
--- 89,98 ----
        }
        prevPattern = currentPattern;
      }
!   Add(limit); // OK, we're done so just add the last compiled pattern
!   
!   compiled = 1;
!   return TRUE;
  }
  
  int


_______________________________________________
htdig-dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/htdig-dev

Reply via email to