From ab840f41154f01d85fec769da693035149689c39 Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Sun, 20 Apr 2014 20:37:39 +0200 Subject: Replaced c-style file reading with std::ifstream * there is no reason for performing system-calls instead of using the features offered by the standard library in this situation --- src/function/read_file.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/function') diff --git a/src/function/read_file.cc b/src/function/read_file.cc index dcbff25..ea7a758 100644 --- a/src/function/read_file.cc +++ b/src/function/read_file.cc @@ -1,6 +1,6 @@ #include "read_file.h" -#include "utility.h" +#include namespace InputXSLT { @@ -33,10 +33,15 @@ xalan::XObjectPtr FunctionReadFile::execute( fileName.end() ); + std::ifstream file(fileName); + + std::string content( + (std::istreambuf_iterator(file)), + (std::istreambuf_iterator()) + ); + return executionContext.getXObjectFactory().createString( - xalan::XalanDOMString( - InputXSLT::readFile(fileName).data() - ) + xalan::XalanDOMString(content.data()) ); } -- cgit v1.2.3