[Libreoffice-commits] core.git: include/osl sal/osl
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jul 27 17:26:57 UTC 2021
include/osl/socket.h | 80 ------------------------------
sal/osl/all/compat.cxx | 30 +++++++++++
sal/osl/unx/socket.cxx | 129 -------------------------------------------------
sal/osl/w32/socket.cxx | 80 ------------------------------
4 files changed, 30 insertions(+), 289 deletions(-)
New commits:
commit db392a8a255326b7a094daeabd7fba195db6a9a5
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Jul 27 15:00:46 2021 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Jul 27 19:26:24 2021 +0200
[API CHANGE] Drop obsolete osl_demultiplexSocketEvents et al
...which were deprecated in 0a126b4c661d65860fd2de92f8cc49bdb65a957c "Deprecate
osl_demultiplexSocketEvents et al" towards LO 7.2 (and leave aborting stubs in
place for backwards compatibility)
Change-Id: Ice6032eb2f351af87dd56eecb002aa2a91e79373
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119560
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/include/osl/socket.h b/include/osl/socket.h
index 8e2a0066d17e..7f87da312d4e 100644
--- a/include/osl/socket.h
+++ b/include/osl/socket.h
@@ -610,86 +610,6 @@ SAL_DLLPUBLIC void SAL_CALL osl_getLastSocketErrorDescription(
SAL_DLLPUBLIC oslSocketError SAL_CALL osl_getLastSocketError(
oslSocket Socket);
-/** Type for the representation of socket sets.
-
- @deprecated
-*/
-typedef struct oslSocketSetImpl * oslSocketSet;
-
-/** Creates a set of sockets to be used with osl_demultiplexSocketEvents().
-
- @return A oslSocketSet or 0 if creation failed.
-
- @deprecated
-*/
-SAL_DLLPUBLIC oslSocketSet SAL_CALL osl_createSocketSet(void);
-
-/** Destroys an oslSocketSet.
-
- @deprecated
-*/
-SAL_DLLPUBLIC void SAL_CALL osl_destroySocketSet(oslSocketSet Set);
-
-/** Clears the set from all previously added sockets.
-
- @param Set the set to be cleared.
-
- @deprecated
-*/
-SAL_DLLPUBLIC void SAL_CALL osl_clearSocketSet(oslSocketSet Set);
-
-
-/** Adds a socket to the set.
-
- @param Set the set were the socket is added.
- @param Socket the socket to be added.
-
- @deprecated
-*/
-SAL_DLLPUBLIC void SAL_CALL osl_addToSocketSet(oslSocketSet Set, oslSocket Socket);
-
-/** Removes a socket from the set.
-
- @param Set the set were the socket is removed from.
- @param Socket the socket to be removed.
-
- @deprecated
-*/
-SAL_DLLPUBLIC void SAL_CALL osl_removeFromSocketSet(oslSocketSet Set, oslSocket Socket);
-
-/** Checks if socket is in the set.
-
- @param Set the set to be checked.
- @param Socket check if this socket is in the set.
-
- @retval sal_True if socket is in the set.
-
- @deprecated
-*/
-SAL_DLLPUBLIC sal_Bool SAL_CALL osl_isInSocketSet(oslSocketSet Set, oslSocket Socket);
-
-/** Checks multiple sockets for events.
-
- @param IncomingSet Checks the sockets in this set for incoming events (read, accept). If the set is 0,
- it is just skipped.
- @param OutgoingSet Checks the sockets in this set for outgoing events (write, connect). If the set is 0,
- it is just skipped.
- @param OutOfBandSet Checks the sockets in this set for out-of-band events. If the set is 0, it is just
- skipped.
- @param pTimeout Address of the number of milliseconds to wait for events. If *pTimeout is -1, the call
- will block until an event or an error occurs.
-
- @return -1 on errors, otherwise the number of sockets with pending events. In case of timeout, the
- number might be 0.
-
- @deprecated
-*/
-SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_demultiplexSocketEvents(
- oslSocketSet IncomingSet,
- oslSocketSet OutgoingSet,
- oslSocketSet OutOfBandSet,
- const TimeValue* pTimeout);
-
/** Closes the socket terminating any ongoing dataflow.
@param[in] Socket The socket to close.
diff --git a/sal/osl/all/compat.cxx b/sal/osl/all/compat.cxx
index 406c39229397..8fafc628b57e 100644
--- a/sal/osl/all/compat.cxx
+++ b/sal/osl/all/compat.cxx
@@ -25,6 +25,10 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL osl_acquireSemaphore(void *) {
for (;;) { std::abort(); } // avoid "must return a value" warnings
}
+SAL_DLLPUBLIC void SAL_CALL osl_addToSocketSet(void *, oslSocket) {
+ std::abort();
+}
+
SAL_DLLPUBLIC_EXPORT int SAL_CALL osl_areCommandArgsSet() {
for (;;) { std::abort(); } // avoid "must return a value" warnings
}
@@ -39,18 +43,40 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL osl_breakDebug() {
std::abort();
}
+SAL_DLLPUBLIC void SAL_CALL osl_clearSocketSet(void *) {
+ std::abort();
+}
+
SAL_DLLPUBLIC_EXPORT void * SAL_CALL osl_createSemaphore(sal_uInt32) {
for (;;) { std::abort(); } // avoid "must return a value" warnings
}
+SAL_DLLPUBLIC void * SAL_CALL osl_createSocketSet() {
+ for (;;) { std::abort(); } // avoid "must return a value" warnings
+}
+
+SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_demultiplexSocketEvents(
+ void *, void *, void *, TimeValue const *)
+{
+ for (;;) { std::abort(); } // avoid "must return a value" warnings
+}
+
SAL_DLLPUBLIC_EXPORT void SAL_CALL osl_destroySemaphore(void *) {
std::abort();
}
+SAL_DLLPUBLIC void SAL_CALL osl_destroySocketSet(void *) {
+ std::abort();
+}
+
SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL osl_getEthernetAddress(sal_uInt8 *) {
for (;;) { std::abort(); } // avoid "must return a value" warnings
}
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_isInSocketSet(void *, oslSocket) {
+ for (;;) { std::abort(); } // avoid "must return a value" warnings
+}
+
SAL_DLLPUBLIC_EXPORT oslSocket SAL_CALL osl_receiveResourcePipe(oslPipe) {
for (;;) { std::abort(); } // avoid "must return a value" warnings
}
@@ -65,6 +91,10 @@ SAL_DLLPUBLIC_EXPORT sal_Int32 SAL_CALL osl_reportError(
for (;;) { std::abort(); } // avoid "must return a value" warnings
}
+SAL_DLLPUBLIC void SAL_CALL osl_removeFromSocketSet(void *, oslSocket) {
+ std::abort();
+}
+
SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL osl_sendResourcePipe(oslPipe, oslSocket)
{
for (;;) { std::abort(); } // avoid "must return a value" warnings
diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx
index cc1798e4eb1d..535c1727cb15 100644
--- a/sal/osl/unx/socket.cxx
+++ b/sal/osl/unx/socket.cxx
@@ -2043,133 +2043,4 @@ oslSocketError SAL_CALL osl_getLastSocketError(oslSocket pSocket)
return ERROR_FROM_NATIVE(pSocket->m_nLastError);
}
-struct oslSocketSetImpl
-{
- int m_MaxHandle; /* for select(), the largest descriptor in the set */
- fd_set m_Set; /* the set of descriptors */
-
-};
-
-oslSocketSet SAL_CALL osl_createSocketSet()
-{
- oslSocketSetImpl* pSet;
-
- pSet= static_cast<oslSocketSetImpl*>(malloc(sizeof(oslSocketSetImpl)));
-
- SAL_WARN_IF( !pSet, "sal.osl", "allocation error" );
-
- if(pSet)
- {
- pSet->m_MaxHandle= 0;
- FD_ZERO(&pSet->m_Set);
- }
-
- return pSet;
-}
-
-void SAL_CALL osl_destroySocketSet(oslSocketSet Set)
-{
- if(Set)
- free(Set);
-}
-
-void SAL_CALL osl_clearSocketSet(oslSocketSet Set)
-{
- SAL_WARN_IF( !Set, "sal.osl", "undefined socket set" );
- if ( Set == nullptr )
- {
- return;
- }
-
- Set->m_MaxHandle= 0;
-
- FD_ZERO(&Set->m_Set);
-}
-
-void SAL_CALL osl_addToSocketSet(oslSocketSet Set, oslSocket pSocket)
-{
- SAL_WARN_IF( !Set, "sal.osl", "undefined socket set" );
- SAL_WARN_IF( !pSocket, "sal.osl", "undefined socket" );
-
- if ( Set == nullptr || pSocket == nullptr)
- {
- return;
- }
-
- /* correct max handle */
- if(pSocket->m_Socket > Set->m_MaxHandle)
- Set->m_MaxHandle= pSocket->m_Socket;
- FD_SET(pSocket->m_Socket, &Set->m_Set);
-
-}
-
-void SAL_CALL osl_removeFromSocketSet(oslSocketSet Set, oslSocket pSocket)
-{
- SAL_WARN_IF( !Set, "sal.osl", "undefined socket set" );
- SAL_WARN_IF( !pSocket, "sal.osl", "undefined socket" );
-
- if ( Set == nullptr || pSocket == nullptr)
- {
- return;
- }
-
- /* correct max handle */
- if(pSocket->m_Socket == Set->m_MaxHandle)
- {
- /* not optimal, since the next used descriptor might be */
- /* much smaller than m_Socket-1, but it will do */
- Set->m_MaxHandle--;
- if(Set->m_MaxHandle < 0)
- {
- Set->m_MaxHandle= 0; /* avoid underflow */
- }
- }
-
- FD_CLR(pSocket->m_Socket, &Set->m_Set);
-}
-
-sal_Bool SAL_CALL osl_isInSocketSet(oslSocketSet Set, oslSocket pSocket)
-{
- SAL_WARN_IF( !Set, "sal.osl", "undefined socket set" );
- SAL_WARN_IF( !pSocket, "sal.osl", "undefined socket" );
- if ( Set == nullptr || pSocket == nullptr )
- {
- return false;
- }
-
- return bool(FD_ISSET(pSocket->m_Socket, &Set->m_Set));
-}
-
-sal_Int32 SAL_CALL osl_demultiplexSocketEvents(oslSocketSet IncomingSet,
- oslSocketSet OutgoingSet,
- oslSocketSet OutOfBandSet,
- const TimeValue* pTimeout)
-{
- int MaxHandle= 0;
- struct timeval tv;
-
- if (pTimeout)
- {
- /* non-blocking call */
- tv.tv_sec = pTimeout->Seconds;
- tv.tv_usec = pTimeout->Nanosec / 1000;
- }
-
- /* get max handle from all sets */
- if (IncomingSet)
- MaxHandle= IncomingSet->m_MaxHandle;
-
- if (OutgoingSet && (OutgoingSet->m_MaxHandle > MaxHandle))
- MaxHandle= OutgoingSet->m_MaxHandle;
-
- if (OutOfBandSet && (OutOfBandSet->m_MaxHandle > MaxHandle))
- MaxHandle= OutOfBandSet->m_MaxHandle;
-
- return select(MaxHandle+1,
- IncomingSet ? PTR_FD_SET(IncomingSet->m_Set) : nullptr,
- OutgoingSet ? PTR_FD_SET(OutgoingSet->m_Set) : nullptr,
- OutOfBandSet ? PTR_FD_SET(OutOfBandSet->m_Set) : nullptr,
- pTimeout ? &tv : nullptr);
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/osl/w32/socket.cxx b/sal/osl/w32/socket.cxx
index 3ac6eacc9602..2548be0d550c 100644
--- a/sal/osl/w32/socket.cxx
+++ b/sal/osl/w32/socket.cxx
@@ -1608,84 +1608,4 @@ oslSocketError SAL_CALL osl_getLastSocketError(oslSocket /*Socket*/)
return ERROR_FROM_NATIVE(WSAGetLastError());
}
-struct oslSocketSetImpl
-{
- fd_set m_Set; /* the set of descriptors */
-
-};
-
-oslSocketSet SAL_CALL osl_createSocketSet()
-{
- oslSocketSetImpl* pSet;
-
- pSet = static_cast<oslSocketSetImpl*>(malloc(sizeof(oslSocketSetImpl)));
-
- if(pSet)
- {
- FD_ZERO(&pSet->m_Set);
- }
-
- return pSet;
-}
-
-void SAL_CALL osl_destroySocketSet (oslSocketSet Set)
-{
- if(Set)
- free(Set);
-}
-
-void SAL_CALL osl_clearSocketSet (oslSocketSet Set)
-{
- if (Set)
- FD_ZERO(&Set->m_Set);
-}
-
-void SAL_CALL osl_addToSocketSet (
- oslSocketSet Set,
- oslSocket Socket)
-{
- if (Set && Socket)
- FD_SET(Socket->m_Socket, &Set->m_Set);
-}
-
-void SAL_CALL osl_removeFromSocketSet (
- oslSocketSet Set,
- oslSocket Socket)
-{
- if (Set && Socket)
- FD_CLR(Socket->m_Socket, &Set->m_Set);
-}
-
-sal_Bool SAL_CALL osl_isInSocketSet (
- oslSocketSet Set,
- oslSocket Socket)
-{
- if (Set && Socket)
- return (FD_ISSET(Socket->m_Socket, &Set->m_Set) != 0);
- else
- return false;
-}
-
-sal_Int32 SAL_CALL osl_demultiplexSocketEvents (
- oslSocketSet IncomingSet,
- oslSocketSet OutgoingSet,
- oslSocketSet OutOfBandSet,
- const TimeValue* pTimeout)
-{
- struct timeval tv;
-
- if(pTimeout)
- {
- /* divide milliseconds into seconds and microseconds */
- tv.tv_sec = pTimeout->Seconds;
- tv.tv_usec = pTimeout->Nanosec / 1000L;
- }
-
- return select(0, /* redundant in WIN32 */
- IncomingSet ? &IncomingSet->m_Set : nullptr,
- OutgoingSet ? &OutgoingSet->m_Set : nullptr,
- OutOfBandSet ? &OutOfBandSet->m_Set : nullptr,
- pTimeout ? &tv : nullptr);
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list