From: Adam Dickmeiss Date: Wed, 2 Jul 2003 10:25:13 +0000 (+0000) Subject: Fixes for GCC 3.2 X-Git-Tag: YAZPP.0.6~14 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=01126607d1b475f43b29548dbd98f199f8e9f57f;p=yazpp-moved-to-github.git Fixes for GCC 3.2 --- diff --git a/zoom/master-header b/zoom/master-header index a9b8502..39b90a0 100644 --- a/zoom/master-header +++ b/zoom/master-header @@ -1,4 +1,4 @@ -// $Id: master-header,v 1.13 2002-12-02 15:55:57 mike Exp $ +// $Id: master-header,v 1.14 2003-07-02 10:25:13 adam Exp $ // // ZOOM C++ Binding. // The ZOOM homepage is at http://zoom.z3950.org/ @@ -135,7 +135,7 @@ namespace ZOOM { // bib1Exception::errcode() returns a code from the // Bib-1 Diagnostic Set. class YAZ_EXPORT bib1Exception: public exception { -* const string &info; +* const std::string &info; public: * ~bib1Exception (); bib1Exception (int code, const std::string &addinfo); @@ -144,7 +144,7 @@ namespace ZOOM { }; class YAZ_EXPORT queryException : public exception { -* const string &q; +* const std::string &q; public: * ~queryException (); enum { PREFIX, CCL }; diff --git a/zoom/zclient.cpp b/zoom/zclient.cpp index ca159a8..7938b0d 100644 --- a/zoom/zclient.cpp +++ b/zoom/zclient.cpp @@ -1,16 +1,16 @@ -// $Id: zclient.cpp,v 1.6 2002-12-02 15:57:58 mike Exp $ +// $Id: zclient.cpp,v 1.7 2003-07-02 10:25:13 adam Exp $ // Simple sample client #include // for atoi() -#include +#include #include "zoom.h" int main(int argc, char **argv) { if (argc != 5) { - cerr << "Usage: " << + std::cerr << "Usage: " << argv[0] << " <@prefix-search>\n"; return 1; } @@ -25,21 +25,21 @@ int main(int argc, char **argv) resultSet rs(conn, pq); size_t n = rs.size(); - cout << "found " << n << " records:\n"; + std::cout << "found " << n << " records:\n"; for (size_t i = 0; i < n; i++) { const record rec(rs, i); - cout << "=== record " << i+1 << - " (record-syntax " << (string) rec.recsyn() << ")" << + std::cout << "=== record " << i+1 << + " (record-syntax " << (std::string) rec.recsyn() << ")" << " ===\n" << rec.render(); } } catch(bib1Exception& err) { - cerr << argv[0] << ": bib1Exception " << + std::cerr << argv[0] << ": bib1Exception " << err.errmsg() << " (" << err.addinfo() << ")\n"; return 2; } catch(ZOOM::exception& err) { - cerr << argv[0] << ": exception " << + std::cerr << argv[0] << ": exception " << err.errmsg() << "\n"; return 3; } diff --git a/zoom/zconn.cpp b/zoom/zconn.cpp index d5d4c85..17773c8 100644 --- a/zoom/zconn.cpp +++ b/zoom/zconn.cpp @@ -1,4 +1,4 @@ -// $Header: /home/cvsroot/yaz++/zoom/zconn.cpp,v 1.4 2002-11-30 22:33:21 mike Exp $ +// $Header: /home/cvsroot/yaz++/zoom/zconn.cpp,v 1.5 2003-07-02 10:25:13 adam Exp $ // Z39.50 Connection class @@ -6,7 +6,7 @@ namespace ZOOM { - connection::connection(const string &hostname, int portnum) { + connection::connection(const std::string &hostname, int portnum) { const char *line_printer_size_hostname = hostname.c_str(); //###cerr << "opening " << hostname << ":" << portnum << "\n"; c = ZOOM_connection_new(line_printer_size_hostname, portnum); @@ -21,11 +21,11 @@ namespace ZOOM { } } - string connection::option(const string &key) const { + std::string connection::option(const std::string &key) const { return ZOOM_connection_option_get(c, key.c_str()); } - bool connection::option(const string &key, const string &val) { + bool connection::option(const std::string &key, const std::string &val) { // No way to tell whether ZOOM_connection_option_set() accepts key ZOOM_connection_option_set(c, key.c_str(), val.c_str()); return true; diff --git a/zoom/zexcept.cpp b/zoom/zexcept.cpp index 04e6665..462767b 100644 --- a/zoom/zexcept.cpp +++ b/zoom/zexcept.cpp @@ -1,10 +1,10 @@ -// $Header: /home/cvsroot/yaz++/zoom/zexcept.cpp,v 1.7 2002-11-30 22:33:21 mike Exp $ +// $Header: /home/cvsroot/yaz++/zoom/zexcept.cpp,v 1.8 2003-07-02 10:25:13 adam Exp $ // Z39.50 Exception classes +#include #include #include // for strerror(), strlen(), strcpy() -#include // for sprintf() #include "zoom.h" @@ -21,7 +21,7 @@ namespace ZOOM { return code; } - string exception::errmsg() const { + std::string exception::errmsg() const { static char buf[40]; sprintf(buf, "error #%d", code); return buf; @@ -33,15 +33,15 @@ namespace ZOOM { code = errno; } - string systemException::errmsg() const { + std::string systemException::errmsg() const { return strerror(code); } - bib1Exception::bib1Exception(int errcode, const string &addinfo) : + bib1Exception::bib1Exception(int errcode, const std::string &addinfo) : exception(errcode), info(addinfo) { - cerr << "WARNING: made bib1Exception(" << errcode << "=" << + std::cerr << "WARNING: made bib1Exception(" << errcode << "=" << ZOOM_diag_str(errcode) << ", '" << addinfo << "')\n"; } @@ -55,24 +55,24 @@ namespace ZOOM { // or less work -- it just leaks memory. (Or does it?) } - string bib1Exception::errmsg() const { + std::string bib1Exception::errmsg() const { return ZOOM_diag_str(code); } - string bib1Exception::addinfo() const { + std::string bib1Exception::addinfo() const { return info; } - queryException::queryException(int qtype, const string &source) : + queryException::queryException(int qtype, const std::string &source) : exception(qtype), q(source) {} queryException::~queryException() { //delete q; // ### see comment on bib1Exception destructor } - string queryException::errmsg() const { + std::string queryException::errmsg() const { switch (code) { case PREFIX: return "bad prefix search"; case CCL: return "bad CCL search"; @@ -81,7 +81,7 @@ namespace ZOOM { return "bad search (unknown type)"; } - string queryException::addinfo() const { + std::string queryException::addinfo() const { return q; } } diff --git a/zoom/zquery.cpp b/zoom/zquery.cpp index 5b173c5..cd937c2 100644 --- a/zoom/zquery.cpp +++ b/zoom/zquery.cpp @@ -1,4 +1,4 @@ -// $Header: /home/cvsroot/yaz++/zoom/zquery.cpp,v 1.4 2002-11-30 22:33:21 mike Exp $ +// $Header: /home/cvsroot/yaz++/zoom/zquery.cpp,v 1.5 2003-07-02 10:25:13 adam Exp $ // Z39.50 Query classes @@ -11,9 +11,7 @@ namespace ZOOM { q = 0; } - - - prefixQuery::prefixQuery(const string &pqn) { + prefixQuery::prefixQuery(const std::string &pqn) { q = ZOOM_query_create(); if (ZOOM_query_prefix(q, pqn.c_str()) == -1) { ZOOM_query_destroy(q); @@ -43,7 +41,7 @@ namespace ZOOM { - CCLQuery::CCLQuery(const string &ccl, void *qualset) { + CCLQuery::CCLQuery(const std::string &ccl, void *qualset) { throw "Oops. No CCL support in ZOOM-C yet. Sorry."; } diff --git a/zoom/zrec.cpp b/zoom/zrec.cpp index fc4bff6..92c9662 100644 --- a/zoom/zrec.cpp +++ b/zoom/zrec.cpp @@ -1,4 +1,4 @@ -// $Header: /home/cvsroot/yaz++/zoom/zrec.cpp,v 1.5 2002-11-30 22:33:21 mike Exp $ +// $Header: /home/cvsroot/yaz++/zoom/zrec.cpp,v 1.6 2003-07-02 10:25:13 adam Exp $ // Z39.50 Record class @@ -9,7 +9,7 @@ namespace ZOOM { record::syntax::syntax (value rs): val(rs) {} - record::syntax::operator string() const { + record::syntax::operator std::string() const { switch (val) { case GRS1: return "grs1"; case SUTRS: return "sutrs"; @@ -82,12 +82,12 @@ namespace ZOOM { return syntax::UNKNOWN; } - string record::render() const { + std::string record::render() const { int len; return ZOOM_record_get(r, "render", &len); } - string record::rawdata() const { + std::string record::rawdata() const { int len; return ZOOM_record_get(r, "raw", &len); } diff --git a/zoom/zrs.cpp b/zoom/zrs.cpp index 8ff9fe3..e290cb2 100644 --- a/zoom/zrs.cpp +++ b/zoom/zrs.cpp @@ -1,4 +1,4 @@ -// $Header: /home/cvsroot/yaz++/zoom/zrs.cpp,v 1.4 2002-11-30 22:33:21 mike Exp $ +// $Header: /home/cvsroot/yaz++/zoom/zrs.cpp,v 1.5 2003-07-02 10:25:13 adam Exp $ // Z39.50 Result Set class @@ -22,11 +22,11 @@ namespace ZOOM { ZOOM_resultset_destroy(rs); } - string resultSet::option(const string &key) const { + std::string resultSet::option(const std::string &key) const { return ZOOM_resultset_option_get(rs, key.c_str()); } - bool resultSet::option(const string &key, const string &val) { + bool resultSet::option(const std::string &key, const std::string &val) { ZOOM_resultset_option_set(rs, key.c_str(), val.c_str()); return true; }