- fix compiler warnings

This commit is contained in:
Dmytro Bogovych 2023-06-05 11:55:40 +03:00
parent 6b8549346c
commit 42cc9ee096
14 changed files with 37 additions and 35 deletions

View File

@ -482,7 +482,7 @@ void AgentImpl::processWaitForEvent(JsonCpp::Value &request, JsonCpp::Value &ans
} }
#if defined(USE_PVQA_LIBRARY) #if defined(USE_PVQA_LIBRARY)
static JsonCpp::Value CsvReportToJson(const std::string& report) /*static JsonCpp::Value CsvReportToJson(const std::string& report)
{ {
JsonCpp::Value detectorValues; JsonCpp::Value detectorValues;
std::istringstream iss(report); std::istringstream iss(report);
@ -514,7 +514,7 @@ static JsonCpp::Value CsvReportToJson(const std::string& report)
} }
} }
return detectorValues; return detectorValues;
} }*/
#endif #endif
void AgentImpl::processGetMediaStats(JsonCpp::Value& request, JsonCpp::Value& answer) void AgentImpl::processGetMediaStats(JsonCpp::Value& request, JsonCpp::Value& answer)

View File

@ -17,7 +17,10 @@
using namespace Audio; using namespace Audio;
#ifndef SHRT_MAX
# define SHRT_MAX 32767 /* maximum (signed) short value */ # define SHRT_MAX 32767 /* maximum (signed) short value */
#endif
AgcFilter::AgcFilter(int channels) AgcFilter::AgcFilter(int channels)
{ {
static const float DefaultLevel = 0.8f; static const float DefaultLevel = 0.8f;

View File

@ -105,7 +105,7 @@ bool WavFileReader::open(const std::tstring& filename)
THROW_READERROR; THROW_READERROR;
// Read the file size // Read the file size
unsigned int filesize = 0; uint32_t filesize = 0;
if (fread(&filesize, 4, 1, mHandle) < 1) if (fread(&filesize, 4, 1, mHandle) < 1)
THROW_READERROR; THROW_READERROR;
@ -117,20 +117,19 @@ bool WavFileReader::open(const std::tstring& filename)
if (strcmp(wavefmt, "WAVEfmt ") != 0) if (strcmp(wavefmt, "WAVEfmt ") != 0)
THROW_READERROR; THROW_READERROR;
unsigned fmtSize = 0; uint32_t fmtSize = 0;
if (fread(&fmtSize, 4, 1, mHandle) < 1) if (fread(&fmtSize, 4, 1, mHandle) < 1)
THROW_READERROR; THROW_READERROR;
unsigned fmtStart = ftell(mHandle); uint32_t fmtStart = ftell(mHandle);
unsigned short formattag = 0; uint16_t formattag = 0;
if (fread(&formattag, 2, 1, mHandle) < 1) if (fread(&formattag, 2, 1, mHandle) < 1)
THROW_READERROR; THROW_READERROR;
if (formattag != 1/*WAVE_FORMAT_PCM*/) if (formattag != 1/*WAVE_FORMAT_PCM*/)
THROW_READERROR; THROW_READERROR;
mChannels = 0;
if (fread(&mChannels, 2, 1, mHandle) < 1) if (fread(&mChannels, 2, 1, mHandle) < 1)
THROW_READERROR; THROW_READERROR;
@ -220,8 +219,8 @@ size_t WavFileReader::read(short* buffer, size_t samples)
unsigned filePosition = ftell(mHandle); unsigned filePosition = ftell(mHandle);
// Check how much data we can read // Check how much data we can read
unsigned fileAvailable = mDataLength + mDataOffset - filePosition; size_t fileAvailable = mDataLength + mDataOffset - filePosition;
requiredBytes = (int)fileAvailable < requiredBytes ? (int)fileAvailable : requiredBytes; requiredBytes = fileAvailable < requiredBytes ? fileAvailable : requiredBytes;
} }
size_t readBytes = fread(temp, 1, requiredBytes, mHandle); size_t readBytes = fread(temp, 1, requiredBytes, mHandle);
@ -282,7 +281,7 @@ std::tstring WavFileReader::filename() const
return mFileName; return mFileName;
} }
unsigned WavFileReader::size() const size_t WavFileReader::size() const
{ {
LOCK; LOCK;

View File

@ -21,14 +21,14 @@ namespace Audio
{ {
protected: protected:
FILE* mHandle; FILE* mHandle;
short mChannels; uint16_t mChannels;
short mBits; uint16_t mBits;
int mSamplerate; int mSamplerate;
std::tstring mFileName; std::tstring mFileName;
mutable std::recursive_mutex mutable std::recursive_mutex
mFileMtx; mFileMtx;
unsigned mDataOffset; size_t mDataOffset;
unsigned mDataLength; size_t mDataLength;
Resampler mResampler; Resampler mResampler;
unsigned mLastError; unsigned mLastError;
@ -53,7 +53,7 @@ namespace Audio
size_t readRaw(short* buffer, size_t samples); size_t readRaw(short* buffer, size_t samples);
std::tstring filename() const; std::tstring filename() const;
unsigned size() const; size_t size() const;
unsigned lastError() const; unsigned lastError() const;
}; };
@ -66,8 +66,8 @@ namespace Audio
FILE* mHandle; /// Handle of audio file. FILE* mHandle; /// Handle of audio file.
std::tstring mFileName; /// Path to requested audio file. std::tstring mFileName; /// Path to requested audio file.
std::recursive_mutex mFileMtx; /// Mutex to protect this instance. std::recursive_mutex mFileMtx; /// Mutex to protect this instance.
int mWritten; /// Amount of written data (in bytes) size_t mWritten; /// Amount of written data (in bytes)
int mLengthOffset; /// Position of length field. size_t mLengthOffset; /// Position of length field.
int mRate, int mRate,
mChannels; mChannels;

View File

@ -553,7 +553,7 @@ void Account::onSuccess(resip::ClientRegistrationHandle h, const resip::SipMessa
} }
mUsedTransport = response.getReceivedTransportTuple().getType(); mUsedTransport = response.getReceivedTransportTuple().getType();
bool streamTransport = mUsedTransport == resip::TCP || mUsedTransport == resip::TLS; //bool streamTransport = mUsedTransport == resip::TCP || mUsedTransport == resip::TLS;
// Retry registration for stream based transport too // Retry registration for stream based transport too
if ( (hostChanged || portChanged) && mRegistrationState == RegistrationState::Registering /*&& !streamTransport*/ && mConfig->at(CONFIG_EXTERNALIP).asBool()) if ( (hostChanged || portChanged) && mRegistrationState == RegistrationState::Registering /*&& !streamTransport*/ && mConfig->at(CONFIG_EXTERNALIP).asBool())

View File

@ -125,6 +125,8 @@ void AudioProvider::updateSdpOffer(resip::SdpContents::Session::Medium& sdp, Sdp
{ {
case msSendonly: attr = "recvonly"; break; case msSendonly: attr = "recvonly"; break;
case msInactive: attr = "recvonly"; break; case msInactive: attr = "recvonly"; break;
case msRecvonly:
case msSendRecv: break; // Do nothing here
} }
break; break;

View File

@ -1085,7 +1085,7 @@ void UserAgent::onOffer(resip::InviteSessionHandle h, const resip::SipMessage& m
if (sdp.session().exists("ice-ufrag")) if (sdp.session().exists("ice-ufrag"))
iceUfrag = sdp.session().getValues("ice-ufrag").front().c_str(); iceUfrag = sdp.session().getValues("ice-ufrag").front().c_str();
ice::Stack& ice = *s->mIceStack; //ice::Stack& ice = *s->mIceStack;
uint64_t version = sdp.session().origin().getVersion(); uint64_t version = sdp.session().origin().getVersion();
std::string remoteIp = sdp.session().connection().getAddress().c_str(); std::string remoteIp = sdp.session().connection().getAddress().c_str();
@ -1591,7 +1591,7 @@ VariantMap& UserAgent::config()
return mConfig; return mConfig;
} }
static void splitToHeaders(resip::Data& content, std::vector<resip::Data>& output) /*static void splitToHeaders(resip::Data& content, std::vector<resip::Data>& output)
{ {
resip::Data::size_type startLine = 0, endLine = content.find("\r\n"); resip::Data::size_type startLine = 0, endLine = content.find("\r\n");
while (endLine != resip::Data::npos) while (endLine != resip::Data::npos)
@ -1603,9 +1603,9 @@ static void splitToHeaders(resip::Data& content, std::vector<resip::Data>& outpu
} }
if (0 == startLine) if (0 == startLine)
output.push_back(content); output.push_back(content);
} }*/
static bool parseHeader(resip::Data& input, resip::Data& name, resip::Data& value) /*static bool parseHeader(resip::Data& input, resip::Data& name, resip::Data& value)
{ {
resip::Data::size_type p = input.find(":"); resip::Data::size_type p = input.find(":");
if (p == resip::Data::npos) if (p == resip::Data::npos)
@ -1626,7 +1626,7 @@ static bool parseHeader(resip::Data& input, resip::Data& name, resip::Data& valu
} }
} }
return true; return true;
} }*/
void UserAgent::onSipMessage(int flow, const char* msg, unsigned int length, const sockaddr* addr, unsigned int addrlen) void UserAgent::onSipMessage(int flow, const char* msg, unsigned int length, const sockaddr* addr, unsigned int addrlen)
{ {

View File

@ -536,12 +536,11 @@ void Session::onReceivedData(PDatagramSocket socket, InternetAddress& src, const
{ {
// Try to process incoming data by ICE stack // Try to process incoming data by ICE stack
int component = -1, stream = -1; int component = -1, stream = -1;
bool processed;
if (mIceStack->findStreamAndComponent(socket->family(), socket->localport(), &stream, &component)) if (mIceStack->findStreamAndComponent(socket->family(), socket->localport(), &stream, &component))
{ {
ice::ByteBuffer buffer(receivedPtr, receivedSize); ice::ByteBuffer buffer(receivedPtr, receivedSize);
buffer.setRemoteAddress(src); buffer.setRemoteAddress(src);
processed = mIceStack->processIncomingData(stream, component, buffer); /*bool processed = */mIceStack->processIncomingData(stream, component, buffer);
} }
} }
else else

View File

@ -1208,7 +1208,7 @@ static const uint16_t byte_crc10_table[256] = {
/* Update the data block's CRC-10 remainder one byte at a time */ /* Update the data block's CRC-10 remainder one byte at a time */
uint16_t update_crc10_by_bytes(uint16_t crc10_accum, const uint8_t *data_blk_ptr, int data_blk_size) uint16_t update_crc10_by_bytes(uint16_t crc10_accum, const uint8_t *data_blk_ptr, int data_blk_size)
{ {
register int i; /*register*/ int i;
for (i = 0; i < data_blk_size; i++) { for (i = 0; i < data_blk_size; i++) {
crc10_accum = ((crc10_accum << 8) & 0x3ff) crc10_accum = ((crc10_accum << 8) & 0x3ff)

View File

@ -61,7 +61,7 @@ void DatagramSocket::sendDatagram(InternetAddress &dest, const void *packetData,
if (mHandle == INVALID_SOCKET) if (mHandle == INVALID_SOCKET)
return; return;
int sent = ::sendto(mHandle, (const char*)packetData, packetSize, 0, dest.genericsockaddr(), dest.sockaddrLen()); /*int sent = */::sendto(mHandle, (const char*)packetData, packetSize, 0, dest.genericsockaddr(), dest.sockaddrLen());
} }
unsigned DatagramSocket::recvDatagram(InternetAddress &src, void *packetBuffer, unsigned packetCapacity) unsigned DatagramSocket::recvDatagram(InternetAddress &src, void *packetBuffer, unsigned packetCapacity)

View File

@ -315,10 +315,10 @@ static int hex2code(char s)
return 0; return 0;
} }
static int hex2code(const char* s) /*static int hex2code(const char* s)
{ {
return (hex2code(s[0]) << 4) + hex2code(s[1]); return (hex2code(s[0]) << 4) + hex2code(s[1]);
} }*/
std::string strx::fromHex2String(const std::string& s) std::string strx::fromHex2String(const std::string& s)
{ {

View File

@ -599,10 +599,10 @@ int AmrWbCodec::encode(const void* input, int inputBytes, void* output, int outp
return 0; return 0;
// Declare the data input pointer // Declare the data input pointer
const short *dataIn = (const short *)input; // const short *dataIn = (const short *)input;
// Declare the data output pointer // Declare the data output pointer
unsigned char *dataOut = (unsigned char *)output; // unsigned char *dataOut = (unsigned char *)output;
// Find how much RTP frames will be generated // Find how much RTP frames will be generated
unsigned int frames = inputBytes / pcmLength(); unsigned int frames = inputBytes / pcmLength();

View File

@ -125,7 +125,7 @@ int G729Codec::channels()
return 1; return 1;
} }
static const int SamplesPerFrame = 80; // static const int SamplesPerFrame = 80;
int G729Codec::encode(const void* input, int inputBytes, void* output, int outputCapacity) int G729Codec::encode(const void* input, int inputBytes, void* output, int outputCapacity)
{ {
// Create encoder if it is not done yet // Create encoder if it is not done yet

View File

@ -227,8 +227,7 @@ int EVSCodec::decode(const void* input, int input_length, void* output, int outp
else else
buffer = std::string(reinterpret_cast<const char*>(input), input_length); buffer = std::string(reinterpret_cast<const char*>(input), input_length);
} }
else else // Skip CMR byte
// Skip CMR byte
buffer = std::string(reinterpret_cast<const char*>(input) + 1, input_length-1); buffer = std::string(reinterpret_cast<const char*>(input) + 1, input_length-1);