From: Marc Cromme Date: Fri, 22 Sep 2006 14:13:03 +0000 (+0000) Subject: protecting from derefenecing empty pointers X-Git-Tag: METAPROXY.1.0.7~52 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=9df178cd376007f26b4336c71abeccba1854b4b6;p=metaproxy-moved-to-github.git protecting from derefenecing empty pointers --- diff --git a/src/gduutil.cpp b/src/gduutil.cpp index 333e605..5b48e6e 100644 --- a/src/gduutil.cpp +++ b/src/gduutil.cpp @@ -1,4 +1,4 @@ -/* $Id: gduutil.cpp,v 1.11 2006-09-21 11:45:00 marc Exp $ +/* $Id: gduutil.cpp,v 1.12 2006-09-22 14:13:03 marc Exp $ Copyright (c) 2005-2006, Index Data. See the LICENSE file for details @@ -213,13 +213,31 @@ std::ostream& std::operator<<(std::ostream& os, Z_APDU& zapdu) } break; case Z_APDU_presentRequest: - os << " " << "presentRequest" << " "; + os << " " << "presentRequest"; { Z_PresentRequest *pr = zapdu.u.presentRequest; - os << pr->resultSetId << " " - //<< pr->referenceId << " " - << *(pr->resultSetStartPoint) << " " - << *(pr->numberOfRecordsRequested); + if (pr->resultSetId) + os << " " << (pr->resultSetId); + else + os << " -"; + //<< pr->referenceId << " " + if (pr->resultSetStartPoint) + os << " " << *(pr->resultSetStartPoint); + else + os << " -"; + if (pr->numberOfRecordsRequested) + os << " " << *(pr->numberOfRecordsRequested); + else + os << " -"; + //if (pr->preferredRecordSyntax) + // os << " " << *(pr->preferredRecordSyntax); + //else + // os << " -"; + //elements + //if (pr->) + // os << " " << *(pr->); + //else + // os << " -"; } break; case Z_APDU_presentResponse: @@ -566,16 +584,25 @@ std::ostream& std::operator<<(std::ostream& os, Z_SRW_PDU& srw_pdu) os << " " << (sr->recordPacking); else os << " -"; + + if (sr->recordSchema) + os << " " << (sr->recordSchema); + else + os << " -"; switch (sr->query_type){ case Z_SRW_query_type_cql: - os << " CQL " << sr->query.cql; + os << " CQL"; + if (sr->query.cql) + os << " " << sr->query.cql; break; case Z_SRW_query_type_xcql: os << " XCQL"; break; case Z_SRW_query_type_pqf: - os << " PQF " << sr->query.pqf; + os << " PQF"; + if (sr->query.pqf) + os << " " << sr->query.pqf; break; } }