--- DarwinStreamingSrvr6.0.3-Source.orig/Buildit 2008-03-26 08:42:48.000000000 +0800 +++ DarwinStreamingSrvr6.0.3-Source/Buildit 2008-07-10 18:56:05.000000000 +0800 @@ -86,14 +86,19 @@ case $PLAT in ;; Linux.i586 | \ - Linux.i686) + Linux.i686 | \ + Linux.x86_64 ) echo "Configuring for the "$OSNAME" "$HARDWARENAME" platform" CPLUS=gcc CCOMP=gcc LINKER='gcc' MAKE=make - COMPILER_FLAGS="-D_REENTRANT -D__USE_POSIX -D__linux__ -pipe" + if [ "$PLAT" = "Linux.x86_64" ]; then + COMPILER_FLAGS="-D_REENTRANT -D__USE_POSIX -D__linux__ -pipe -fPIC" + else + COMPILER_FLAGS="-D_REENTRANT -D__USE_POSIX -D__linux__ -pipe" + fi INCLUDE_FLAG="-include" CORE_LINK_LIBS="-lpthread -ldl -lstdc++ -lm -lcrypt" --- DarwinStreamingSrvr6.0.3-Source.orig/MP3Broadcaster/BroadcasterMain.cpp_orig 2008-07-03 20:51:14.000000000 +0800 +++ DarwinStreamingSrvr6.0.3-Source/MP3Broadcaster/BroadcasterMain.cpp 2008-07-03 20:51:47.000000000 +0800 @@ -216,7 +216,7 @@ static void RegisterEventHandlers() struct sigaction act; -#if defined(sun) || defined(i386) || defined(__MacOSX__) || defined(__sgi__) || defined(__osf__) || defined(__hpux__) || defined(__linuxppc__) +#if defined(sun) || defined(i386) || defined(__MacOSX__) || defined(__sgi__) || defined(__osf__) || defined(__hpux__) || defined(__linuxppc__) || defined(__linux__) sigemptyset(&act.sa_mask); act.sa_flags = 0; act.sa_handler = (void(*)(int))&SignalEventHandler; --- DarwinStreamingSrvr6.0.3-Source.orig/PlaylistBroadcaster.tproj/PlaylistBroadcaster.cpp_orig 2008-07-03 20:42:56.000000000 +0800 +++ DarwinStreamingSrvr6.0.3-Source/PlaylistBroadcaster.tproj/PlaylistBroadcaster.cpp 2008-07-03 20:43:13.000000000 +0800 @@ -2082,7 +2082,7 @@ static void RegisterEventHandlers() struct sigaction act; -#if defined(sun) || defined(i386) || defined(__MacOSX__) || defined(__powerpc__) || defined (__sgi_cc__) || defined(__osf__) || defined(__hpux__) +#if defined(sun) || defined(i386) || defined(__MacOSX__) || defined(__powerpc__) || defined (__sgi_cc__) || defined(__osf__) || defined(__hpux__) || defined(__linux__) sigemptyset(&act.sa_mask); act.sa_flags = 0; act.sa_handler = (void(*)(int))&SignalEventHandler; --- DarwinStreamingSrvr6.0.3-Source.orig/Server.tproj/main.cpp_orig 2008-07-03 20:38:56.000000000 +0800 +++ DarwinStreamingSrvr6.0.3-Source/Server.tproj/main.cpp 2008-07-03 20:39:30.000000000 +0800 @@ -216,7 +216,7 @@ int main(int argc, char * argv[]) //(void) ::signal(SIGPIPE, SIG_IGN); struct sigaction act; -#if defined(sun) || defined(i386) || defined (__MacOSX__) || defined(__powerpc__) || defined (__osf__) || defined (__sgi_cc__) || defined (__hpux__) +#if defined(sun) || defined(i386) || defined (__MacOSX__) || defined(__powerpc__) || defined (__osf__) || defined (__sgi_cc__) || defined (__hpux__) || defined (__linux__) sigemptyset(&act.sa_mask); act.sa_flags = 0; act.sa_handler = (void(*)(int))&sigcatcher; --- DarwinStreamingSrvr6.0.3-Source.orig/StreamingLoadTool/StreamingLoadTool.cpp_orig 2008-07-04 13:37:58.000000000 +0800 +++ DarwinStreamingSrvr6.0.3-Source/StreamingLoadTool/StreamingLoadTool.cpp 2008-07-04 13:38:16.000000000 +0800 @@ -135,7 +135,7 @@ int main(int argc, char *argv[]) #ifndef __Win32__ struct sigaction act; -#if defined(sun) || defined(i386) || defined (__MacOSX__) || defined(__powerpc__) || defined (__osf__) || defined (__sgi_cc__) || defined (__hpux__) +#if defined(sun) || defined(i386) || defined (__MacOSX__) || defined(__powerpc__) || defined (__osf__) || defined (__sgi_cc__) || defined (__hpux__) || defined (__linux__) sigemptyset(&act.sa_mask); act.sa_flags = 0; act.sa_handler = (void(*)(int))&sigcatcher; --- DarwinStreamingSrvr6.0.3-Source_orig/CommonUtilitiesLib/SocketUtils.cpp_orig 2008-07-22 13:27:28.026924464 +0800 +++ DarwinStreamingSrvr6.0.3-Source/CommonUtilitiesLib/SocketUtils.cpp 2008-07-22 13:33:57.944935981 +0800 @@ -549,9 +549,6 @@ Bool16 SocketUtils::IncrementIfReqIter(c //if the length of the addr is 0, use the family to determine //what the addr size is if (ifr->ifr_addr.sa_len == 0) -#else - *inIfReqIter += sizeof(ifr->ifr_name) + 0; -#endif { switch (ifr->ifr_addr.sa_family) { @@ -565,6 +562,9 @@ Bool16 SocketUtils::IncrementIfReqIter(c // return false; } } +#else + *inIfReqIter += sizeof(*ifr); +#endif return true; } #endif --- DarwinStreamingSrvr6.0.3-Source_orig/CommonUtilitiesLib/Task.h_orig 2008-07-25 17:12:53.000000000 +0800 +++ DarwinStreamingSrvr6.0.3-Source/CommonUtilitiesLib/Task.h 2008-07-25 17:14:05.000000000 +0800 @@ -213,7 +213,7 @@ private: static UInt32 sNumShortTaskThreads; static UInt32 sNumBlockingTaskThreads; - static OSMutexRW sMutexRW; + static OSMutexRW sMutexRW __attribute__((visibility("hidden"))); friend class Task; friend class TaskThread; --- DarwinStreamingSrvr6.0.3-Source.orig/Server.tproj/QTSServer.cpp_orig 2008-07-24 10:00:06.000000000 +0800 +++ DarwinStreamingSrvr6.0.3-Source/Server.tproj/QTSServer.cpp 2008-07-24 20:59:40.000000000 +0800 @@ -135,13 +135,13 @@ QTSServer::~QTSServer() // // Grab the server mutex. This is to make sure all gets & set values on this // object complete before we start deleting stuff - OSMutexLocker serverlocker(this->GetServerObjectMutex()); + OSMutexLocker* serverlocker = new OSMutexLocker(this->GetServerObjectMutex()); // // Grab the prefs mutex. This is to make sure we can't reread prefs // WHILE shutting down, which would cause some weirdness for QTSS API // (some modules could get QTSS_RereadPrefs_Role after QTSS_Shutdown, which would be bad) - OSMutexLocker locker(this->GetPrefs()->GetMutex()); + OSMutexLocker* locker = new OSMutexLocker(this->GetPrefs()->GetMutex()); QTSS_ModuleState theModuleState; theModuleState.curRole = QTSS_Shutdown_Role; @@ -152,6 +152,13 @@ QTSServer::~QTSServer() (void)QTSServerInterface::GetModule(QTSSModule::kShutdownRole, x)->CallDispatch(QTSS_Shutdown_Role, NULL); OSThread::SetMainThreadData(NULL); + + delete fRTPMap; + delete fSocketPool; + delete fSrvrMessages; + delete locker; + delete serverlocker; + delete fSrvrPrefs; } Bool16 QTSServer::Initialize(XMLPrefsParser* inPrefsSource, PrefsSource* inMessagesSource, UInt16 inPortOverride, Bool16 createListeners) --- DarwinStreamingSrvr6.0.3-Source.orig/Server.tproj/QTSSMessages.cpp_orig 2008-07-24 14:26:35.000000000 +0800 +++ DarwinStreamingSrvr6.0.3-Source/Server.tproj/QTSSMessages.cpp 2008-07-24 19:28:31.000000000 +0800 @@ -212,15 +212,17 @@ void QTSSMessages::Initialize() } QTSSMessages::QTSSMessages(PrefsSource* inMessages) -: QTSSDictionary(QTSSDictionaryMap::GetMap(QTSSDictionaryMap::kTextMessagesDictIndex)) +: QTSSDictionary(QTSSDictionaryMap::GetMap(QTSSDictionaryMap::kTextMessagesDictIndex)), + numAttrs(GetDictionaryMap()->GetNumAttrs()) { static const UInt32 kMaxMessageSize = 2048; char theMessage[kMaxMessageSize]; // Use the names of the attributes in the attribute map as the key values for // finding preferences in the config file. - - for (UInt32 x = 0; x < this->GetDictionaryMap()->GetNumAttrs(); x++) + attrBuffer = NEW char* [numAttrs]; + ::memset(attrBuffer, 0, sizeof(char*) * numAttrs); + for (UInt32 x = 0; x < numAttrs; x++) { theMessage[0] = '\0'; (void)inMessages->GetValue(this->GetDictionaryMap()->GetAttrName(x), &theMessage[0]); @@ -248,9 +250,10 @@ QTSSMessages::QTSSMessages(PrefsSource* // the new attribute, and copy the data into the newly allocated buffer if (theMessage[0] != '\0') { - char* attrBuffer = NEW char[::strlen(theMessage) + 2]; - ::strcpy(attrBuffer, theMessage); - this->SetVal(this->GetDictionaryMap()->GetAttrID(x), attrBuffer, ::strlen(attrBuffer)); + attrBuffer[x] = NEW char[::strlen(theMessage) + 2]; + ::strcpy(attrBuffer[x], theMessage); + this->SetVal(this->GetDictionaryMap()->GetAttrID(x), + attrBuffer[x], ::strlen(attrBuffer[x])); } } } --- DarwinStreamingSrvr6.0.3-Source.orig/Server.tproj/QTSSDictionary.h_orig 2008-07-24 15:52:36.000000000 +0800 +++ DarwinStreamingSrvr6.0.3-Source/Server.tproj/QTSSDictionary.h 2008-07-24 15:52:36.000000000 +0800 @@ -215,7 +215,8 @@ class QTSSDictionary : public QTSSStream Bool16 fMyMutex; Bool16 fLocked; - void DeleteAttributeData(DictValueElement* inDictValues, UInt32 inNumValues); + void DeleteAttributeData(DictValueElement* inDictValues, + UInt32 inNumValues, QTSSDictionaryMap* theMap); }; @@ -271,7 +272,11 @@ class QTSSDictionaryMap // CONSTRUCTOR / DESTRUCTOR QTSSDictionaryMap(UInt32 inNumReservedAttrs, UInt32 inFlags = kNoFlags); - ~QTSSDictionaryMap(){ delete fAttrArray; } + ~QTSSDictionaryMap() { + for (UInt32 i = 0; i < fAttrArraySize; i++) + delete fAttrArray[i]; + delete [] fAttrArray; + } // // QTSS API CALLS --- DarwinStreamingSrvr6.0.3-Source.orig/Server.tproj/QTSSMessages.h_orig 2008-07-24 14:26:35.000000000 +0800 +++ DarwinStreamingSrvr6.0.3-Source/Server.tproj/QTSSMessages.h 2008-07-24 20:20:45.000000000 +0800 @@ -53,13 +53,20 @@ class QTSSMessages : public QTSSDictiona static void Initialize(); QTSSMessages(PrefsSource* inMessages); - virtual ~QTSSMessages() {} + virtual ~QTSSMessages() { + for (UInt32 x = 0; x < numAttrs; x++) + if (attrBuffer[x] != NULL) + delete [] attrBuffer[x]; + delete [] attrBuffer; + } //Use the standard GetAttribute method in QTSSDictionary to retrieve messages private: - + char** attrBuffer; + UInt32 numAttrs; + enum { kNumMessages = 74 // 0 based count so it is one more than last message index number --- DarwinStreamingSrvr6.0.3-Source.orig/Server.tproj/QTSSDictionary.cpp_orig 2008-07-23 12:27:56.000000000 +0800 +++ DarwinStreamingSrvr6.0.3-Source/Server.tproj/QTSSDictionary.cpp 2008-07-24 16:54:46.000000000 +0800 @@ -60,12 +60,12 @@ QTSSDictionary::QTSSDictionary(QTSSDicti QTSSDictionary::~QTSSDictionary() { if (fMap != NULL) - this->DeleteAttributeData(fAttributes, fMap->GetNumAttrs()); + this->DeleteAttributeData(fAttributes, fMap->GetNumAttrs(), fMap); if (fAttributes != NULL) delete [] fAttributes; - delete fInstanceMap; - this->DeleteAttributeData(fInstanceAttrs, fInstanceArraySize); + this->DeleteAttributeData(fInstanceAttrs, fInstanceArraySize, fInstanceMap); delete [] fInstanceAttrs; + delete fInstanceMap; if (fMyMutex) delete fMutexP; } @@ -340,7 +340,8 @@ QTSS_Error QTSSDictionary::SetValue(QTSS theAttrs[theMapIndex].fAttributeData.Len = sizeof(char*); // store off original string as first value in array *(char**)theAttrs[theMapIndex].fAttributeData.Ptr = temp; - // question: why isn't theAttrs[theMapIndex].fAllocatedInternally set to true? + // question: why isn't theAttrs[theMapIndex].fAllocatedInternally set to true? + theAttrs[theMapIndex].fAllocatedInternally = true; } } else @@ -407,7 +408,7 @@ QTSS_Error QTSSDictionary::SetValue(QTSS // The offset should be (attrLen * inIndex) and not (inLen * inIndex) char** valuePtr = (char**)(theAttrs[theMapIndex].fAttributeData.Ptr + (attrLen * inIndex)); if (inIndex < numValues) // we're replacing an existing string - delete *valuePtr; + delete [] *valuePtr; *valuePtr = (char*)attributeBufferPtr; } @@ -522,7 +523,7 @@ QTSS_Error QTSSDictionary::RemoveValue(Q { // we need to delete the string char* str = *(char**)(theAttrs[theMapIndex].fAttributeData.Ptr + (theValueLen * inIndex)); - delete str; + delete [] str; } // @@ -797,12 +798,22 @@ QTSS_Error QTSSDictionary::GetAttrInfoBy return theErr; } -void QTSSDictionary::DeleteAttributeData(DictValueElement* inDictValues, UInt32 inNumValues) +void QTSSDictionary::DeleteAttributeData(DictValueElement* inDictValues, + UInt32 inNumValues, + QTSSDictionaryMap* theMap) { for (UInt32 x = 0; x < inNumValues; x++) { - if (inDictValues[x].fAllocatedInternally) + if (inDictValues[x].fAllocatedInternally) { + if ((theMap->GetAttrType(x) == qtssAttrDataTypeCharArray) && + (inDictValues[x].fNumAttributes > 1)) { + UInt32 z = 0; + for (char **y = (char **) (inDictValues[x].fAttributeData.Ptr); + z < inDictValues[x].fNumAttributes; z++) + delete [] y[z]; + } delete [] inDictValues[x].fAttributeData.Ptr; + } } } --- DarwinStreamingSrvr6.0.3-Source.orig/CommonUtilitiesLib/OS.cpp_orig 2008-07-24 09:38:53.000000000 +0800 +++ DarwinStreamingSrvr6.0.3-Source/CommonUtilitiesLib/OS.cpp 2008-07-24 09:39:31.000000000 +0800 @@ -220,7 +220,7 @@ SInt32 OS::GetGMTOffset() return ((tzInfo.Bias / 60) * -1); #else - time_t clock; + time_t clock = 0; //Make 'clock' initialized for valgrind struct tm *tmptr= localtime(&clock); if (tmptr == NULL) return 0;