[PATCH][REJECTED] fdo#<bug number>: warning-free code : minor fixes including some of the -Wwrite-strings warnings

David Tardon dtardon at redhat.com
Fri Jun 1 01:36:38 PDT 2012


Hi,

On Thu, May 31, 2012 at 05:33:03PM -0500, Brandon Garcia wrote:
> Note:
> 
> Also made extremely minor adjustments to code in various places primarily
> in terms of const-correctness simplification of code.

Practically all of the changes use features that are new in C++11, so we
cannot use this patch.

> -ResMgr*                 desktop::Desktop::pResMgr = 0;
> +ResMgr*    desktop::Desktop::pResMgr = nullptr;

nullptr is C++11-only.

> if (pEventAttacher)
> -    {
>         xRet = Reference<XInterface>::query(pEventAttacher);
> -    }

I would not bother to change this. It is a matter of taste.

> -#define INITIAL_UNICODE_BUFFER_CAPACITY     0x100
> -#define READ_BYTE_COUNT                     0x100
> +constexpr unsigned short initial_unicode_buffer_capacity = 0x100;
> +constexpr unsigned short read_byte_count = 0x100;

constexpr is C++-11-only. Also, why to change the names to lowercase?

>  OTextOutputStream::OTextOutputStream()
> +   : mbEncodingInitialized{false}
> {
> -     mbEncodingInitialized = false;
> }

Bracket initializers are C++11-only.

> -        for ( vector < uno::Sequence < PropertyValue > >::const_iterator aIter = aManList.begin(), aEnd = >aManList.end();
> -             aIter != aEnd;
> -             ++aIter, ++nInd )
> +        for ( const uno::Sequence<PropertyValue>& seq : aManList )
> {
> -            aManifestSequence[nInd] = ( *aIter );
> +            aManifestSequence[nInd] = ( seq );
> +            ++nInd;
> }

This style of for loop is C++11-only.

> -    for (RtfColorTbl::iterator it=m_aColTbl.begin() ; it != m_aColTbl.end(); ++it )
> -        if ((*it).second == rCol)
> +    for (auto myColor : m_aColTbl )
> +        if (myColor.second == rCol)

Automatically deduced type of variable is C++11-only.

D.


More information about the LibreOffice mailing list