Added several type casts due to no portable way of doing printf of
[yaz-moved-to-github.git] / src / seshigh.c
index 22df1a8..5ad7ef3 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: seshigh.c,v 1.69 2006-03-15 13:32:05 adam Exp $
+ * $Id: seshigh.c,v 1.75 2006-04-21 10:28:07 adam Exp $
  */
 /**
  * \file seshigh.c
@@ -360,10 +360,10 @@ void ir_session(IOCHAN h, int event)
             if (!z_GDU(assoc->decode, &req->gdu_request, 0, 0))
             {
                 yaz_log(YLOG_WARN, "ODR error on incoming PDU: %s [element %s] "
-                        "[near byte %d] ",
+                        "[near byte %ld] ",
                         odr_errmsg(odr_geterror(assoc->decode)),
                         odr_getelement(assoc->decode),
-                        odr_offset(assoc->decode));
+                        (long) odr_offset(assoc->decode));
                 if (assoc->decode->error != OHTTP)
                 {
                     yaz_log(YLOG_WARN, "PDU dump:");
@@ -517,8 +517,9 @@ static int srw_bend_init(association *assoc, Z_SRW_diagnostic **d, int *num)
         assoc->backend = binitres->handle;
         if (binitres->errcode)
         {
+            int srw_code = yaz_diag_bib1_to_srw(binitres->errcode);
             assoc->state = ASSOC_DEAD;
-            yaz_add_srw_diagnostic(assoc->encode, d, num, binitres->errcode,
+            yaz_add_srw_diagnostic(assoc->encode, d, num, srw_code,
                                    binitres->errstring);
             return 0;
         }
@@ -641,7 +642,7 @@ static int cql2pqf(ODR odr, const char *cql, cql_transform_t ct,
     int r;
     int srw_errcode = 0;
     const char *add = 0;
-    char rpn_buf[512];
+    char rpn_buf[5120];
             
     r = cql_parser_string(cp, cql);
     if (r)
@@ -774,8 +775,8 @@ static void srw_bend_search(association *assoc, request *req,
                 const char *pqf_msg;
                 size_t off;
                 int code = yaz_pqf_error (pqf_parser, &pqf_msg, &off);
-                yaz_log(log_requestdetail, "Parse error %d %s near offset %d",
-                        code, pqf_msg, off);
+                yaz_log(log_requestdetail, "Parse error %d %s near offset %ld",
+                        code, pqf_msg, (long) off);
                 srw_error = YAZ_SRW_QUERY_SYNTAX_ERROR;
             }
             
@@ -1462,6 +1463,7 @@ static void process_http_request(association *assoc, request *req)
                 yaz_mime_types_add(types, "html", "text/html");
                 yaz_mime_types_add(types, "htm", "text/html");
                 yaz_mime_types_add(types, "txt", "text/plain");
+                yaz_mime_types_add(types, "js", "application/x-javascript");
                 
                 yaz_mime_types_add(types, "gif", "image/gif");
                 yaz_mime_types_add(types, "png", "image/png");
@@ -1590,10 +1592,13 @@ static void process_http_request(association *assoc, request *req)
             p = z_get_HTTP_Response(o, 200);
             hres = p->u.HTTP_Response;
 
-            yaz_log(YLOG_LOG, "assoc->stylesheet=%s", assoc->stylesheet);
             if (!stylesheet)
                 stylesheet = assoc->stylesheet;
 
+            /* empty stylesheet means NO stylesheet */
+            if (stylesheet && *stylesheet == '\0')
+                stylesheet = 0;
+
             ret = z_soap_codec_enc_xsl(assoc->encode, &soap_package,
                                        &hres->content_buf, &hres->content_len,
                                        soap_handlers, charset, stylesheet);
@@ -2068,7 +2073,7 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb)
                 assoc->init->implementation_name,
                 odr_prepend(assoc->encode, "GFS", resp->implementationName));
 
-    version = odr_strdup(assoc->encode, "$Revision: 1.69 $");
+    version = odr_strdup(assoc->encode, "$Revision: 1.75 $");
     if (strlen(version) > 10)   /* check for unexpanded CVS strings */
         version[strlen(version)-2] = '\0';
     resp->implementationVersion = odr_prepend(assoc->encode,