You are viewing a plain text version of this content. The canonical link for it is here.
Posted to p-dev@xerces.apache.org by James Cole <Ja...@logicaCMG.com> on 2004/08/23 01:54:48 UTC

A couple of bugs

I have found a couple of bugs in the Xerces-2.3 version. I have been able to
fix both as described below.

1. I was experiencing segmentation errors on windows platform and eventually
found that it was related to the perl garbage collection of strings returned
by Xerces. I beleive that under some circumstances Xerces was freeing memory
that was still being used by perl. I fixed the problem in Xercess.cpp
function Perl2XMLString() by returning a copy of the string for perl as
follows:

998c995
<   XMLByte* res = new XMLByte[(length+1) * UTF8_MAXLEN];          // output
string
---
>   XMLByte* res = new XMLByte[length * UTF8_MAXLEN];          // output
string
1025d1021
<     XMLCh* temp;
1030c1026
<       printf("Perl in length = %d: \"%s\" ",length,ptr);
---
>       printf("Perl in length = %d: ",length);
1059,1062c1055
<     output = new XMLCh[length+1];
<       temp = XMLString::transcode(ptr);
<       XMLString::copyString(output,temp);
<       XMLString::release(&temp);
---
>       output = XMLString::transcode(ptr);

2. I could not write to the same file twice as the LocalFileFormatTarget was
not being destroyed and the file was not being closed after the first write.
Added a DESTROY sub for XML::Xerces::LocalFileFormatTarget in file xerces.pm
as follows:

2949,2961d2948
<
< sub DESTROY {
<     return unless $_[0]->isa('HASH');
<     my $self = tied(%{$_[0]});
<     return unless defined $self;
<     return unless defined $self;
<     delete $ITERATORS{$self};
<     if (exists $OWNER{$self}) {
<       XML::Xercesc::delete_LocalFileFormatTarget($self);
<         delete $OWNER{$self};
<     }
< }
<

I would like to pass on my appreciation for the work you guys have done on
xerces perl.




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org