From 681297e10b666e13cc463f6fbb16236f36c3266c Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Tue, 12 Jul 2005 22:28:02 +0000 Subject: Reference counting and smart pointers. --- src/mailboxField.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/mailboxField.cpp') diff --git a/src/mailboxField.cpp b/src/mailboxField.cpp index 3580b011..db62b36c 100644 --- a/src/mailboxField.cpp +++ b/src/mailboxField.cpp @@ -44,7 +44,7 @@ void mailboxField::parse(const string& buffer, const string::size_type position, // Here, we cannot simply call "m_mailbox.parse()" because it // may have more than one address specified (even if this field // should contain only one). We are never too much careful... - address* parsedAddress = address::parseNext(buffer, position, end, newPosition); + ref
parsedAddress = address::parseNext(buffer, position, end, newPosition); if (parsedAddress) { @@ -52,7 +52,7 @@ void mailboxField::parse(const string& buffer, const string::size_type position, { // If it is a group of mailboxes, take the first // mailbox of the group - mailboxGroup* group = static_cast (parsedAddress); + ref group = parsedAddress.staticCast (); if (!group->isEmpty()) getValue() = *(group->getMailboxAt(0)); @@ -60,12 +60,10 @@ void mailboxField::parse(const string& buffer, const string::size_type position, else { // Parse only if it is a mailbox - getValue() = *static_cast (parsedAddress); + getValue() = *parsedAddress.staticCast (); } } - delete (parsedAddress); - getValue().setParsedBounds(position, end); setParsedBounds(position, end); -- cgit v1.2.3