drawinglayer/source/dumper/XShapeDumper.cxx |   31 +++++++++++-----------------
 1 file changed, 13 insertions(+), 18 deletions(-)

New commits:
commit 380b9a819a29a8aa0525632065006f4bd026cf96
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Oct 26 07:55:30 2021 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Wed Oct 27 11:33:30 2021 +0200

    Move variable declaration to its use in if() condition
    
    Helps understanding the condition more clearly.
    
    Change-Id: Ibb2b60283ea650bfac93621feb0333953cac8fcf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124188
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx 
b/drawinglayer/source/dumper/XShapeDumper.cxx
index 7e258dc40619..1434de2ba219 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -1131,53 +1131,48 @@ void dumpPropertyValueAsElement(const 
beans::PropertyValue& rPropertyValue, xmlT
             OUStringToOString(rPropertyValue.Name, 
RTL_TEXTENCODING_UTF8).getStr());
 
     uno::Any aAny = rPropertyValue.Value;
-    OUString sValue;
-    float fValue;
-    sal_Int32 nValue;
-    bool bValue;
-    awt::Rectangle aRectangleValue;
-    uno::Sequence< drawing::EnhancedCustomShapeAdjustmentValue> 
aAdjustmentValues;
-    uno::Sequence< drawing::EnhancedCustomShapeParameterPair > aCoordinates;
-    uno::Sequence< drawing::EnhancedCustomShapeSegment > aSegments;
-    uno::Sequence< beans::PropertyValue > aPropSeq;
-    if(aAny >>= sValue)
+    if(OUString sValue; aAny >>= sValue)
     {
         (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), 
"%s",
                 OUStringToOString(sValue, RTL_TEXTENCODING_UTF8).getStr());
     }
-    else if(aAny >>= nValue)
+    else if(sal_Int32 nValue; aAny >>= nValue)
     {
         (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), 
"%" SAL_PRIdINT32, nValue);
     }
-    else if(aAny >>= fValue)
+    else if(float fValue; aAny >>= fValue)
     {
         (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), 
"%f", fValue);
     }
-    else if(aAny >>= bValue)
+    else if(bool bValue; aAny >>= bValue)
     {
         (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), 
"%s", (bValue? "true": "false"));
     }
-    else if(rPropertyValue.Name == "ViewBox" && (aAny >>= aRectangleValue))
+    else if(awt::Rectangle aRectangleValue;
+            rPropertyValue.Name == "ViewBox" && (aAny >>= aRectangleValue))
     {
         EnhancedShapeDumper enhancedDumper(xmlWriter);
         enhancedDumper.dumpViewBoxAsElement(aRectangleValue);
     }
-    else if(rPropertyValue.Name == "AdjustmentValues" && (aAny >>= 
aAdjustmentValues))
+    else if(uno::Sequence< drawing::EnhancedCustomShapeAdjustmentValue> 
aAdjustmentValues;
+            rPropertyValue.Name == "AdjustmentValues" && (aAny >>= 
aAdjustmentValues))
     {
         EnhancedShapeDumper enhancedDumper(xmlWriter);
         enhancedDumper.dumpAdjustmentValuesAsElement(aAdjustmentValues);
     }
-    else if(rPropertyValue.Name == "Coordinates" && (aAny >>= aCoordinates))
+    else if(uno::Sequence< drawing::EnhancedCustomShapeParameterPair > 
aCoordinates;
+            rPropertyValue.Name == "Coordinates" && (aAny >>= aCoordinates))
     {
         EnhancedShapeDumper enhancedDumper(xmlWriter);
         enhancedDumper.dumpCoordinatesAsElement(aCoordinates);
     }
-    else if(rPropertyValue.Name == "Segments" && (aAny >>= aSegments))
+    else if(uno::Sequence< drawing::EnhancedCustomShapeSegment > aSegments;
+            rPropertyValue.Name == "Segments" && (aAny >>= aSegments))
     {
         EnhancedShapeDumper enhancedDumper(xmlWriter);
         enhancedDumper.dumpSegmentsAsElement(aSegments);
     }
-    else if(aAny >>= aPropSeq)
+    else if(uno::Sequence< beans::PropertyValue > aPropSeq; aAny >>= aPropSeq)
     {
         (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( 
OUStringToOString(rPropertyValue.Name, RTL_TEXTENCODING_UTF8).getStr() ));
 

Reply via email to