summaryrefslogtreecommitdiff
path: root/shared/xml_base.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:13:13 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:13:13 +0200
commit7f23ee90fd545995a29e2175f15e8b97e59ca67a (patch)
treef8d0afac51995032e58b9a475ccbbc73ba207baf /shared/xml_base.cpp
parent3.19 (diff)
downloadFreeFileSync-7f23ee90fd545995a29e2175f15e8b97e59ca67a.tar.gz
FreeFileSync-7f23ee90fd545995a29e2175f15e8b97e59ca67a.tar.bz2
FreeFileSync-7f23ee90fd545995a29e2175f15e8b97e59ca67a.zip
3.20
Diffstat (limited to 'shared/xml_base.cpp')
-rw-r--r--shared/xml_base.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/shared/xml_base.cpp b/shared/xml_base.cpp
index cd9f58a6..c7c92401 100644
--- a/shared/xml_base.cpp
+++ b/shared/xml_base.cpp
@@ -3,7 +3,7 @@
// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) *
// **************************************************************************
-//
+
#include "xml_base.h"
#include <file_handling.h>
#include <string_conv.h>
@@ -13,12 +13,14 @@
using namespace zen;
+//loadXmlDocument vs loadStream:
+//1. better error reporting
+//2. quick exit if (potentially large) input file is not an XML
void xmlAccess::loadXmlDocument(const wxString& filename, XmlDoc& doc) //throw FfsXmlError()
{
std::string stream;
try
{
- const zen::UInt64 fs = zen::getFilesize(toZ(filename)); //throw (FileError)
{
//quick test whether input is an XML: avoid loading large binary files up front!
//doesn't correctly handle BOM! (but no issue yet...)
@@ -31,6 +33,7 @@ void xmlAccess::loadXmlDocument(const wxString& filename, XmlDoc& doc) //throw F
throw FfsXmlError(wxString(_("Error parsing configuration file:")) + wxT("\n\"") + filename + wxT("\""));
}
+ const zen::UInt64 fs = zen::getFilesize(toZ(filename)); //throw (FileError)
stream.resize(to<size_t>(fs));
FileInput inputFile(toZ(filename)); //throw (FileError);
bgstack15