X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Ffilter_backend_test.cpp;h=d14bee248bf3c38c247f7f6964edec876def3be5;hb=e6d572ef110d14fa55115021505b808620457bd3;hp=635d9eb8c174274e7fecf56a15dd21537c05e9e8;hpb=219ffa015c0e35b03fae0788b0e8e6abcfde1a81;p=metaproxy-moved-to-github.git diff --git a/src/filter_backend_test.cpp b/src/filter_backend_test.cpp index 635d9eb..d14bee2 100644 --- a/src/filter_backend_test.cpp +++ b/src/filter_backend_test.cpp @@ -1,14 +1,26 @@ -/* $Id: filter_backend_test.cpp,v 1.24 2007-04-13 09:57:51 adam Exp $ - Copyright (c) 2005-2007, Index Data. +/* This file is part of Metaproxy. + Copyright (C) 2005-2010 Index Data - See the LICENSE file for details - */ +Metaproxy is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include "config.hpp" -#include "filter.hpp" -#include "package.hpp" -#include "util.hpp" +#include +#include +#include #include "filter_backend_test.hpp" #include @@ -32,6 +44,8 @@ namespace metaproxy_1 { namespace filter { class Session_info { int dummy; + public: + Session_info() { dummy = 0; }; }; class BackendTest::Rep { friend class BackendTest; @@ -100,14 +114,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 +142,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 { @@ -220,7 +234,7 @@ void yf::BackendTest::process(Package &package) const Z_InitRequest *req = apdu_req->u.initRequest; Z_InitResponse *resp = apdu_res->u.initResponse; - resp->implementationName = "backend_test"; + resp->implementationName = odr_strdup(odr, "backend_test"); if (ODR_MASK_GET(req->options, Z_Options_namedResultSets)) m_p->m_support_named_result_sets = true; @@ -385,8 +399,9 @@ extern "C" { /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil - * c-file-style: "stroustrup" * End: * vim: shiftwidth=4 tabstop=8 expandtab */ +