summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilhelm Pflueger <Wilhelm.Pflueger@web.de>2011-03-21 14:14:39 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-03-21 14:14:39 +0000
commit49092c2df5b4cd13f46bf928a95ede306d69d0ff (patch)
tree549f2444975ea204133e4029bddc4a2ab392b467
parentbcc3dec9bbc8be9f3a24fa24ec43391d8354601e (diff)
Tests in ure/sal/osl/socket unveiled SocketAddr comparison bug
Reenabled test unveiled a bug in socket.c when comparing socket addresses.
-rw-r--r--sal/osl/unx/socket.c10
-rw-r--r--sal/osl/w32/socket.cxx4
-rwxr-xr-xsal/qa/osl/socket/makefile.mk72
-rw-r--r--sal/qa/osl/socket/osl_Socket2.cxx3
-rw-r--r--sal/qa/osl/socket/osl_SocketAddr.cxx3
5 files changed, 51 insertions, 41 deletions
diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c
index 740959244..74abe947f 100644
--- a/sal/osl/unx/socket.c
+++ b/sal/osl/unx/socket.c
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -594,11 +594,17 @@ sal_Bool SAL_CALL osl_isEqualSocketAddr (
oslSocketAddr Addr1,
oslSocketAddr Addr2)
{
+ OSL_ASSERT(Addr1);
+ OSL_ASSERT(Addr2);
struct sockaddr* pAddr1= &(Addr1->m_sockaddr);
struct sockaddr* pAddr2= &(Addr2->m_sockaddr);
OSL_ASSERT(pAddr1);
OSL_ASSERT(pAddr2);
+ if (pAddr1 == pAddr2)
+ {
+ return (sal_True);
+ }
if (pAddr1->sa_family == pAddr2->sa_family)
{
@@ -617,7 +623,7 @@ sal_Bool SAL_CALL osl_isEqualSocketAddr (
default:
{
- return (memcmp(pAddr1, Addr2, sizeof(struct sockaddr)) == 0);
+ return (memcmp(pAddr1, pAddr2, sizeof(struct sockaddr)) == 0);
}
}
}
diff --git a/sal/osl/w32/socket.cxx b/sal/osl/w32/socket.cxx
index 7acf7a54e..fe26f5e35 100644
--- a/sal/osl/w32/socket.cxx
+++ b/sal/osl/w32/socket.cxx
@@ -564,6 +564,8 @@ oslSocketAddr SAL_CALL osl_copySocketAddr(oslSocketAddr Addr)
/*****************************************************************************/
sal_Bool SAL_CALL osl_isEqualSocketAddr(oslSocketAddr Addr1, oslSocketAddr Addr2)
{
+ OSL_ASSERT(Addr1);
+ OSL_ASSERT(Addr2);
struct sockaddr* pAddr1= &(Addr1->m_sockaddr);
struct sockaddr* pAddr2= &(Addr2->m_sockaddr);
@@ -587,7 +589,7 @@ sal_Bool SAL_CALL osl_isEqualSocketAddr(oslSocketAddr Addr1, oslSocketAddr Addr2
default:
{
- return (memcmp(pAddr1, Addr2, sizeof(struct sockaddr)) == 0);
+ return (memcmp(pAddr1, pAddr2, sizeof(struct sockaddr)) == 0);
}
}
}
diff --git a/sal/qa/osl/socket/makefile.mk b/sal/qa/osl/socket/makefile.mk
index ae67d191c..cdc268a24 100755
--- a/sal/qa/osl/socket/makefile.mk
+++ b/sal/qa/osl/socket/makefile.mk
@@ -123,47 +123,47 @@ SHL4VERSIONMAP = $(PRJ)$/qa$/export.map
# BEGIN ----------------------------------------------------------------
# auto generated Target:Socket by codegen.pl
-#SHL5OBJS= \
-# $(SLO)$/sockethelper.obj \
-# $(SLO)$/osl_SocketAddr.obj
-#
-#SHL5TARGET= osl_SocketAddr
-#SHL5STDLIBS= $(SALLIB) $(CPPUNITLIB)
-#
-#.IF "$(GUI)" == "WNT"
-#SHL5STDLIBS += $(WS2_32LIB)
-#.ENDIF
-#
-#.IF "$(GUI)" == "UNX"
-#SHL5STDLIBS += -ldl -lnsl
-#.ENDIF
-#
-#SHL5IMPLIB= i$(SHL5TARGET)
-#DEF5NAME= $(SHL5TARGET)
-#SHL5VERSIONMAP = $(PRJ)$/qa$/export.map
+SHL5OBJS= \
+ $(SLO)$/sockethelper.obj \
+ $(SLO)$/osl_SocketAddr.obj
+
+SHL5TARGET= osl_SocketAddr
+SHL5STDLIBS= $(SALLIB) $(CPPUNITLIB)
+
+.IF "$(GUI)" == "WNT"
+SHL5STDLIBS += $(WS2_32LIB)
+.ENDIF
+
+.IF "$(GUI)" == "UNX"
+SHL5STDLIBS += -ldl -lnsl
+.ENDIF
+
+SHL5IMPLIB= i$(SHL5TARGET)
+DEF5NAME= $(SHL5TARGET)
+SHL5VERSIONMAP = $(PRJ)$/qa$/export.map
# auto generated Target:Socket
# END ------------------------------------------------------------------
# BEGIN ----------------------------------------------------------------
# auto generated Target:Socket by codegen.pl
-#SHL6OBJS= \
-# $(SLO)$/sockethelper.obj \
-# $(SLO)$/osl_Socket2.obj
-#
-#SHL6TARGET= osl_Socket2
-#SHL6STDLIBS= $(SALLIB) $(CPPUNITLIB)
-#
-#.IF "$(GUI)" == "WNT"
-#SHL6STDLIBS += $(WS2_32LIB)
-#.ENDIF
-#
-#.IF "$(GUI)" == "UNX"
-#SHL6STDLIBS += -ldl -lnsl
-#.ENDIF
-#
-#SHL6IMPLIB= i$(SHL6TARGET)
-#DEF6NAME= $(SHL6TARGET)
-#SHL6VERSIONMAP = $(PRJ)$/qa$/export.map
+SHL6OBJS= \
+ $(SLO)$/sockethelper.obj \
+ $(SLO)$/osl_Socket2.obj
+
+SHL6TARGET= osl_Socket2
+SHL6STDLIBS= $(SALLIB) $(CPPUNITLIB)
+
+.IF "$(GUI)" == "WNT"
+SHL6STDLIBS += $(WS2_32LIB)
+.ENDIF
+
+.IF "$(GUI)" == "UNX"
+SHL6STDLIBS += -ldl -lnsl
+.ENDIF
+
+SHL6IMPLIB= i$(SHL6TARGET)
+DEF6NAME= $(SHL6TARGET)
+SHL6VERSIONMAP = $(PRJ)$/qa$/export.map
# auto generated Target:Socket
# END ------------------------------------------------------------------
diff --git a/sal/qa/osl/socket/osl_Socket2.cxx b/sal/qa/osl/socket/osl_Socket2.cxx
index 3d5566bb5..ed02581d9 100644
--- a/sal/qa/osl/socket/osl_Socket2.cxx
+++ b/sal/qa/osl/socket/osl_Socket2.cxx
@@ -241,7 +241,8 @@ namespace osl_Socket
CPPUNIT_TEST( ctors_no_acquire );
CPPUNIT_TEST( ctors_copy_ctor );
CPPUNIT_TEST( ctors_TypeRaw );
- CPPUNIT_TEST( ctors_family_Ipx );
+ //TODO: Check if family_Ipx is still in use?
+ // CPPUNIT_TEST( ctors_family_Ipx );
CPPUNIT_TEST_SUITE_END();
}; // class ctors
diff --git a/sal/qa/osl/socket/osl_SocketAddr.cxx b/sal/qa/osl/socket/osl_SocketAddr.cxx
index ab52775bf..71e8e68f8 100644
--- a/sal/qa/osl/socket/osl_SocketAddr.cxx
+++ b/sal/qa/osl/socket/osl_SocketAddr.cxx
@@ -866,7 +866,8 @@ namespace osl_SocketAddr
CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::ctors);
CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::is);
-CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::getHostname);
+//TODO: enable Test with valid host names
+//CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::getHostname);
CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::getPort);
CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::setPort);
CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::setAddr);