[Libreoffice-commits] .: drop ensure for non-NULL pointer and use a ref

Stephan Bergmann sbergman at redhat.com
Thu May 3 02:09:39 PDT 2012


On 05/03/2012 01:07 AM, Caolán McNamara wrote:
> commit 80fdb3498c68f9e7f9bdd98674e762cb084fce57
> Author: Caolán McNamara<caolanm at redhat.com>
> Date:   Wed May 2 22:45:52 2012 +0100
>
>      drop ensure for non-NULL pointer and use a ref

That was the common(?) idiom of passing out parameters by pointer 
instead of reference, to make it more obvious at the call sites that the 
given entity is modified.

>      Change-Id: I492c576a9a04874538f07769f5ac40f84e2d4308
>
> diff --git a/uui/source/iahndl-errorhandler.cxx b/uui/source/iahndl-errorhandler.cxx
> index f3abea7..aa89315 100644
> --- a/uui/source/iahndl-errorhandler.cxx
> +++ b/uui/source/iahndl-errorhandler.cxx
> @@ -185,7 +185,7 @@ UUIInteractionHelper::handleErrorHandlerRequest(
>           if (!xManager.get())
>               return;
>           ResId aResId(aId[eSource], *xManager.get());
> -        if (!ErrorResource(aResId).getString(nErrorCode,&aMessage))
> +        if (!ErrorResource(aResId).getString(nErrorCode, aMessage))
>               return;
>       }
>
> diff --git a/uui/source/iahndl-ssl.cxx b/uui/source/iahndl-ssl.cxx
> index 5bd3832..2b860ff 100644
> --- a/uui/source/iahndl-ssl.cxx
> +++ b/uui/source/iahndl-ssl.cxx
> @@ -172,7 +172,7 @@ executeUnknownAuthDialog(
>           {
>               ResId aResId(RID_UUI_ERRHDL, *xManager.get());
>               if (ErrorResource(aResId).getString(
> -                    ERRCODE_UUI_UNKNOWNAUTH_UNTRUSTED,&aMessage))
> +                    ERRCODE_UUI_UNKNOWNAUTH_UNTRUSTED, aMessage))
>               {
>                   aMessage = UUIInteractionHelper::replaceMessageWithArguments(
>                       aMessage, aArguments );
> @@ -241,7 +241,7 @@ executeSSLWarnDialog(
>               ResId aResId(RID_UUI_ERRHDL, *xManager.get());
>               if (ErrorResource(aResId).getString(
>                       ERRCODE_AREA_UUI_UNKNOWNAUTH + failure + DESCRIPTION_1,
> -&aMessage_1))
> +                    aMessage_1))
>               {
>                   aMessage_1 = UUIInteractionHelper::replaceMessageWithArguments(
>                       aMessage_1, aArguments_1 );
> @@ -250,7 +250,7 @@ executeSSLWarnDialog(
>
>               rtl::OUString aTitle;
>               ErrorResource(aResId).getString(
> -                ERRCODE_AREA_UUI_UNKNOWNAUTH + failure + TITLE,&aTitle);
> +                ERRCODE_AREA_UUI_UNKNOWNAUTH + failure + TITLE, aTitle);
>               xDialog->SetText( aTitle );
>           }
>
> diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
> index 2406b40..8816ea9 100644
> --- a/uui/source/iahndl.cxx
> +++ b/uui/source/iahndl.cxx
> @@ -1488,7 +1488,7 @@ UUIInteractionHelper::handleBrokenPackageRequest(
>               return;
>
>           ResId aResId( RID_UUI_ERRHDL, *xManager.get() );
> -        if ( !ErrorResource(aResId).getString(nErrorCode,&aMessage) )
> +        if ( !ErrorResource(aResId).getString(nErrorCode, aMessage) )
>               return;
>       }
>
> @@ -1545,17 +1545,16 @@ UUIInteractionHelper::handleBrokenPackageRequest(
>   //=========================================================================
>
>   bool
> -ErrorResource::getString(ErrCode nErrorCode, rtl::OUString * pString)
> +ErrorResource::getString(ErrCode nErrorCode, rtl::OUString&rString)
>       const SAL_THROW(())
>   {
> -    OSL_ENSURE(pString, "specification violation");
>       ResId aResId(static_cast<  sal_uInt16>(nErrorCode&  ERRCODE_RES_MASK),
>                    *m_pResMgr);
>       aResId.SetRT(RSC_STRING);
>       if (!IsAvailableRes(aResId))
>           return false;
>       aResId.SetAutoRelease(false);
> -    *pString = UniString(aResId);
> +    rString = aResId.toString();
>       m_pResMgr->PopContext();
>       return true;
>   }
> diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx
> index df1edde..3306e27 100644
> --- a/uui/source/iahndl.hxx
> +++ b/uui/source/iahndl.hxx
> @@ -346,28 +346,10 @@ public:
>
>       inline ~ErrorResource() SAL_THROW(()) { FreeResource(); }
>
> -    bool getString(ErrCode nErrorCode, rtl::OUString * pString) const
> +    bool getString(ErrCode nErrorCode, rtl::OUString&rString) const
>           SAL_THROW(());
>   };
>
> -/*
> -class InteractionRequest
> -{
> -public:
> -    InteractionRequest(
> -        com::sun::star::uno::Reference<
> -            com::sun::star::task::XInteractionRequest>  const&  rRequest)
> -    : m_aRequest( rRequest ) {}
> -
> -    virtual bool toString( rtl::OUString&  rString ) = 0;
> -    virtual bool handle( rtl::OUString&  rString ) = 0;
> -
> -private:
> -    com::sun::star::uno::Reference<
> -        com::sun::star::task::XInteractionRequest>  m_aRequest;
> -};
> -*/
> -
>   #endif // UUI_IAHNDL_HXX
>
>   /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the LibreOffice mailing list