--- parser3/src/main/pa_pool.C 2001/10/19 14:42:53 1.36 +++ parser3/src/main/pa_pool.C 2001/11/16 11:07:58 1.42 @@ -2,14 +2,15 @@ Parser: pool class. Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) - Author: Alexander Petrosyan (http://design.ru/paf) + Author: Alexander Petrosyan (http://paf.design.ru) - $Id: pa_pool.C,v 1.36 2001/10/19 14:42:53 parser Exp $ + $Id: pa_pool.C,v 1.42 2001/11/16 11:07:58 paf Exp $ */ #include "pa_pool.h" #include "pa_exception.h" #include "pa_common.h" +#include "pa_sapi.h" #ifdef XML #include @@ -35,15 +36,14 @@ Pool::~Pool() { } void Pool::fail_alloc(size_t size) const { - throw Exception(0, 0, - 0, - "failed to allocate %u bytes", size); + SAPI::die("out of pooled memory: failed to allocate %u bytes, " + "total allocated %u in %u times", + size, + ftotal_allocated, ftotal_times); } void Pool::fail_register_cleanup() const { - throw Exception(0, 0, - 0, - "failed to register cleanup"); + SAPI::die("failed to register cleanup"); } void Pool::set_charset(const String &new_charset) { @@ -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; } @@ -101,7 +101,7 @@ std::auto_ptr Pool::tran unsigned int dest_size=0; XMLCh* dest=(XMLCh *)malloc((buf_size+1)*sizeof(XMLCh)); unsigned char *charSizes=(unsigned char *)malloc(buf_size*sizeof(unsigned char)); - std::auto_ptr result; + XalanDOMString *result; try { if(transcoder) { unsigned int bytesEaten; @@ -112,16 +112,17 @@ std::auto_ptr Pool::tran bytesEaten, charSizes ); - result=std::auto_ptr(new XalanDOMString(dest, dest_size)); + 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); } std::auto_ptr Pool::transcode(const String& s) { - const char *cstr=s.cstr(String::UL_XML); + const char *cstr=s.cstr(String::UL_UNSPECIFIED); return transcode_buf(cstr, strlen(cstr)); }