--- parser3/src/main/pa_pool.C 2001/10/19 14:15:23 1.35 +++ parser3/src/main/pa_pool.C 2001/10/22 16:44:42 1.38 @@ -4,7 +4,7 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_pool.C,v 1.35 2001/10/19 14:15:23 parser Exp $ + $Id: pa_pool.C,v 1.38 2001/10/22 16:44:42 parser Exp $ */ #include "pa_pool.h" @@ -87,7 +87,7 @@ const char *Pool::transcode_cstr(const X error=false; } } catch(XMLException& e) { - Exception::convert(*this, 0, e); + Exception::provide_source(*this, 0, e); } return (const char *)dest; } @@ -95,8 +95,7 @@ String& Pool::transcode(const XalanDOMSt return *new(*this) String(*this, transcode_cstr(s)); } -/// @test who would free up result? -XalanDOMString& Pool::transcode_buf(const char *buf, size_t buf_size) { +std::auto_ptr Pool::transcode_buf(const char *buf, size_t buf_size) { update_transcoder(); unsigned int dest_size=0; @@ -116,12 +115,13 @@ XalanDOMString& Pool::transcode_buf(cons result=new XalanDOMString(dest, dest_size); } } catch(XMLException& e) { - Exception::convert(*this, 0, e); + Exception::provide_source(*this, 0, e); + result=0; //calm, compiler } - return *result; + return std::auto_ptr(result); } -XalanDOMString& Pool::transcode(const String& s) { +std::auto_ptr Pool::transcode(const String& s) { const char *cstr=s.cstr(String::UL_XML); return transcode_buf(cstr, strlen(cstr));