Clean up checks for YAZ version in code MP-609
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 13 Apr 2015 07:23:55 +0000 (09:23 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 13 Apr 2015 07:23:55 +0000 (09:23 +0200)
src/filter_multi.cpp
src/filter_sru_to_z3950.cpp
src/filter_zoom.cpp
src/sru_util.cpp

index 3b1d6f3..19be558 100644 (file)
@@ -968,9 +968,6 @@ Z_Entry *yf::Multi::ScanTermInfo::get_entry(ODR odr)
     t->term = (Z_Term *) odr_malloc(odr, sizeof(*t->term));
     t->term->which = Z_Term_general;
     t->term->u.general = odr_create_Odr_oct(odr,
-#if YAZ_VERSIONL < 0x50000
-                                 (unsigned char *)
-#endif
                                  m_norm_term.c_str(), m_norm_term.size());
     return e;
 }
index b383c07..262b936 100644 (file)
@@ -31,9 +31,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <yaz/oid_db.h>
 #include <yaz/log.h>
 #include <yaz/otherinfo.h>
-#if YAZ_VERSIONL >= 0x50000
 #include <yaz/facet.h>
-#endif
 
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/condition.hpp>
@@ -612,15 +610,11 @@ bool yf::SRUtoZ3950::Impl::z3950_search_request(mp::Package &package,
             odr_malloc(odr_en, sizeof(char *));
         z_searchRequest->databaseNames[0] = odr_strdup(odr_en, db.c_str());
     }
-#if YAZ_VERSIONL >= 0x50000
-    // yaz_oi_set_facetlist not public in YAZ 4.2.66
     if (sr_req->facetList)
     {
         Z_OtherInformation **oi = &z_searchRequest->additionalSearchInfo;
         yaz_oi_set_facetlist(oi, odr_en, sr_req->facetList);
     }
-#endif
-
     Z_Query *z_query = (Z_Query *) odr_malloc(odr_en, sizeof(Z_Query));
     z_searchRequest->query = z_query;
 
