summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2010-06-15 05:33:03 +0200
committerKohei Yoshida <kyoshida@novell.com>2010-06-15 05:33:03 +0200
commitd3996884eefaa66b329e4aecba095bea696cf696 (patch)
treeff5127f7d6f05f537115085f2c57ac01881da092 /tools
parent355b32c362ddba7e7af31961fbda61ba5f83b9d3 (diff)
parentff33409c01b082dc5a0e501b0f4c2f97131fcd52 (diff)
calctabcolor: rebased to DEV300_m82.
Diffstat (limited to 'tools')
-rw-r--r--tools/inc/tools/diagnose_ex.h18
-rw-r--r--tools/inc/tools/gen.hxx15
-rw-r--r--tools/inc/tools/preextstl.h15
-rw-r--r--tools/inc/tools/solar.h26
-rw-r--r--tools/inc/tools/svborder.hxx8
-rw-r--r--tools/inc/tools/urlobj.hxx31
-rw-r--r--tools/source/fsys/urlobj.cxx64
-rw-r--r--tools/source/stream/strmunx.cxx4
-rw-r--r--tools/workben/urltest.cxx14
9 files changed, 126 insertions, 69 deletions
diff --git a/tools/inc/tools/diagnose_ex.h b/tools/inc/tools/diagnose_ex.h
index fac739b32583..6833fd6632ce 100644
--- a/tools/inc/tools/diagnose_ex.h
+++ b/tools/inc/tools/diagnose_ex.h
@@ -141,6 +141,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
diff --git a/tools/inc/tools/gen.hxx b/tools/inc/tools/gen.hxx
index 85da22126b77..308cc02165ce 100644
--- a/tools/inc/tools/gen.hxx
+++ b/tools/inc/tools/gen.hxx
@@ -420,6 +420,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;
@@ -578,6 +579,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 )
diff --git a/tools/inc/tools/preextstl.h b/tools/inc/tools/preextstl.h
index 4d0418d01c57..27aed38686f0 100644
--- a/tools/inc/tools/preextstl.h
+++ b/tools/inc/tools/preextstl.h
@@ -24,8 +24,11 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
+//1. Force inclusion of a std:: using header to ensure the stlport define
+//of std as "stlport"
+#include <algorithm>
#if defined(ADAPT_EXT_STL)
+//2. Force inclusion of stlport headers to get their stlport:: definitions
# include <ostream>
# include <istream>
# include <fstream>
@@ -33,12 +36,14 @@
# include <vector>
# include <list>
# include <map>
-# include <algorithm>
+//3. Now force inclusion of native headers to get their std:: definitions
# if defined(std)
# define std_was_redefined_as_stlport std
# undef std
# define _STLP_OUTERMOST_HEADER_ID 0xdeadbeaf
-# pragma GCC visibility push(default)
+# if defined(_GNUC__)
+# pragma GCC visibility push(default)
+# endif
# include _STLP_NATIVE_HEADER(exception_defines.h)
# include _STLP_NATIVE_HEADER(limits)
# include _STLP_NATIVE_HEADER(memory)
@@ -56,7 +61,9 @@
# include _STLP_NATIVE_HEADER(vector)
# include _STLP_NATIVE_HEADER(list)
# include _STLP_NATIVE_HEADER(map)
-# pragma GCC visibility pop
+# if defined(_GNUC__)
+# pragma GCC visibility pop
+# endif
# endif
#endif
//ext_std resolves to the std that external c++ libs, e.g. Graphite were built
diff --git a/tools/inc/tools/solar.h b/tools/inc/tools/solar.h
index 1d248853f895..096d34d05b9e 100644
--- a/tools/inc/tools/solar.h
+++ b/tools/inc/tools/solar.h
@@ -122,23 +122,13 @@ typedef BYTE SVBT64[8];
#ifdef __cplusplus
inline BYTE SVBT8ToByte ( const SVBT8 p ) { return p[0]; }
-#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT2 == 1
-inline USHORT SVBT16ToShort( const SVBT16 p ) { return *(USHORT*)p; }
-#else
inline USHORT SVBT16ToShort( const SVBT16 p ) { return (USHORT)p[0]
+ ((USHORT)p[1] << 8); }
-#endif
-#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT4 == 1
-inline sal_uInt32 SVBT32ToUInt32 ( const SVBT32 p ) { return *(sal_uInt32*)p; }
-#else
inline sal_uInt32 SVBT32ToUInt32 ( const SVBT32 p ) { return (sal_uInt32)p[0]
+ ((sal_uInt32)p[1] << 8)
+ ((sal_uInt32)p[2] << 16)
+ ((sal_uInt32)p[3] << 24); }
-#endif
-#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT8 == 1
-inline double SVBT64ToDouble( const SVBT64 p ) { return *(double*)p; }
-#elif defined OSL_LITENDIAN
+#if defined OSL_LITENDIAN
inline double SVBT64ToDouble( const SVBT64 p ) { double n;
((BYTE*)&n)[0] = p[0];
((BYTE*)&n)[1] = p[1];
@@ -163,23 +153,13 @@ inline double SVBT64ToDouble( const SVBT64 p ) { double n;
#endif
inline void ByteToSVBT8 ( BYTE n, SVBT8 p ) { p[0] = n; }
-#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT2 == 1
-inline void ShortToSVBT16( USHORT n, SVBT16 p ) { *(USHORT*)p = n; }
-#else
inline void ShortToSVBT16( USHORT n, SVBT16 p ) { p[0] = (BYTE) n;
p[1] = (BYTE)(n >> 8); }
-#endif
-#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT4 == 1
-inline void UInt32ToSVBT32 ( sal_uInt32 n, SVBT32 p ) { *(sal_uInt32*)p = n; }
-#else
inline void UInt32ToSVBT32 ( sal_uInt32 n, SVBT32 p ) { p[0] = (BYTE) n;
p[1] = (BYTE)(n >> 8);
p[2] = (BYTE)(n >> 16);
p[3] = (BYTE)(n >> 24); }
-#endif
-#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT8 == 1
-inline void DoubleToSVBT64( double n, SVBT64 p ) { *(double*)p = n; }
-#elif defined OSL_LITENDIAN
+#if defined OSL_LITENDIAN
inline void DoubleToSVBT64( double n, SVBT64 p ) { p[0] = ((BYTE*)&n)[0];
p[1] = ((BYTE*)&n)[1];
p[2] = ((BYTE*)&n)[2];
@@ -384,6 +364,8 @@ template<typename T> inline T Abs(T a) { return (a>=0?a:-a); }
#define __DLLEXTENSION "lm.so"
#elif defined LINUX && defined HPPA
#define __DLLEXTENSION "lh.so"
+#elif defined LINUX && defined AXP
+ #define __DLLEXTENSION "ll.so"
#elif defined LINUX
#error unknown plattform
#elif defined FREEBSD && defined X86
diff --git a/tools/inc/tools/svborder.hxx b/tools/inc/tools/svborder.hxx
index 9523a71a060f..a0509bcc89be 100644
--- a/tools/inc/tools/svborder.hxx
+++ b/tools/inc/tools/svborder.hxx
@@ -49,6 +49,14 @@ public:
}
BOOL operator != ( const SvBorder & rObj ) const
{ return !(*this == rObj); }
+ SvBorder & operator = ( const SvBorder & rBorder )
+ {
+ Left() = rBorder.Left();
+ Top() = rBorder.Top();
+ Right() = rBorder.Right();
+ Bottom() = rBorder.Bottom();
+ return *this;
+ }
SvBorder & operator += ( const SvBorder & rBorder )
{
Left() += rBorder.Left();
diff --git a/tools/inc/tools/urlobj.hxx b/tools/inc/tools/urlobj.hxx
index 86a8114ab0b8..17d52432e206 100644
--- a/tools/inc/tools/urlobj.hxx
+++ b/tools/inc/tools/urlobj.hxx
@@ -125,22 +125,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
};
//============================================================================
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index 07c532e60dd7..a6d7bc6fd04e 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -191,11 +191,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 / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / ":" / ";" / "=" / "@" / "_" / "~")
@@ -403,8 +398,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,
@@ -429,7 +422,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 } };
@@ -1338,7 +1331,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef,
if (pHostPortBegin)
{
sal_Unicode const * pPort = pHostPortEnd;
- if (getSchemeInfo().m_bPort && pHostPortBegin < pHostPortEnd)
+ if ( getSchemeInfo().m_bPort && pHostPortBegin < pHostPortEnd )
{
sal_Unicode const * p1 = pHostPortEnd - 1;
while (p1 > pHostPortBegin && INetMIME::isDigit(*p1))
@@ -1350,7 +1343,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,
@@ -1367,7 +1359,6 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef,
return false;
}
break;
-
default:
if (pHostPortBegin == pPort)
{
@@ -1609,7 +1600,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();
@@ -2162,11 +2169,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;
@@ -2889,7 +2892,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(
@@ -2985,7 +2987,6 @@ bool INetURLObject::parsePath(INetProtocol eScheme,
break;
case INET_PROT_FILE:
- case INET_PROT_VND_SUN_STAR_WFS:
{
if (bSkippedInitialSlash)
aTheSynPath.append(sal_Unicode('/'));
@@ -3398,7 +3399,6 @@ bool INetURLObject::parsePath(INetProtocol eScheme,
if (aTheSynPath.getLength() == 0)
return false;
break;
-
default:
OSL_ASSERT(false);
break;
@@ -3825,7 +3825,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
@@ -4007,7 +4027,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
@@ -4162,7 +4181,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(
diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx
index 9e4f501d1823..88ccb2113e0d 100644
--- a/tools/source/stream/strmunx.cxx
+++ b/tools/source/stream/strmunx.cxx
@@ -209,7 +209,7 @@ static sal_uInt32 GetSvError( int nErrno )
{ 0, SVSTREAM_OK },
{ EACCES, SVSTREAM_ACCESS_DENIED },
{ EBADF, SVSTREAM_INVALID_HANDLE },
-#if defined( RS6000 ) || defined( ALPHA ) || defined( HP9000 ) || defined( NETBSD ) || defined(FREEBSD) || defined(MACOSX)
+#if defined( RS6000 ) || defined( ALPHA ) || defined( HP9000 ) || defined( NETBSD ) || defined(FREEBSD) || defined(MACOSX) || defined(__FreeBSD_kernel__)
{ EDEADLK, SVSTREAM_LOCKING_VIOLATION },
#else
{ EDEADLOCK, SVSTREAM_LOCKING_VIOLATION },
@@ -223,7 +223,7 @@ static sal_uInt32 GetSvError( int nErrno )
{ EAGAIN, SVSTREAM_LOCKING_VIOLATION },
{ EISDIR, SVSTREAM_PATH_NOT_FOUND },
{ ELOOP, SVSTREAM_PATH_NOT_FOUND },
-#if ! defined( RS6000 ) && ! defined( ALPHA ) && ! defined( NETBSD ) && ! defined (FREEBSD) && ! defined (MACOSX)
+#if ! defined( RS6000 ) && ! defined( ALPHA ) && ! defined( NETBSD ) && ! defined (FREEBSD) && ! defined (MACOSX) && ! defined(__FreeBSD_kernel__)
{ EMULTIHOP, SVSTREAM_PATH_NOT_FOUND },
{ ENOLINK, SVSTREAM_PATH_NOT_FOUND },
#endif
diff --git a/tools/workben/urltest.cxx b/tools/workben/urltest.cxx
index 694698297680..0930dfcc5239 100644
--- a/tools/workben/urltest.cxx
+++ b/tools/workben/urltest.cxx
@@ -523,6 +523,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/",*/
@@ -533,13 +535,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());
+ }
}
}
}