[Libreoffice-commits] .: Branch 'libreoffice-3-5' - basegfx/source
Petr Mladek
pmladek at kemper.freedesktop.org
Mon May 14 05:39:50 PDT 2012
basegfx/source/polygon/b2dsvgpolypolygon.cxx | 38 +++++++++++----------------
1 file changed, 16 insertions(+), 22 deletions(-)
New commits:
commit 36c401f402a30f386dba82f121961a187ab8f7af
Author: Chr. Rossmanith <ChrRossmanith at gmx.de>
Date: Fri May 11 21:24:12 2012 +0200
fdo#48070 fix parsing of arc paths
+ the flag value can be only "1" or "0"
+ neither "+" nor "-" nor other digit is allowed
Signed-off-by: Petr Mladek <pmladek at suse.cz>
diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx
index 2928364..fa9e184 100644
--- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx
@@ -144,35 +144,29 @@ namespace basegfx
return true;
}
- bool lcl_importNumberAndSpaces(sal_Int32& o_nRetval,
- sal_Int32& io_rPos,
- const ::rtl::OUString& rStr,
- const sal_Int32 nLen)
+ bool lcl_importFlagAndSpaces(sal_Int32& o_nRetval,
+ sal_Int32& io_rPos,
+ const ::rtl::OUString& rStr,
+ const sal_Int32 nLen)
{
sal_Unicode aChar( rStr[io_rPos] );
- ::rtl::OUStringBuffer sNumberString;
- if(sal_Unicode('+') == aChar || sal_Unicode('-') == aChar)
+ if(sal_Unicode('0') == aChar)
{
- sNumberString.append(rStr[io_rPos]);
- aChar = rStr[++io_rPos];
+ o_nRetval = 0;
+ ++io_rPos;
}
-
- while(sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
+ else if (sal_Unicode('1') == aChar)
{
- sNumberString.append(rStr[io_rPos]);
- aChar = rStr[++io_rPos];
+ o_nRetval = 1;
+ ++io_rPos;
}
+ else
+ return false;
- if(sNumberString.getLength())
- {
- o_nRetval = sNumberString.makeStringAndClear().toInt32();
- lcl_skipSpacesAndCommas(io_rPos, rStr, nLen);
-
- return true;
- }
+ lcl_skipSpacesAndCommas(io_rPos, rStr, nLen);
- return false;
+ return true;
}
void lcl_putNumberChar( ::rtl::OUStringBuffer& rStr,
@@ -622,8 +616,8 @@ namespace basegfx
if(!lcl_importDoubleAndSpaces(fRX, nPos, rSvgDStatement, nLen)) return false;
if(!lcl_importDoubleAndSpaces(fRY, nPos, rSvgDStatement, nLen)) return false;
if(!lcl_importDoubleAndSpaces(fPhi, nPos, rSvgDStatement, nLen)) return false;
- if(!lcl_importNumberAndSpaces(bLargeArcFlag, nPos, rSvgDStatement, nLen)) return false;
- if(!lcl_importNumberAndSpaces(bSweepFlag, nPos, rSvgDStatement, nLen)) return false;
+ if(!lcl_importFlagAndSpaces(bLargeArcFlag, nPos, rSvgDStatement, nLen)) return false;
+ if(!lcl_importFlagAndSpaces(bSweepFlag, nPos, rSvgDStatement, nLen)) return false;
if(!lcl_importDoubleAndSpaces(nX, nPos, rSvgDStatement, nLen)) return false;
if(!lcl_importDoubleAndSpaces(nY, nPos, rSvgDStatement, nLen)) return false;
More information about the Libreoffice-commits
mailing list