Commit 4e85791e authored by Emmanuel Lepage Vallee's avatar Emmanuel Lepage Vallee Committed by gerrit2

build: Fix some GCC5.1 warnings

Not all warnings have been enabled, only the most
useful ones. This fix some outstanding issues and
try to mute most deprecated warnings in dependencies
headers.

* Add missing "defined()" macro function
* Undefine an improper macro
* Disable warnings for legacy code include
* Add missing cases for enum classes based switch
* Add a warning for potentially dangerous code
* Change ICE "onRecv()" prototype to return void
* Fix an apparently accidental virtual override signature problem
* Change a std::basic_string constructor to avoid ambiguity

Refs #74147

Change-Id: I1361fc5d16c63fd7590f8d68ffdb0e2588a8b635
parent d2746ead
......@@ -54,7 +54,10 @@
#include "system_codec_container.h"
#include "ice_transport.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <yaml-cpp/yaml.h>
#pragma GCC diagnostic pop
#include "upnp/upnp_control.h"
#include "ip_utils.h"
......
......@@ -332,7 +332,7 @@ get_cache_dir()
} else {
#ifdef __ANDROID__
return get_home_dir() + DIR_SEPARATOR_STR + PACKAGE;
#elif __APPLE__
#elif defined(__APPLE__)
return get_home_dir() + DIR_SEPARATOR_STR
+ "Library" + DIR_SEPARATOR_STR + "Caches"
+ DIR_SEPARATOR_STR + PACKAGE;
......@@ -382,7 +382,7 @@ get_data_dir()
{
#ifdef __ANDROID__
return get_program_dir();
#elif __APPLE__
#elif defined(__APPLE__)
return get_home_dir() + DIR_SEPARATOR_STR
+ "Library" + DIR_SEPARATOR_STR + "Application Support"
+ DIR_SEPARATOR_STR + PACKAGE;
......
......@@ -98,7 +98,7 @@ void strErr();
#define LOGGER(M, LEVEL, ...) __android_log_print(LEVEL, APP_NAME, \
LOG_FORMAT(M, ##__VA_ARGS__))
#elif _WIN32
#elif defined(_WIN32)
#include "winsyslog.h"
......
......@@ -303,6 +303,8 @@ AudioReceiveThread::process()
loop_.stop();
break;
case MediaDecoder::Status::Success:
case MediaDecoder::Status::EOFError:
default:
break;
}
......
......@@ -31,9 +31,13 @@
#ifndef _AUDIO_BUFFER_H
#define _AUDIO_BUFFER_H
#if __cplusplus >= 201103L
#undef isblank
#endif
#include <sstream>
#include <vector>
#include <string>
#include <sstream>
#include <cstddef> // for size_t
#include "ring_types.h"
......
......@@ -38,6 +38,7 @@
#endif
#include "audio/audiobuffer.h" // for AudioFormat
#include <cctype>
#include "ip_utils.h"
#include <string>
......
......@@ -114,7 +114,7 @@ private:
uint8_t *scaledFrameBuffer_ = nullptr;
int scaledFrameBufferSize_ = 0;
int streamIndex_ = -1;
#if (LIBAVCODEC_VERSION_MAJOR < 54)
#if defined(LIBAVCODEC_VERSION_MAJOR) && (LIBAVCODEC_VERSION_MAJOR < 54)
uint8_t *encoderBuffer_ = nullptr;
int encoderBufferSize_ = 0;
#endif
......
......@@ -127,6 +127,7 @@ int ff_srtp_decrypt(struct SRTPContext *s, uint8_t *buf, int *lenptr)
{
uint8_t iv[16] = { 0 }, hmac[20];
int len = *lenptr;
#warning seq_largest and roc may be unitialized
int av_uninit(seq_largest);
uint32_t ssrc, av_uninit(roc);
uint64_t index;
......
......@@ -34,7 +34,11 @@
#include "noncopyable.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#pragma GCC diagnostic ignored "-Wshadow"
#include <yaml-cpp/yaml.h>
#pragma GCC diagnostic pop
#include <cstdlib>
#include <cstdint>
......
......@@ -33,7 +33,10 @@
#include <cassert>
#include <sstream>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <yaml-cpp/yaml.h>
#pragma GCC diagnostic pop
#include "manager.h"
#include "client/videomanager.h"
......
......@@ -191,7 +191,8 @@ bool VideoReceiveThread::decodeFrame()
RING_ERR("fatal error, read failed");
loop_.stop();
default:
case MediaDecoder::Status::Success:
case MediaDecoder::Status::EOFError:
break;
}
......
......@@ -55,7 +55,11 @@
#endif
#endif /* HAVE_OPENSL */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <yaml-cpp/yaml.h>
#pragma GCC diagnostic pop
#include "config/yamlparser.h"
#include "hooks/urlhook.h"
#include "sip/sip_utils.h"
......
......@@ -228,7 +228,7 @@ SipIceTransport::send(pjsip_tx_data *tdata, const pj_sockaddr_t *rem_addr,
return PJ_SUCCESS;
}
ssize_t
void
SipIceTransport::onRecv()
{
rdata_.pkt_info.len += ice_->recv(comp_id_,
......
......@@ -92,7 +92,7 @@ struct SipIceTransport
int addr_len, void *token,
pjsip_transport_callback callback);
ssize_t onRecv();
void onRecv();
};
} // namespace ring
......@@ -230,6 +230,7 @@ TrustStore::statusToStr(TrustStore::Status s)
return DRing::Certificate::Status::ALLOWED;
case Status::BANNED:
return DRing::Certificate::Status::BANNED;
case Status::UNDEFINED:
default:
return DRing::Certificate::Status::UNDEFINED;
}
......
......@@ -49,7 +49,10 @@
#include "sippresence.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <yaml-cpp/yaml.h>
#pragma GCC diagnostic pop
#include "account_schema.h"
#include "config/yamlparser.h"
......@@ -126,7 +129,7 @@ SIPAccount::SIPAccount(const std::string& accountID, bool presenceEnabled)
, ciphers_(100)
, tlsMethod_("TLSv1")
, tlsCiphers_()
, tlsServerName_(0, 0)
, tlsServerName_("")
, tlsVerifyServer_(false)
, tlsVerifyClient_(true)
, tlsRequireClientCertificate_(true)
......@@ -1650,7 +1653,7 @@ SIPAccount::getCredentials() const
}
void
SIPAccount::setRegistrationState(RegistrationState state, unsigned details_code)
SIPAccount::setRegistrationState(RegistrationState state, unsigned details_code, const std::string& detail_str)
{
std::string details_str;
const pj_str_t *description = pjsip_get_status_text(details_code);
......
......@@ -220,7 +220,7 @@ class SIPAccount : public SIPAccountBase {
std::vector<std::map<std::string, std::string>>
getCredentials() const;
void setRegistrationState(RegistrationState state, unsigned code=0);
virtual void setRegistrationState(RegistrationState state, unsigned code=0, const std::string& detail_str={}) override;
/**
* A client sendings a REGISTER request MAY suggest an expiration
......
......@@ -42,7 +42,11 @@
#include "ice_transport.h"
#include "config/yamlparser.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <yaml-cpp/yaml.h>
#pragma GCC diagnostic pop
#include "client/ring_signal.h"
#include "string_utils.h"
......
......@@ -484,6 +484,10 @@ transfer_client_cb(pjsip_evsub *sub, pjsip_event *event)
break;
}
case PJSIP_EVSUB_STATE_NULL:
case PJSIP_EVSUB_STATE_SENT:
case PJSIP_EVSUB_STATE_PENDING:
case PJSIP_EVSUB_STATE_UNKNOWN:
default:
break;
}
......
......@@ -72,6 +72,9 @@
namespace ring {
bool
utf8_validate_c_str(const char *str, ssize_t max_len, const char **end);
static const char *
fast_validate(const char *str)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment