[ http://issues.apache.org/jira/browse/XERCESC-1428?page=all ]
Axel Weiss updated XERCESC-1428:
--------------------------------
Attachment: transcoder-179371.diff
This patch simplifies the LCP transcoder interface and subsequently all
inheriting transcoders: there is now only one transcode method for both
directions, which saves a lot of redundand code:
virtual char* transcode(const XMLCh* const toTranscode,
MemoryManager* const manager =
XMLPlatformUtils::fgMemoryManager) = 0;
virtual XMLCh* transcode(const char* const toTranscode,
MemoryManager* const manager =
XMLPlatformUtils::fgMemoryManager) = 0;
The transcode methods using an externally provided buffer are still present,
but have been declared deprecated. There were three occurences in the xerces
sources, where these were called: DOMPrint/DOMPrint.cpp,
internal/XProtoType.cpp and util/XMLMsgLoader.cpp. These have been changed so
that they now use the simpler transcode methods.
The unliked methods calcRequiredSize have been declared deprecated, too. ;)
Axel
> new iconv-transcoder algorithm
> ------------------------------
>
> Key: XERCESC-1428
> URL: http://issues.apache.org/jira/browse/XERCESC-1428
> Project: Xerces-C++
> Type: Improvement
> Components: Utilities
> Environment: linux
> Reporter: Axel Weiss
> Assignee: James Berry
> Priority: Minor
> Attachments: transcoder-179120.diff, transcoder-179120.diff,
> transcoder-179371.diff
>
> James Berry wrote:
> > What if you make this initial buffer a static buffer? And allocate
> > the exact size needed at the end?
> > That keeps the memory cost constant, at the expense of a guaranteed
> > extra string copy.
> >
> > For cases where you exceed the static buffer size, continue to do
> > your size-doubling on overflow; for the cases where you exceed the
> > static buffer size, you'll continue to use excess memory.
> >
> > I think this tradeoff would be worth it...
> Ok, it now starts with a local buffer on the stack and creates a copy with
> the exact size needed, if this buffer was not exceeded. Otherwise, an always
> doubling buffer enlargement is performed, resulting in returning an excess
> buffer for the result.
> The patch is against 3.0-unstable-179120.
> Axel
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]