zoom: throw diagnostic for records for some udb
[metaproxy-moved-to-github.git] / src / filter_zoom.cpp
index c28eb16..3aae72c 100644 (file)
@@ -52,7 +52,8 @@ namespace yf = mp::filter;
 
 namespace metaproxy_1 {
     namespace filter {
-        struct Zoom::Searchable : boost::noncopyable {
+        class Zoom::Searchable : boost::noncopyable {
+          public:
             std::string authentication;
             std::string cfAuth;
             std::string cfProxy;
@@ -369,7 +370,7 @@ yf::Zoom::Impl::Impl() :
 {
     bibset = ccl_qual_mk();
 
-    srand(time(0));
+    srand((unsigned int) time(0));
 }
 
 yf::Zoom::Impl::~Impl()
@@ -660,8 +661,17 @@ yf::Zoom::BackendPtr yf::Zoom::Frontend::get_backend_from_databases(
                 if (ptr->type == XML_ELEMENT_NODE
                     && !strcmp((const char *) ptr->name, "record"))
                 {
+                    if (sptr)
+                    {
+                        *error = YAZ_BIB1_UNSPECIFIED_ERROR;
+                        *addinfo = (char*) odr_malloc(odr, 40 + database.length()),
+                        sprintf(*addinfo, "multiple records for udb=%s",
+                                 database.c_str());
+                        xmlFreeDoc(doc);
+                        BackendPtr b;
+                        return b;
+                    }
                     sptr = m_p->parse_torus_record(ptr);
-                    break;
                 }
             }
         }
@@ -871,8 +881,6 @@ yf::Zoom::BackendPtr yf::Zoom::Frontend::get_backend_from_databases(
             wrbuf_printf(w, "authentication: %s\n", authentication.c_str());
         if (proxy.length())
             wrbuf_printf(w, "proxy: %s\n", proxy.c_str());
-        if (sptr->cfAuth.length())
-            wrbuf_printf(w, "cfauth: %s\n", sptr->cfAuth.c_str());
         if (sptr->cfProxy.length())
             wrbuf_printf(w, "cfproxy: %s\n", sptr->cfProxy.c_str());
 
@@ -926,7 +934,7 @@ Z_Records *yf::Zoom::Frontend::get_records(Odr_int start,
         number_to_present = 10000;
     
     ZOOM_record *recs = (ZOOM_record *)
-        odr_malloc(odr, number_to_present * sizeof(*recs));
+        odr_malloc(odr, (size_t) number_to_present * sizeof(*recs));
 
     char oid_name_str[OID_STR_MAX];
     const char *syntax_name = 0;
@@ -975,7 +983,7 @@ Z_Records *yf::Zoom::Frontend::get_records(Odr_int start,
 
     b->present(start, number_to_present, recs, error, addinfo, odr);
 
-    Odr_int i = 0;
+    int i = 0;
     if (!*error)
     {
         for (i = 0; i < number_to_present; i++)