the Fink project is an effort to port
popular Unix programs to Mac OS X
Package: xerces-c
Version: 2.7.0
Revision: 1003
GCC: 4.0
Maintainer: Daniel Czarnecki
License: BSD
Homepage: http://xml.apache.org/xerces-c/
BuildDepends: fink (>= 0.24.12)
Depends: %N-shlibs (= %v-%r)
Conflicts: xerces-c23
Replaces: xerces-c23
Source: http://archive.apache.org/dist/xml/xerces-c/source/xerces-c-src_2_7_0.tar.gz
Source-MD5: 04169609449a8846bc1e6891c04cadf4
#SourceDirectory: xerces-c-src_2_7_0
PatchFile: %n.patch
PatchFile-MD5: 765046388d4a6a224bee1e9fcde28de5
PatchScript: <<
%{default_script}
#perl -pi -e 's/(\${MAKE}) -s /\1 /' `find . -name Makefile*`
perl -pi -e 's/(-install_name )/-compatibility_version %v -current_version %v \1/' src/xercesc/Makefile.incl
<<
NoSetMAKEFLAGS: true
SetMAKEFLAGS: -j1
NoSetLDFLAGS: true
NoSetCPPFLAGS: true
CompileScript: <<
#!/bin/sh -ev
export BITSFLAG
if [ "%m" = "x86_64" ]; then
export BITSFLAG="-b 64"
fi
export XERCESCROOT=%b CPATH=%p/include
cd src/xercesc
./runConfigure -p macosx -n native -C "%c" $BITSFLAG
make
cd ../../samples
./runConfigure -p macosx -C "%c" $BITSFLAG
make
<<
InstallScript: <<
#!/bin/sh -ev
export XERCESCROOT=%b
echo Install samples
mkdir -p %d/%p/bin
cp -fp bin/{CreateDOMDocument,EnumVal,Redirect,SAXCount,StdInParse,DOMCount,MemParse,SAX2Count,SAXPrint,DOMPrint,PParse,SAX2Print,SEnumVal} %d/%p/bin
echo Install docs
mkdir -p %i/share/doc/%n-dev
cp -Rfp doc/html %i/share/doc/%n-dev
cd src/xercesc
echo Install config.status
mkdir -p %i/share/%n-dev
cp -fp config.status %i/share/%n-dev
echo make install
make install DESTDIR=%d
<<
DocFiles: LICENSE*
SplitOff: <<
Package: %N-shlibs
Files: lib/libxerces-c.27.0.dylib lib/libxerces-c.27.dylib lib/libxerces-depdom.27.0.dylib lib/libxerces-depdom.27.dylib
Shlibs: <<
%p/lib/libxerces-c.27.dylib 2.7.0 %n (>= 2.7.0-1)
%p/lib/libxerces-depdom.27.dylib 2.7.0 %n (>= 2.7.0-1)
<<
DocFiles: LICENSE*
<<
SplitOff2: <<
Package: %N-dev
Conflicts: xerces-c23-dev, %N-dev (<< %v-%r)
Replaces: xerces-c23-dev, %N-dev (<< %v-%r)
BuildDependsOnly: True
Depends: %N-shlibs (= %v-%r)
Files: include share/%N-dev lib share/doc/%N-dev
DocFiles: LICENSE*
<<
Description: XML parser in C++
DescDetail: <<
Xerces-C is a validating XML parser written in C++. Xerces-C
conforms with the XML-1.0 W3C recommendation.
<<
DescPackaging: <<
The extensive documentation is in the -dev splitoff
.
The main package contains the sample applications, installed in bin.
.
If building the Perl XML::Xerces package (sold separately), it should
set the following envvars:
XERCESCROOT=%%p
XERCES_CONFIG=%%p/share/%n-dev/config.status
<<
DescPort: <<
Patched samples/runConfigure to support a -C flag just like
src/xercesc/runConfigure
dmacks updated/fixed libverisoning flag hacks.
dmacks patched a lot of makefile fragments to link directly to
build-dir libs in order to avoid libs that might be installed already.
See: https://issues.apache.org/jira/browse/XERCESC-1765
dmacks applied patch for 64bit (32-bit-only system funtions)
to MacCarbonFile.cpp and MacOSPlatformUtils.cpp from
https://issues.apache.org/jira/browse/XERCESC-1772 and pass
64-bit flag on that platform.
<<
diff -urN xerces-c-src_2_7_0-orig/obj/Makefile.in xerces-c-src_2_7_0/obj/Makefile.in
--- xerces-c-src_2_7_0-orig/obj/Makefile.in 2005-09-07 11:56:58.000000000 -0400
+++ xerces-c-src_2_7_0/obj/Makefile.in 2007-12-08 13:26:09.000000000 -0500
@@ -126,7 +126,7 @@
## DepDOM ##
${FQ_SO_DEPDOM}: $(DEPDOM_OBJECTS)
@echo Building ${FQ_SO_DEPDOM}
- ${MAKE_SHARED} ${LD_SODEPDOM} -o ${@} ${^} $(TEMPLATESOBJS) $(PLATFORM_LIBRARIES) $(DEPDOM_LINK_OPTIONS) $(ALLLIBS) -L${LIB} -l${LINK_LIBNAME}
+ ${MAKE_SHARED} ${LD_SODEPDOM} -o ${@} ${^} $(TEMPLATESOBJS) $(PLATFORM_LIBRARIES) $(DEPDOM_LINK_OPTIONS) $(ALLLIBS) ${LIB}/lib${LINK_LIBNAME}${SHLIBSUFFIX}
@echo symlink ${FQ_REAL_DEPDOM}.a
rm -rf ${FQ_REAL_DEPDOM}.a && ln -s ${XML_LIB_DIR}/${LIBDEPDOM}${SO_TARGET_VERSION}${SHLIBSUFFIX}.a ${FQ_REAL_DEPDOM}.a
@echo symlink ${FQ_LINK_DEPDOM}.a
@@ -151,14 +151,14 @@
@echo Building ${FQ_REAL_DEPDOM}
ifeq (${PLATFORM},SOLARIS)
cp $(DEPDOM_OBJECTS) $(PLATFORM)
- ${MAKE_SHARED} ${LD_SODEPDOM} -o ${@} ${DEPDOM_OBJS} $(TEMPLATESOBJS) $(PLATFORM_LIBRARIES) $(DEPDOM_LINK_OPTIONS) $(ALLLIBS) -L${LIB} -l${LINK_LIBNAME}
+ ${MAKE_SHARED} ${LD_SODEPDOM} -o ${@} ${DEPDOM_OBJS} $(TEMPLATESOBJS) $(PLATFORM_LIBRARIES) $(DEPDOM_LINK_OPTIONS) $(ALLLIBS) ${LIB}/lib${LINK_LIBNAME}${SHLIBSUFFIX}
rm ${DEPDOM_OBJS}
else
ifeq (${PLATFORM},OS390)
${MAKE_SHARED} ${LD_SODEPDOM} -o ${@} ${^} $(TEMPLATESOBJS) $(PLATFORM_LIBRARIES) $(DEPDOM_LINK_OPTIONS) $(ALLLIBS) ${LIB}/${LIBNAME}${VER}${OS390SIDEDECK}
$(CP) ${LIBDEPDOM}${VER}${OS390SIDEDECK} ${LIB}
else
- ${MAKE_SHARED} ${LD_SODEPDOM} -o ${@} ${^} $(TEMPLATESOBJS) $(PLATFORM_LIBRARIES) $(DEPDOM_LINK_OPTIONS) $(ALLLIBS) -L${LIB} -l${LINK_LIBNAME}
+ ${MAKE_SHARED} ${LD_SODEPDOM} -o ${@} ${^} $(TEMPLATESOBJS) $(PLATFORM_LIBRARIES) $(DEPDOM_LINK_OPTIONS) $(ALLLIBS) ${LIB}/lib${LINK_LIBNAME}${SHLIBSUFFIX}
endif
endif
ifneq (${FQ_SO_DEPDOM},${FQ_REAL_DEPDOM})
diff -urN xerces-c-src_2_7_0-orig/samples/Makefile.incl xerces-c-src_2_7_0/samples/Makefile.incl
--- xerces-c-src_2_7_0-orig/samples/Makefile.incl 2005-09-07 11:56:50.000000000 -0400
+++ xerces-c-src_2_7_0/samples/Makefile.incl 2007-12-08 13:26:50.000000000 -0500
@@ -32,8 +32,8 @@
endif
THISLIB=${LIB_DIR}/${LIBNAME}
-LIBRARY_NAMES=-l${LIBNAME}
-LIBRARY_SEARCH_PATHS=-L${LIB_DIR}
+LIBRARY_NAMES=${LIB_DIR}/lib${LIBNAME}${SHLIBSUFFIX}
+LIBRARY_SEARCH_PATHS=
ifndef XERCESCOUT
XERCESCOUT=${XERCESCROOT}
diff -urN xerces-c-src_2_7_0-orig/samples/runConfigure xerces-c-src_2_7_0/samples/runConfigure
--- xerces-c-src_2_7_0-orig/samples/runConfigure 2005-09-07 11:56:50.000000000 -0400
+++ xerces-c-src_2_7_0/samples/runConfigure 2007-12-06 09:30:46.000000000 -0500
@@ -93,17 +93,18 @@
transcoder=native # by default use native transcoder
thread=none # by default no need to have threads
bitsToBuild=32 # by default 32 bit build assumed
+configureoptions=""
# Check the command line parameters
if test -x /usr/bin/getopt; then
- getoptErr=`getopt p:c:x:dr:b:l:z:h $*`
+ getoptErr=`getopt p:c:x:dr:b:l:z:C:h $*`
if [ $? != 0 ]
then
usage
exit ${ERROR_EXIT_CODE}
fi
# Now get the command line parameters
- set -- `getopt p:c:x:dr:b:l:z:h $*`
+ set -- `getopt p:c:x:dr:b:l:z:C:h $*`
while [ $# -gt 0 ]
do
case $1 in
@@ -131,6 +132,9 @@
-l)
linkeroptions="$linkeroptions $2"; shift 2;;
+ -C)
+ configureoptions="$configureoptions $2"; shift 2;;
+
-h)
usage
exit ${ERROR_EXIT_CODE};;
@@ -145,7 +149,7 @@
esac
done
else
- while getopts "p:c:x:dr:b:l:z:h" switch; do
+ while getopts "p:c:x:dr:b:l:z:C:h" switch; do
case $switch in
p)
platform=$OPTARG;;
@@ -191,6 +195,7 @@
echo "bitsToBuild option: $bitsToBuild"
echo "Extra compile options: $compileroptions"
echo "Extra link options: $linkeroptions"
+echo "Extra configure options: $configureoptions"
#
# Now check if the options are correct or not, bail out if incorrect
@@ -506,11 +511,11 @@
rm -f config.log
rm -f config.status
if test $platform = "os400"; then
-./configure --host AS400-OS400
+./configure --host AS400-OS400 $configureoptions
elif test $platform = "ptx"; then
-./configure --prefix=$XMLINSTALL
+./configure --prefix=$XMLINSTALL $configureoptions
else
-./configure
+./configure $configureoptions
fi
# exit if configure failed
if test $? != 0; then
@@ -529,7 +534,7 @@
echo export CFLAGS=\"$CFLAGS\"
echo export LDFLAGS=\"$LDFLAGS\"
echo export EXTRA_LIBS=\"$EXTRA_LIBS\"
-echo configure
+echo configure $configureoptions
echo
echo If the result of the above commands look OK to you, go to the directory
diff -urN xerces-c-src_2_7_0-orig/src/xercesc/util/MsgLoaders/ICU/resources/Makefile.in xerces-c-src_2_7_0/src/xercesc/util/MsgLoaders/ICU/resources/Makefile.in
--- xerces-c-src_2_7_0-orig/src/xercesc/util/MsgLoaders/ICU/resources/Makefile.in 2005-09-07 11:55:38.000000000 -0400
+++ xerces-c-src_2_7_0/src/xercesc/util/MsgLoaders/ICU/resources/Makefile.in 2007-12-08 13:27:34.000000000 -0500
@@ -87,7 +87,7 @@
CHECK_VARS= ICU_DATA=$(RESDIR)
# DLL and static modes are identical here
-RESLDFLAGS= -L$(RESDIR) -l$(RESNAME)
+RESLDFLAGS= $(RESDIR)/lib$(RESNAME)${SHLIBSUFFIX}
RESCPPFLAGS=
CHECK_VARS=
diff -urN xerces-c-src_2_7_0-orig/src/xercesc/util/Platforms/MacOS/MacCarbonFile.cpp xerces-c-src_2_7_0/src/xercesc/util/Platforms/MacOS/MacCarbonFile.cpp
--- xerces-c-src_2_7_0-orig/src/xercesc/util/Platforms/MacOS/MacCarbonFile.cpp 2005-09-07 11:55:32.000000000 -0400
+++ xerces-c-src_2_7_0/src/xercesc/util/Platforms/MacOS/MacCarbonFile.cpp 2011-05-13 18:58:40.000000000 -0400
@@ -44,6 +44,9 @@
unsigned int
XMLMacCarbonFile::currPos()
{
+#if defined(XML_BITSTOBUILD_64)
+ return 0;
+#else
OSErr err = noErr;
unsigned int pos = 0;
@@ -69,12 +72,14 @@
ThrowXML(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetCurPos);
return pos;
+#endif
}
void
XMLMacCarbonFile::close()
{
+#ifndef XML_BITSTOBUILD_64
OSErr err = noErr;
if (!mFileValid)
ThrowXML(XMLPlatformUtilsException, XMLExcepts::File_CouldNotCloseFile);
@@ -88,12 +93,16 @@
if (err != noErr)
ThrowXML(XMLPlatformUtilsException, XMLExcepts::File_CouldNotCloseFile);
+#endif
}
unsigned int
XMLMacCarbonFile::size()
{
+#if defined(XML_BITSTOBUILD_64)
+ return 0;
+#else
OSErr err = noErr;
unsigned int len = 0;
@@ -119,12 +128,16 @@
ThrowXML(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetSize);
return len;
+#endif
}
bool
XMLMacCarbonFile::openWithPermission(const XMLCh* const fileName, int macPermission)
{
+#if defined(XML_BITSTOBUILD_64)
+ return false;
+#else
OSErr err = noErr;
if (mFileValid)
@@ -158,12 +171,14 @@
mFileValid = true;
return mFileValid;
+#endif
}
void
XMLMacCarbonFile::create(const XMLCh* const filePath)
{
+#ifndef XML_BITSTOBUILD_64
OSErr err = noErr;
// Split path into directory and filename components
@@ -254,12 +269,16 @@
ThrowXML(XMLPlatformUtilsException, XMLExcepts::File_CouldNotReadFromFile);
//ThrowXML(XMLPlatformUtilsException, XMLExcepts::File_CouldNotWriteToFile);
}
+#endif
}
bool
XMLMacCarbonFile::open(const XMLCh* const path, bool toWrite)
{
+#if defined(XML_BITSTOBUILD_64)
+ return false;
+#else
bool success = false;
if (toWrite)
@@ -273,12 +292,16 @@
}
return success;
+#endif
}
bool
XMLMacCarbonFile::open(const char* fileName, bool toWrite)
{
+#if defined(XML_BITSTOBUILD_64)
+ return false;
+#else
// Transcode the input filename from UTF8 into UTF16
UniChar uniBuf[kMaxMacStaticPathChars];
std::size_t pathLen = TranscodeUTF8ToUniChars(fileName, uniBuf, kMaxMacStaticPathChars-1);
@@ -286,12 +309,16 @@
// Call through to the unicode open routine
return open(uniBuf, toWrite);
+#endif
}
unsigned int
XMLMacCarbonFile::read(const unsigned int toRead, XMLByte* const toFill)
{
+#if defined(XML_BITSTOBUILD_64)
+ return 0;
+#else
unsigned int bytesRead = 0;
OSErr err = noErr;
@@ -315,12 +342,14 @@
ThrowXML(XMLPlatformUtilsException, XMLExcepts::File_CouldNotReadFromFile);
return bytesRead;
+#endif
}
void
XMLMacCarbonFile::write(const long byteCount, const XMLByte* const buffer)
{
+#ifndef XML_BITSTOBUILD_64
long bytesWritten = 0;
OSErr err = noErr;
@@ -349,12 +378,14 @@
{
ThrowXML(XMLPlatformUtilsException, XMLExcepts::File_CouldNotWriteToFile);
}
+#endif
}
void
XMLMacCarbonFile::reset()
{
+#ifndef XML_BITSTOBUILD_64
OSErr err = noErr;
if (!mFileValid)
@@ -367,13 +398,16 @@
if (err != noErr)
ThrowXML(XMLPlatformUtilsException, XMLExcepts::File_CouldNotResetFile);
+#endif
}
XMLMacCarbonFile::~XMLMacCarbonFile()
{
+#ifndef XML_BITSTOBUILD_64
if (mFileValid)
close();
+#endif
}
XERCES_CPP_NAMESPACE_END
diff -urN xerces-c-src_2_7_0-orig/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.cpp xerces-c-src_2_7_0/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.cpp
--- xerces-c-src_2_7_0-orig/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.cpp 2005-09-07 11:55:32.000000000 -0400
+++ xerces-c-src_2_7_0/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.cpp 2011-05-13 18:58:40.000000000 -0400
@@ -30,6 +30,13 @@
#include
#include
+#if defined(XML_BITSTOBUILD_64)
+#include
+#include
+#include
+#endif
+
+
#if defined(__APPLE__)
// Include from Frameworks Headers under ProjectBuilder
#include
@@ -59,7 +66,9 @@
#include
#include
-#if (defined(XML_USE_INMEMORY_MSGLOADER) || defined(XML_USE_INMEM_MESSAGELOADER))
+#if defined(XML_USE_ICU_MESSAGELOADER)
+ #include
+#elif (defined(XML_USE_INMEMORY_MSGLOADER) || defined(XML_USE_INMEM_MESSAGELOADER))
#include
#endif
@@ -155,6 +164,9 @@
bool gUseGETCWD = false;
+#if defined(XML_BITSTOBUILD_64)
+static XMLMutex* atomicOpsMutex = 0;
+#endif
// ---------------------------------------------------------------------------
// XMLPlatformUtils: The panic method
// ---------------------------------------------------------------------------
@@ -175,22 +187,63 @@
XMLPlatformUtils::curFilePos(const FileHandle theFile
, MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ int curPos = ftell( (FILE*)theFile);
+ if (curPos == -1)
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException,
+ XMLExcepts::File_CouldNotGetSize, manager);
+
+ return (unsigned int)curPos;
+#else
return reinterpret_cast
+#endif
}
void
XMLPlatformUtils::closeFile(const FileHandle theFile
, MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ if (fclose((FILE*)theFile))
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException,
+ XMLExcepts::File_CouldNotCloseFile, manager);
+#else
reinterpret_cast
delete reinterpret_cast
+#endif
}
unsigned int
XMLPlatformUtils::fileSize(const FileHandle theFile
, MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ // Get the current position
+ long int curPos = ftell((FILE*) theFile);
+ if (curPos == -1)
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException,
+ XMLExcepts::File_CouldNotGetCurPos, manager);
+
+ // Seek to the end and save that value for return
+ if (fseek((FILE*) theFile, 0, SEEK_END))
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException,
+ XMLExcepts::File_CouldNotSeekToEnd, manager);
+
+ long int retVal = ftell((FILE*)theFile);
+ if (retVal == -1)
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException,
+ XMLExcepts::File_CouldNotSeekToEnd, manager);
+
+ // And put the pointer back
+
+ if (fseek( (FILE*)theFile, curPos, SEEK_SET) )
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException,
+ XMLExcepts::File_CouldNotSeekToPos, manager);
+
+ return (unsigned int)retVal;
+#else
return reinterpret_cast
+#endif
}
@@ -198,6 +251,13 @@
XMLPlatformUtils::openFile(const char* const fileName
, MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ FileHandle retVal = (FILE*)fopen( fileName , "rb" );
+
+ if (retVal == NULL)
+ return 0;
+ return retVal;
+#else
// Check to make sure the file system is in a state where we can use it
if (!gFileSystemCompatible)
ThrowXMLwithMemMgr1(XMLPlatformUtilsException, XMLExcepts::File_CouldNotOpenFile, fileName, manager);
@@ -205,12 +265,22 @@
Janitor
return (file->open(fileName, false)) ? file.release() : NULL;
+#endif
}
FileHandle
XMLPlatformUtils::openFile(const XMLCh* const fileName, MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ const char* tmpFileName = XMLString::transcode(fileName, manager);
+ ArrayJanitor
+ FileHandle retVal = (FILE*)fopen( tmpFileName , "rb" );
+
+ if (retVal == NULL)
+ return 0;
+ return retVal;
+#else
// Check to make sure the file system is in a state where we can use it
if (!gFileSystemCompatible)
ThrowXMLwithMemMgr1(XMLPlatformUtilsException, XMLExcepts::File_CouldNotOpenFile, fileName, manager);
@@ -218,6 +288,7 @@
Janitor
return (file->open(fileName, false)) ? file.release() : NULL;
+#endif
}
@@ -225,6 +296,9 @@
XMLPlatformUtils::openFileToWrite(const char* const fileName
, MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ return fopen( fileName , "wb" );
+#else
// Check to make sure the file system is in a state where we can use it
if (!gFileSystemCompatible)
ThrowXMLwithMemMgr1(XMLPlatformUtilsException, XMLExcepts::File_CouldNotOpenFile, fileName, manager);
@@ -232,6 +306,7 @@
Janitor
return (file->open(fileName, true)) ? file.release() : NULL;
+#endif
}
@@ -239,6 +314,11 @@
XMLPlatformUtils::openFileToWrite(const XMLCh* const fileName
, MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ const char* tmpFileName = XMLString::transcode(fileName, manager);
+ ArrayJanitor
+ return fopen( tmpFileName , "wb" );
+#else
// Check to make sure the file system is in a state where we can use it
if (!gFileSystemCompatible)
ThrowXMLwithMemMgr1(XMLPlatformUtilsException, XMLExcepts::File_CouldNotOpenFile, fileName, manager);
@@ -246,15 +326,31 @@
Janitor
return (file->open(fileName, true)) ? file.release() : NULL;
+#endif
}
FileHandle
XMLPlatformUtils::openStdInHandle(MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ int nfd = dup(0);
+ FileHandle fh;
+ if (nfd == -1)
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException,
+ XMLExcepts::File_CouldNotDupHandle, manager);
+ fh = (FileHandle) fdopen(nfd, "r");
+ if (fh == 0) {
+ XMLCh stdinStr[] = {chLatin_s, chLatin_t, chLatin_d, chLatin_i, chLatin_n, chNull};
+ ThrowXMLwithMemMgr1(XMLPlatformUtilsException, XMLExcepts::File_CouldNotOpenFile, stdinStr, manager);
+ return NULL;
+ }
+ return fh;
+#else
XMLCh stdinStr[] = {chLatin_s, chLatin_t, chLatin_d, chLatin_i, chLatin_n, chNull};
ThrowXMLwithMemMgr1(XMLPlatformUtilsException, XMLExcepts::File_CouldNotOpenFile, stdinStr, manager);
return NULL;
+#endif
}
@@ -264,17 +360,60 @@
, XMLByte* const toFill
, MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ size_t noOfItemsRead = fread((void*) toFill, 1, toRead, (FILE*)theFile);
+
+ if(ferror((FILE*)theFile))
+ {
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException,
+ XMLExcepts::File_CouldNotReadFromFile, manager);
+ }
+
+ return (unsigned int)noOfItemsRead;
+#else
return reinterpret_cast
+#endif
}
void
XMLPlatformUtils::writeBufferToFile( const FileHandle theFile
- , const long toWrite
+ , long toWrite
, const XMLByte* const toFlush
, MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ if (!theFile ||
+ (toWrite <= 0 ) ||
+ !toFlush )
+ return;
+
+ const XMLByte* tmpFlush = (const XMLByte*) toFlush;
+ size_t bytesWritten = 0;
+
+ while (true)
+ {
+ bytesWritten=fwrite(tmpFlush, sizeof(XMLByte), toWrite, (FILE*)theFile);
+
+ if(ferror((FILE*)theFile))
+ {
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotWriteToFile, manager);
+ }
+
+ if (bytesWritten < toWrite) //incomplete write
+ {
+ tmpFlush+=bytesWritten;
+ toWrite-=bytesWritten;
+ bytesWritten=0;
+ }
+ else
+ return;
+ }
+
+ return;
+#else
return reinterpret_cast
+#endif
}
@@ -282,7 +421,14 @@
XMLPlatformUtils::resetFile(FileHandle theFile
, MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ // Seek to the start of the file
+ if (fseek((FILE*)theFile, 0, SEEK_SET))
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException,
+ XMLExcepts::File_CouldNotResetFile, manager);
+#else
reinterpret_cast
+#endif
}
@@ -293,6 +439,24 @@
XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ //
+ // NOTE: The path provided has always already been opened successfully,
+ // so we know that its not some pathological freaky path. It comes in
+ // in native format, and goes out as Unicode always
+ //
+ char* newSrc = XMLString::transcode(srcPath, manager);
+ ArrayJanitor
+
+ // Use a local buffer that is big enough for the largest legal path
+ char absPath[PATH_MAX + 1];
+
+ // get the absolute path
+ if (!realpath(newSrc, absPath))
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetBasePathName, manager);
+
+ return XMLString::transcode(absPath, manager);
+#else
XMLCh* path = NULL;
if (gHasHFSPlusAPIs)
@@ -313,6 +477,7 @@
}
return path;
+#endif
}
@@ -326,6 +491,16 @@
XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ char dirBuf[PATH_MAX + 2];
+ char *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
+
+ if (!curDir)
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException,
+ XMLExcepts::File_CouldNotGetBasePathName, manager);
+
+ return XMLString::transcode(curDir, manager);
+#else
// Get a newly allocated path to the current directory
FSSpec spec;
@@ -343,6 +518,7 @@
XMLExcepts::File_CouldNotGetBasePathName, manager);
return path;
+#endif
}
@@ -359,6 +535,11 @@
unsigned long
XMLPlatformUtils::getCurrentMillis()
{
+#if defined(XML_BITSTOBUILD_64)
+ struct timeval aTime;
+ gettimeofday(&aTime, NULL);
+ return (unsigned long) (aTime.tv_sec * 1000 + aTime.tv_usec / 1000);
+#else
if ((void*)kUnresolvedCFragSymbolAddress != UpTime)
{
// Use Driver services routines, now in Carbon,
@@ -368,6 +549,7 @@
}
else
return TickCount() * 100 / 6;
+#endif
}
@@ -461,12 +643,21 @@
// Replace *toFill with newValue iff *toFill == toCompare,
// returning previous value of *toFill
+#if defined(XML_BITSTOBUILD_64)
+ XMLMutexLock lockMutex(atomicOpsMutex);
+
+ void *retVal = *toFill;
+ if (*toFill == toCompare)
+ *toFill = (void *)newValue;
+
+ return retVal;
+#else
Boolean success = CompareAndSwap(
reinterpret_cast
reinterpret_cast
reinterpret_cast
-
return (success) ? const_cast
+#endif
}
@@ -481,14 +672,24 @@
int
XMLPlatformUtils::atomicIncrement(int &location)
{
+#if defined(XML_BITSTOBUILD_64)
+ XMLMutexLock lockMutex(atomicOpsMutex);
+ return ++location;
+#else
return IncrementAtomic(reinterpret_cast
+#endif
}
int
XMLPlatformUtils::atomicDecrement(int &location)
{
+#if defined(XML_BITSTOBUILD_64)
+ XMLMutexLock lockMutex(atomicOpsMutex);
+ return --location;
+#else
return DecrementAtomic(reinterpret_cast
+#endif
}
@@ -507,10 +708,15 @@
// Detect available functions
// Check whether we're on OS X
+#if defined(XML_BITSTOBUILD_64)
+ gMacOSXOrBetter = true;
+ gUsePosixFiles = true;
+ gFileSystemCompatible = true;
+ gHasMPAPIs = true;
+#else
gMacOSXOrBetter = noErr == Gestalt(gestaltSystemVersion, &value)
&& value >= 0x00001000
;
-
// Look for file system services
if (noErr == Gestalt(gestaltFSAttr, &value))
{
@@ -550,6 +756,16 @@
// Look for MP
gHasMPAPIs = MPLibraryIsLoaded();
+#endif
+
+#if defined(XML_BITSTOBUILD_64)
+ if ( atomicOpsMutex == 0 )
+ {
+ atomicOpsMutex = new (fgMemoryManager) XMLMutex(fgMemoryManager);
+ if (atomicOpsMutex->fHandle == 0)
+ atomicOpsMutex->fHandle = XMLPlatformUtils::makeMutex(fgMemoryManager);
+ }
+#endif
}
@@ -559,6 +775,13 @@
void
XMLPlatformUtils::platformTerm()
{
+#if defined(XML_BITSTOBUILD_64)
+ // delete the mutex we created
+ closeMutex(atomicOpsMutex->fHandle);
+ atomicOpsMutex->fHandle = 0;
+ delete atomicOpsMutex;
+ atomicOpsMutex = 0;
+#endif
}
@@ -612,7 +835,9 @@
XMLMsgLoader* retVal;
try
{
-#if (defined(XML_USE_INMEMORY_MSGLOADER) || defined(XML_USE_INMEM_MESSAGELOADER))
+#if defined (XML_USE_ICU_MESSAGELOADER)
+ retVal = new (fgMemoryManager) ICUMsgLoader(msgDomain);
+#elif (defined(XML_USE_INMEMORY_MSGLOADER) || defined(XML_USE_INMEM_MESSAGELOADER))
retVal = new (fgMemoryManager) InMemMsgLoader(msgDomain);
#else
#error You must provide a message loader
@@ -765,6 +990,9 @@
bool
XMLParsePathToFSRef(const XMLCh* const pathName, FSRef& ref, MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ return false;
+#else
bool result;
// If FSPathMakeRef is available, we use it to parse the
@@ -788,12 +1016,16 @@
result = XMLParsePathToFSRef_Classic(pathName, ref, manager);
return result;
+#endif
}
bool
XMLParsePathToFSRef_X(const XMLCh* const pathName, FSRef& ref, MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ return NULL;
+#else
// Parse Path to FSRef using FSPathMakeRef as available under
// Mac OS X and CarbonLib 1.1 and greater.
@@ -860,12 +1092,16 @@
// Return true on success
return (err == noErr);
+#endif
}
bool
XMLParsePathToFSRef_Classic(const XMLCh* const pathName, FSRef& ref, MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ return NULL;
+#else
// Parse Path to FSRef by stepping manually through path components.
// Path's parsed in this way must always begin with a volume name.
@@ -992,6 +1228,7 @@
}
return err == noErr;
+#endif
}
@@ -999,6 +1236,9 @@
XMLParsePathToFSSpec(const XMLCh* const pathName, FSSpec& spec,
MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ return NULL;
+#else
// Parse Path to an FSSpec
// If we've got HFS+ APIs, do this in terms of refs so that
@@ -1028,6 +1268,7 @@
// Return true on success
return result;
+#endif
}
@@ -1035,6 +1276,9 @@
XMLParsePathToFSSpec_Classic(const XMLCh* const pathName, FSSpec& spec,
MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ return NULL;
+#else
// Manually parse the path using FSSpec APIs.
// Transcode the path into ascii
@@ -1187,6 +1431,7 @@
}
return err == noErr;
+#endif
}
@@ -1194,6 +1439,9 @@
XMLCreateFullPathFromFSRef(const FSRef& startingRef,
MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ return NULL;
+#else
XMLCh* result = NULL;
// If FSRefMakePath is available, we use it to create the
@@ -1215,6 +1463,7 @@
result = XMLCreateFullPathFromFSRef_Classic(startingRef, manager);
return result;
+#endif
}
@@ -1222,6 +1471,9 @@
XMLCreateFullPathFromFSRef_X(const FSRef& startingRef,
MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ return NULL;
+#else
// Create the path using FSRefMakePath as available on Mac OS X
// and under CarbonLib 1.1 and greater.
OSStatus err = noErr;
@@ -1249,6 +1501,7 @@
CopyUniCharsToXMLChs(uniBuf, result.get(), pathLen, pathLen);
return result.release();
+#endif
}
@@ -1256,6 +1509,9 @@
XMLCreateFullPathFromFSRef_Classic(const FSRef& startingRef,
MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ return NULL;
+#else
// Manually create the path using FSRef APIs.
OSStatus err = noErr;
FSCatalogInfo catalogInfo;
@@ -1335,6 +1591,7 @@
std::memcpy(final.get() + bufCnt, result.get(), resultLen * sizeof(XMLCh));
return final.release();
+#endif
}
@@ -1342,6 +1599,9 @@
XMLCreateFullPathFromFSSpec(const FSSpec& startingSpec,
MemoryManager* const manager)
{
+#if defined(XML_BITSTOBUILD_64)
+ return NULL;
+#else
XMLCh* result = NULL;
// If FSRefs are available, do this operation in terms of refs...this
@@ -1367,6 +1627,7 @@
}
return result;
+#endif
}
@@ -1374,7 +1635,10 @@
XMLCreateFullPathFromFSSpec_Classic(const FSSpec& startingSpec,
MemoryManager* const manager)
{
- // Manually create the path using FSSpec APIs.
+#if defined(XML_BITSTOBUILD_64)
+ return NULL;
+#else
+ // Manually create the path using FSSpec APIs.
OSStatus err = noErr;
FSSpec spec = startingSpec;
@@ -1457,6 +1721,7 @@
// Cleanup and transcode to unicode
return XMLString::transcode(final.get(), manager);
+#endif
}
diff -urN xerces-c-src_2_7_0-orig/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp xerces-c-src_2_7_0/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp
--- xerces-c-src_2_7_0-orig/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp 2005-09-07 11:55:43.000000000 -0400
+++ xerces-c-src_2_7_0/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp 2011-05-13 18:58:40.000000000 -0400
@@ -97,7 +97,11 @@
: fCollator(NULL)
{
// Test for presense of unicode collation functions
+#if defined(XML_BITSTOBUILD_64)
+ fHasUnicodeCollation = true;
+#else
fHasUnicodeCollation = (UCCompareText != (void*)kUnresolvedCFragSymbolAddress);
+#endif
// Create a unicode collator for doing string comparisons
if (fHasUnicodeCollation)
@@ -440,10 +444,17 @@
UnicodeToTextInfo unicodeToTextInfo = NULL;
// Map the encoding to a Mac OS Encoding value
- Str255 pasEncodingName;
char cEncodingName[256];
ConvertWideToNarrow(encodingName, cEncodingName, sizeof(cEncodingName));
+#if defined(XML_BITSTOBUILD_64)
+ CFStringRef temp;
+ temp = CFStringCreateWithCString(NULL, cEncodingName, kCFStringEncodingUTF16);
+ const unsigned char* pasEncodingName = CFStringGetPascalStringPtr (temp, kCFStringEncodingASCII);
+
+#else
+ Str255 pasEncodingName;
CopyCStringToPascal(cEncodingName, pasEncodingName);
+#endif
TextEncoding textEncoding = 0;
OSStatus status = TECGetTextEncodingFromInternetName (
@@ -514,9 +525,13 @@
bool
MacOSUnicodeConverter::IsMacOSUnicodeConverterSupported(void)
{
+#if defined(XML_BITSTOBUILD_64)
+ return true;
+#else
return UpgradeScriptInfoToTextEncoding != (void*)kUnresolvedCFragSymbolAddress
&& CreateTextToUnicodeInfoByEncoding != (void*)kUnresolvedCFragSymbolAddress
;
+#endif
}
@@ -625,7 +640,12 @@
if (status == kTECUnmappableElementErr && options == UnRep_Throw)
{
XMLCh tmpBuf[17];
+#if defined(XML_BITSTOBUILD_64)
+ unsigned int tmpValue = (unsigned int)srcData[charsConsumed];
+ XMLString::binToText(tmpValue, tmpBuf, 16, 16);
+#else
XMLString::binToText((unsigned int)&srcData[charsConsumed], tmpBuf, 16, 16);
+#endif
ThrowXML2
(
TranscodingException
diff -urN xerces-c-src_2_7_0-orig/tests/Makefile.incl xerces-c-src_2_7_0/tests/Makefile.incl
--- xerces-c-src_2_7_0-orig/tests/Makefile.incl 2005-09-07 11:56:40.000000000 -0400
+++ xerces-c-src_2_7_0/tests/Makefile.incl 2007-12-08 13:28:02.000000000 -0500
@@ -34,9 +34,9 @@
endif
THISLIB=${LIB_DIR}/${LIBNAME}
-LIBRARY_NAMES=-l${LIBNAME}
-LIBRARY_DEPDOM=-l${LIBDEPDOM}
-LIBRARY_SEARCH_PATHS=-L${LIB_DIR}
+LIBRARY_NAMES=${LIB_DIR}/lib${LIBNAME}${SHLIBSUFFIX}
+LIBRARY_DEPDOM=${LIB_DIR/lib${LIBDEPDOM}${SHLIBSUFFIX}
+LIBRARY_SEARCH_PATHS=
TO = o
####################### PLATFORM DEPENDENCIES #####################