Reformat
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 21 Jun 2010 11:20:05 +0000 (13:20 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 21 Jun 2010 11:20:05 +0000 (13:20 +0200)
src/filter_sru_to_z3950.cpp
src/sru_util.cpp

index 7dd70a8..8c74017 100644 (file)
@@ -66,7 +66,7 @@ namespace metaproxy_1 {
                 mp::odr &odr_en, Z_Query *z_query, 
                 const Z_SRW_searchRetrieveRequest *req
                 ) const;
-
+            
             bool z3950_init_request(
                 mp::Package &package, 
                 mp::odr &odr_en,
@@ -156,7 +156,7 @@ void yf::SRUtoZ3950::Impl::configure(const xmlNode *confignode)
             }
             // assigning explain node to database name - no check yet 
             m_database_explain.insert(std::make_pair(database, explainnode));
-         }
+        }
     }
 }
 
@@ -407,7 +407,7 @@ yf::SRUtoZ3950::Impl::z3950_init_request(mp::Package &package,
     if (z3950_gdu && z3950_gdu->which == Z_GDU_Z3950 
         && z3950_gdu->u.z3950->which == Z_APDU_initResponse 
         && *z3950_gdu->u.z3950->u.initResponse->result)
-         return true;
+        return true;
  
     yaz_add_srw_diagnostic(odr_en,
                            &(sru_pdu_res->u.response->diagnostics),
@@ -463,8 +463,8 @@ bool yf::SRUtoZ3950::Impl::z3950_search_request(mp::Package &package,
 
 
     if (!mp_util::set_databases_from_zurl(odr_en, zurl,
-                                     &z_searchRequest->num_databaseNames,
-                                         &z_searchRequest->databaseNames))
+                                          &z_searchRequest->num_databaseNames,
+                                          &z_searchRequest->databaseNames))
     {
         z_searchRequest->num_databaseNames = 1;
         z_searchRequest->databaseNames = (char**)
@@ -475,7 +475,7 @@ bool yf::SRUtoZ3950::Impl::z3950_search_request(mp::Package &package,
                 = odr_strdup(odr_en, const_cast<char *>(sr_req->database));
         else
             z_searchRequest->databaseNames[0] 
-            = odr_strdup(odr_en, "Default");
+                = odr_strdup(odr_en, "Default");
     }
 
     // z3950'fy query
@@ -805,8 +805,8 @@ yf::SRUtoZ3950::Impl::z3950_to_srw_diagnostics_ok(mp::odr &odr_en,
 
 int 
 yf::SRUtoZ3950::Impl::z3950_to_srw_diag(mp::odr &odr_en, 
-                                       Z_SRW_searchRetrieveResponse *sru_res,
-                                       Z_DefaultDiagFormat *ddf) const
+                                        Z_SRW_searchRetrieveResponse *sru_res,
+                                        Z_DefaultDiagFormat *ddf) const
 {
     int bib1_code = *ddf->condition;
     sru_res->num_diagnostics = 1;
index 1992f9f..fce602e 100644 (file)
@@ -102,7 +102,8 @@ bool mp_util::build_sru_explain(metaproxy_1::Package &package,
     // building SRU explain record
     std::string explain_xml;    
 
-    if (explain == 0){
+    if (explain == 0)
+    {
         explain_xml 
             = mp_util::to_string(
                 "<explain  xmlns=\"" + xmlns_explain + "\">\n"
@@ -119,7 +120,8 @@ bool mp_util::build_sru_explain(metaproxy_1::Package &package,
                                  "  </serverInfo>\n"
                                  "</explain>\n");
     }
-    else {
+    else
+    {
         // make new XML DOC with given explain node
         xmlDocPtr doc =  xmlNewDoc(BAD_CAST "1.0");
         xmlDocSetRootElement(doc, (xmlNode*)explain);
@@ -191,30 +193,30 @@ bool mp_util::build_sru_response(mp::Package &package,
         z_HTTP_header_add(odr_en, 
                           &http_res->headers, "Content-Type", ctype.c_str());
 
-         // packaging Z_SOAP into HTML response
-         static Z_SOAP_Handler soap_handlers[4] = {
-             {(char *)YAZ_XMLNS_SRU_v1_1, 0, (Z_SOAP_fun) yaz_srw_codec},
-             {(char *)YAZ_XMLNS_SRU_v1_0, 0,  (Z_SOAP_fun) yaz_srw_codec},
-             {(char *)YAZ_XMLNS_UPDATE_v0_9, 0, (Z_SOAP_fun) yaz_ucp_codec},
-             {0, 0, 0}
-         };
+        // packaging Z_SOAP into HTML response
+        static Z_SOAP_Handler soap_handlers[4] = {
+            {(char *)YAZ_XMLNS_SRU_v1_1, 0, (Z_SOAP_fun) yaz_srw_codec},
+            {(char *)YAZ_XMLNS_SRU_v1_0, 0,  (Z_SOAP_fun) yaz_srw_codec},
+            {(char *)YAZ_XMLNS_UPDATE_v0_9, 0, (Z_SOAP_fun) yaz_ucp_codec},
+            {0, 0, 0}
+        };
 
 
-         // empty stylesheet means NO stylesheet
-         if (stylesheet && *stylesheet == '\0')
-             stylesheet = 0;
+        // empty stylesheet means NO stylesheet
+        if (stylesheet && *stylesheet == '\0')
+            stylesheet = 0;
          
-         // encoding SRU package
+        // encoding SRU package
          
-         soap->u.generic->p  = (void*) sru_pdu_res;         
-         //int ret = 
-         z_soap_codec_enc_xsl(odr_en, &soap, 
-                              &http_res->content_buf, &http_res->content_len,
-                              soap_handlers, charset, stylesheet);
+        soap->u.generic->p  = (void*) sru_pdu_res;         
+        //int ret = 
+        z_soap_codec_enc_xsl(odr_en, &soap, 
+                             &http_res->content_buf, &http_res->content_len,
+                             soap_handlers, charset, stylesheet);
          
 
-         package.response() = zgdu_res;
-         return true;
+        package.response() = zgdu_res;
+        return true;
     }
     package.session().close();
     return false;
@@ -293,11 +295,11 @@ mp_util::check_sru_query_exists(mp::Package &package,
     }
     if ((sr_req->query_type == Z_SRW_query_type_xcql && !sr_req->query.xcql))
     {
-         yaz_add_srw_diagnostic(odr_en,
+        yaz_add_srw_diagnostic(odr_en,
                                &(sru_pdu_res->u.response->diagnostics), 
                                &(sru_pdu_res->u.response->num_diagnostics), 
-                                10, "XCQL query is empty");
-         return false;
+                               10, "XCQL query is empty");
+        return false;
     }
     if ((sr_req->query_type == Z_SRW_query_type_pqf && !sr_req->query.pqf))
     {
@@ -329,7 +331,8 @@ std::ostream& std::operator<<(std::ostream& os, Z_SRW_PDU& srw_pdu)
 {
     os << "SRU";
     
-    switch(srw_pdu.which) {
+    switch (srw_pdu.which)
+    {
     case  Z_SRW_searchRetrieve_request:
         os << " " << "searchRetrieveRequest";
         {