From 6c0c08aa87abd3698c7a2dab55628cbbe788659c Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 16 Apr 2007 21:54:52 +0000 Subject: [PATCH] Another and hopefully, last, YAZ OID DB update --- src/filter_backend_test.cpp | 18 +++++++++--------- src/filter_sru_to_z3950.cpp | 12 ++++-------- src/test_filter_z3950_client.cpp | 7 ++----- src/util.cpp | 19 ++++--------------- 4 files changed, 19 insertions(+), 37 deletions(-) diff --git a/src/filter_backend_test.cpp b/src/filter_backend_test.cpp index 635d9eb..020e823 100644 --- a/src/filter_backend_test.cpp +++ b/src/filter_backend_test.cpp @@ -1,4 +1,4 @@ -/* $Id: filter_backend_test.cpp,v 1.24 2007-04-13 09:57:51 adam Exp $ +/* $Id: filter_backend_test.cpp,v 1.25 2007-04-16 21:54:52 adam Exp $ Copyright (c) 2005-2007, Index Data. See the LICENSE file for details @@ -100,14 +100,14 @@ Z_Records *yf::BackendTest::Rep::fetch( return 0; } - const char *name_oid = OID_STR_USMARC; // default if syntax is given + if (!preferredRecordSyntax) + preferredRecordSyntax = odr_oiddup(odr, yaz_oid_recsyn_usmarc); + if (preferredRecordSyntax) { - name_oid = - yaz_oid_to_string(yaz_oid_std(), preferredRecordSyntax, 0); - if (name_oid && !strcmp(name_oid, OID_STR_USMARC)) + if (!oid_oidcmp(preferredRecordSyntax, yaz_oid_recsyn_xml)) ; - else if (name_oid && !strcmp(name_oid, OID_STR_XML)) + else if (!oid_oidcmp(preferredRecordSyntax, yaz_oid_recsyn_usmarc)) ; else { @@ -128,13 +128,13 @@ Z_Records *yf::BackendTest::Rep::fetch( element_set_name = esn->u.generic; } if (!strcmp(element_set_name, "B") - && !strcmp(name_oid, OID_STR_USMARC)) + && !oid_oidcmp(preferredRecordSyntax, yaz_oid_recsyn_usmarc)) ; // Brief else if (!strcmp(element_set_name, "F") - && !strcmp(name_oid, OID_STR_USMARC)) + && !oid_oidcmp(preferredRecordSyntax, yaz_oid_recsyn_usmarc)) ; // Full else if (!strncmp(element_set_name, "FF", 2) - && !strcmp(name_oid, OID_STR_XML)) + && !oid_oidcmp(preferredRecordSyntax, yaz_oid_recsyn_xml)) ; // Huge XML test record else { diff --git a/src/filter_sru_to_z3950.cpp b/src/filter_sru_to_z3950.cpp index 30be4da..45abb57 100644 --- a/src/filter_sru_to_z3950.cpp +++ b/src/filter_sru_to_z3950.cpp @@ -1,4 +1,4 @@ -/* $Id: filter_sru_to_z3950.cpp,v 1.33 2007-04-13 09:57:51 adam Exp $ +/* $Id: filter_sru_to_z3950.cpp,v 1.34 2007-04-16 21:54:52 adam Exp $ Copyright (c) 2005-2007, Index Data. See the LICENSE file for details @@ -568,8 +568,7 @@ yf::SRUtoZ3950::Impl::z3950_present_request(mp::Package &package, // RecordSyntax will always be XML apdu->u.presentRequest->preferredRecordSyntax - = yaz_string_to_oid_odr(yaz_oid_std(), CLASS_RECSYN, OID_STR_XML, - odr_en); + = odr_oiddup(odr_en, yaz_oid_recsyn_xml); // z3950'fy record schema if (sr_req->recordSchema) @@ -664,11 +663,8 @@ yf::SRUtoZ3950::Impl::z3950_present_request(mp::Package &package, else { Z_External *r = npr->u.databaseRecord; - const int *xml_oid = yaz_string_to_oid(yaz_oid_std(), - CLASS_RECSYN, - OID_STR_XML); - if (xml_oid && r->direct_reference - && !oid_oidcmp(r->direct_reference, xml_oid)) + if (r->direct_reference + && !oid_oidcmp(r->direct_reference, yaz_oid_recsyn_xml)) { sru_res->records[i].recordSchema = "dc"; sru_res->records[i].recordData_buf diff --git a/src/test_filter_z3950_client.cpp b/src/test_filter_z3950_client.cpp index 4675f85..2785abe 100644 --- a/src/test_filter_z3950_client.cpp +++ b/src/test_filter_z3950_client.cpp @@ -1,4 +1,4 @@ -/* $Id: test_filter_z3950_client.cpp,v 1.11 2007-04-13 09:57:51 adam Exp $ +/* $Id: test_filter_z3950_client.cpp,v 1.12 2007-04-16 21:54:52 adam Exp $ Copyright (c) 2005-2007, Index Data. See the LICENSE file for details @@ -137,11 +137,8 @@ BOOST_AUTO_UNIT_TEST( test_filter_z3950_client_4 ) const char *vhost = "localhost:9999"; if (vhost) { - const int *oid_proxy = yaz_string_to_oid(yaz_oid_std(), - CLASS_USERINFO, - OID_STR_PROXY); yaz_oi_set_string_oid(&apdu->u.initRequest->otherInfo, - odr, oid_proxy, 1, vhost); + odr, yaz_oid_userinfo_proxy, 1, vhost); } BOOST_CHECK(apdu); diff --git a/src/util.cpp b/src/util.cpp index f0ea1d6..c615811 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1,4 +1,4 @@ -/* $Id: util.cpp,v 1.27 2007-04-13 09:57:51 adam Exp $ +/* $Id: util.cpp,v 1.28 2007-04-16 21:54:52 adam Exp $ Copyright (c) 2005-2007, Index Data. See the LICENSE file for details @@ -292,15 +292,12 @@ int mp_util::get_or_remove_vhost_otherinfo( std::list &vhosts) { int cat; - const int *oid_proxy = yaz_string_to_oid(yaz_oid_std(), - CLASS_USERINFO, - OID_STR_PROXY); for (cat = 1; ; cat++) { // check virtual host const char *vhost = yaz_oi_get_string_oid(otherInformation, - oid_proxy, + yaz_oid_userinfo_proxy, cat /* categoryValue */, remove_flag /* delete flag */); if (!vhost) @@ -332,14 +329,10 @@ void mp_util::set_vhost_otherinfo( int cat; std::list::const_iterator it = vhosts.begin(); - const int *oid_proxy = yaz_string_to_oid(yaz_oid_std(), - CLASS_USERINFO, - OID_STR_PROXY); - for (cat = 1; it != vhosts.end() ; cat++, it++) { yaz_oi_set_string_oid(otherInformation, odr, - oid_proxy, cat, it->c_str()); + yaz_oid_userinfo_proxy, cat, it->c_str()); } } @@ -347,12 +340,8 @@ void mp_util::set_vhost_otherinfo( Z_OtherInformation **otherInformation, ODR odr, const std::string vhost, const int cat) { - const int *oid_proxy = yaz_string_to_oid(yaz_oid_std(), - CLASS_USERINFO, - OID_STR_PROXY); - yaz_oi_set_string_oid(otherInformation, odr, - oid_proxy, cat, vhost.c_str()); + yaz_oid_userinfo_proxy, cat, vhost.c_str()); } void mp_util::split_zurl(std::string zurl, std::string &host, -- 1.7.10.4