projects
/
yazpp-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bump version to 1.2.1. Depend on YAZ 4.0.1
[yazpp-moved-to-github.git]
/
zlint
/
zlint.cpp
diff --git
a/zlint/zlint.cpp
b/zlint/zlint.cpp
index
45c9b23
..
0389974
100644
(file)
--- a/
zlint/zlint.cpp
+++ b/
zlint/zlint.cpp
@@
-1,8
+1,6
@@
-/*
- * Copyright (c) 2004, Index Data.
+/* This file is part of the yazpp toolkit.
+ * Copyright (C) 1998-2010 Index Data and Mike Taylor
* See the file LICENSE for details.
* See the file LICENSE for details.
- *
- * $Id: zlint.cpp,v 1.7 2004-11-30 21:10:31 adam Exp $
*/
#include <stdio.h>
*/
#include <stdio.h>
@@
-12,10
+10,15
@@
#include <yaz/options.h>
#include <yaz/otherinfo.h>
#include <yaz/charneg.h>
#include <yaz/options.h>
#include <yaz/otherinfo.h>
#include <yaz/charneg.h>
-#include <yaz/ylog.h>
+#include <yaz/log.h>
#include <zlint.h>
#include <zlint.h>
+Zlint_test::~Zlint_test()
+{
+
+}
+
class Zlint_t {
public:
friend class Zlint;
class Zlint_t {
public:
friend class Zlint;
@@
-29,8
+32,8
@@
private:
int m_test_reported;
};
int m_test_reported;
};
-Zlint::Zlint(IYaz_PDU_Observable *the_PDU_Observable) :
- Yaz_Z_Assoc(the_PDU_Observable)
+Zlint::Zlint(IPDU_Observable *the_PDU_Observable) :
+ Z_Assoc(the_PDU_Observable)
{
m_PDU_Observable = the_PDU_Observable;
{
m_PDU_Observable = the_PDU_Observable;
@@
-44,9
+47,9
@@
Zlint::~Zlint()
{
while (m_tests)
{
{
while (m_tests)
{
- Zlint_t *t = m_tests;
- m_tests = t->m_next;
- delete t;
+ Zlint_t *t = m_tests;
+ m_tests = t->m_next;
+ delete t;
}
xfree(m_host);
xfree(m_database);
}
xfree(m_host);
xfree(m_database);
@@
-62,7
+65,7
@@
void Zlint::set_host(const char *cp)
const char *basep;
cs_get_host_args(m_host, &basep);
if (!basep || !*basep)
const char *basep;
cs_get_host_args(m_host, &basep);
if (!basep || !*basep)
- basep = "Default";
+ basep = "Default";
xfree(m_database);
m_database = xstrdup(basep);
}
xfree(m_database);
m_database = xstrdup(basep);
}
@@
-71,13
+74,13
@@
void Zlint::timeoutNotify()
{
if (m_cur_test)
{
{
if (m_cur_test)
{
- if (m_cur_test->m_t->recv_fail(this, 2) != TEST_FINISHED)
- {
- close();
- client(m_host);
- timeout(30);
- return;
- }
+ if (m_cur_test->m_t->recv_fail(this, 2) != TEST_FINISHED)
+ {
+ close();
+ client(m_host);
+ timeout(30);
+ return;
+ }
}
close_goto_next();
}
}
close_goto_next();
}
@@
-86,13
+89,13
@@
void Zlint::failNotify()
{
if (m_cur_test)
{
{
if (m_cur_test)
{
- if (m_cur_test->m_t->recv_fail(this, 1) != TEST_FINISHED)
- {
- close();
- client(m_host);
- timeout(30);
- return;
- }
+ if (m_cur_test->m_t->recv_fail(this, 1) != TEST_FINISHED)
+ {
+ close();
+ client(m_host);
+ timeout(30);
+ return;
+ }
}
close_goto_next();
}
}
close_goto_next();
}
@@
-101,8
+104,8
@@
void Zlint::connectNotify()
{
if (m_cur_test)
{
{
if (m_cur_test)
{
- if (m_cur_test->m_t->init(this) != TEST_FINISHED)
- return;
+ if (m_cur_test->m_t->init(this) != TEST_FINISHED)
+ return;
}
close_goto_next();
}
}
close_goto_next();
}
@@
-111,16
+114,16
@@
void Zlint::recv_GDU(Z_GDU *gdu, int len)
{
if (m_cur_test)
{
{
if (m_cur_test)
{
- int r = m_cur_test->m_t->recv_gdu(this, gdu);
- if (r == TEST_CONTINUE)
- return;
- if (r == TEST_REOPEN)
- {
- close();
- client(m_host);
- timeout(30);
- return;
- }
+ int r = m_cur_test->m_t->recv_gdu(this, gdu);
+ if (r == TEST_CONTINUE)
+ return;
+ if (r == TEST_REOPEN)
+ {
+ close();
+ client(m_host);
+ timeout(30);
+ return;
+ }
}
close_goto_next();
}
}
close_goto_next();
}
@@
-129,14
+132,14
@@
void Zlint::close_goto_next()
{
close();
if (m_cur_test)
{
close();
if (m_cur_test)
- m_cur_test = m_cur_test->m_next;
+ m_cur_test = m_cur_test->m_next;
if (m_cur_test)
if (m_cur_test)
- client(m_host);
+ client(m_host);
timeout(30);
}
timeout(30);
}
-IYaz_PDU_Observer *Zlint::sessionNotify(
- IYaz_PDU_Observable *the_PDU_Observable, int fd)
+IPDU_Observer *Zlint::sessionNotify(
+ IPDU_Observable *the_PDU_Observable, int fd)
{
return 0;
}
{
return 0;
}
@@
-144,7
+147,7
@@
IYaz_PDU_Observer *Zlint::sessionNotify(
Z_ReferenceId *Zlint::mk_refid(const char *buf, int len)
{
Z_ReferenceId *id =
Z_ReferenceId *Zlint::mk_refid(const char *buf, int len)
{
Z_ReferenceId *id =
- (Z_ReferenceId *) odr_malloc(odr_encode(), sizeof(*id));
+ (Z_ReferenceId *) odr_malloc(odr_encode(), sizeof(*id));
id->size = id->len = len;
id->buf = (unsigned char*) odr_malloc(odr_encode(), len);
memcpy(id->buf, buf, len);
id->size = id->len = len;
id->buf = (unsigned char*) odr_malloc(odr_encode(), len);
memcpy(id->buf, buf, len);
@@
-157,14
+160,12
@@
int Zlint::initResponseGetVersion(Z_InitResponse *init)
int off = 0;
int i;
for (i = 0; i<12; i++)
int off = 0;
int i;
for (i = 0; i<12; i++)
- if (ODR_MASK_GET(init->protocolVersion, no))
- {
- no = i+1;
- if (off)
- yaz_log(YLOG_WARN, "%sbad formatted version");
- }
- else
- off = 1;
+ if (ODR_MASK_GET(init->protocolVersion, no))
+ {
+ no = i+1;
+ }
+ else
+ off = 1;
return no;
}
return no;
}
@@
-172,10
+173,10
@@
void Zlint::add_test(Zlint_test *t)
{
Zlint_t **d = &m_tests;
while (*d)
{
Zlint_t **d = &m_tests;
while (*d)
- d = &(*d)->m_next;
+ d = &(*d)->m_next;
*d = new Zlint_t(t);
if (!m_cur_test)
*d = new Zlint_t(t);
if (!m_cur_test)
- m_cur_test = m_tests;
+ m_cur_test = m_tests;
}
void Zlint::msg_check_for(const char *fmt, ...)
}
void Zlint::msg_check_for(const char *fmt, ...)
@@
-206,9
+207,9
@@
void Zlint::msg_check_ok()
{
if (!m_cur_test->m_test_reported)
{
{
if (!m_cur_test->m_test_reported)
{
- m_cur_test->m_test_ok = 1;
- m_cur_test->m_test_reported = 1;
- printf ("OK\n");
+ m_cur_test->m_test_ok = 1;
+ m_cur_test->m_test_reported = 1;
+ printf ("OK\n");
}
}
}
}
@@
-216,9
+217,9
@@
void Zlint::msg_check_fail(const char *fmt, ...)
{
if (!m_cur_test->m_test_reported)
{
{
if (!m_cur_test->m_test_reported)
{
- m_cur_test->m_test_ok = 0;
- m_cur_test->m_test_reported = 1;
- printf ("Fail\n");
+ m_cur_test->m_test_ok = 0;
+ m_cur_test->m_test_reported = 1;
+ printf ("Fail\n");
}
va_list ap;
va_start(ap, fmt);
}
va_list ap;
va_start(ap, fmt);
@@
-232,9
+233,9
@@
void Zlint::msg_check_notapp()
{
if (!m_cur_test->m_test_reported)
{
{
if (!m_cur_test->m_test_reported)
{
- m_cur_test->m_test_ok = 2;
- m_cur_test->m_test_reported = 1;
- printf ("Unsupported\n");
+ m_cur_test->m_test_ok = 2;
+ m_cur_test->m_test_reported = 1;
+ printf ("Unsupported\n");
}
}
}
}
@@
-265,3
+266,12
@@
Zlint_code Zlint_test_simple::recv_fail(Zlint *z, int reason)
z->msg_check_fail("target closed connection");
return TEST_FINISHED;
}
z->msg_check_fail("target closed connection");
return TEST_FINISHED;
}
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+