From 635be0caa17968031beeaa8de1b1e54f0f8d2535 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Mon, 19 Sep 2011 21:28:48 +0000 Subject: [PATCH] =?UTF-8?q?-=20Update=20to=202011.09.02=20-=20Reorder=20pa?= =?UTF-8?q?tches=20-=20Add=20live-cloexec.patch=20and=20live-intptr.patch?= =?UTF-8?q?=20(rebased)=20from=20R=C3=A9mi.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- live-cloexec.patch | 49 +++++++++++++ live-inet_ntop.patch | 4 +- live-intptr.patch | 163 +++++++++++++++++++++++++++++++++++++++++++ live-uselocale.patch | 6 +- live555.spec | 19 +++-- sources | 2 +- 7 files changed, 232 insertions(+), 13 deletions(-) create mode 100644 live-cloexec.patch create mode 100644 live-intptr.patch diff --git a/.gitignore b/.gitignore index 1dd9de7..e861370 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -live.2011.01.24.tar.gz +live.2011.09.02.tar.gz diff --git a/live-cloexec.patch b/live-cloexec.patch new file mode 100644 index 0000000..fbdbff9 --- /dev/null +++ b/live-cloexec.patch @@ -0,0 +1,49 @@ +Copyright (C) 2011 Rémi Denis-Courmont. +Licensed under GNU General Public License version 2 or higher. +diff -ru live.orig/groupsock/GroupsockHelper.cpp live555/groupsock/GroupsockHelper.cpp +--- live.orig/groupsock/GroupsockHelper.cpp 2011-08-23 18:19:59.000000000 +0300 ++++ live/groupsock/GroupsockHelper.cpp 2011-08-23 18:26:32.000000000 +0300 +@@ -49,13 +49,33 @@ + reuseFlag = 1; + } + ++static int makeSocket(int type) ++{ ++ int fd; ++ ++#ifdef SOCK_CLOEXEC ++ fd = socket(AF_INET, type|SOCK_CLOEXEC, 0); ++ if (fd != -1 || errno != EINVAL) ++ return fd; ++#endif ++ ++ fd = socket(AF_INET, type, 0); ++ if (fd == -1) ++ return -1; ++#ifdef FD_CLOEXEC ++ fcntl(fd, F_SETFD, FD_CLOEXEC); ++#endif ++ return fd; ++} ++ ++ + int setupDatagramSocket(UsageEnvironment& env, Port port) { + if (!initializeWinsockIfNecessary()) { + socketErr(env, "Failed to initialize 'winsock': "); + return -1; + } + +- int newSocket = socket(AF_INET, SOCK_DGRAM, 0); ++ int newSocket = makeSocket(SOCK_DGRAM); + if (newSocket < 0) { + socketErr(env, "unable to create datagram socket: "); + return newSocket; +@@ -161,7 +181,7 @@ + return -1; + } + +- int newSocket = socket(AF_INET, SOCK_STREAM, 0); ++ int newSocket = makeSocket(SOCK_STREAM); + if (newSocket < 0) { + socketErr(env, "unable to create stream socket: "); + return newSocket; diff --git a/live-inet_ntop.patch b/live-inet_ntop.patch index b565f71..60071e6 100644 --- a/live-inet_ntop.patch +++ b/live-inet_ntop.patch @@ -177,9 +177,9 @@ diff -ru live.orig/liveMedia/RTSPServer.cpp live/liveMedia/RTSPServer.cpp increaseSendBufferTo(envir(), clientSocket, 50*1024); #ifdef DEBUG -- envir() << "accept()ed connection from " << our_inet_ntoa(clientAddr.sin_addr) << '\n'; +- envir() << "accept()ed connection from " << our_inet_ntoa(clientAddr.sin_addr) << "\n"; + char buf[16]; -+ envir() << "accept()ed connection from " << our_inet_ntoa(clientAddr.sin_addr, buf) << '\n'; ++ envir() << "accept()ed connection from " << our_inet_ntoa(clientAddr.sin_addr, buf) << "\n"; #endif // Create a new object for this RTSP session. diff --git a/live-intptr.patch b/live-intptr.patch new file mode 100644 index 0000000..79f7f08 --- /dev/null +++ b/live-intptr.patch @@ -0,0 +1,163 @@ +diff -up live/BasicUsageEnvironment/BasicHashTable.cpp.vlc3 live/BasicUsageEnvironment/BasicHashTable.cpp +--- live/BasicUsageEnvironment/BasicHashTable.cpp.vlc3 2011-09-02 22:52:41.000000000 +0200 ++++ live/BasicUsageEnvironment/BasicHashTable.cpp 2011-09-19 23:20:03.696255717 +0200 +@@ -26,6 +26,7 @@ along with this library; if not, write t + #endif + #include + #include ++#include + + // When there are this many entries per bucket, on average, rebuild + // the table to increase the number of buckets +@@ -253,17 +254,17 @@ void BasicHashTable::rebuild() { + } + + unsigned BasicHashTable::hashIndexFromKey(char const* key) const { +- unsigned result = 0; ++ uintptr_t result = 0; + + if (fKeyType == STRING_HASH_KEYS) { + while (1) { + char c = *key++; + if (c == 0) break; +- result += (result<<3) + (unsigned)c; ++ result += (result<<3) + (uintptr_t)c; + } + result &= fMask; + } else if (fKeyType == ONE_WORD_HASH_KEYS) { +- result = randomIndex((unsigned long)key); ++ result = randomIndex((uintptr_t)key); + } else { + unsigned* k = (unsigned*)key; + unsigned long sum = 0; +diff -up live/BasicUsageEnvironment/BasicTaskScheduler0.cpp.vlc3 live/BasicUsageEnvironment/BasicTaskScheduler0.cpp +--- live/BasicUsageEnvironment/BasicTaskScheduler0.cpp.vlc3 2011-09-02 22:52:41.000000000 +0200 ++++ live/BasicUsageEnvironment/BasicTaskScheduler0.cpp 2011-09-19 23:20:03.697255868 +0200 +@@ -19,6 +19,7 @@ along with this library; if not, write t + + #include "BasicUsageEnvironment0.hh" + #include "HandlerSet.hh" ++#include + + ////////// A subclass of DelayQueueEntry, + ////////// used to implement BasicTaskScheduler0::scheduleDelayedTask() +@@ -68,7 +69,7 @@ TaskToken BasicTaskScheduler0::scheduleD + } + + void BasicTaskScheduler0::unscheduleDelayedTask(TaskToken& prevTask) { +- DelayQueueEntry* alarmHandler = fDelayQueue.removeEntry((long)prevTask); ++ DelayQueueEntry* alarmHandler = fDelayQueue.removeEntry((intptr_t)prevTask); + prevTask = NULL; + delete alarmHandler; + } +diff -up live/BasicUsageEnvironment/include/BasicHashTable.hh.vlc3 live/BasicUsageEnvironment/include/BasicHashTable.hh +--- live/BasicUsageEnvironment/include/BasicHashTable.hh.vlc3 2011-09-02 22:52:41.000000000 +0200 ++++ live/BasicUsageEnvironment/include/BasicHashTable.hh 2011-09-19 23:20:03.701256472 +0200 +@@ -24,6 +24,8 @@ along with this library; if not, write t + #include "HashTable.hh" + #endif + ++#include ++ + // A simple hash table implementation, inspired by the hash table + // implementation used in Tcl 7.6: + +@@ -87,7 +89,7 @@ private: + unsigned hashIndexFromKey(char const* key) const; + // used to implement many of the routines above + +- unsigned randomIndex(unsigned long i) const { ++ unsigned randomIndex(uintptr_t i) const { + return (((i*1103515245) >> fDownShift) & fMask); + } + +diff -up live/groupsock/Groupsock.cpp.vlc3 live/groupsock/Groupsock.cpp +--- live/groupsock/Groupsock.cpp.vlc3 2011-09-19 23:20:03.690254809 +0200 ++++ live/groupsock/Groupsock.cpp 2011-09-19 23:20:03.698256018 +0200 +@@ -17,6 +17,7 @@ along with this library; if not, write t + // 'Group sockets' + // Implementation + ++#include + #include "Groupsock.hh" + #include "GroupsockHelper.hh" + //##### Eventually fix the following #include; we shouldn't know about tunnels +@@ -401,7 +402,7 @@ int Groupsock::outputToAllMembersExcept( + = (TunnelEncapsulationTrailer*)&data[size]; + TunnelEncapsulationTrailer* trailer; + +- Boolean misaligned = ((unsigned long)trailerInPacket & 3) != 0; ++ Boolean misaligned = ((uintptr_t)trailerInPacket & 3) != 0; + unsigned trailerOffset; + u_int8_t tunnelCmd; + if (isSSM()) { +diff -up live/liveMedia/MP3StreamState.cpp.vlc3 live/liveMedia/MP3StreamState.cpp +--- live/liveMedia/MP3StreamState.cpp.vlc3 2011-09-02 22:52:41.000000000 +0200 ++++ live/liveMedia/MP3StreamState.cpp 2011-09-19 23:20:03.699256170 +0200 +@@ -21,6 +21,7 @@ along with this library; if not, write t + #include "MP3StreamState.hh" + #include "InputFile.hh" + #include "GroupsockHelper.hh" ++#include + + #if defined(__WIN32__) || defined(_WIN32) + #define snprintf _snprintf +@@ -36,8 +37,8 @@ MP3StreamState::~MP3StreamState() { + // Close our open file or socket: + if (fFid != NULL && fFid != stdin) { + if (fFidIsReallyASocket) { +- long fid_long = (long)fFid; +- closeSocket((int)fid_long); ++ intptr_t fid_long = (intptr_t)fFid; ++ closeSocket(fid_long); + } else { + CloseInputFile(fFid); + } +@@ -192,7 +193,7 @@ void MP3StreamState::writeGetCmd(char co + char const* const getCmdFmt = "GET %s HTTP/1.1\r\nHost: %s:%d\r\n\r\n"; + + if (fFidIsReallyASocket) { +- long fid_long = (long)fFid; ++ intptr_t fid_long = (intptr_t)fFid; + int sock = (int)fid_long; + char writeBuf[100]; + #if defined(IRIX) || defined(ALPHA) || defined(_QNX4) || defined(IMN_PIM) || defined(CRIS) +@@ -391,7 +392,7 @@ unsigned MP3StreamState::readFromStream( + unsigned numChars) { + // Hack for doing socket I/O instead of file I/O (e.g., on Windows) + if (fFidIsReallyASocket) { +- long fid_long = (long)fFid; ++ intptr_t fid_long = (intptr_t)fFid; + int sock = (int)fid_long; + unsigned totBytesRead = 0; + do { +diff -up live/liveMedia/RTCP.cpp.vlc3 live/liveMedia/RTCP.cpp +--- live/liveMedia/RTCP.cpp.vlc3 2011-09-02 22:52:41.000000000 +0200 ++++ live/liveMedia/RTCP.cpp 2011-09-19 23:20:03.700256322 +0200 +@@ -18,6 +18,7 @@ along with this library; if not, write t + // RTCP + // Implementation + ++#include + #include "RTCP.hh" + #include "GroupsockHelper.hh" + #include "rtcp_from_spec.h" +@@ -81,14 +82,14 @@ void RTCPMemberDatabase::reapOldMembers( + + HashTable::Iterator* iter + = HashTable::Iterator::create(*fTable); +- unsigned long timeCount; ++ uintptr_t timeCount; + char const* key; +- while ((timeCount = (unsigned long)(iter->next(key))) != 0) { ++ while ((timeCount = (uintptr_t)(iter->next(key))) != 0) { + #ifdef DEBUG + fprintf(stderr, "reap: checking SSRC 0x%lx: %ld (threshold %d)\n", (unsigned long)key, timeCount, threshold); + #endif +- if (timeCount < (unsigned long)threshold) { // this SSRC is old +- unsigned long ssrc = (unsigned long)key; ++ if (timeCount < (uintptr_t)threshold) { // this SSRC is old ++ intptr_t ssrc = (uintptr_t)key; + oldSSRC = (unsigned)ssrc; + foundOldMember = True; + } diff --git a/live-uselocale.patch b/live-uselocale.patch index 0b56063..d3b76b5 100644 --- a/live-uselocale.patch +++ b/live-uselocale.patch @@ -68,7 +68,7 @@ diff -urN live.orig/liveMedia/Locale.cpp live/liveMedia/Locale.cpp } --- live.orig/liveMedia/RTSPClient.cpp 2010-03-16 03:09:46.000000000 +0100 +++ live/liveMedia/RTSPClient.cpp 2010-08-24 15:04:31.000000000 +0200 -@@ -1019,7 +1019,7 @@ +@@ -469,7 +469,7 @@ // This is the default value; we don't need a "Scale:" header: buf[0] = '\0'; } else { @@ -77,7 +77,7 @@ diff -urN live.orig/liveMedia/Locale.cpp live/liveMedia/Locale.cpp sprintf(buf, "Scale: %f\r\n", scale); } -@@ -1033,11 +1033,11 @@ +@@ -483,11 +483,11 @@ buf[0] = '\0'; } else if (end < 0) { // There's no end time: @@ -91,8 +91,6 @@ diff -urN live.orig/liveMedia/Locale.cpp live/liveMedia/Locale.cpp sprintf(buf, "Range: npt=%.3f-%.3f\r\n", start, end); } ---- live/liveMedia/RTSPClient.cpp 2010-08-24 17:05:46.000000000 +0200 -+++ live.new/liveMedia/RTSPClient.cpp 2010-08-24 17:04:50.000000000 +0200 @@ -935,7 +935,7 @@ } diff --git a/live555.spec b/live555.spec index c707979..1913af8 100644 --- a/live555.spec +++ b/live555.spec @@ -1,9 +1,9 @@ -%global date 2011.01.24 +%global date 2011.09.02 %global live_soversion 0 Name: live555 Version: 0 -Release: 0.30.%{date}%{?dist} +Release: 0.32.%{date}%{?dist} Summary: Live555.com streaming libraries Group: System Environment/Libraries @@ -12,9 +12,11 @@ URL: http://live555.com/liveMedia/ Source0: http://live555.com/liveMedia/public/live.%{date}.tar.gz Patch0: live.2010.01.16-shared.patch #Thoses patches are Copyright Rémi Denis-Courmont - provided as GPLv2+ -Patch1: live-getaddrinfo.patch -Patch2: live-inet_ntop.patch -Patch3: live-uselocale.patch +Patch1: live-uselocale.patch +Patch2: live-inet_ntop.patch +Patch3: live-intptr.patch +Patch4: live-getaddrinfo.patch +Patch5: live-cloexec.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Provides: live555date%{_isa} = %{date} @@ -92,6 +94,8 @@ install -pm 0644 config.linux config.linux.static %patch1 -p1 -b .vlc1 %patch2 -p1 -b .vlc2 %patch3 -p1 -b .vlc3 +%patch4 -p1 -b .vlc4 +%patch5 -p1 -b .vlc5 %build @@ -193,6 +197,11 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/libUsageEnvironment*.a %changelog +* Mon Sep 19 2011 Nicolas Chauvet - 0-0.32.2011.09.02 +- Update to 2011.09.02 +- Reorder patches +- Add live-cloexec.patch and live-intptr.patch (rebased) from Rémi. + * Tue Jan 25 2011 Nicolas Chauvet - 0-0.30.2011.01.24 - Update to 2011.01.24 - Update live555 patches from Rémi. diff --git a/sources b/sources index a25aa76..170f2fc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -0626e80c774fb27c651c3daf6cc3fb91 live.2011.01.24.tar.gz +e66901b4bc2b4e6fbd7821880d0373fd live.2011.09.02.tar.gz