- fix many compiler warnings
This commit is contained in:
parent
6b6f4147db
commit
178ebac88a
|
|
@ -29,10 +29,6 @@ TimeSource::TimeSource(int quantTime, int nrOfQuants)
|
|||
mTailTime = 0;
|
||||
}
|
||||
|
||||
TimeSource::~TimeSource()
|
||||
{
|
||||
}
|
||||
|
||||
void TimeSource::start()
|
||||
{
|
||||
#ifdef TARGET_WIN
|
||||
|
|
@ -107,7 +103,7 @@ unsigned TimeSource::time()
|
|||
|
||||
// --- StubTimer ---
|
||||
StubTimer::StubTimer(int bufferTime, int bufferCount)
|
||||
:mBufferTime(bufferTime), mBufferCount(bufferCount), mTimeSource(bufferTime, bufferCount), mActive(false)
|
||||
:mBufferTime(bufferTime), mBufferCount(bufferCount), mTimeSource(bufferTime, bufferCount), mActive(false), mCurrentTime(0)
|
||||
{
|
||||
#ifdef TARGET_WIN
|
||||
mStubSignal = ::CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace Audio
|
|||
|
||||
public:
|
||||
TimeSource(int quantTime, int nrOfQuants);
|
||||
~TimeSource();
|
||||
~TimeSource() = default;
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ NullInputDevice::NullInputDevice()
|
|||
|
||||
NullInputDevice::~NullInputDevice()
|
||||
{
|
||||
close();
|
||||
internalClose();
|
||||
}
|
||||
|
||||
bool NullInputDevice::open()
|
||||
|
|
@ -73,7 +73,7 @@ bool NullInputDevice::open()
|
|||
return true;
|
||||
}
|
||||
|
||||
void NullInputDevice::close()
|
||||
void NullInputDevice::internalClose()
|
||||
{
|
||||
mTimer.reset();
|
||||
if (mBuffer)
|
||||
|
|
@ -84,6 +84,10 @@ void NullInputDevice::close()
|
|||
ICELogInfo(<<"Pseudocaptured " << mTimeCounter << " milliseconds , " << mDataCounter << " bytes.");
|
||||
}
|
||||
|
||||
void NullInputDevice::close()
|
||||
{
|
||||
internalClose();
|
||||
}
|
||||
Format NullInputDevice::getFormat()
|
||||
{
|
||||
assert (Format().sizeFromTime(AUDIO_MIC_BUFFER_LENGTH) == AUDIO_MIC_BUFFER_SIZE);
|
||||
|
|
@ -106,7 +110,7 @@ NullOutputDevice::NullOutputDevice()
|
|||
|
||||
NullOutputDevice::~NullOutputDevice()
|
||||
{
|
||||
close();
|
||||
internalClose();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -119,13 +123,18 @@ bool NullOutputDevice::open()
|
|||
return true;
|
||||
}
|
||||
|
||||
void NullOutputDevice::close()
|
||||
void NullOutputDevice::internalClose()
|
||||
{
|
||||
mTimer.reset();
|
||||
free(mBuffer); mBuffer = nullptr;
|
||||
ICELogInfo(<< "Pseudoplayed " << mTimeCounter << " milliseconds, " << mDataCounter << " bytes.");
|
||||
}
|
||||
|
||||
void NullOutputDevice::close()
|
||||
{
|
||||
internalClose();
|
||||
}
|
||||
|
||||
Format NullOutputDevice::getFormat()
|
||||
{
|
||||
assert (Format().sizeFromTime(AUDIO_SPK_BUFFER_LENGTH) == AUDIO_SPK_BUFFER_SIZE);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ namespace Audio
|
|||
void* mBuffer = nullptr;
|
||||
std::shared_ptr<NullTimer> mTimer;
|
||||
int64_t mTimeCounter = 0, mDataCounter = 0;
|
||||
void internalClose();
|
||||
|
||||
public:
|
||||
NullInputDevice();
|
||||
virtual ~NullInputDevice();
|
||||
|
|
@ -55,6 +57,8 @@ namespace Audio
|
|||
std::shared_ptr<NullTimer> mTimer;
|
||||
void* mBuffer = nullptr;
|
||||
int64_t mDataCounter = 0, mTimeCounter = 0;
|
||||
|
||||
void internalClose();
|
||||
public:
|
||||
NullOutputDevice();
|
||||
virtual ~NullOutputDevice();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace Audio
|
|||
|
||||
|
||||
SpeexResampler::SpeexResampler()
|
||||
:mContext(NULL), mErrorCode(0), mSourceRate(0), mDestRate(0), mLastSample(0)
|
||||
:mContext(NULL), mErrorCode(0), mSourceRate(0), mDestRate(0), mLastSample(0), mChannels(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -274,7 +274,7 @@ PResampler UniversalResampler::findResampler(int sourceRate, int destRate)
|
|||
PResampler r;
|
||||
if (resamplerIter == mResamplerMap.end())
|
||||
{
|
||||
r = PResampler(new Resampler());
|
||||
r = std::make_shared<Resampler>();
|
||||
r->start(AUDIO_CHANNELS, sourceRate, destRate);
|
||||
mResamplerMap[RatePair(sourceRate, destRate)] = r;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ using namespace Audio;
|
|||
|
||||
// ---------------------- WavFileReader -------------------------
|
||||
WavFileReader::WavFileReader()
|
||||
:mHandle(nullptr), mSamplerate(0), mLastError(0)
|
||||
:mHandle(nullptr), mSamplerate(0), mLastError(0), mChannels(0), mBits(0), mDataLength(0)
|
||||
{
|
||||
mDataOffset = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,23 +32,24 @@ void FileHelper::remove(const char* s)
|
|||
::remove(s);
|
||||
}
|
||||
|
||||
std::string FileHelper::gettempname()
|
||||
{
|
||||
#if defined(TARGET_LINUX) || defined(TARGET_ANDROID)
|
||||
char template_filename[L_tmpnam] = "rtphone_XXXXXXX.tmp";
|
||||
mkstemp(template_filename);
|
||||
return template_filename;
|
||||
#elif defined(TARGET_WIN)
|
||||
char buffer[L_tmpnam];
|
||||
tmpnam(buffer);
|
||||
// std::string FileHelper::gettempname()
|
||||
// {
|
||||
// #if defined(TARGET_LINUX) || defined(TARGET_ANDROID)
|
||||
// char template_filename[L_tmpnam] = "rtphone_XXXXXXX.tmp";
|
||||
// int code = mkstemp(template_filename);
|
||||
|
||||
return buffer;
|
||||
#elif defined(TARGET_OSX)
|
||||
char template_filename[L_tmpnam] = "rtphone_XXXXXXX.tmp";
|
||||
mktemp(template_filename);
|
||||
return template_filename;
|
||||
#endif
|
||||
}
|
||||
// return template_filename;
|
||||
// #elif defined(TARGET_WIN)
|
||||
// char buffer[L_tmpnam];
|
||||
// tmpnam(buffer);
|
||||
|
||||
// return buffer;
|
||||
// #elif defined(TARGET_OSX)
|
||||
// char template_filename[L_tmpnam] = "rtphone_XXXXXXX.tmp";
|
||||
// mktemp(template_filename);
|
||||
// return template_filename;
|
||||
// #endif
|
||||
// }
|
||||
|
||||
bool FileHelper::isAbsolute(const std::string& s)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public:
|
|||
static void remove(const std::string& s);
|
||||
static void remove(const char* s);
|
||||
|
||||
static std::string gettempname();
|
||||
// static std::string gettempname();
|
||||
static bool isAbsolute(const std::string& s);
|
||||
|
||||
static std::string getCurrentDir();
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ DatagramSocket::DatagramSocket()
|
|||
|
||||
DatagramSocket::~DatagramSocket()
|
||||
{
|
||||
closeSocket();
|
||||
internalClose();
|
||||
}
|
||||
|
||||
void DatagramSocket::open(int family)
|
||||
|
|
@ -85,7 +85,7 @@ unsigned DatagramSocket::recvDatagram(InternetAddress &src, void *packetBuffer,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void DatagramSocket::closeSocket()
|
||||
void DatagramSocket::internalClose()
|
||||
{
|
||||
if (mHandle != INVALID_SOCKET)
|
||||
{
|
||||
|
|
@ -98,6 +98,11 @@ void DatagramSocket::closeSocket()
|
|||
}
|
||||
}
|
||||
|
||||
void DatagramSocket::closeSocket()
|
||||
{
|
||||
internalClose();
|
||||
}
|
||||
|
||||
bool DatagramSocket::isValid() const
|
||||
{
|
||||
return mHandle != INVALID_SOCKET;
|
||||
|
|
@ -163,7 +168,7 @@ unsigned DatagramAgreggator::count()
|
|||
bool DatagramAgreggator::hasDataAtIndex(unsigned index)
|
||||
{
|
||||
PDatagramSocket socket = mSocketVector[index];
|
||||
return (FD_ISSET(socket->mHandle, &mReadSet) != 0);
|
||||
return FD_ISSET(socket->mHandle, &mReadSet);
|
||||
}
|
||||
|
||||
PDatagramSocket DatagramAgreggator::socketAt(unsigned index)
|
||||
|
|
|
|||
|
|
@ -36,10 +36,12 @@ public:
|
|||
virtual SOCKET socket() const;
|
||||
|
||||
virtual void open(int family);
|
||||
|
||||
protected:
|
||||
int mFamily;
|
||||
SOCKET mHandle;
|
||||
int mLocalPort;
|
||||
void internalClose();
|
||||
};
|
||||
typedef std::shared_ptr<DatagramSocket> PDatagramSocket;
|
||||
|
||||
|
|
|
|||
|
|
@ -278,12 +278,12 @@ std::shared_ptr<std::thread> OsProcess::asyncExecCommand(const std::string& cmdl
|
|||
}
|
||||
while (r == sizeof(buffer) - 1);
|
||||
|
||||
if (lines.find("\n") != std::string::npos && line_callback)
|
||||
if (lines.find('\n') != std::string::npos && line_callback)
|
||||
{
|
||||
std::string::size_type p = 0;
|
||||
while (p < lines.size())
|
||||
{
|
||||
std::string::size_type d = lines.find("\n", p);
|
||||
std::string::size_type d = lines.find('\n', p);
|
||||
if (d != std::string::npos)
|
||||
{
|
||||
if (line_callback)
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ PDatagramSocket SocketHeap::allocSocket(int family, SocketSink* sink, int port)
|
|||
if (sock == INVALID_SOCKET)
|
||||
{
|
||||
// Return null socket
|
||||
PDatagramSocket result(new DatagramSocket());
|
||||
auto result = std::make_shared<DatagramSocket>();
|
||||
result->mLocalPort = port;
|
||||
result->mFamily = family;
|
||||
return result;
|
||||
|
|
@ -170,7 +170,7 @@ PDatagramSocket SocketHeap::allocSocket(int family, SocketSink* sink, int port)
|
|||
closesocket(sock);
|
||||
throw Exception(ERR_NET_FAILED, WSAGetLastError());
|
||||
}
|
||||
PDatagramSocket resultObject(new DatagramSocket());
|
||||
auto resultObject = std::make_shared<DatagramSocket>();
|
||||
resultObject->mLocalPort = testport;
|
||||
resultObject->mHandle = sock;
|
||||
if (!resultObject->setBlocking(false))
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ thread_pool::thread_pool(size_t num_of_threads, const std::string& name)
|
|||
num_of_threads = std::thread::hardware_concurrency();
|
||||
|
||||
for(size_t idx = 0; idx < num_of_threads; idx++)
|
||||
this->workers.push_back(std::thread(&thread_pool::run_worker, this));
|
||||
this->workers.emplace_back(std::thread(&thread_pool::run_worker, this));
|
||||
}
|
||||
|
||||
// Add new work item to the pool
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ NetworkAddress NetworkAddress::parse(const std::string& s)
|
|||
if (ip4Pos == std::string::npos && ip6Pos == std::string::npos)
|
||||
{
|
||||
// Parse usual IP[:port] pair
|
||||
std::string::size_type cp = s.find_last_of(":");
|
||||
std::string::size_type cp = s.find_last_of(':');
|
||||
if (cp == std::string::npos)
|
||||
result.setIp(cp);
|
||||
else
|
||||
|
|
@ -87,7 +87,7 @@ NetworkAddress NetworkAddress::parse(const std::string& s)
|
|||
std::string addr = s.substr(familyPos + 5);
|
||||
|
||||
// Find IP substring and port
|
||||
std::string::size_type colonPos = addr.find_last_of(":");
|
||||
std::string::size_type colonPos = addr.find_last_of(':');
|
||||
if (colonPos != std::string::npos)
|
||||
{
|
||||
int port = atoi(addr.substr(colonPos+1).c_str());
|
||||
|
|
@ -230,10 +230,6 @@ NetworkAddress::NetworkAddress(const NetworkAddress& src)
|
|||
memcpy(&mAddr6, &src.mAddr6, sizeof mAddr6);
|
||||
}
|
||||
|
||||
NetworkAddress::~NetworkAddress()
|
||||
{
|
||||
}
|
||||
|
||||
int NetworkAddress::family() const
|
||||
{
|
||||
assert(mInitialized == true);
|
||||
|
|
@ -305,9 +301,10 @@ sockaddr_in6* NetworkAddress::sockaddr6() const
|
|||
|
||||
void NetworkAddress::setIp(NetworkAddress ipOnly)
|
||||
{
|
||||
// Save port
|
||||
// Setup family
|
||||
mAddr4.sin_family = ipOnly.genericsockaddr()->sa_family;
|
||||
|
||||
// Copy address chunk only
|
||||
switch (ipOnly.family())
|
||||
{
|
||||
case AF_INET:
|
||||
|
|
@ -315,7 +312,7 @@ void NetworkAddress::setIp(NetworkAddress ipOnly)
|
|||
break;
|
||||
|
||||
case AF_INET6:
|
||||
memcpy(&mAddr4.sin_addr, &ipOnly.sockaddr6()->sin6_addr, 16);
|
||||
memcpy(&mAddr6.sin6_addr, &ipOnly.sockaddr6()->sin6_addr, 16);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace ice
|
|||
NetworkAddress(const in_addr& ip, unsigned short port);
|
||||
NetworkAddress(const sockaddr& addr, size_t addrLen);
|
||||
NetworkAddress(const NetworkAddress& src);
|
||||
~NetworkAddress();
|
||||
~NetworkAddress() = default;
|
||||
|
||||
// Returns AF_INET or AF_INET6
|
||||
int family() const;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ using namespace ice;
|
|||
|
||||
AuthTransaction::AuthTransaction()
|
||||
:Transaction(), mActive(false), mComposed(false), mConformsToKeepaliveSchedule(true),
|
||||
mCredentialsEncoded(false)
|
||||
mCredentialsEncoded(false), mErrorCode(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ void AuthTransaction::init()
|
|||
buildAuthenticatedMsg();
|
||||
else
|
||||
{
|
||||
std::shared_ptr<StunMessage> msg(new StunMessage());
|
||||
auto msg = std::make_shared<StunMessage>();
|
||||
msg->setTransactionId(mTransactionID);
|
||||
setInitialRequest(*msg);
|
||||
mComposed = false;
|
||||
|
|
@ -44,7 +44,7 @@ void AuthTransaction::buildAuthenticatedMsg()
|
|||
md5Bin(key.c_str(), key.size(), mKey);
|
||||
|
||||
// Create new authenticated message
|
||||
std::shared_ptr<StunMessage> newMsg( new StunMessage() );
|
||||
auto newMsg = std::make_shared<StunMessage>();
|
||||
|
||||
// Optional - generate new transaction ID
|
||||
// mTransactionID = StunMessage::TransactionID::GenerateNew();
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ protected:
|
|||
int mErrorCode;
|
||||
std::string mErrorResponse;
|
||||
std::deque<std::shared_ptr<StunMessage> > mOutgoingMsgQueue;
|
||||
unsigned char mKey[16];
|
||||
unsigned char mKey[16] = {0};
|
||||
bool mConformsToKeepaliveSchedule;
|
||||
std::string mRealm;
|
||||
std::string mNonce;
|
||||
|
|
|
|||
|
|
@ -284,9 +284,6 @@ void BitReader::init()
|
|||
mCurrentBit = 0;
|
||||
}
|
||||
|
||||
BitReader::~BitReader()
|
||||
{}
|
||||
|
||||
// Check for valid position
|
||||
uint8_t BitReader::readBit()
|
||||
{
|
||||
|
|
@ -357,9 +354,6 @@ void BitWriter::init()
|
|||
mCurrentBit = 0;
|
||||
}
|
||||
|
||||
BitWriter::~BitWriter()
|
||||
{}
|
||||
|
||||
BitWriter& BitWriter::writeBit(int bit)
|
||||
{
|
||||
bit = bit ? 1 : 0;
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ namespace ice
|
|||
public:
|
||||
BitReader(const void* input, size_t bytes);
|
||||
BitReader(const ByteBuffer& buffer);
|
||||
~BitReader();
|
||||
~BitReader() = default;
|
||||
|
||||
uint8_t readBit();
|
||||
uint32_t readBits(size_t nrOfBits);
|
||||
|
|
@ -126,7 +126,7 @@ namespace ice
|
|||
public:
|
||||
BitWriter(void* output);
|
||||
BitWriter(ByteBuffer& buffer);
|
||||
~BitWriter();
|
||||
~BitWriter() = default;
|
||||
|
||||
// Bit must be 0 or 1
|
||||
BitWriter& writeBit(int bit);
|
||||
|
|
|
|||
|
|
@ -19,13 +19,6 @@ CRC32::CRC32(void)
|
|||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CRC32::~CRC32(void)
|
||||
{
|
||||
//No destructor code.
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
This function initializes "CRC Lookup Table". You only need to call it once to
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace ice
|
|||
{
|
||||
public:
|
||||
CRC32(void);
|
||||
~CRC32(void);
|
||||
~CRC32(void) = default;
|
||||
|
||||
void initialize(void);
|
||||
|
||||
|
|
@ -29,4 +29,4 @@ namespace ice
|
|||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ PCandidatePair CheckList::findEqualPair(CandidatePair& _pair, ComparisionType ct
|
|||
|
||||
unsigned CheckList::add(CandidatePair& p)
|
||||
{
|
||||
mPairList.push_back(PCandidatePair(new CandidatePair(p)));
|
||||
mPairList.push_back(std::make_shared<CandidatePair>(p));
|
||||
|
||||
// Sort list by priority
|
||||
std::sort(mPairList.begin(), mPairList.end(), ComparePairByPriority);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ Exception::Exception(int code, int subcode)
|
|||
}
|
||||
|
||||
Exception::Exception(const Exception& src)
|
||||
:mErrorCode(src.mErrorCode), mErrorMsg(src.mErrorMsg)
|
||||
:mErrorCode(src.mErrorCode), mErrorMsg(src.mErrorMsg), mSubcode(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,10 +16,6 @@ PacketScheduler::PacketScheduler()
|
|||
mLastRTO = 100;
|
||||
}
|
||||
|
||||
PacketScheduler::~PacketScheduler()
|
||||
{
|
||||
}
|
||||
|
||||
void PacketScheduler::setInitialRTO(int value)
|
||||
{
|
||||
mInitialRTO = value;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class PacketScheduler
|
|||
{
|
||||
public:
|
||||
PacketScheduler();
|
||||
~PacketScheduler();
|
||||
~PacketScheduler() = default;
|
||||
|
||||
void setInitialRTO(int value);
|
||||
int initialRTO();
|
||||
|
|
@ -40,4 +40,4 @@ protected:
|
|||
|
||||
} //end of namespace
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -63,9 +63,7 @@ namespace ice
|
|||
:mTag(NULL), mPort4(0), mPort6(0), mNominationWaitIntervalStartTime(0)
|
||||
{}
|
||||
|
||||
~Component()
|
||||
{
|
||||
}
|
||||
~Component() = default;
|
||||
};
|
||||
|
||||
typedef std::map<int, Component> ComponentMap;
|
||||
|
|
|
|||
Loading…
Reference in New Issue