[Libreoffice] [PATCH] Replace SvULongs with vector and code clean up part 1

Maciej Rumianowski maciej.rumianowski at gmail.com
Sat Aug 6 06:32:52 PDT 2011


Hi,

I was working on SvULongs in libs-core and I decided to split my work in
several Patches.

With this patch comes some questions:
> @@ -159,16 +159,10 @@ SvxNumberFormatShell::~SvxNumberFormatShell()
>          // Hinzugefuegte Formate sind nicht gueltig:
>          // => wieder entfernen:
> 
> -        for ( sal_uInt16 i = 0; i < aAddList.Count(); ++i )
> -            pFormatter->DeleteEntry( aAddList[i] );
> +        for ( std::vector<sal_uInt32>::const_iterator it =
> aAddList.begin(); it != aAddList.end(); ++it )
> +            pFormatter->DeleteEntry( *it );
>      }
> 
> -    //--------------------------------
> -    // Add-/Remove-Listen leerraeumen:
> -    //--------------------------------
> -    aAddList.Remove( 0, aAddList.Count() );
> -    aDelList.Remove( 0, aAddList.Count() );

1. It is not necessary to explicitly clear vectors?

> @@ -1279,21 +1272,6 @@ void
> SvxNumberFormatShell::MakePrevStringFromVal(
>      pFormatter->GetPreviewString( rFormatStr, nValue, rPreviewStr,
> &rpFontColor, eCurLanguage );
> }
> 
> -/*************************************************************************
> -#* Member: GetComment4Entry Datum:30.10.97
> -#*------------------------------------------------------------------------
> -#*
> -#*  Klasse: SvxNumberFormatShell
> -#*
> -#*  Funktion: Liefert den Kommentar fuer einen gegebenen
> -#* Eintrag zurueck.
> -#*
> -#*  Input: Nummer des Eintrags
> -#*
> -#* Output: Kommentar-String
> -#*
> -#************************************************************************/
> -
> void SvxNumberFormatShell::SetComment4Entry(short nEntry,String
> aEntStr)
> {
>      SvNumberformat *pNumEntry;

2. Is it useful to translate comments like this? and convert to actual
documentation style?
Tranlation:
"Funktion:	Liefert den Kommentar fuer einen gegebenen Eintrag zurueck."
- Returns a comment for given Entry
"Input:		Nummer des Eintrags" - Number of entry
"Output:		Kommentar-String" - Comment's string

> @@ -228,9 +229,9 @@ private:
>      String aValStr;
>      double nValNum;
>      sal_Bool bUndoAddList;
> -    SvULongs aAddList;
> -    SvULongs aDelList;
> -    SvULongs aCurEntryList;
> +    std::vector<sal_uInt32> aAddList;
> +    std::vector<sal_uInt32> aDelList;
> +    std::vector<sal_uInt32> aCurEntryList;
3. For code formating tabs are okay? I have used spaces, but previous
there were tabs.

> @@ -229,21 +224,18 @@ void SvxNumberFormatShell::FormatChanged( sal_uInt16  nFmtLbPos,
>                                            String& rPreviewStr,
>                                            Color*& rpFontColor )
>  {
> -    //nCurFormatKey = pCurFmtTable->GetKey( pCurFmtTable->GetObject( nFmtLbPos ) );
> -
4. If there is commented code should it be removed?


> @@ -1325,7 +1288,7 @@ String SvxNumberFormatShell::GetComment4Entry(short nEntry)
>      if(nEntry < 0)
>          return String();
>  
> -    if(nEntry<aCurEntryList.Count())
> +    if(nEntry < (short)aCurEntryList.size())
>      {

5. Should short type be replaced with sal_Int16 or more appropriate type?

Best Regards,
	Maciej


More information about the LibreOffice mailing list