OK, here's a completely untested patch. As it turns out, someone's in the
process of upgrading my development box, so I can't compile. :-(

The first also takes care of a smallish memory leak in the display code.
The second should take care of the problems with empty descriptions. (I
noticed it checks for null strings, but not strings of nulls :-).

So once again, not only are these untested, but I didn't get a chance to
compile them, so I might have made some silly mistake somewhere. If so,
please let me know...

-Geoff

*** htdig-3.1.1/htsearch/Display.cc     Wed Feb 17 00:03:56 1999
--- htdig3/htsearch/Display.cc  Wed Mar 10 13:57:06 1999
*************** Display::display(int pageNumber)
*** 180,185 ****
--- 181,188 ----
            ref->DocScore(match->getScore());
            displayMatch(match,currentMatch+1);
            numberDisplayed++;
+           match->setRef(NULL);
+           delete ref;
        }
        currentMatch++;
      }
*************** Display::displayMatch(ResultMatch *match
*** 337,343 ****
            *str << ((String*) (*list)[i])->get() << "<br>\n";
        }
        vars.Add("DESCRIPTIONS", str);
!       vars.Add("DESCRIPTION", ((String*) (*list)[1]));
      }

      expandVariables(currentTemplate->getMatchTemplate());
--- 342,350 ----
            *str << ((String*) (*list)[i])->get() << "<br>\n";
        }
        vars.Add("DESCRIPTIONS", str);
!        String *description = new String();
!        *description = ((String*) (*list)[0]);
!        vars.Add("DESCRIPTION", description);
      }

      expandVariables(currentTemplate->getMatchTemplate());

*** htdig-3.1.1/htcommon/DocumentRef.cc Wed Feb 17 00:03:52 1999
--- htdig3/htcommon/DocumentRef.cc      Wed Mar 10 14:10:11 1999
*************** void DocumentRef::Deserialize(String &st
*** 546,556 ****
  //
  void DocumentRef::AddDescription(char *d)
  {
!     if (!d)
          return;

      while (isspace(*d))
          d++;

      String    desc = d;
      desc.chop(" \t");
--- 536,549 ----
  //
  void DocumentRef::AddDescription(char *d)
  {
!     if (!d || !*d)
          return;

      while (isspace(*d))
          d++;
+
+    if (!d || !*d)
+      return;

      String    desc = d;
      desc.chop(" \t");


------------------------------------
To unsubscribe from the htdig mailing list, send a message to
[EMAIL PROTECTED] containing the single word "unsubscribe" in
the SUBJECT of the message.

Reply via email to