1 diff -ru live/groupsock/Groupsock.cpp live-patched/groupsock/Groupsock.cpp
2 --- live/groupsock/Groupsock.cpp Thu Nov 6 03:53:15 2003
3 +++ live-patched/groupsock/Groupsock.cpp Sun Dec 7 21:30:15 2003
5 #if defined(__WIN32__) || defined(_WIN32)
8 -#include <strstream.h>
13 diff -ru live/groupsock/NetInterface.cpp live-patched/groupsock/NetInterface.cpp
14 --- live/groupsock/NetInterface.cpp Thu Nov 6 03:53:15 2003
15 +++ live-patched/groupsock/NetInterface.cpp Sun Dec 7 21:30:30 2003
17 #if defined(__WIN32__) || defined(_WIN32)
20 -#include <strstream.h>
24 ////////// NetInterface //////////
25 --- live/liveMedia/RTSPClient.cpp 2007-04-24 11:38:22.000000000 +0200
26 +++ live-patched/liveMedia/RTSPClient.cpp 2007-04-26 15:19:54.000000000 +0200
28 #include "RTSPClient.hh"
29 #include "RTSPCommon.hh"
32 #include <GroupsockHelper.hh>
34 #ifdef SUPPORT_REAL_RTSP
35 #include "../RealRTSP/include/RealRTSP.hh"
40 +/* Radix safe (always uses .) printf and friends */
41 +int radix_safe_sprintf( char *str, const char *format, ...)
45 + char *locale = NULL;
47 + locale = strDup( setlocale( LC_NUMERIC, NULL ) );
48 + setlocale( LC_NUMERIC, "C" );
50 + va_start( args, format );
51 + result = vsprintf(str, format, args );
54 + setlocale( LC_NUMERIC, locale );
60 +int radix_safe_sscanf( const char *str, const char *format, ...)
64 + char *locale = NULL;
66 + locale = strDup( setlocale( LC_NUMERIC, NULL ) );
67 + setlocale( LC_NUMERIC, "C" );
69 + va_start( args, format );
70 + result = vsscanf(str, format, args );
73 + setlocale( LC_NUMERIC, locale );
79 ////////// RTSPClient //////////
81 RTSPClient* RTSPClient::createNew(UsageEnvironment& env,
83 // This is the default value; we don't need a "Scale:" header:
86 - Locale("POSIX", LC_NUMERIC);
87 - sprintf(buf, "Scale: %f\r\n", scale);
88 + radix_safe_sprintf(buf, "Scale: %f\r\n", scale);
92 @@ -1003,12 +1042,10 @@
95 // There's no end time:
96 - Locale("POSIX", LC_NUMERIC);
97 - sprintf(buf, "Range: npt=%.3f-\r\n", start);
98 + radix_safe_sprintf(buf, "Range: npt=%.3f-\r\n", start);
100 // There's both a start and an end time; include them both in the "Range:" hdr
101 - Locale("POSIX", LC_NUMERIC);
102 - sprintf(buf, "Range: npt=%.3f-%.3f\r\n", start, end);
103 + radix_safe_sprintf(buf, "Range: npt=%.3f-%.3f\r\n", start, end);
107 @@ -2246,8 +2283,7 @@
108 if (_strncasecmp(line, "Scale: ", 7) != 0) return False;
111 - Locale("POSIX", LC_NUMERIC);
112 - return sscanf(line, "%f", &scale) == 1;
113 + return radix_safe_sscanf(line, "%f", &scale) == 1;
116 Boolean RTSPClient::parseGetParameterHeader(char const* line,
117 --- live/liveMedia/RTSPClient.cpp 2007-04-28 16:02:39.000000000 +0200
118 +++ live-patched/liveMedia/RTSPClient.cpp 2007-12-10 10:42:00.000000000 +0100
119 @@ -2074,7 +2076,8 @@ Boolean RTSPClient::getResponse(char con
120 unsigned RTSPClient::getResponse1(char*& responseBuffer,
121 unsigned responseBufferSize) {
122 struct sockaddr_in fromAddress;
124 + struct timeval timeout;
126 if (responseBufferSize == 0) return 0; // just in case...
127 responseBuffer[0] = '\0'; // ditto
129 @@ -2084,7 +2087,9 @@ unsigned RTSPClient::getResponse1(char*&
130 Boolean success = False;
132 unsigned char firstByte;
133 - if (readSocket(envir(), fInputSocketNum, &firstByte, 1, fromAddress)
134 + timeout.tv_sec = 5;
135 + timeout.tv_usec = 0;
136 + if (readSocket(envir(), fInputSocketNum, &firstByte, 1, fromAddress, &timeout)
138 if (firstByte != '$') {
139 // Normal case: This is the start of a regular response; use it: