Commit 60f907a5 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Revert "Contribs: update live555 to latest snapshot"

This reverts commit acb6ff18.
parent 73033a8c
00578686c1e154cea7638d19a6ab7675fa79d7da8f1848e9765954e3b02b82c54fd05e4480e7ffcdc399c7ad3a0ad26aff0a8ce97222e26e66e345fe82906e02 live.2011.12.02.tar.gz
42e424e8743cdbce2d6c87b6ceeb182a8868e870a0b233df987004a99e97e80c216e6c996774e936be40b1c3397a7c95ac8aa74eb6dcd8fac42a81dfcb4fd767 live.2011.11.08.tar.gz
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;
Copyright (C) 2010 Rémi Denis-Courmont.
Licensed under GNU General Public License version 2 or higher.
diff -ru live.orig//groupsock/GroupsockHelper.cpp live//groupsock/GroupsockHelper.cpp
--- live.orig//groupsock/GroupsockHelper.cpp 2010-04-09 22:27:39.000000000 +0300
+++ live//groupsock/GroupsockHelper.cpp 2010-04-17 20:18:11.000000000 +0300
@@ -625,25 +625,29 @@
#include <hostLib.h>
if (ERROR == (ourAddress = hostGetByName( hostname ))) break;
#else
- struct hostent* hstent
- = (struct hostent*)gethostbyname(hostname);
- if (hstent == NULL || hstent->h_length != 4) {
- env.setResultErrMsg("initial gethostbyname() failed");
+ struct addrinfo hints, *res;
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = AF_INET;
+ hints.ai_socktype = SOCK_DGRAM;
+ hints.ai_protocol = IPPROTO_UDP;
+ if (getaddrinfo(hostname, NULL, &hints, &res)) {
+ env.setResultErrMsg("initial getaddrinfo() failed");
break;
}
// Take the first address that's not bad
// (This code, like many others, won't handle IPv6)
netAddressBits addr = 0;
- for (unsigned i = 0; ; ++i) {
- char* addrPtr = hstent->h_addr_list[i];
- if (addrPtr == NULL) break;
+ for (const struct addrinfo *p = res; p; p = p->ai_next) {
+ const struct in_addr in =
+ ((const struct sockaddr_in *)p->ai_addr)->sin_addr;
- netAddressBits a = *(netAddressBits*)addrPtr;
+ netAddressBits a = in.s_addr;
if (!badAddress(a)) {
addr = a;
break;
}
}
+ freeaddrinfo(res);
if (addr != 0) {
fromAddr.sin_addr.s_addr = addr;
} else {
diff -ru live.orig//groupsock/inet.c live//groupsock/inet.c
--- live.orig//groupsock/inet.c 2010-04-09 22:27:39.000000000 +0300
+++ live//groupsock/inet.c 2010-04-17 20:14:07.000000000 +0300
@@ -76,16 +76,6 @@
#define NULL 0
#endif
-#if !defined(VXWORKS)
-struct hostent* our_gethostbyname(name)
- char* name;
-{
- if (!initializeWinsockIfNecessary()) return NULL;
-
- return (struct hostent*) gethostbyname(name);
-}
-#endif
-
#ifdef USE_SYSTEM_RANDOM
/* Use the system-supplied "random()" and "srandom()" functions */
#include <stdlib.h>
diff -ru live.orig//groupsock/NetAddress.cpp live//groupsock/NetAddress.cpp
--- live.orig//groupsock/NetAddress.cpp 2010-04-09 22:27:39.000000000 +0300
+++ live//groupsock/NetAddress.cpp 2010-04-17 20:13:29.000000000 +0300
@@ -83,15 +83,12 @@
NetAddressList::NetAddressList(char const* hostname)
: fNumAddresses(0), fAddressArray(NULL) {
- struct hostent* host;
+
+ struct addrinfo *res;
// Check first whether "hostname" is an IP address string:
netAddressBits addr = our_inet_addr((char*)hostname);
if (addr != INADDR_NONE) { // yes it was an IP address string
- //##### host = gethostbyaddr((char*)&addr, sizeof (netAddressBits), AF_INET);
- host = NULL; // don't bother calling gethostbyaddr(); we only want 1 addr
-
- if (host == NULL) {
// For some unknown reason, gethostbyaddr() failed, so just
// return a 1-element list with the address we were given:
fNumAddresses = 1;
@@ -101,41 +98,40 @@
fAddressArray[0] = new NetAddress((u_int8_t*)&addr,
sizeof (netAddressBits));
return;
- }
} else { // Try resolving "hostname" as a real host name
-#if defined(VXWORKS)
- char hostentBuf[512];
- host = (struct hostent*)resolvGetHostByName((char*)hostname,(char*)&hostentBuf,sizeof hostentBuf);
-#else
- host = our_gethostbyname((char*)hostname);
-#endif
+ struct addrinfo hints;
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = AF_INET;
+ hints.ai_socktype = SOCK_DGRAM; /* be sure to not get dups! */
+ hints.ai_protocol = IPPROTO_UDP;
- if (host == NULL) {
+ if (getaddrinfo(hostname, NULL, &hints, &res))
// It was a host name, and we couldn't resolve it. We're SOL.
return;
- }
}
- u_int8_t const** const hAddrPtr
- = (u_int8_t const**)host->h_addr_list;
- if (hAddrPtr != NULL) {
- // First, count the number of addresses:
- u_int8_t const** hAddrPtr1 = hAddrPtr;
- while (*hAddrPtr1 != NULL) {
- ++fNumAddresses;
- ++hAddrPtr1;
- }
-
- // Next, set up the list:
- fAddressArray = new NetAddress*[fNumAddresses];
- if (fAddressArray == NULL) return;
-
- for (unsigned i = 0; i < fNumAddresses; ++i) {
- fAddressArray[i]
- = new NetAddress(hAddrPtr[i], host->h_length);
- }
+ // First, count the number of addresses:
+ for (const struct addrinfo *p = res; p; p = p->ai_next)
+ fNumAddresses++;
+
+ // Next, set up the list:
+ fAddressArray = new NetAddress*[fNumAddresses];
+
+ unsigned i = 0;
+ for (const struct addrinfo *p = res; p; p = p->ai_next) {
+ union
+ {
+ struct in_addr ip4;
+ uint8_t b[4];
+ } buf;
+ const struct sockaddr_in *sin =
+ (const struct sockaddr_in *)p->ai_addr;
+
+ buf.ip4 = sin->sin_addr;
+ fAddressArray[i++] = new NetAddress(buf.b, 4);
}
+ freeaddrinfo(res);
}
NetAddressList::NetAddressList(NetAddressList const& orig) {
Copyright (C) 2010 Rémi Denis-Courmont.
Licensed under GNU General Public License version 2 or higher.
diff -ru live.orig/groupsock/Groupsock.cpp live/groupsock/Groupsock.cpp
--- live.orig/groupsock/Groupsock.cpp 2010-10-20 10:31:13.000000000 +0200
+++ live/groupsock/Groupsock.cpp 2010-10-20 12:34:04.762178010 +0200
@@ -335,8 +335,10 @@
}
}
if (DebugLevel >= 3) {
+ char buf[16];
+
env() << *this << ": read " << bytesRead << " bytes from ";
- env() << our_inet_ntoa(fromAddress.sin_addr);
+ env() << our_inet_ntoa(fromAddress.sin_addr, buf);
if (numMembers > 0) {
env() << "; relayed to " << numMembers << " members";
}
@@ -445,13 +447,14 @@
}
UsageEnvironment& operator<<(UsageEnvironment& s, const Groupsock& g) {
+ char buf[16];
UsageEnvironment& s1 = s << timestampString() << " Groupsock("
<< g.socketNum() << ": "
- << our_inet_ntoa(g.groupAddress())
+ << our_inet_ntoa(g.groupAddress(), buf)
<< ", " << g.port() << ", ";
if (g.isSSM()) {
return s1 << "SSM source: "
- << our_inet_ntoa(g.sourceFilterAddress()) << ")";
+ << our_inet_ntoa(g.sourceFilterAddress(), buf) << ")";
} else {
return s1 << (unsigned)(g.ttl()) << ")";
}
diff -ru live.orig/groupsock/include/GroupsockHelper.hh live/groupsock/include/GroupsockHelper.hh
--- live.orig/groupsock/include/GroupsockHelper.hh 2010-10-20 10:31:13.000000000 +0200
+++ live/groupsock/include/GroupsockHelper.hh 2010-10-20 12:34:04.762178010 +0200
@@ -116,7 +116,7 @@
// The following are implemented in inet.c:
extern "C" netAddressBits our_inet_addr(char const*);
-extern "C" char* our_inet_ntoa(struct in_addr);
+extern "C" char* our_inet_ntoa(struct in_addr, char *);
extern "C" struct hostent* our_gethostbyname(char* name);
extern "C" void our_srandom(int x);
extern "C" long our_random();
diff -ru live.orig/groupsock/inet.c live/groupsock/inet.c
--- live.orig/groupsock/inet.c 2010-10-20 10:31:13.000000000 +0200
+++ live/groupsock/inet.c 2010-10-20 12:34:04.762178010 +0200
@@ -21,26 +21,19 @@
}
char *
-our_inet_ntoa(in)
- struct in_addr in;
+our_inet_ntoa(in, result)
+ struct in_addr in;
+ char *result;
{
-#ifndef VXWORKS
- return inet_ntoa(in);
+#ifdef WIN32
+ char *ret = inet_ntoa(in);
+ if(ret != NULL)
+ strncpy(result, ret, 16);
+ return ret;
+#elif !defined (VXWORKS)
+ inet_ntop(AF_INET, &in, result, 16);
+ return(result);
#else
- /* according the man pages of inet_ntoa :
-
- NOTES
- The return value from inet_ntoa() points to a buffer which
- is overwritten on each call. This buffer is implemented as
- thread-specific data in multithreaded applications.
-
- the vxworks version of inet_ntoa allocates a buffer for each
- ip address string, and does not reuse the same buffer.
-
- this is merely to simulate the same behaviour (not multithread
- safe though):
- */
- static char result[INET_ADDR_LEN];
inet_ntoa_b(in, result);
return(result);
#endif
diff -ru live.orig/liveMedia/DarwinInjector.cpp live/liveMedia/DarwinInjector.cpp
--- live.orig/liveMedia/DarwinInjector.cpp 2010-10-20 10:31:13.000000000 +0200
+++ live/liveMedia/DarwinInjector.cpp 2010-10-20 12:34:04.762178010 +0200
@@ -146,7 +146,8 @@
NetAddress const* address = addresses.firstAddress();
addr.s_addr = *(unsigned*)(address->data());
}
- char const* remoteRTSPServerAddressStr = our_inet_ntoa(addr);
+ char buf[16];
+ char const* remoteRTSPServerAddressStr = our_inet_ntoa(addr, buf);
// Construct a SDP description for the session that we'll be streaming:
char const* const sdpFmt =
diff -ru live.orig/liveMedia/OnDemandServerMediaSubsession.cpp live/liveMedia/OnDemandServerMediaSubsession.cpp
--- live.orig/liveMedia/OnDemandServerMediaSubsession.cpp 2010-10-20 10:31:13.000000000 +0200
+++ live/liveMedia/OnDemandServerMediaSubsession.cpp 2010-10-20 12:34:04.762178010 +0200
@@ -365,7 +365,8 @@
char const* mediaType = rtpSink->sdpMediaType();
unsigned char rtpPayloadType = rtpSink->rtpPayloadType();
struct in_addr serverAddrForSDP; serverAddrForSDP.s_addr = fServerAddressForSDP;
- char* const ipAddressStr = strDup(our_inet_ntoa(serverAddrForSDP));
+ char ipAddressStr[16];
+ our_inet_ntoa(serverAddrForSDP, ipAddressStr);
char* rtpmapLine = rtpSink->rtpmapLine();
char const* rangeLine = rangeSDPLine();
char const* auxSDPLine = getAuxSDPLine(rtpSink, inputSource);
@@ -398,7 +399,7 @@
rangeLine, // a=range:... (if present)
auxSDPLine, // optional extra SDP line
trackId()); // a=control:<track-id>
- delete[] (char*)rangeLine; delete[] rtpmapLine; delete[] ipAddressStr;
+ delete[] (char*)rangeLine; delete[] rtpmapLine;
fSDPLines = strDup(sdpLines);
delete[] sdpLines;
diff -ru live.orig/liveMedia/PassiveServerMediaSubsession.cpp live/liveMedia/PassiveServerMediaSubsession.cpp
--- live.orig/liveMedia/PassiveServerMediaSubsession.cpp 2010-10-20 10:31:13.000000000 +0200
+++ live/liveMedia/PassiveServerMediaSubsession.cpp 2010-10-20 12:34:04.762178010 +0200
@@ -54,7 +54,8 @@
char const* auxSDPLine = fRTPSink.auxSDPLine();
if (auxSDPLine == NULL) auxSDPLine = "";
- char* const ipAddressStr = strDup(our_inet_ntoa(ipAddress));
+ char ipAddressStr[16];
+ our_inet_ntoa(ipAddress, ipAddressStr);
char const* const sdpFmt =
"m=%s %d RTP/AVP %d\r\n"
@@ -84,7 +85,7 @@
rangeLine, // a=range:... (if present)
auxSDPLine, // optional extra SDP line
trackId()); // a=control:<track-id>
- delete[] ipAddressStr; delete[] (char*)rangeLine; delete[] rtpmapLine;
+ delete[] (char*)rangeLine; delete[] rtpmapLine;
fSDPLines = strDup(sdpLines);
delete[] sdpLines;
diff -ru live.orig/liveMedia/RTSPClient.cpp live/liveMedia/RTSPClient.cpp
--- live.orig/liveMedia/RTSPClient.cpp 2010-10-20 12:34:33.662177993 +0200
+++ live/liveMedia/RTSPClient.cpp 2010-10-20 12:34:04.762178010 +0200
@@ -411,7 +411,8 @@
int RTSPClient::connectToServer(int socketNum, portNumBits remotePortNum) {
MAKE_SOCKADDR_IN(remoteName, fServerAddress, htons(remotePortNum));
if (fVerbosityLevel >= 1) {
- envir() << "Opening connection to " << our_inet_ntoa(remoteName.sin_addr) << ", port " << remotePortNum << "...\n";
+ char buf[16];
+ envir() << "Opening connection to " << our_inet_ntoa(remoteName.sin_addr, buf) << ", port " << remotePortNum << "...\n";
}
if (connect(socketNum, (struct sockaddr*) &remoteName, sizeof remoteName) != 0) {
if (envir().getErrno() == EINPROGRESS) {
diff -ru live.orig/liveMedia/RTSPServer.cpp live/liveMedia/RTSPServer.cpp
--- live.orig/liveMedia/RTSPServer.cpp 2010-10-20 10:31:13.000000000 +0200
+++ live/liveMedia/RTSPServer.cpp 2010-10-20 12:34:04.772177998 +0200
@@ -114,11 +114,12 @@
char urlBuffer[100]; // more than big enough for "rtsp://<ip-address>:<port>/"
portNumBits portNumHostOrder = ntohs(fRTSPServerPort.num());
+ char buf[16];
if (portNumHostOrder == 554 /* the default port number */) {
- sprintf(urlBuffer, "rtsp://%s/", our_inet_ntoa(ourAddress.sin_addr));
+ sprintf(urlBuffer, "rtsp://%s/", our_inet_ntoa(ourAddress.sin_addr, buf));
} else {
sprintf(urlBuffer, "rtsp://%s:%hu/",
- our_inet_ntoa(ourAddress.sin_addr), portNumHostOrder);
+ our_inet_ntoa(ourAddress.sin_addr, buf), portNumHostOrder);
}
return strDup(urlBuffer);
@@ -266,7 +267,8 @@
increaseSendBufferTo(envir(), clientSocket, 50*1024);
#ifdef DEBUG
- 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";
#endif
// Create a new object for this RTSP session.
@@ -885,8 +887,10 @@
ReceivingInterfaceAddr = origReceivingInterfaceAddr;
struct in_addr destinationAddr; destinationAddr.s_addr = destinationAddress;
- char* destAddrStr = strDup(our_inet_ntoa(destinationAddr));
- char* sourceAddrStr = strDup(our_inet_ntoa(sourceAddr.sin_addr));
+ char destAddrStr[16];
+ our_inet_ntoa(destinationAddr, destAddrStr);
+ char sourceAddrStr[16];
+ our_inet_ntoa(sourceAddr.sin_addr, sourceAddrStr);
if (fIsMulticast) {
switch (streamingMode) {
case RTP_UDP:
@@ -961,7 +965,7 @@
}
}
}
- delete[] destAddrStr; delete[] sourceAddrStr; delete[] streamingModeString;
+ delete[] streamingModeString;
} while (0);
delete[] concatenatedStreamName;
@@ -1544,7 +1548,8 @@
// If this gets called, the client session is assumed to have timed out,
// so delete it:
#ifdef DEBUG
- fprintf(stderr, "RTSP client session from %s has timed out (due to inactivity)\n", our_inet_ntoa(clientSession->fClientAddr.sin_addr));
+ char buf[16];
+ fprintf(stderr, "RTSP client session from %s has timed out (due to inactivity)\n", our_inet_ntoa(clientSession->fClientAddr.sin_addr, buf));
#endif
delete clientSession;
}
diff -ru live.orig/liveMedia/ServerMediaSession.cpp live/liveMedia/ServerMediaSession.cpp
--- live.orig/liveMedia/ServerMediaSession.cpp 2010-10-20 10:31:13.000000000 +0200
+++ live/liveMedia/ServerMediaSession.cpp 2010-10-20 12:34:04.772177998 +0200
@@ -185,7 +185,8 @@
char* ServerMediaSession::generateSDPDescription() {
struct in_addr ipAddress;
ipAddress.s_addr = ourIPAddress(envir());
- char* const ipAddressStr = strDup(our_inet_ntoa(ipAddress));
+ char ipAddressStr[16];
+ our_inet_ntoa(ipAddress, ipAddressStr);
unsigned ipAddressStrSize = strlen(ipAddressStr);
// For a SSM sessions, we need a "a=source-filter: incl ..." line also:
@@ -281,7 +282,7 @@
}
} while (0);
- delete[] rangeLine; delete[] sourceFilterLine; delete[] ipAddressStr;
+ delete[] rangeLine; delete[] sourceFilterLine;
return sdp;
}
diff -ru live.orig/liveMedia/SIPClient.cpp live/liveMedia/SIPClient.cpp
--- live.orig/liveMedia/SIPClient.cpp 2010-10-20 10:31:13.000000000 +0200
+++ live/liveMedia/SIPClient.cpp 2010-10-20 12:34:04.772177998 +0200
@@ -60,13 +60,14 @@
struct in_addr ourAddress;
ourAddress.s_addr = ourIPAddress(env); // hack
- fOurAddressStr = strDup(our_inet_ntoa(ourAddress));
+ char buf[16];
+ fOurAddressStr = strDup(our_inet_ntoa(ourAddress, buf));
fOurAddressStrSize = strlen(fOurAddressStr);
fOurSocket = new Groupsock(env, ourAddress, 0, 255);
if (fOurSocket == NULL) {
env << "ERROR: Failed to create socket for addr "
- << our_inet_ntoa(ourAddress) << ": "
+ << our_inet_ntoa(ourAddress, buf) << ": "
<< env.getResultMsg() << "\n";
}
@@ -84,7 +85,7 @@
fOurSocket = new Groupsock(env, ourAddress, fOurPortNum, 255);
if (fOurSocket == NULL) {
env << "ERROR: Failed to create socket for addr "
- << our_inet_ntoa(ourAddress) << ", port "
+ << our_inet_ntoa(ourAddress, buf) << ", port "
<< fOurPortNum << ": "
<< env.getResultMsg() << "\n";
}
diff -ru live.orig/testProgs/sapWatch.cpp live/testProgs/sapWatch.cpp
--- live.orig/testProgs/sapWatch.cpp 2010-10-20 10:31:13.000000000 +0200
+++ live/testProgs/sapWatch.cpp 2010-10-20 12:34:04.772177998 +0200
@@ -49,13 +49,14 @@
struct sockaddr_in fromAddress;
while (inputGroupsock.handleRead(packet, maxPacketSize,
packetSize, fromAddress)) {
+ char buf[16];
printf("\n[packet from %s (%d bytes)]\n",
- our_inet_ntoa(fromAddress.sin_addr), packetSize);
+ our_inet_ntoa(fromAddress.sin_addr, buf), packetSize);
// Ignore the first 8 bytes (SAP header).
if (packetSize < 8) {
*env << "Ignoring short packet from "
- << our_inet_ntoa(fromAddress.sin_addr) << "%s!\n";
+ << our_inet_ntoa(fromAddress.sin_addr, buf) << "%s!\n";
continue;
}
diff -ruN live/BasicUsageEnvironment/BasicHashTable.cpp live.new/BasicUsageEnvironment/BasicHashTable.cpp
--- live/BasicUsageEnvironment/BasicHashTable.cpp 2009-07-28 03:05:14.000000000 +0200
+++ live.new/BasicUsageEnvironment/BasicHashTable.cpp 2009-08-19 00:58:32.000000000 +0200
@@ -26,6 +26,7 @@
#endif
#include <string.h>
#include <stdio.h>
+#include <stdint.h>
// When there are this many entries per bucket, on average, rebuild
// the table to increase the number of buckets
@@ -253,17 +254,17 @@
}
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 -ruN live/BasicUsageEnvironment/BasicTaskScheduler0.cpp live.new/BasicUsageEnvironment/BasicTaskScheduler0.cpp
--- live/BasicUsageEnvironment/BasicTaskScheduler0.cpp 2009-07-28 03:05:14.000000000 +0200
+++ live.new/BasicUsageEnvironment/BasicTaskScheduler0.cpp 2009-08-19 00:58:04.000000000 +0200
@@ -19,6 +19,7 @@
#include "BasicUsageEnvironment0.hh"
#include "HandlerSet.hh"
+#include <stdint.h>
////////// A subclass of DelayQueueEntry,
////////// used to implement BasicTaskScheduler0::scheduleDelayedTask()
@@ -64,7 +65,7 @@
}
void BasicTaskScheduler0::unscheduleDelayedTask(TaskToken& prevTask) {
- DelayQueueEntry* alarmHandler = fDelayQueue.removeEntry((long)prevTask);
+ DelayQueueEntry* alarmHandler = fDelayQueue.removeEntry((intptr_t)prevTask);
prevTask = NULL;
delete alarmHandler;
}
diff -ruN live/groupsock/Groupsock.cpp live.new/groupsock/Groupsock.cpp
--- live/groupsock/Groupsock.cpp 2009-07-28 03:05:14.000000000 +0200
+++ live.new/groupsock/Groupsock.cpp 2009-08-19 00:57:14.000000000 +0200
@@ -17,6 +17,7 @@
// 'Group sockets'
// Implementation
+#include <stdint.h>
#include "Groupsock.hh"
#include "GroupsockHelper.hh"
//##### Eventually fix the following #include; we shouldn't know about tunnels
@@ -403,7 +404,7 @@
= (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 -ruN live/liveMedia/MP3StreamState.cpp live.new/liveMedia/MP3StreamState.cpp
--- live/liveMedia/MP3StreamState.cpp 2009-07-28 03:05:14.000000000 +0200
+++ live.new/liveMedia/MP3StreamState.cpp 2009-08-19 00:56:37.000000000 +0200
@@ -20,6 +20,7 @@
#include "MP3StreamState.hh"
#include "GroupsockHelper.hh"
+#include <stdint.h>
#if defined(__WIN32__) || defined(_WIN32)
#define snprintf _snprintf
@@ -35,8 +36,8 @@
// 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 {
fclose(fFid);
}
@@ -201,7 +202,7 @@
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)
@@ -412,7 +413,7 @@
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 -ruN live/liveMedia/RTCP.cpp live.new/liveMedia/RTCP.cpp
--- live/liveMedia/RTCP.cpp 2009-07-28 03:05:14.000000000 +0200
+++ live.new/liveMedia/RTCP.cpp 2009-08-19 00:57:01.000000000 +0200
@@ -18,6 +18,7 @@
// RTCP
// Implementation
+#include <stdint.h>
#include "RTCP.hh"
#include "GroupsockHelper.hh"
#include "rtcp_from_spec.h"
@@ -81,14 +82,14 @@
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;
}
--- live/BasicUsageEnvironment/include/BasicHashTable.hh 2009-07-28 03:05:14.000000000 +0200
+++ live.new/BasicUsageEnvironment/include/BasicHashTable.hh 2009-08-19 19:00:05.000000000 +0200
@@ -24,6 +24,8 @@
#include "HashTable.hh"
#endif
+#include <stdint.h>
+
// A simple hash table implementation, inspired by the hash table
// implementation used in Tcl 7.6: <http://www.tcl.tk/>
@@ -87,7 +89,7 @@
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);
}
Copyright (C) 2008 Rémi Denis-Courmont, adaptation by Felix Kühne (C) 2009.
Licensed under GNU General Public License version 2 or higher.
diff -urN live.orig/liveMedia/include/Locale.hh live/liveMedia/include/Locale.hh
--- live.orig/liveMedia/include/Locale.hh 2009-03-23 01:26:16 +0300
+++ live/liveMedia/include/Locale.hh 2009-03-26 19:17:43 +0300
@@ -27,23 +27,26 @@
#ifndef LOCALE_NOT_USED
#include <locale.h>
+#ifdef __APPLE__
+#include <xlocale.h>
+#endif
#else
-#ifndef LC_ALL
-#define LC_ALL 0
+#ifndef LC_ALL_MASK
+#define LC_ALL_MASK 0
#endif
-#ifndef LC_NUMERIC
-#define LC_NUMERIC 4
+#ifndef LC_NUMERIC_MASK
+#define LC_NUMERIC_MASK 0
#endif
+typedef int locale_t;
#endif
class Locale {
public:
- Locale(char const* newLocale, int category = LC_ALL);
+ Locale(char const* newLocale, int category = LC_ALL_MASK);
virtual ~Locale();
private:
- int fCategory;
- char* fPrevLocale;
+ locale_t fLocale, fPrevLocale;
};
#endif
diff -urN live.orig/liveMedia/Locale.cpp live/liveMedia/Locale.cpp
--- live.orig/liveMedia/Locale.cpp 2009-03-23 01:26:16 +0300
+++ live/liveMedia/Locale.cpp 2009-03-26 19:17:43 +0300
@@ -22,19 +22,18 @@
#include "Locale.hh"
#include <strDup.hh>
-Locale::Locale(char const* newLocale, int category)
- : fCategory(category) {
+Locale::Locale(char const* newLocale, int category) {
#ifndef LOCALE_NOT_USED
- fPrevLocale = strDup(setlocale(category, NULL));
- setlocale(category, newLocale);
+ fLocale = newlocale(category, newLocale, NULL);
+ fPrevLocale = uselocale(fLocale);
#endif
}
Locale::~Locale() {
#ifndef LOCALE_NOT_USED
- if (fPrevLocale != NULL) {
- setlocale(fCategory, fPrevLocale);
- delete[] fPrevLocale;
+ if (fLocale != (locale_t)0) {
+ uselocale(fPrevLocale);
+ freelocale(fLocale);
}
#endif
}
--- 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
@@ -469,7 +469,7 @@
// This is the default value; we don't need a "Scale:" header:
buf[0] = '\0';
} else {
- Locale l("C", LC_NUMERIC);
+ Locale l("C", LC_NUMERIC_MASK);
sprintf(buf, "Scale: %f\r\n", scale);
}
@@ -483,11 +483,11 @@
buf[0] = '\0';
} else if (end < 0) {
// There's no end time:
- Locale l("C", LC_NUMERIC);
+ Locale l("C", LC_NUMERIC_MASK);
sprintf(buf, "Range: npt=%.3f-\r\n", start);
} else {
// There's both a start and an end time; include them both in the "Range:" hdr
- Locale l("C", LC_NUMERIC);
+ Locale l("C", LC_NUMERIC_MASK);
sprintf(buf, "Range: npt=%.3f-%.3f\r\n", start, end);
}
@@ -935,7 +935,7 @@
}
Boolean RTSPClient::parseScaleParam(char const* paramStr, float& scale) {
- Locale l("C", LC_NUMERIC);
+ Locale l("C", LC_NUMERIC_MASK);
return sscanf(paramStr, "%f", &scale) == 1;
}
--- live/liveMedia/RTSPCommon.cpp.orig 2011-01-06 01:26:50.000000000 +0100
+++ live/liveMedia/RTSPCommon.cpp 2011-01-09 16:32:24.142645155 +0100
@@ -137,7 +137,7 @@
Boolean parseRangeParam(char const* paramStr, double& rangeStart, double& rangeEnd) {
double start, end;
int numCharsMatched = 0;
- Locale l("C", LC_NUMERIC);
+ Locale l("C", LC_NUMERIC_MASK);
if (sscanf(paramStr, "npt = %lf - %lf", &start, &end) == 2) {
rangeStart = start;
rangeEnd = end;
# live555
#LIVEDOTCOM_URL := http://live555.com/liveMedia/public/live555-latest.tar.gz
LIVE555_FILE := live.2011.12.02.tar.gz
LIVE555_FILE := live.2011.11.08.tar.gz
LIVEDOTCOM_URL := http://live555sourcecontrol.googlecode.com/files/$(LIVE555_FILE)
PKGS += live555
......@@ -15,6 +15,15 @@ live555: $(LIVE555_FILE) .sum-live555
rm -Rf live
$(UNPACK)
chmod -R u+w live
patch -p0 < $(SRC)/live555/live-uselocale.patch
patch -p0 < $(SRC)/live555/live-inet_ntop.patch
patch -p0 < $(SRC)/live555/live-intptr.patch
ifndef HAVE_WIN32
ifndef HAVE_WINCE
patch -p0 < $(SRC)/live555/live-getaddrinfo.patch
endif
endif
patch -p0 < $(SRC)/live555/live-cloexec.patch
mv live $@
touch $@
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment