Changeset 4709

Show
Ignore:
Timestamp:
10/18/06 01:35:55 (2 years ago)
Author:
erijo
Message:

Don't use asprintf as it's a GNU extension. Do it the "c++-way" with a stringstream instead.

Fixes #1415.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/licq/include/licq_message.h

    r4591 r4709  
    22#define MESSAGE_H 
    33 
     4#include <ctime> 
    45#include <list> 
    5 #include <time.h> 
     6#include <sstream> 
    67 
    78#include "licq_buffer.h" 
     
    394395{ 
    395396public: 
    396   CContact(const char *s, unsigned long n, const char *a) 
    397     {  m_szId = strdup(s); m_nPPID = n; m_szAlias = strdup(a); m_nUin = strtoul(s, (char**)NULL, 10); } 
    398   CContact(unsigned long n, const char *a) 
    399     { asprintf(&m_szId, "%lu", n); m_nPPID = 0; m_nUin = n; m_szAlias = strdup(a); } 
     397  CContact(const char *s, unsigned long n, const char *a) : m_nPPID(n) 
     398  { 
     399    m_szId = strdup(s); 
     400    m_szAlias = strdup(a); 
     401    m_nUin = strtoul(s, (char**)NULL, 10); 
     402  } 
     403  CContact(unsigned long n, const char *a) : m_nUin(n), m_nPPID(0) 
     404  { 
     405    std::ostringstream ss; 
     406    ss << n; 
     407    m_szId = strdup(ss.str().c_str()); 
     408    m_szAlias = strdup(a); 
     409  } 
    400410  ~CContact() { free(m_szAlias); free(m_szId); } 
    401411