[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Comments on xerces-c patch please



Hi,

One of the blahtexml build dependencies is xerces-c which is not
available for the Hurd. The attached patch fixes the build. Can somebody
check it the patch is OK before I submit a bug report? 

Thanks,
Svante
--- xerces-c-3.1.1/src/xercesc/util/FileManagers/PosixFileMgr.cpp.orig	2008-07-04 09:23:56.000000000 +0000
+++ xerces-c-3.1.1/src/xercesc/util/FileManagers/PosixFileMgr.cpp	2011-08-03 21:58:23.000000000 +0000
@@ -187,6 +187,17 @@
     ArrayJanitor<char> janText(newSrc, manager);
 
     // Use a local buffer that is big enough for the largest legal path
+#ifdef __GNU__
+    char *absPath;
+    XMLCh *ret;
+    // get the absolute path
+    absPath=realpath(newSrc, NULL);
+    if (absPath == NULL)
+   		ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetBasePathName, manager);
+    ret = XMLString::transcode(absPath, manager);
+    free (absPath);
+    return ret; 
+#else
     char absPath[PATH_MAX + 1];
     
     // get the absolute path
@@ -194,20 +205,34 @@
    		ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetBasePathName, manager);
 
     return XMLString::transcode(absPath, manager);
+#endif
 }
 
 
 XMLCh*
 PosixFileMgr::getCurrentDirectory(MemoryManager* const manager)
 {
+#ifdef __GNU__
+    char *dirBuf=NULL;
+    XMLCh *ret;
+    size_t dummy = 0;
+    char *curDir = getcwd(dirBuf, dummy);
+    if (curDir == NULL)
+        ThrowXMLwithMemMgr(XMLPlatformUtilsException,
+                 XMLExcepts::File_CouldNotGetBasePathName, manager);
+
+    ret = XMLString::transcode(curDir, manager);
+    free (curDir);
+    return ret;
+#else
     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);
+#endif
 }
 
 

Reply to: