Projects

Ticket #6: dss-hh-20081021-1.patch

File dss-hh-20081021-1.patch, 14.7 KB (added by horace.hsieh@…, 4 years ago)
  • DarwinStreamingSrvr6.0.3-Source

    old new  
    8686                ;;               
    8787 
    8888        Linux.i586 | \ 
    89         Linux.i686) 
     89        Linux.i686 | \ 
     90        Linux.x86_64 ) 
    9091        echo "Configuring for the "$OSNAME" "$HARDWARENAME" platform" 
    9192                CPLUS=gcc 
    9293                CCOMP=gcc 
    9394                LINKER='gcc' 
    9495                MAKE=make 
    9596                 
    96                 COMPILER_FLAGS="-D_REENTRANT -D__USE_POSIX -D__linux__ -pipe" 
     97                if [ "$PLAT" = "Linux.x86_64" ]; then 
     98                        COMPILER_FLAGS="-D_REENTRANT -D__USE_POSIX -D__linux__ -pipe -fPIC" 
     99                else 
     100                        COMPILER_FLAGS="-D_REENTRANT -D__USE_POSIX -D__linux__ -pipe" 
     101                fi 
    97102        INCLUDE_FLAG="-include" 
    98103                 
    99104                CORE_LINK_LIBS="-lpthread -ldl -lstdc++ -lm -lcrypt" 
  • DarwinStreamingSrvr6.0.3-Source

    old new  
    190190 
    191191# Add the unprivileged user qtss as the server's run user 
    192192        echo "Creating unprivileged user to run the server = \"qtss\"." 
    193     if [ $INSTALL_OS = "Linux" ]; then 
    194         /usr/sbin/groupadd qtss > /dev/null 2>&1 
     193    groupadded="1" 
     194    if [ -x /usr/sbin/addgroup ]; then 
     195        addgroup --system qtss > /dev/null 2>&1 
     196        groupadded=$? 
     197    fi 
     198    if [ "$grouptadded" != "0" ]; then 
     199        /usr/sbin/groupadd -r qtss > /dev/null 2>&1 
     200        if [ $? != "0" ]; then 
     201            /usr/sbin/groupadd qtss > /dev/null 2>&1 
     202        fi 
     203    fi 
     204    usradded="1" 
     205    if [ -x /usr/sbin/adduser ]; then 
     206        adduser --system --no-create-home --ingroup qtss qtss > /dev/null 2>&1 
     207        usradded=$? 
     208    fi 
     209    if [ "$usradded" != "0" ]; then 
    195210        /usr/sbin/useradd -M qtss > /dev/null 2>&1 
    196     else 
    197         /usr/sbin/groupadd qtss > /dev/null 2>&1 
    198         /usr/sbin/useradd qtss > /dev/null 2>&1 
     211        if [ $? != "0" ]; then 
     212            /usr/sbin/useradd qtss > /dev/null 2>&1 
     213        fi 
    199214    fi 
    200215         
    201216## INSTALL NEW VERSION ## 
  • DarwinStreamingSrvr6.0.3-Source

    old new  
    216216 
    217217struct sigaction act; 
    218218     
    219 #if defined(sun) || defined(i386) || defined(__MacOSX__) || defined(__sgi__) || defined(__osf__) || defined(__hpux__) || defined(__linuxppc__) 
     219#if defined(sun) || defined(i386) || defined(__MacOSX__) || defined(__sgi__) || defined(__osf__) || defined(__hpux__) || defined(__linuxppc__) || defined(__linux__) 
    220220    sigemptyset(&act.sa_mask); 
    221221    act.sa_flags = 0; 
    222222    act.sa_handler = (void(*)(int))&SignalEventHandler; 
  • DarwinStreamingSrvr6.0.3-Source

    old new  
    20822082 
    20832083struct sigaction act; 
    20842084     
    2085 #if defined(sun) || defined(i386) || defined(__MacOSX__) || defined(__powerpc__) || defined (__sgi_cc__) || defined(__osf__) || defined(__hpux__) 
     2085#if defined(sun) || defined(i386) || defined(__MacOSX__) || defined(__powerpc__) || defined (__sgi_cc__) || defined(__osf__) || defined(__hpux__) || defined(__linux__) 
    20862086        sigemptyset(&act.sa_mask); 
    20872087        act.sa_flags = 0; 
    20882088    act.sa_handler = (void(*)(int))&SignalEventHandler; 
  • DarwinStreamingSrvr6.0.3-Source

    old new  
    216216    //(void) ::signal(SIGPIPE, SIG_IGN); 
    217217    struct sigaction act; 
    218218     
    219 #if defined(sun) || defined(i386) || defined (__MacOSX__) || defined(__powerpc__) || defined (__osf__) || defined (__sgi_cc__) || defined (__hpux__) 
     219#if defined(sun) || defined(i386) || defined (__MacOSX__) || defined(__powerpc__) || defined (__osf__) || defined (__sgi_cc__) || defined (__hpux__) || defined (__linux__) 
    220220    sigemptyset(&act.sa_mask); 
    221221    act.sa_flags = 0; 
    222222    act.sa_handler = (void(*)(int))&sigcatcher; 
  • DarwinStreamingSrvr6.0.3-Source

    old new  
    135135#ifndef __Win32__ 
    136136        struct sigaction act; 
    137137         
    138 #if defined(sun) || defined(i386) || defined (__MacOSX__) || defined(__powerpc__) || defined (__osf__) || defined (__sgi_cc__) || defined (__hpux__) 
     138#if defined(sun) || defined(i386) || defined (__MacOSX__) || defined(__powerpc__) || defined (__osf__) || defined (__sgi_cc__) || defined (__hpux__) || defined (__linux__) 
    139139    sigemptyset(&act.sa_mask); 
    140140    act.sa_flags = 0; 
    141141    act.sa_handler = (void(*)(int))&sigcatcher; 
  • DarwinStreamingSrvr6.0.

    old new  
    549549    //if the length of the addr is 0, use the family to determine 
    550550    //what the addr size is 
    551551    if (ifr->ifr_addr.sa_len == 0) 
    552 #else 
    553     *inIfReqIter += sizeof(ifr->ifr_name) + 0; 
    554 #endif 
    555552    { 
    556553        switch (ifr->ifr_addr.sa_family) 
    557554        { 
     
    565562//              return false; 
    566563        } 
    567564    } 
     565#else 
     566    *inIfReqIter += sizeof(*ifr); 
     567#endif 
    568568    return true; 
    569569} 
    570570#endif 
  • DarwinStreamingSrvr6.0.

    old new  
    213213    static UInt32           sNumShortTaskThreads; 
    214214    static UInt32           sNumBlockingTaskThreads; 
    215215     
    216     static OSMutexRW        sMutexRW; 
     216    static OSMutexRW        sMutexRW __attribute__((visibility("hidden"))); 
    217217     
    218218    friend class Task; 
    219219    friend class TaskThread; 
  • DarwinStreamingSrvr6.0.3-Source

    old new  
    135135    // 
    136136    // Grab the server mutex. This is to make sure all gets & set values on this 
    137137    // object complete before we start deleting stuff 
    138     OSMutexLocker serverlocker(this->GetServerObjectMutex()); 
     138    OSMutexLocker* serverlocker = new OSMutexLocker(this->GetServerObjectMutex()); 
    139139     
    140140    // 
    141141    // Grab the prefs mutex. This is to make sure we can't reread prefs 
    142142    // WHILE shutting down, which would cause some weirdness for QTSS API 
    143143    // (some modules could get QTSS_RereadPrefs_Role after QTSS_Shutdown, which would be bad) 
    144     OSMutexLocker locker(this->GetPrefs()->GetMutex()); 
     144    OSMutexLocker* locker = new OSMutexLocker(this->GetPrefs()->GetMutex()); 
    145145 
    146146    QTSS_ModuleState theModuleState; 
    147147    theModuleState.curRole = QTSS_Shutdown_Role; 
     
    152152        (void)QTSServerInterface::GetModule(QTSSModule::kShutdownRole, x)->CallDispatch(QTSS_Shutdown_Role, NULL); 
    153153 
    154154    OSThread::SetMainThreadData(NULL); 
     155 
     156    delete fRTPMap; 
     157    delete fSocketPool; 
     158    delete fSrvrMessages; 
     159    delete locker; 
     160    delete serverlocker; 
     161    delete fSrvrPrefs; 
    155162} 
    156163 
    157164Bool16 QTSServer::Initialize(XMLPrefsParser* inPrefsSource, PrefsSource* inMessagesSource, UInt16 inPortOverride, Bool16 createListeners) 
  • DarwinStreamingSrvr6.0.3-Source

    old new  
    212212} 
    213213 
    214214QTSSMessages::QTSSMessages(PrefsSource* inMessages) 
    215 : QTSSDictionary(QTSSDictionaryMap::GetMap(QTSSDictionaryMap::kTextMessagesDictIndex)) 
     215: QTSSDictionary(QTSSDictionaryMap::GetMap(QTSSDictionaryMap::kTextMessagesDictIndex)), 
     216  numAttrs(GetDictionaryMap()->GetNumAttrs()) 
    216217{ 
    217218    static const UInt32 kMaxMessageSize = 2048; 
    218219    char theMessage[kMaxMessageSize]; 
    219220     
    220221    // Use the names of the attributes in the attribute map as the key values for 
    221222    // finding preferences in the config file. 
    222      
    223     for (UInt32 x = 0; x < this->GetDictionaryMap()->GetNumAttrs(); x++) 
     223    attrBuffer = NEW char* [numAttrs]; 
     224    ::memset(attrBuffer, 0, sizeof(char*) * numAttrs); 
     225    for (UInt32 x = 0; x < numAttrs; x++) 
    224226    { 
    225227        theMessage[0] = '\0'; 
    226228        (void)inMessages->GetValue(this->GetDictionaryMap()->GetAttrName(x), &theMessage[0]); 
     
    248250        // the new attribute, and copy the data into the newly allocated buffer 
    249251        if (theMessage[0] != '\0') 
    250252        { 
    251             char* attrBuffer = NEW char[::strlen(theMessage) + 2]; 
    252             ::strcpy(attrBuffer, theMessage); 
    253             this->SetVal(this->GetDictionaryMap()->GetAttrID(x), attrBuffer, ::strlen(attrBuffer)); 
     253            attrBuffer[x] = NEW char[::strlen(theMessage) + 2]; 
     254            ::strcpy(attrBuffer[x], theMessage); 
     255            this->SetVal(this->GetDictionaryMap()->GetAttrID(x), 
     256                         attrBuffer[x], ::strlen(attrBuffer[x])); 
    254257        } 
    255258    } 
    256259} 
  • DarwinStreamingSrvr6.0.3-Source

    old new  
    215215                Bool16                          fMyMutex; 
    216216                Bool16                          fLocked; 
    217217         
    218         void DeleteAttributeData(DictValueElement* inDictValues, UInt32 inNumValues); 
     218        void DeleteAttributeData(DictValueElement* inDictValues, 
     219                                 UInt32 inNumValues, QTSSDictionaryMap* theMap); 
    219220}; 
    220221 
    221222 
     
    271272        // CONSTRUCTOR / DESTRUCTOR 
    272273         
    273274        QTSSDictionaryMap(UInt32 inNumReservedAttrs, UInt32 inFlags = kNoFlags); 
    274         ~QTSSDictionaryMap(){ delete fAttrArray; } 
     275        ~QTSSDictionaryMap() { 
     276            for (UInt32 i = 0; i < fAttrArraySize; i++) 
     277                delete fAttrArray[i]; 
     278            delete [] fAttrArray; 
     279        } 
    275280 
    276281        // 
    277282        // QTSS API CALLS 
  • DarwinStreamingSrvr6.0.3-Source

    old new  
    5353        static void Initialize(); 
    5454     
    5555        QTSSMessages(PrefsSource* inMessages); 
    56         virtual ~QTSSMessages() {} 
     56        virtual ~QTSSMessages() { 
     57            for (UInt32 x = 0; x < numAttrs; x++) 
     58               if (attrBuffer[x] != NULL) 
     59                 delete [] attrBuffer[x]; 
     60            delete [] attrBuffer; 
     61        } 
    5762         
    5863 
    5964        //Use the standard GetAttribute method in QTSSDictionary to retrieve messages 
    6065         
    6166    private: 
    62      
     67        char**              attrBuffer; 
     68        UInt32              numAttrs; 
     69 
    6370        enum 
    6471        { 
    6572            kNumMessages = 74 // 0 based count so it is one more than last message index number 
  • DarwinStreamingSrvr6.0.3-Source

    old new  
    6060QTSSDictionary::~QTSSDictionary() 
    6161{ 
    6262    if (fMap != NULL) 
    63         this->DeleteAttributeData(fAttributes, fMap->GetNumAttrs()); 
     63        this->DeleteAttributeData(fAttributes, fMap->GetNumAttrs(), fMap); 
    6464    if (fAttributes != NULL) 
    6565        delete [] fAttributes; 
    66     delete fInstanceMap; 
    67     this->DeleteAttributeData(fInstanceAttrs, fInstanceArraySize); 
     66    this->DeleteAttributeData(fInstanceAttrs, fInstanceArraySize, fInstanceMap); 
    6867    delete [] fInstanceAttrs; 
     68    delete fInstanceMap; 
    6969        if (fMyMutex) 
    7070                delete fMutexP; 
    7171} 
     
    340340            theAttrs[theMapIndex].fAttributeData.Len = sizeof(char*); 
    341341            // store off original string as first value in array 
    342342            *(char**)theAttrs[theMapIndex].fAttributeData.Ptr = temp; 
    343                         // question: why isn't theAttrs[theMapIndex].fAllocatedInternally set to true? 
     343            // question: why isn't theAttrs[theMapIndex].fAllocatedInternally set to true? 
     344            theAttrs[theMapIndex].fAllocatedInternally = true; 
    344345        } 
    345346    } 
    346347    else 
     
    407408        // The offset should be (attrLen * inIndex) and not (inLen * inIndex)  
    408409        char** valuePtr = (char**)(theAttrs[theMapIndex].fAttributeData.Ptr + (attrLen * inIndex)); 
    409410        if (inIndex < numValues)    // we're replacing an existing string 
    410             delete *valuePtr; 
     411            delete [] *valuePtr; 
    411412        *valuePtr = (char*)attributeBufferPtr; 
    412413    } 
    413414     
     
    522523    { 
    523524        // we need to delete the string 
    524525        char* str = *(char**)(theAttrs[theMapIndex].fAttributeData.Ptr + (theValueLen * inIndex)); 
    525         delete str; 
     526        delete [] str; 
    526527    } 
    527528 
    528529    // 
     
    797798    return theErr; 
    798799} 
    799800 
    800 void QTSSDictionary::DeleteAttributeData(DictValueElement* inDictValues, UInt32 inNumValues) 
     801void QTSSDictionary::DeleteAttributeData(DictValueElement* inDictValues, 
     802                                         UInt32 inNumValues, 
     803                                         QTSSDictionaryMap* theMap) 
    801804{ 
    802805    for (UInt32 x = 0; x < inNumValues; x++) 
    803806    { 
    804         if (inDictValues[x].fAllocatedInternally) 
     807        if (inDictValues[x].fAllocatedInternally) { 
     808            if ((theMap->GetAttrType(x) == qtssAttrDataTypeCharArray) && 
     809                (inDictValues[x].fNumAttributes > 1)) { 
     810                UInt32 z = 0; 
     811                for (char **y = (char **) (inDictValues[x].fAttributeData.Ptr); 
     812                           z < inDictValues[x].fNumAttributes; z++) 
     813                    delete [] y[z]; 
     814            } 
    805815            delete [] inDictValues[x].fAttributeData.Ptr; 
     816        } 
    806817    } 
    807818} 
    808819 
  • DarwinStreamingSrvr6.0.3-Source

    old new  
    220220    return ((tzInfo.Bias / 60) * -1); 
    221221#else 
    222222       
    223     time_t clock; 
     223    time_t clock = 0; //Make 'clock' initialized for valgrind 
    224224    struct tm  *tmptr= localtime(&clock); 
    225225    if (tmptr == NULL) 
    226226        return 0;