@@ -660,12 +654,10 @@ bool yf::SRUtoZ3950::Impl::z3950_search_request(mp::Package &package,
     {
         return false;
     }
-#if YAZ_VERSIONL >= 0x50000
     Z_FacetList *fl = yaz_oi_get_facetlist(&sr->additionalSearchInfo);
     if (!fl)
         fl =  yaz_oi_get_facetlist(&sr->otherInfo);
     sru_pdu_res->u.response->facetList = fl;
-#endif
     sru_pdu_res->u.response->numberOfRecords
         = odr_intdup(odr_en, *sr->resultCount);
     return true;
@@ -897,13 +889,7 @@ int yf::SRUtoZ3950::Impl::z3950_build_query(
     const Z_SRW_searchRetrieveRequest *req
     ) const
 {
-    if (
-#ifdef Z_SRW_query_type_cql
-        req->query_type == Z_SRW_query_type_cql
-#else
-        !strcmp(req->queryType, "cql")
-#endif
-        )
+    if (!strcmp(req->queryType, "cql"))
     {
         Z_External *ext = (Z_External *)
             odr_malloc(odr_en, sizeof(*ext));
@@ -912,39 +898,21 @@ int yf::SRUtoZ3950::Impl::z3950_build_query(
         ext->indirect_reference = 0;
         ext->descriptor = 0;
         ext->which = Z_External_CQL;
-        ext->u.cql = odr_strdup(odr_en,
-#ifdef Z_SRW_query_type_cql
-        req->query.cql
-#else
-        req->query
-#endif
-            );
+        ext->u.cql = odr_strdup(odr_en, req->query);
 
         z_query->which = Z_Query_type_104;
         z_query->u.type_104 =  ext;
         return 0;
     }
 
-    if (
-#ifdef Z_SRW_query_type_pqf
-        req->query_type == Z_SRW_query_type_pqf
-#else
-        !strcmp(req->queryType, "pqf")
-#endif
-        )
+    if (!strcmp(req->queryType, "pqf"))
     {
         Z_RPNQuery *RPNquery;
         YAZ_PQF_Parser pqf_parser;
 
         pqf_parser = yaz_pqf_create ();
 
-        RPNquery = yaz_pqf_parse (pqf_parser, odr_en,
-#ifdef Z_SRW_query_type_pqf
-        req->query.pqf
-#else
-        req->query
-#endif
-            );
+        RPNquery = yaz_pqf_parse (pqf_parser, odr_en, req->query);
         yaz_pqf_destroy(pqf_parser);
 
         if (!RPNquery)
index 841534a..4948ca5 100644 (file)
@@ -2414,12 +2414,8 @@ next_proxy:
             case CCL_ERR_TRUNC_NOT_LEFT:
             case CCL_ERR_TRUNC_NOT_RIGHT:
             case CCL_ERR_TRUNC_NOT_BOTH:
-#ifdef CCL_ERR_TRUNC_NOT_EMBED
             case CCL_ERR_TRUNC_NOT_EMBED:
-#endif
-#ifdef CCL_ERR_TRUNC_NOT_SINGLE
             case CCL_ERR_TRUNC_NOT_SINGLE:
-#endif
                 error = YAZ_BIB1_UNSUPP_SEARCH;
                 break;
             }
index d9e8730..1e3090e 100644 (file)
@@ -275,40 +275,6 @@ mp_util::check_sru_query_exists(mp::Package &package,
                                 Z_SRW_PDU *sru_pdu_res,
                                 Z_SRW_searchRetrieveRequest const *sr_req)
 {
-#ifdef Z_SRW_query_type_cql
-    if ((sr_req->query_type == Z_SRW_query_type_cql && !sr_req->query.cql))
-    {
-        yaz_add_srw_diagnostic(odr_en,
-                               &(sru_pdu_res->u.response->diagnostics),
-                               &(sru_pdu_res->u.response->num_diagnostics),
-                               YAZ_SRW_MANDATORY_PARAMETER_NOT_SUPPLIED,
-                               "query");
-        yaz_add_srw_diagnostic(odr_en,
-                               &(sru_pdu_res->u.response->diagnostics),
-                               &(sru_pdu_res->u.response->num_diagnostics),
-                               YAZ_SRW_QUERY_SYNTAX_ERROR,
-                               "CQL query is empty");
-        return false;
-    }
-    if ((sr_req->query_type == Z_SRW_query_type_xcql && !sr_req->query.xcql))
-    {
-        yaz_add_srw_diagnostic(odr_en,
-                               &(sru_pdu_res->u.response->diagnostics),
-                               &(sru_pdu_res->u.response->num_diagnostics),
-                               YAZ_SRW_QUERY_SYNTAX_ERROR,
-                               "XCQL query is empty");
-        return false;
-    }
-    if ((sr_req->query_type == Z_SRW_query_type_pqf && !sr_req->query.pqf))
-    {
-        yaz_add_srw_diagnostic(odr_en,
-                               &(sru_pdu_res->u.response->diagnostics),
-                               &(sru_pdu_res->u.response->num_diagnostics),
-                               YAZ_SRW_QUERY_SYNTAX_ERROR,
-                               "PQF query is empty");
-        return false;
-    }
-#else
     if (!sr_req->query)
     {
         yaz_add_srw_diagnostic(odr_en,
@@ -323,7 +289,6 @@ mp_util::check_sru_query_exists(mp::Package &package,
                                "CQL query is empty");
         return false;
     }
-#endif
     return true;
 }
 
@@ -375,27 +340,8 @@ std::ostream& std::operator<<(std::ostream& os, Z_SRW_PDU& srw_pdu)
                     os << " " << (sr->recordSchema);
                 else
                     os << " -";
-
-#ifdef Z_SRW_query_type_cql
-                switch (sr->query_type){
-                case Z_SRW_query_type_cql:
-                    os << " CQL";
-                    if (sr->query.cql)
-                        os << " " << sr->query.cql;
-                    break;
-                case Z_SRW_query_type_xcql:
-                    os << " XCQL";
-                    break;
-                case Z_SRW_query_type_pqf:
-                    os << " PQF";
-                    if (sr->query.pqf)
-                        os << " " << sr->query.pqf;
-                    break;
-                }
-#else
                 os << " " << (sr->queryType ? sr->queryType : "cql")
                    << " " << sr->query;
-#endif
             }
         }
         break;