You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ar...@locus.apache.org on 2000/06/02 02:21:39 UTC
cvs commit: xml-xerces/c/src/util XMLURL.cpp XMLURL.hpp
aruna1 00/06/01 17:21:39
Modified: c/src/util XMLURL.cpp XMLURL.hpp
Log:
Modified to rectify crash on solaris CC5.0 optimized builds. Its an irrational fix for some compiler problem.
Revision Changes Path
1.13 +37 -77 xml-xerces/c/src/util/XMLURL.cpp
Index: XMLURL.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/util/XMLURL.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- XMLURL.cpp 2000/03/24 20:02:43 1.12
+++ XMLURL.cpp 2000/06/02 00:21:38 1.13
@@ -55,64 +55,7 @@
*/
/*
- * $Log: XMLURL.cpp,v $
- * Revision 1.12 2000/03/24 20:02:43 roddey
- * A few more tweaks to the base/relative URL conglomeration code.
- *
- * Revision 1.11 2000/03/24 00:29:36 rahulj
- * While composing the full path, also consider the port number
- * of the base URL.
- *
- * Revision 1.10 2000/03/23 01:02:38 roddey
- * Updates to the XMLURL class to correct a lot of parsing problems
- * and to add support for the port number. Updated the URL tests
- * to test some of this new stuff.
- *
- * Revision 1.9 2000/03/17 23:59:55 roddey
- * Initial updates for two way transcoding support
- *
- * Revision 1.8 2000/03/02 19:54:49 roddey
- * This checkin includes many changes done while waiting for the
- * 1.1.0 code to be finished. I can't list them all here, but a list is
- * available elsewhere.
- *
- * Revision 1.7 2000/02/17 18:09:02 roddey
- * Fixed an infinite loop caused while trying to trim leading
- * whitespace from the raw URL during parsing.
- *
- * Revision 1.6 2000/02/06 07:48:06 rahulj
- * Year 2K copyright swat.
- *
- * Revision 1.5 2000/02/01 00:07:31 roddey
- * A small patch for the base/rel conglomeration when the protocol is file.
- *
- * Revision 1.4 2000/01/27 18:22:31 roddey
- * Fixed a couple of small reported bugs, in the parsing code and in the
- * special cased local file stream creation code.
- *
- * Revision 1.3 2000/01/19 00:56:59 roddey
- * Changes to get rid of dependence on old utils standard streams and to
- * get rid of the fgLibLocation stuff.
- *
- * Revision 1.2 2000/01/17 23:38:06 abagchi
- * Changed string "localhost" to XMLUni::fgLocalHostString
- *
- * Revision 1.1 2000/01/15 01:26:17 rahulj
- * Added support for HTTP to the parser using libWWW 5.2.8.
- * Renamed URL.[ch]pp to XMLURL.[ch]pp and like wise for the class name.
- * Only tested under NT 4.0 SP 5.
- * Removed URL.hpp from files where it was not used.
- *
- * Revision 1.2 2000/01/12 00:16:22 roddey
- * Changes to deal with multiply nested, relative pathed, entities and to deal
- * with the new URL class changes.
- *
- * Revision 1.1.1.1 1999/11/09 01:04:20 twl
- * Initial checkin
- *
- * Revision 1.3 1999/11/08 20:45:16 rahul
- * Swat for adding in Product name and CVS comment log variable.
- *
+ * $Id: XMLURL.cpp,v 1.13 2000/06/02 00:21:38 aruna1 Exp $
*/
@@ -130,6 +73,7 @@
#include <util/XMLUni.hpp>
+
// ---------------------------------------------------------------------------
// Local types
//
@@ -465,19 +409,6 @@
{
// Parse our URL string
parse(relativeURL);
-
- //
- // If its relative and the base is non-null and non-empty, then
- // parse the base URL string and conglomerate them.
- //
- if (isRelative() && baseURL)
- {
- if (*baseURL)
- {
- XMLURL basePart(baseURL);
- conglomerateWithBase(basePart);
- }
- }
}
catch(...)
@@ -485,6 +416,23 @@
cleanup();
throw;
}
+
+ //
+ // If its relative and the base is non-null and non-empty, then
+ // parse the base URL string and conglomerate them.
+ //
+ if (isRelative() && baseURL)
+ {
+ if (*baseURL)
+ {
+ XMLURL basePart(baseURL);
+ if (!conglomerateWithBase(basePart, false))
+ {
+ cleanup();
+ ThrowXML(MalformedURLException, XMLExcepts::URL_RelativeBaseURL);
+ }
+ }
+ }
}
void XMLURL::setURL(const XMLURL& baseURL
@@ -727,11 +675,20 @@
}
-void XMLURL::conglomerateWithBase(const XMLURL& baseURL)
+//This function has been modified to take a bool parameter and the
+//functionality inside looks irrational but is only to make
+//solaris 2.7 CC 5.0 optimized build happy.
+
+bool XMLURL::conglomerateWithBase(const XMLURL& baseURL, bool useExceptions)
{
// The base URL cannot be relative
if (baseURL.isRelative())
- ThrowXML(MalformedURLException, XMLExcepts::URL_RelativeBaseURL);
+ {
+ if (useExceptions)
+ ThrowXML(MalformedURLException, XMLExcepts::URL_RelativeBaseURL);
+ else
+ return false;
+ }
//
// Check a special case. If all we have is a fragment, then we want
@@ -757,7 +714,7 @@
fUser = XMLString::replicate(baseURL.fUser);
fPassword = XMLString::replicate(baseURL.fPassword);
fPath = XMLString::replicate(baseURL.fPath);
- return;
+ return true;
}
//
@@ -766,7 +723,7 @@
// that we have, we stop.
//
if (fProtocol != Unknown)
- return;
+ return true;
fProtocol = baseURL.fProtocol;
//
@@ -776,7 +733,7 @@
if (fProtocol != File)
{
if (fHost || !baseURL.fHost)
- return;
+ return true;
}
// Replicate all of the hosty stuff if the base has one
@@ -800,7 +757,7 @@
if (hadPath)
{
if (*fPath == chForwardSlash)
- return;
+ return true;
}
// Its a relative path, so weave them together.
@@ -809,15 +766,15 @@
// If we had any original path, then we are done
if (hadPath)
- return;
+ return true;
// We had no original path, so go on to deal with the query/fragment parts
if (fQuery || !baseURL.fQuery)
- return;
+ return true;
fQuery = XMLString::replicate(baseURL.fQuery);
if (fFragment || !baseURL.fFragment)
- return;
+ return true;
fFragment = XMLString::replicate(baseURL.fFragment);
}
1.7 +2 -2 xml-xerces/c/src/util/XMLURL.hpp
Index: XMLURL.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/util/XMLURL.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XMLURL.hpp 2000/05/04 02:43:45 1.6
+++ XMLURL.hpp 2000/06/02 00:21:38 1.7
@@ -55,7 +55,7 @@
*/
/*
- * $Id: XMLURL.hpp,v 1.6 2000/05/04 02:43:45 aruna1 Exp $
+ * $Id: XMLURL.hpp,v 1.7 2000/06/02 00:21:38 aruna1 Exp $
*/
#if !defined(XMLURL_HPP)
@@ -189,7 +189,7 @@
// -----------------------------------------------------------------------
void buildFullText();
void cleanup();
- void conglomerateWithBase(const XMLURL& baseURL);
+ bool conglomerateWithBase(const XMLURL& baseURL, bool useExceptions=true);
void parse
(
const XMLCh* const urlText