fix build on 64-bit big-endians

This commit is contained in:
Dan Horák 2011-04-07 15:48:55 +02:00
parent ef54c37c12
commit 421d8bc783
2 changed files with 42 additions and 1 deletions

35
xmlstar-sf3266898.patch Normal file
View File

@ -0,0 +1,35 @@
From 348ee3d65a0f30983c72d43a15d371b47fea65f6 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@users.sourceforge.net>
Date: Fri, 1 Apr 2011 17:41:03 -0400
Subject: [PATCH 1/1] don't write to curXPath[-1]
---
src/xml_elem.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/xml_elem.c b/src/xml_elem.c
index 69f3126..eaabcf2 100644
--- a/src/xml_elem.c
+++ b/src/xml_elem.c
@@ -163,7 +163,9 @@ void elStartElement(void *user_data, const xmlChar *name, const xmlChar **attrs)
*/
void elEndElement(void *user_data, const xmlChar *name)
{
- *(curXPath + xmlStrlen(curXPath) - xmlStrlen(name) - 1) = '\0';
+ int xlen = xmlStrlen(curXPath);
+ int nlen = xmlStrlen(name);
+ *(curXPath + xlen - nlen - (xlen == nlen?0:1)) = '\0';
depth--;
}
@@ -184,6 +186,7 @@ parse_xml_file(const char *filename)
ret = xmlSAXUserParseFile(&xmlSAX_handler, NULL, filename);
xmlCleanupParser();
+ xmlFree(curXPath);
return ret;
}
--
1.7.0.1

View File

@ -1,12 +1,14 @@
Name: xmlstarlet
Version: 1.0.6
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Command Line XML Toolkit
Group: Applications/Text
License: MIT
URL: http://xmlstar.sourceforge.net/
Source0: http://downloads.sourceforge.net/xmlstar/%{name}-%{version}.tar.gz
Patch0: xmlstarlet-1.0.6-gendoc.patch
# http://sourceforge.net/tracker/?func=detail&aid=3266898&group_id=66612&atid=515106
Patch1: xmlstar-sf3266898.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: xmlto automake autoconf libxslt-devel
@ -22,6 +24,7 @@ commands.
%prep
%setup -q
%patch0 -p1 -b .gendoc
%patch1 -p1 -b .sf3266898
%build
@ -57,6 +60,9 @@ rm -fr %{buildroot}
%changelog
* Thu Apr 07 2011 Dan Horák <dan[at]danny.cz> - 1.0.6-2
- fix build on 64-bit big-endians
* Sat Mar 26 2011 Paul W. Frields <stickster@gmail.com> - 1.0.6-1
- Update to upstream 1.0.6
- Drop obsolete patch