Revert last change regarding display_term. There still exists systems
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 22 Aug 2007 08:11:28 +0000 (08:11 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 22 Aug 2007 08:11:28 +0000 (08:11 +0000)
with old behavior.

src/seshigh.c

index 46e6210..c68af21 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: seshigh.c,v 1.125 2007-08-21 13:20:51 adam Exp $
+ * $Id: seshigh.c,v 1.126 2007-08-22 08:11:28 adam Exp $
  */
 /**
  * \file seshigh.c
@@ -2377,7 +2377,7 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb)
                 assoc->init->implementation_name,
                 odr_prepend(assoc->encode, "GFS", resp->implementationName));
 
-    version = odr_strdup(assoc->encode, "$Revision: 1.125 $");
+    version = odr_strdup(assoc->encode, "$Revision: 1.126 $");
     if (strlen(version) > 10)   /* check for unexpanded CVS strings */
         version[strlen(version)-2] = '\0';
     resp->implementationVersion = odr_prepend(assoc->encode,
@@ -3051,7 +3051,9 @@ static Z_APDU *process_scanRequest(association *assoc, request *reqb, int *fd)
     /* For YAZ 2.0 and earlier it was the backend handler that
        initialized entries (member display_term did not exist)
        YAZ 2.0 and later sets 'entries'  and initialize all members
-       including 'display_term'.
+       including 'display_term'. If YAZ 2.0 or later sees that
+       entries was modified - we assume that it is an old handler and
+       that 'display_term' is _not_ set.
     */
     if (bsrr->num_entries > 0) 
     {
@@ -3110,8 +3112,13 @@ static Z_APDU *process_scanRequest(association *assoc, request *reqb, int *fd)
                     odr_malloc(assoc->encode, sizeof(*t));
                 t->suggestedAttributes = 0;
                 t->displayTerm = 0;
-                if (bsrr->entries[i].display_term)
+                if (save_entries == bsrr->entries && 
+                    bsrr->entries[i].display_term)
                 {
+                    /* the entries was _not_ set by the handler. So it's
+                       safe to test for new member display_term. It is
+                       NULL'ed by us.
+                    */
                     t->displayTerm = odr_strdup(assoc->encode,
                                                 bsrr->entries[i].display_term);
                 }