[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [xml] XPath fix
- From: Daniel Veillard <veillard redhat com>
- To: Richard Jinks <cyberthymia yahoo co uk>
- Cc: xml gnome org
- Subject: Re: [xml] XPath fix
- Date: Fri, 22 Mar 2002 06:45:39 -0500
On Fri, Mar 22, 2002 at 10:28:30AM -0000, Richard Jinks wrote:
> Hi.
>
> Found a small bug in xmlXPathCastToString() in xpath.c
> Had problems getting wierd results if the XPath result was a string (e.g.
> "string('Hello')" = "ÝÝÝÝÝÝÝÝÝÝ)p)" )
> Noticed that all other cases in xmlXPathCastToString() create a new string
> apart from case XPATH_STRING, which just returns the stringval itself. As I
> was already freeing the XPathObject results object, the memory was getting
> trashed.
> Fix just involves returning a duplicate of the string, and now you are
> always responsible for freeing the string returned separately, regardless of
> what type of result it is.
Hum, right, that's sensible. This doesn't seem to introduce memory
leak either so I assume that path was simply never used in the regression
tests. I made the change, thanks.
> As a heads up, I'm working on a fix for one of the number expressions -
> libxml returns 1 for the expression "5.46 mod 2.6". Apparently, according to
> the xsl-list, it should return "0.26" (Something to do with Java doing
> floating point mods, C only doing integer mods).
Section 3.5 of the XPath spec states:
"This is the same as the % operator in Java and ECMAScript."
"This is not the same as the IEEE 754 remainder operation,
which returns the remainder from a rounding division."
So they may be right, I hate those parts where XPath/XSLT relies on Java
for the semantic of operations, it is usually a mess.
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]