From ea3e3cdae879ea62f371874cf4ce1cde020ce969 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 3 Mar 2010 14:16:02 +0100 Subject: slidecopy: +Rectangle::Transpose --- tools/inc/tools/gen.hxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tools') diff --git a/tools/inc/tools/gen.hxx b/tools/inc/tools/gen.hxx index 0d82f4d73160..2ab762ef82da 100644 --- a/tools/inc/tools/gen.hxx +++ b/tools/inc/tools/gen.hxx @@ -423,6 +423,7 @@ public: Point Center() const; void Move( long nHorzMove, long nVertMove ); + inline void Transpose(); inline void SetPos( const Point& rPoint ); void SetSize( const Size& rSize ); inline Size GetSize() const; @@ -581,6 +582,20 @@ inline void Rectangle::Move( long nHorzMove, long nVertMove ) nBottom += nVertMove; } +void Rectangle::Transpose() +{ + if ( !IsEmpty() ) + { + long swap( nLeft ); + nLeft = nTop; + nTop = swap; + + swap = nRight; + nRight = nBottom; + nBottom = swap; + } +} + inline void Rectangle::SetPos( const Point& rPoint ) { if ( nRight != RECT_EMPTY ) -- cgit v1.2.3 From 5ca62ea8ae6580684d6f177990aeb406a93f64d1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 29 Jan 2010 08:49:42 +0100 Subject: autorecovery: ENSURE_OR_RETURN => ENSURE_OR_RETURN_FALSE, added new ENSURE_OR_RETURN taking a return value --- canvas/source/directx/dx_5rm.cxx | 2 +- canvas/source/directx/dx_9rm.cxx | 2 +- .../source/directx/dx_canvashelper_texturefill.cxx | 2 +- canvas/source/vcl/canvashelper.cxx | 2 +- cppcanvas/source/mtfrenderer/implrenderer.cxx | 30 +++++++++++----------- tools/inc/tools/diagnose_ex.h | 12 ++++++--- 6 files changed, 28 insertions(+), 22 deletions(-) (limited to 'tools') diff --git a/canvas/source/directx/dx_5rm.cxx b/canvas/source/directx/dx_5rm.cxx index 4937934732cd..71c65feb3b6f 100755 --- a/canvas/source/directx/dx_5rm.cxx +++ b/canvas/source/directx/dx_5rm.cxx @@ -1008,7 +1008,7 @@ namespace dxcanvas break; default: - ENSURE_OR_RETURN(false, + ENSURE_OR_RETURN_FALSE(false, "DXSurface::update(): Unknown/unimplemented buffer format" ); break; } diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx index acef323ddc1b..a50d0d5abeb7 100755 --- a/canvas/source/directx/dx_9rm.cxx +++ b/canvas/source/directx/dx_9rm.cxx @@ -544,7 +544,7 @@ namespace dxcanvas break; default: - ENSURE_OR_RETURN(false, + ENSURE_OR_RETURN_FALSE(false, "DXSurface::update(): Unknown/unimplemented buffer format" ); break; } diff --git a/canvas/source/directx/dx_canvashelper_texturefill.cxx b/canvas/source/directx/dx_canvashelper_texturefill.cxx index 73a2d49bfb62..f5836e56d668 100755 --- a/canvas/source/directx/dx_canvashelper_texturefill.cxx +++ b/canvas/source/directx/dx_canvashelper_texturefill.cxx @@ -345,7 +345,7 @@ namespace dxcanvas GraphicsPathSharedPtr pGradientPath( tools::graphicsPathFromB2DPolygon( rValues.maGradientPoly ) ); - ENSURE_OR_RETURN( pGradientPath.get(), + ENSURE_OR_RETURN_FALSE( pGradientPath.get(), "ParametricPolyPolygon::fillPolygonalGradient(): Could not clone path" ); PathGradientBrushSharedPtr pGradientBrush; diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index 20b489144d0e..144a41fb0212 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -1390,7 +1390,7 @@ namespace vclcanvas const ::Size& rSz, const GraphicAttr& rAttr ) const { - ENSURE_OR_RETURN( rGrf, + ENSURE_OR_RETURN_FALSE( rGrf, "Invalid Graphic" ); if( !mpOutDev ) diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index 8ea2ae453a97..0f51216b190e 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -1876,16 +1876,16 @@ namespace cppcanvas ::vcl::unotools::xBitmapFromBitmapEx( rCanvas->getUNOCanvas()->getDevice(), aBmpEx ); - if( aFill.isTiling() ) - { - aTexture.RepeatModeX = rendering::TexturingMode::REPEAT; - aTexture.RepeatModeY = rendering::TexturingMode::REPEAT; - } - else - { - aTexture.RepeatModeX = rendering::TexturingMode::CLAMP; - aTexture.RepeatModeY = rendering::TexturingMode::CLAMP; - } + if( aFill.isTiling() ) + { + aTexture.RepeatModeX = rendering::TexturingMode::REPEAT; + aTexture.RepeatModeY = rendering::TexturingMode::REPEAT; + } + else + { + aTexture.RepeatModeX = rendering::TexturingMode::CLAMP; + aTexture.RepeatModeY = rendering::TexturingMode::CLAMP; + } ::PolyPolygon aPath; aFill.getPath( aPath ); @@ -2877,7 +2877,7 @@ namespace cppcanvas aSubset.mnSubsetEnd = ::std::min( aRangeBegin->mpAction->getActionCount(), nEndIndex - aRangeBegin->mnOrigIndex ); - ENSURE_OR_RETURN( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, + ENSURE_OR_RETURN_FALSE( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, "ImplRenderer::forSubsetRange(): Invalid indices" ); rFunctor( *aRangeBegin, aSubset ); @@ -2893,7 +2893,7 @@ namespace cppcanvas nStartIndex - aRangeBegin->mnOrigIndex ); aSubset.mnSubsetEnd = aRangeBegin->mpAction->getActionCount(); - ENSURE_OR_RETURN( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, + ENSURE_OR_RETURN_FALSE( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, "ImplRenderer::forSubsetRange(): Invalid indices" ); rFunctor( *aRangeBegin, aSubset ); @@ -2922,7 +2922,7 @@ namespace cppcanvas aSubset.mnSubsetBegin = 0; aSubset.mnSubsetEnd = nEndIndex - aRangeEnd->mnOrigIndex; - ENSURE_OR_RETURN( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, + ENSURE_OR_RETURN_FALSE( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, "ImplRenderer::forSubsetRange(): Invalid indices" ); rFunctor( *aRangeEnd, aSubset ); @@ -2937,10 +2937,10 @@ namespace cppcanvas ActionVector::const_iterator& o_rRangeBegin, ActionVector::const_iterator& o_rRangeEnd ) const { - ENSURE_OR_RETURN( io_rStartIndex<=io_rEndIndex, + ENSURE_OR_RETURN_FALSE( io_rStartIndex<=io_rEndIndex, "ImplRenderer::getSubsetIndices(): invalid action range" ); - ENSURE_OR_RETURN( !maActions.empty(), + ENSURE_OR_RETURN_FALSE( !maActions.empty(), "ImplRenderer::getSubsetIndices(): no actions to render" ); const sal_Int32 nMinActionIndex( maActions.front().mnOrigIndex ); diff --git a/tools/inc/tools/diagnose_ex.h b/tools/inc/tools/diagnose_ex.h index 5ca7a71cf62c..eee965fcfd76 100644 --- a/tools/inc/tools/diagnose_ex.h +++ b/tools/inc/tools/diagnose_ex.h @@ -121,11 +121,17 @@ ifc ); } /** This macro asserts the given condition (in debug mode), and - returns false afterwards. + returns the given value afterwards. */ -#define ENSURE_OR_RETURN(c, m) if( !(c) ) { \ +#define ENSURE_OR_RETURN(c, m, r) if( !(c) ) { \ OSL_ENSURE(c, m); \ - return false; } + return r; } + +/** This macro asserts the given condition (in debug mode), and + returns false afterwards. + */ +#define ENSURE_OR_RETURN_FALSE(c, m) \ + ENSURE_OR_RETURN(c, m, false) -- cgit v1.2.3 From abee041f8d2bf4f865838df72d388cd84e8da9ef Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 12 Feb 2010 10:45:01 +0100 Subject: autorecovery: +ENSURE_OR_RETURN_VOID --- tools/inc/tools/diagnose_ex.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tools') diff --git a/tools/inc/tools/diagnose_ex.h b/tools/inc/tools/diagnose_ex.h index eee965fcfd76..0d74195d6437 100644 --- a/tools/inc/tools/diagnose_ex.h +++ b/tools/inc/tools/diagnose_ex.h @@ -134,5 +134,16 @@ ENSURE_OR_RETURN(c, m, false) +/** This macro asserts the given condition (in debug mode), and + returns afterwards, without return value "void". + */ +#define ENSURE_OR_RETURN_VOID( c, m ) \ + if( !(c) ) \ + { \ + OSL_ENSURE( c, m ); \ + return; \ + } + + #endif // TOOLS_DIAGNOSE_EX_H -- cgit v1.2.3 From a0c44c8ef392b0cdef327e6aa35fc391bf1e7464 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 22 Mar 2010 09:46:02 +0100 Subject: slidecopy: +ENSURE_OR_CONTINUE/BREAK --- tools/inc/tools/diagnose_ex.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tools') diff --git a/tools/inc/tools/diagnose_ex.h b/tools/inc/tools/diagnose_ex.h index 0d74195d6437..cd7f26c06b10 100644 --- a/tools/inc/tools/diagnose_ex.h +++ b/tools/inc/tools/diagnose_ex.h @@ -144,6 +144,24 @@ return; \ } +/** asserts a given condition (in debug mode), and continues the most-inner + loop if the condition is not met +*/ +#define ENSURE_OR_CONTINUE( c, m ) \ + if ( !(c) ) \ + { \ + OSL_ENSURE( false, m ); \ + continue; \ + } +/** asserts a given condition (in debug mode), and continues the most-inner + loop if the condition is not met +*/ +#define ENSURE_OR_BREAK( c, m ) \ + if ( !(c) ) \ + { \ + OSL_ENSURE( false, m ); \ + break; \ + } #endif // TOOLS_DIAGNOSE_EX_H -- cgit v1.2.3 From df23161a602841c7a5cbcc69ab1263a7b173151c Mon Sep 17 00:00:00 2001 From: Steffen Grund Date: Tue, 19 Jan 2010 12:50:17 +0100 Subject: #161490# removed scheme vnd.sun.star.wfs --- tools/inc/tools/urlobj.hxx | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'tools') diff --git a/tools/inc/tools/urlobj.hxx b/tools/inc/tools/urlobj.hxx index 3c83f2beb5b3..f8b0c440022b 100644 --- a/tools/inc/tools/urlobj.hxx +++ b/tools/inc/tools/urlobj.hxx @@ -128,22 +128,21 @@ enum INetProtocol INET_PROT_DATA = 15, INET_PROT_CID = 16, INET_PROT_OUT = 17, - INET_PROT_VND_SUN_STAR_WFS = 18, - INET_PROT_VND_SUN_STAR_HIER = 19, - INET_PROT_VIM = 20, - INET_PROT_UNO = 21, - INET_PROT_COMPONENT = 22, - INET_PROT_VND_SUN_STAR_PKG = 23, - INET_PROT_LDAP = 24, - INET_PROT_DB = 25, - INET_PROT_VND_SUN_STAR_CMD = 26, - INET_PROT_VND_SUN_STAR_ODMA = 27, - INET_PROT_TELNET = 28, - INET_PROT_VND_SUN_STAR_EXPAND = 29, - INET_PROT_VND_SUN_STAR_TDOC = 30, - INET_PROT_GENERIC = 31, - INET_PROT_SMB = 32, - INET_PROT_END = 33 + INET_PROT_VND_SUN_STAR_HIER = 18, + INET_PROT_VIM = 19, + INET_PROT_UNO = 20, + INET_PROT_COMPONENT = 21, + INET_PROT_VND_SUN_STAR_PKG = 22, + INET_PROT_LDAP = 23, + INET_PROT_DB = 24, + INET_PROT_VND_SUN_STAR_CMD = 25, + INET_PROT_VND_SUN_STAR_ODMA = 26, + INET_PROT_TELNET = 27, + INET_PROT_VND_SUN_STAR_EXPAND = 28, + INET_PROT_VND_SUN_STAR_TDOC = 29, + INET_PROT_GENERIC = 30, + INET_PROT_SMB = 31, + INET_PROT_END = 32 }; //============================================================================ -- cgit v1.2.3 From bd261abc608e982ccd5307eecd64618ba9caf966 Mon Sep 17 00:00:00 2001 From: Steffen Grund Date: Tue, 19 Jan 2010 12:50:52 +0100 Subject: #161491# fixed handling of generic schemes --- tools/source/fsys/urlobj.cxx | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) (limited to 'tools') diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index e0f711bd2883..0360f63da87e 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -194,11 +194,6 @@ using namespace com::sun; name = *(escaped / alphanum / "!" / "$" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / ":" / ";" / "=" / "?" / "@" / "_" / "~" - ; prvate (see RFC 1738, RFC 2396) - vnd-sun-star-wfs-url = "VND.SUN.STAR.WFS://" [host / "LOCALHOST"] ["/" segment *("/" segment)] - segment = *pchar - - ; private vnd-sun-star-hier-url = "VND.SUN.STAR.HIER:" ["//"reg_name] *("/" *pchar) reg_name = 1*(escaped / alphanum / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / ":" / ";" / "=" / "@" / "_" / "~") @@ -406,8 +401,6 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END] false, false }, { "out", "out://", 0, true, false, false, false, false, false, false, false }, - { "vnd.sun.star.wfs", "vnd.sun.star.wfs://", 0, true, false, false, - false, true, true, true, false }, { "vnd.sun.star.hier", "vnd.sun.star.hier:", 0, true, false, false, false, false, false, true, false }, { "vim", "vim://", 0, true, true, false, true, false, false, true, @@ -432,6 +425,7 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END] false, false, false, false, false }, { "vnd.sun.star.tdoc", "vnd.sun.star.tdoc:", 0, false, false, false, false, false, false, true, false }, +// { "", "", 0, true, false, false, false, true, true, true, false }, { "", "", 0, false, false, false, false, false, false, false, false }, { "smb", "smb://", 139, true, true, false, true, true, true, true, true } }; @@ -881,7 +875,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, // Parse //;AUTH=@: or // //:@: or // // - if (getSchemeInfo().m_bAuthority) + if (m_eScheme == INET_PROT_GENERIC || getSchemeInfo().m_bAuthority) { sal_Unicode const * pUserInfoBegin = 0; sal_Unicode const * pUserInfoEnd = 0; @@ -1233,7 +1227,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, pUserInfoBegin = pAuthority; pUserInfoEnd = pPos; } - else if (getSchemeInfo().m_bHost) + else if (m_eScheme == INET_PROT_GENERIC || getSchemeInfo().m_bHost) { pHostPortBegin = pAuthority; pHostPortEnd = pPos; @@ -1341,7 +1335,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, if (pHostPortBegin) { sal_Unicode const * pPort = pHostPortEnd; - if (getSchemeInfo().m_bPort && pHostPortBegin < pHostPortEnd) + if ( (m_eScheme == INET_PROT_GENERIC || getSchemeInfo().m_bPort) && pHostPortBegin < pHostPortEnd ) { sal_Unicode const * p1 = pHostPortEnd - 1; while (p1 > pHostPortBegin && INetMIME::isDigit(*p1)) @@ -1353,7 +1347,6 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, switch (m_eScheme) { case INET_PROT_FILE: - case INET_PROT_VND_SUN_STAR_WFS: // If the host equals "LOCALHOST" (unencoded and ignoring // case), turn it into an empty host: if (INetMIME::equalIgnoreCase(pHostPortBegin, pPort, @@ -1370,9 +1363,8 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, return false; } break; - default: - if (pHostPortBegin == pPort) + if (pHostPortBegin == pPort && pPort != pHostPortEnd) { setInvalid(); return false; @@ -2165,11 +2157,7 @@ INetURLObject::getPrefix(sal_Unicode const *& rBegin, { "vnd.sun.star.tdoc:", 0, INET_PROT_VND_SUN_STAR_TDOC, PrefixInfo::OFFICIAL }, { "vnd.sun.star.webdav:", 0, INET_PROT_VND_SUN_STAR_WEBDAV, - PrefixInfo::OFFICIAL }, - { "vnd.sun.star.wfs:", 0, INET_PROT_VND_SUN_STAR_WFS, - PrefixInfo::OFFICIAL }, - { "wfs:", "vnd.sun.star.wfs:", INET_PROT_VND_SUN_STAR_WFS, - PrefixInfo::ALIAS } }; + PrefixInfo::OFFICIAL } }; PrefixInfo const * pFirst = aMap + 1; PrefixInfo const * pLast = aMap + sizeof aMap / sizeof (PrefixInfo) - 1; PrefixInfo const * pMatch = 0; @@ -2892,7 +2880,6 @@ bool INetURLObject::setHost(rtl::OUString const & rTheHost, bool bOctets, switch (m_eScheme) { case INET_PROT_FILE: - case INET_PROT_VND_SUN_STAR_WFS: { rtl::OUString sTemp(aSynHost); if (sTemp.equalsIgnoreAsciiCaseAsciiL( @@ -2909,7 +2896,7 @@ bool INetURLObject::setHost(rtl::OUString const & rTheHost, bool bOctets, break; default: - if (aSynHost.getLength() == 0) + if (aSynHost.getLength() == 0 && m_aPort.isPresent()) return false; break; } @@ -2988,7 +2975,6 @@ bool INetURLObject::parsePath(INetProtocol eScheme, break; case INET_PROT_FILE: - case INET_PROT_VND_SUN_STAR_WFS: { if (bSkippedInitialSlash) aTheSynPath.append(sal_Unicode('/')); @@ -3401,7 +3387,6 @@ bool INetURLObject::parsePath(INetProtocol eScheme, if (aTheSynPath.getLength() == 0) return false; break; - default: OSL_ASSERT(false); break; @@ -3437,6 +3422,10 @@ bool INetURLObject::checkHierarchical() const { false, "INetURLObject::checkHierarchical vnd.sun.star.expand"); return true; } else { + // set hierarchical for generic schemes + if (m_eScheme == INET_PROT_GENERIC) { + return true; + } return getSchemeInfo().m_bHierarchical; } } @@ -4010,7 +3999,6 @@ bool INetURLObject::operator ==(INetURLObject const & rObject) const switch (m_eScheme) { case INET_PROT_FILE: - case INET_PROT_VND_SUN_STAR_WFS: { // If the URL paths of two file URLs only differ in that one has a // final '/' and the other has not, take the two paths as @@ -4165,7 +4153,6 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme, switch (m_eScheme) { case INET_PROT_FILE: - case INET_PROT_VND_SUN_STAR_WFS: { rtl::OUString sTemp(aSynHost); if (sTemp.equalsIgnoreAsciiCaseAsciiL( @@ -4186,7 +4173,7 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme, break; default: - if (aSynHost.getLength() == 0) + if (aSynHost.getLength() == 0 && nThePort != 0) { setInvalid(); return false; -- cgit v1.2.3 From 7dd16c6faabd03e178a3c7560019589efe0e23bd Mon Sep 17 00:00:00 2001 From: Steffen Grund Date: Wed, 20 Jan 2010 16:04:05 +0100 Subject: #161490# removed one commented line --- tools/source/fsys/urlobj.cxx | 1 - 1 file changed, 1 deletion(-) (limited to 'tools') diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 0360f63da87e..bfca09c27b2a 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -425,7 +425,6 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END] false, false, false, false, false }, { "vnd.sun.star.tdoc", "vnd.sun.star.tdoc:", 0, false, false, false, false, false, false, true, false }, -// { "", "", 0, true, false, false, false, true, true, true, false }, { "", "", 0, false, false, false, false, false, false, false, false }, { "smb", "smb://", 139, true, true, false, true, true, true, true, true } }; -- cgit v1.2.3 From bf9614cf5b5eea50131aa9f6030bf3d7175d7e94 Mon Sep 17 00:00:00 2001 From: Steffen Grund Date: Fri, 22 Jan 2010 16:29:42 +0100 Subject: #161491# bugfixes and additional tests --- tools/source/fsys/urlobj.cxx | 18 +++++++----------- tools/workben/urltest.cxx | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 13 deletions(-) (limited to 'tools') diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index bfca09c27b2a..68a66b596f5c 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -425,7 +425,7 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END] false, false, false, false, false }, { "vnd.sun.star.tdoc", "vnd.sun.star.tdoc:", 0, false, false, false, false, false, false, true, false }, - { "", "", 0, false, false, false, false, false, false, false, false }, + { "", "", 0, false, false, false, false, true, true, true, false }, { "smb", "smb://", 139, true, true, false, true, true, true, true, true } }; @@ -874,7 +874,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, // Parse //;AUTH=@: or // //:@: or // // - if (m_eScheme == INET_PROT_GENERIC || getSchemeInfo().m_bAuthority) + if (getSchemeInfo().m_bAuthority) { sal_Unicode const * pUserInfoBegin = 0; sal_Unicode const * pUserInfoEnd = 0; @@ -1226,7 +1226,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, pUserInfoBegin = pAuthority; pUserInfoEnd = pPos; } - else if (m_eScheme == INET_PROT_GENERIC || getSchemeInfo().m_bHost) + else if (getSchemeInfo().m_bHost) { pHostPortBegin = pAuthority; pHostPortEnd = pPos; @@ -1334,7 +1334,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, if (pHostPortBegin) { sal_Unicode const * pPort = pHostPortEnd; - if ( (m_eScheme == INET_PROT_GENERIC || getSchemeInfo().m_bPort) && pHostPortBegin < pHostPortEnd ) + if ( getSchemeInfo().m_bPort && pHostPortBegin < pHostPortEnd ) { sal_Unicode const * p1 = pHostPortEnd - 1; while (p1 > pHostPortBegin && INetMIME::isDigit(*p1)) @@ -1363,7 +1363,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, } break; default: - if (pHostPortBegin == pPort && pPort != pHostPortEnd) + if (pHostPortBegin == pPort) { setInvalid(); return false; @@ -2895,7 +2895,7 @@ bool INetURLObject::setHost(rtl::OUString const & rTheHost, bool bOctets, break; default: - if (aSynHost.getLength() == 0 && m_aPort.isPresent()) + if (aSynHost.getLength() == 0) return false; break; } @@ -3421,10 +3421,6 @@ bool INetURLObject::checkHierarchical() const { false, "INetURLObject::checkHierarchical vnd.sun.star.expand"); return true; } else { - // set hierarchical for generic schemes - if (m_eScheme == INET_PROT_GENERIC) { - return true; - } return getSchemeInfo().m_bHierarchical; } } @@ -4172,7 +4168,7 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme, break; default: - if (aSynHost.getLength() == 0 && nThePort != 0) + if (aSynHost.getLength() == 0) { setInvalid(); return false; diff --git a/tools/workben/urltest.cxx b/tools/workben/urltest.cxx index 0e9d22081cb4..7f27995fe63b 100644 --- a/tools/workben/urltest.cxx +++ b/tools/workben/urltest.cxx @@ -526,6 +526,8 @@ main() /*TODO "vnd.sun.star.wfs:///c|/xyz/",*/ /*TODO "vnd.sun.star.wfs://xxx/yyy?zzz",*/ "vnd.sun.star.wfs:///x/y/z", + "vnd.sun.star.generic:///x/y/z", + "vnd.sun.star.generic://host:34/x/y/z" /*TODO "wfs://",*/ /*TODO "wfs://LocalHost",*/ /*TODO "wfs:///c|/xyz/",*/ @@ -536,13 +538,21 @@ main() INetURLObject aUrl(aTest[i]); if (aUrl.HasError()) printf("BAD %s\n", aTest[i]); - else if (aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI). - equalsAscii(aTest[i]) != sal_True) + else { + if (aUrl.GetProtocol() != INET_PROT_GENERIC) { + printf("BAD PROTOCOL %i -> %i\n", + aUrl.GetProtocol(), + INET_PROT_GENERIC); + } + if (aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI). + equalsAscii(aTest[i]) != sal_True) + { String sTest(aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI)); printf("BAD %s -> %s\n", aTest[i], ByteString(sTest, RTL_TEXTENCODING_ASCII_US).GetBuffer()); + } } } } -- cgit v1.2.3 From ec2d9aa11250e94588f9ff89190303da01c8bbf2 Mon Sep 17 00:00:00 2001 From: Steffen Grund Date: Thu, 4 Mar 2010 14:25:05 +0100 Subject: #161491# further support for own generic schemes --- tools/source/fsys/urlobj.cxx | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 68a66b596f5c..d5f48a552916 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -1603,7 +1603,23 @@ bool INetURLObject::convertRelToAbs(rtl::OUString const & rTheRelURIRef, STATE_DONE }; rtl::OUStringBuffer aSynAbsURIRef; - aSynAbsURIRef.appendAscii(getSchemeInfo().m_pScheme); + // make sure that the scheme is copied for generic schemes: getSchemeInfo().m_pScheme + // is empty ("") in that case, so take the scheme from m_aAbsURIRef + if (m_eScheme != INET_PROT_GENERIC) + { + aSynAbsURIRef.appendAscii(getSchemeInfo().m_pScheme); + } + else + { + sal_Unicode const * pSchemeBegin + = m_aAbsURIRef.getStr(); + sal_Unicode const * pSchemeEnd = pSchemeBegin; + while (pSchemeEnd[0] != ':') + { + ++pSchemeEnd; + } + aSynAbsURIRef.append(pSchemeBegin, pSchemeEnd - pSchemeBegin); + } aSynAbsURIRef.append(sal_Unicode(':')); sal_Char cEscapePrefix = getEscapePrefix(); @@ -3812,7 +3828,27 @@ INetURLObject::getAbbreviated( OSL_ENSURE(rStringWidth.is(), "specification violation"); sal_Char cEscapePrefix = getEscapePrefix(); rtl::OUStringBuffer aBuffer; - aBuffer.appendAscii(getSchemeInfo().m_pScheme); + // make sure that the scheme is copied for generic schemes: getSchemeInfo().m_pScheme + // is empty ("") in that case, so take the scheme from m_aAbsURIRef + if (m_eScheme != INET_PROT_GENERIC) + { + aBuffer.appendAscii(getSchemeInfo().m_pScheme); + } + else + { + if (m_aAbsURIRef) + { + sal_Unicode const * pSchemeBegin + = m_aAbsURIRef.getStr(); + sal_Unicode const * pSchemeEnd = pSchemeBegin; + + while (pSchemeEnd[0] != ':') + { + ++pSchemeEnd; + } + aBuffer.append(pSchemeBegin, pSchemeEnd - pSchemeBegin); + } + } aBuffer.append(static_cast< sal_Unicode >(':')); bool bAuthority = getSchemeInfo().m_bAuthority; sal_Unicode const * pCoreBegin -- cgit v1.2.3