#84155# - Fixed memory leaks in class DAVResource and NeonPropFindRequest.

This commit is contained in:
Kai Sommerfeld 2001-02-20 15:20:44 +00:00
parent f78462eda7
commit d926e6be6d
3 changed files with 46 additions and 56 deletions

View file

@ -2,9 +2,9 @@
*
* $RCSfile: DAVResource.hxx,v $
*
* $Revision: 1.1 $
* $Revision: 1.2 $
*
* last change: $Author: kso $ $Date: 2000-10-16 14:55:20 $
* last change: $Author: kso $ $Date: 2001-02-20 16:20:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -70,19 +70,12 @@ namespace webdav_ucp
class DAVResource
{
private:
bool canDelete;
public:
::rtl::OUString uri;
std::vector < com::sun::star::beans::PropertyValue* > properties;
std::vector < com::sun::star::beans::PropertyValue > properties;
public:
DAVResource(const DAVResource & inDAVResource);
DAVResource(const ::rtl::OUString & inUri, bool incanDelete = true );
void deletePropertyValues( void );
void operator=( const DAVResource & inDAVResource );
DAVResource(const ::rtl::OUString & inUri );
};
}; // namespace webdav_ucp

View file

@ -2,9 +2,9 @@
*
* $RCSfile: NeonPropFindRequest.cxx,v $
*
* $Revision: 1.3 $
* $Revision: 1.4 $
*
* last change: $Author: kso $ $Date: 2001-02-15 11:04:48 $
* last change: $Author: kso $ $Date: 2001-02-20 16:20:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -252,8 +252,7 @@ NeonPropFindRequest::NeonPropFindRequest( HttpSession * inSession,
// -------------------------------------------------------------------
NeonPropFindRequest::~NeonPropFindRequest( )
{
// Crash in neon -> hip_xml_destroy(...) is buggy!
// dav_propfind_destroy( mPropFindHandler );
dav_propfind_destroy( mPropFindHandler );
}
#ifdef OLD_NEON_PROPFIND_INTERFACE
@ -266,12 +265,11 @@ NeonPropFindRequest::~NeonPropFindRequest( )
void * NeonPropFindRequest::StartResource( void * inUserData,
const char * inHref )
{
DAVResource * theResource = new DAVResource(
OStringToOUString( inHref, RTL_TEXTENCODING_UTF8 ),
false );
DAVResource theResource(
OStringToOUString( inHref, RTL_TEXTENCODING_UTF8 ) );
//theResource->uri = OStringToOUString( inHref, RTL_TEXTENCODING_UTF8 );
vector< DAVResource > * theResources = (vector< DAVResource > * )inUserData;
theResources->push_back( *theResource );
theResources->push_back( theResource );
return theResources;
}
@ -297,8 +295,7 @@ void * NeonPropFindRequest::CreatePrivate( void * userdata,
const char * uri )
{
DAVResource theResource(
OStringToOUString( uri, RTL_TEXTENCODING_UTF8 ),
false );
OStringToOUString( uri, RTL_TEXTENCODING_UTF8 ) );
vector< DAVResource > * theResources = (vector< DAVResource > * )userdata;
theResources->push_back( theResource );
return theResources;
@ -329,23 +326,23 @@ int NeonPropFindRequest::EndElement( void * inUserData,
if ( inXmlElem->id != ELM_resourcetype )
{
// Create & set the PropertyValue
PropertyValue *thePropertyValue = new PropertyValue;
PropertyValue thePropertyValue;
// Warning: What should Handle be?
thePropertyValue->Handle = 0;
thePropertyValue->State = PropertyState_DIRECT_VALUE;
thePropertyValue.Handle = -1;
thePropertyValue.State = PropertyState_DIRECT_VALUE;
if ( inXmlElem->id == ELM_collection )
{
thePropertyValue->Name = OStringToOUString( "resourcetype",
thePropertyValue.Name = OStringToOUString( "resourcetype",
RTL_TEXTENCODING_UTF8 );
thePropertyValue->Value <<= OStringToOUString( "collection",
thePropertyValue.Value <<= OStringToOUString( "collection",
RTL_TEXTENCODING_UTF8 );
}
else
{
thePropertyValue->Name = OStringToOUString( inXmlElem->name,
thePropertyValue.Name = OStringToOUString( inXmlElem->name,
RTL_TEXTENCODING_UTF8 );
thePropertyValue->Value <<= OStringToOUString( inCdata,
thePropertyValue.Value <<= OStringToOUString( inCdata,
RTL_TEXTENCODING_UTF8 );
}

View file

@ -2,9 +2,9 @@
*
* $RCSfile: webdavcontent.cxx,v $
*
* $Revision: 1.12 $
* $Revision: 1.13 $
*
* last change: $Author: kso $ $Date: 2001-02-15 11:11:45 $
* last change: $Author: kso $ $Date: 2001-02-20 16:20:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -230,60 +230,60 @@ void ContentProperties::setValues(DAVResource& resource)
bIsDocument = sal_True;
bIsFolder = sal_False;
std::vector< com::sun::star::beans::PropertyValue* >::iterator it;
std::vector< com::sun::star::beans::PropertyValue >::iterator it;
for ( it=resource.properties.begin(); it!=resource.properties.end(); ++it) {
if ( (*it) == 0 ) {
continue;
}
// if ( (*it) == 0 ) {
// continue;
// }
if ( (*it)->Name.equals(DAVProperties::CREATIONDATE) ) {
(*it)->Value >>= creationdate;
if ( (*it).Name.equals(DAVProperties::CREATIONDATE) ) {
(*it).Value >>= creationdate;
// Map the DAV:creationdate to UCP:DateCreated
//
DateTimeHelper::convert (creationdate, dateCreated);
}
else if ( (*it)->Name.equals(DAVProperties::DISPLAYNAME) ) {
(*it)->Value >>= displayname;
else if ( (*it).Name.equals(DAVProperties::DISPLAYNAME) ) {
(*it).Value >>= displayname;
}
else if ( (*it)->Name.equals(DAVProperties::GETCONTENTLANGUAGE) ) {
(*it)->Value >>= getcontentlanguage;
else if ( (*it).Name.equals(DAVProperties::GETCONTENTLANGUAGE) ) {
(*it).Value >>= getcontentlanguage;
}
else if ( (*it)->Name.equals(DAVProperties::GETCONTENTLENGTH) ) {
(*it)->Value >>= getcontentlength;
else if ( (*it).Name.equals(DAVProperties::GETCONTENTLENGTH) ) {
(*it).Value >>= getcontentlength;
// Map the DAV:getcontentlength to UCP:Size
//
size = getcontentlength.toInt64 ();
}
else if ( (*it)->Name.equals(DAVProperties::GETCONTENTTYPE) ) {
(*it)->Value >>= getcontenttype;
else if ( (*it).Name.equals(DAVProperties::GETCONTENTTYPE) ) {
(*it).Value >>= getcontenttype;
}
else if ( (*it)->Name.equals(DAVProperties::GETETAG) ) {
(*it)->Value >>= getetag;
else if ( (*it).Name.equals(DAVProperties::GETETAG) ) {
(*it).Value >>= getetag;
}
else if ( (*it)->Name.equals(DAVProperties::GETLASTMODIFIED) ) {
(*it)->Value >>= getlastmodified;
else if ( (*it).Name.equals(DAVProperties::GETLASTMODIFIED) ) {
(*it).Value >>= getlastmodified;
// Map the DAV:getlastmodified to UCP:DateModified
//
DateTimeHelper::convert (getlastmodified, dateModified);
}
else if ( (*it)->Name.equals(DAVProperties::LOCKDISCOVERY) ) {
(*it)->Value >>= lockdiscovery;
else if ( (*it).Name.equals(DAVProperties::LOCKDISCOVERY) ) {
(*it).Value >>= lockdiscovery;
}
else if ( (*it)->Name.equals(DAVProperties::RESOURCETYPE) ) {
(*it)->Value >>= resourcetype;
else if ( (*it).Name.equals(DAVProperties::RESOURCETYPE) ) {
(*it).Value >>= resourcetype;
if (resourcetype.getLength()>0) {
bIsDocument = sal_False;
bIsFolder = sal_True;
}
}
else if ( (*it)->Name.equals(DAVProperties::SOURCE) ) {
(*it)->Value >>= source;
else if ( (*it).Name.equals(DAVProperties::SOURCE) ) {
(*it).Value >>= source;
}
else if ( (*it)->Name.equals(DAVProperties::SUPPORTEDLOCK) ) {
(*it)->Value >>= supportedlock;
else if ( (*it).Name.equals(DAVProperties::SUPPORTEDLOCK) ) {
(*it).Value >>= supportedlock;
}
}
}