Changeset 5522


Ignore:
Timestamp:
Jan 11, 2017 11:13:57 AM (7 years ago)
Author:
ming
Message:

Re #1960: Use boolean field to indicate whether the info is empty (instead of relying on bzero and memcmp)

Location:
pjproject/trunk/pjsip
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua2/endpoint.hpp

    r5518 r5522  
    165165public: 
    166166    /** 
     167     * Constructor. 
     168     */ 
     169    SslCertInfo(); 
     170 
     171    /** 
    167172     * Check if the info is set with empty values. 
    168173     * 
     
    175180     */ 
    176181    void fromPj(const pj_ssl_cert_info &info); 
     182     
     183private: 
     184    bool empty; 
    177185}; 
    178186 
     
    256264     */ 
    257265    void fromPj(const pjsip_tls_state_info &info); 
     266 
     267private: 
     268    bool empty; 
    258269}; 
    259270 
  • pjproject/trunk/pjsip/src/pjsua2/endpoint.cpp

    r5518 r5522  
    4646 
    4747TlsInfo::TlsInfo() 
    48 { 
    49     pj_bzero(this, sizeof(TlsInfo)); 
     48        : empty(true) 
     49{ 
    5050} 
    5151 
    5252bool TlsInfo::isEmpty() const 
    5353{ 
    54     TlsInfo dummy; 
    55  
    56     pj_bzero(&dummy, sizeof(dummy)); 
    57     return ((pj_memcmp(this, &dummy, sizeof(dummy)) == 0)? true: false); 
     54    return empty; 
    5855} 
    5956 
     
    6663    unsigned verif_msg_cnt; 
    6764     
     65    empty       = false; 
    6866    established = PJ2BOOL(ssock_info->established); 
    6967    protocol    = ssock_info->proto; 
     
    9088} 
    9189 
     90SslCertInfo::SslCertInfo() 
     91        : empty(true) 
     92{ 
     93} 
     94 
    9295bool SslCertInfo::isEmpty() const 
    9396{ 
    94     SslCertInfo dummy; 
    95  
    96     pj_bzero(&dummy, sizeof(dummy)); 
    97     return ((pj_memcmp(this, &dummy, sizeof(dummy)) == 0)? true: false); 
     97    return empty; 
    9898} 
    9999 
    100100void SslCertInfo::fromPj(const pj_ssl_cert_info &info) 
    101101{ 
     102    empty       = false; 
    102103    version     = info.version; 
    103104    pj_memcpy(serialNo, info.serial_no, sizeof(info.serial_no)); 
     
    638639    prm.state = state; 
    639640    prm.lastError = info ? info->status : PJ_SUCCESS; 
    640     pj_bzero(&prm.tlsInfo, sizeof(TlsInfo)); 
    641641 
    642642#if defined(PJSIP_HAS_TLS_TRANSPORT) && PJSIP_HAS_TLS_TRANSPORT!=0 
Note: See TracChangeset for help on using the changeset viewer.