]> git.mxchange.org Git - simgear.git/blobdiff - simgear/io/SVNReportParser.cxx
HTTP: Rename urlretrieve/urlload to save/load.
[simgear.git] / simgear / io / SVNReportParser.cxx
index a6f80224e4e71d5aa947affcb5db97ce1f8ef463..96b357f51e3e231b05c23e8dd7e6cafac4592abc 100644 (file)
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
+#ifdef HAVE_CONFIG_H
+#  include <simgear_config.h>
+#endif
+     
 #include "SVNReportParser.hxx"
 
 #include <iostream>
 #include "simgear/misc/sg_path.hxx"
 #include "simgear/misc/sg_dir.hxx"
 #include "simgear/debug/logstream.hxx"
-#include "simgear/xml/xmlparse.h"
 #include "simgear/xml/easyxml.hxx"
 #include "simgear/misc/strutils.hxx"
 #include "simgear/package/md5.h"
 
+#ifdef SYSTEM_EXPAT
+#  include <expat.h>
+#else
+#  include "sg_expat.h"     
+#endif
+
 #include "SVNDirectory.hxx"
 #include "SVNRepository.hxx"
 #include "DAVMultiStatus.hxx"
@@ -156,7 +165,7 @@ namespace {
          _ptr = p;
      }
   
-    bool apply(std::vector<char>& output, std::istream& source)
+    bool apply(std::vector<unsigned char>& output, std::istream& source)
     {
         unsigned char* pEnd = _ptr + instructionLength;
         unsigned char* newData = pEnd;
@@ -321,11 +330,12 @@ public:
   }
   
   bool decodeTextDelta(const SGPath& outputPath)
-  {    
-    string decoded = strutils::decodeBase64(txDeltaData);
+  {
+      std::vector<unsigned char> output, decoded;
+    strutils::decodeBase64(txDeltaData, decoded);
     size_t bytesToDecode = decoded.size();
-    std::vector<char> output;      
-    unsigned char* p = (unsigned char*) decoded.data();
+         
+    unsigned char* p = decoded.data();
     if (memcmp(p, "SVN\0", DELTA_HEADER_SIZE) != 0) {
         return false; // bad header
     }
@@ -337,9 +347,9 @@ public:
     
     while (bytesToDecode > 0) {  
         if (!SVNDeltaWindow::isWindowComplete(p, bytesToDecode)) {
-         SG_LOG(SG_IO, SG_WARN, "SVN txdelta broken window");
-         return false;
-       }
+            SG_LOG(SG_IO, SG_WARN, "SVN txdelta broken window");
+            return false;
+        }
        
         SVNDeltaWindow window(p);      
         assert(bytesToDecode >= window.size());
@@ -353,7 +363,7 @@ public:
     std::ofstream f;
     f.open(outputPath.c_str(), 
       std::ios::out | std::ios::trunc | std::ios::binary);
-    f.write(output.data(), output.size());
+    f.write((char*) output.data(), output.size());
 
     // compute MD5 while we have the file in memory
     memset(&md5Context, 0, sizeof(SG_MD5_CTX));
@@ -433,11 +443,11 @@ public:
       }
       
     if (tagStack.back() == SVN_SET_PROP_TAG) {
-      setPropValue += string(s, length);
+      setPropValue.append(s, length);
     } else if (tagStack.back() == SVN_TXDELTA_TAG) {
-      txDeltaData += string(s, length);
+      txDeltaData.append(s, length);
     } else if (tagStack.back() == SVN_DAV_MD5_CHECKSUM) {
-      md5Sum += string(s, length);
+      md5Sum.append(s, length);
     }
   }