Commit f6dc68db authored by Adrien Béraud's avatar Adrien Béraud Committed by Sébastien Blin

string utils: remove to_string

Change-Id: If34adb4833dff7ea71175bb7f465f48cb3758d55
parent fbafa847
......@@ -312,7 +312,7 @@ Account::getAccountDetails() const
{Conf::CONFIG_ACCOUNT_USERAGENT, hasCustomUserAgent_ ? userAgent_ : DEFAULT_USER_AGENT},
{Conf::CONFIG_ACCOUNT_HAS_CUSTOM_USERAGENT, hasCustomUserAgent_ ? userAgent_ : DEFAULT_USER_AGENT},
{Conf::CONFIG_ACCOUNT_AUTOANSWER, autoAnswerEnabled_ ? TRUE_STR : FALSE_STR},
{DRing::Account::ConfProperties::ACTIVE_CALL_LIMIT, jami::to_string(activeCallLimit_)},
{DRing::Account::ConfProperties::ACTIVE_CALL_LIMIT, std::to_string(activeCallLimit_)},
{Conf::CONFIG_RINGTONE_ENABLED, ringtoneEnabled_ ? TRUE_STR : FALSE_STR},
{Conf::CONFIG_RINGTONE_PATH, ringtonePath_},
{Conf::CONFIG_UPNP_ENABLED, upnp_ ? TRUE_STR : FALSE_STR}
......
......@@ -336,12 +336,12 @@ std::map<std::string, std::string>
Call::getDetails() const
{
return {
{DRing::Call::Details::CALL_TYPE, jami::to_string((unsigned)type_)},
{DRing::Call::Details::CALL_TYPE, std::to_string((unsigned)type_)},
{DRing::Call::Details::PEER_NUMBER, peerNumber_},
{DRing::Call::Details::DISPLAY_NAME, peerDisplayName_},
{DRing::Call::Details::CALL_STATE, getStateStr()},
{DRing::Call::Details::CONF_ID, confID_},
{DRing::Call::Details::TIMESTAMP_START, jami::to_string(timestamp_start_)},
{DRing::Call::Details::TIMESTAMP_START, std::to_string(timestamp_start_)},
{DRing::Call::Details::ACCOUNTID, getAccountId()},
{DRing::Call::Details::AUDIO_MUTED, std::string(bool_to_str(isAudioMuted_))},
{DRing::Call::Details::VIDEO_MUTED, std::string(bool_to_str(isVideoMuted_))},
......
......@@ -515,8 +515,8 @@ getRenderer(const std::string& callId)
return {
{DRing::Media::Details::CALL_ID, callId},
{DRing::Media::Details::SHM_PATH, sink->openedName()},
{DRing::Media::Details::WIDTH, jami::to_string(sink->getWidth())},
{DRing::Media::Details::HEIGHT, jami::to_string(sink->getHeight())},
{DRing::Media::Details::WIDTH, std::to_string(sink->getWidth())},
{DRing::Media::Details::HEIGHT, std::to_string(sink->getHeight())},
};
else
return {
......
......@@ -1588,7 +1588,7 @@ JamiAccount::getAccountDetails() const
{
std::lock_guard<std::mutex> lock(configurationMutex_);
std::map<std::string, std::string> a = SIPAccountBase::getAccountDetails();
a.emplace(Conf::CONFIG_DHT_PORT, jami::to_string(dhtPort_));
a.emplace(Conf::CONFIG_DHT_PORT, std::to_string(dhtPort_));
a.emplace(Conf::CONFIG_DHT_PUBLIC_IN_CALLS, dhtPublicInCalls_ ? TRUE_STR : FALSE_STR);
a.emplace(DRing::Account::ConfProperties::DHT_PEER_DISCOVERY, dhtPeerDiscovery_ ? TRUE_STR : FALSE_STR);
a.emplace(DRing::Account::ConfProperties::RING_DEVICE_ID, ringDeviceId_);
......
......@@ -314,7 +314,7 @@ void NameDirectory::registerName(const std::string& addr, const std::string& n,
body = ss.str();
}
request->set_body(body);
request->set_header("Content-Length", jami::to_string(body.size()));
request->set_header("Content-Length", std::to_string(body.size()));
auto params = std::make_shared<restbed::Settings>();
params->set_connection_timeout(std::chrono::seconds(120));
......
......@@ -2686,12 +2686,12 @@ Manager::testAccountICEInitialization(const std::string& accountID)
if (ice->waitForInitialization(ICE_INIT_TIMEOUT) <= 0)
{
result["STATUS"] = jami::to_string((int) DRing::Account::testAccountICEInitializationStatus::FAILURE);
result["STATUS"] = std::to_string((int) DRing::Account::testAccountICEInitializationStatus::FAILURE);
result["MESSAGE"] = ice->getLastErrMsg();
}
else
{
result["STATUS"] = jami::to_string((int) DRing::Account::testAccountICEInitializationStatus::SUCCESS);
result["STATUS"] = std::to_string((int) DRing::Account::testAccountICEInitializationStatus::SUCCESS);
result["MESSAGE"] = "";
}
......
......@@ -86,9 +86,9 @@ SystemAudioCodecInfo::getCodecSpecifications()
return {
{DRing::Account::ConfProperties::CodecInfo::NAME, name},
{DRing::Account::ConfProperties::CodecInfo::TYPE, (mediaType & MEDIA_AUDIO ? "AUDIO" : "VIDEO")},
{DRing::Account::ConfProperties::CodecInfo::BITRATE, to_string(bitrate)},
{DRing::Account::ConfProperties::CodecInfo::SAMPLE_RATE, to_string(audioformat.sample_rate)},
{DRing::Account::ConfProperties::CodecInfo::CHANNEL_NUMBER, to_string(audioformat.nb_channels)}
{DRing::Account::ConfProperties::CodecInfo::BITRATE, std::to_string(bitrate)},
{DRing::Account::ConfProperties::CodecInfo::SAMPLE_RATE, std::to_string(audioformat.sample_rate)},
{DRing::Account::ConfProperties::CodecInfo::CHANNEL_NUMBER, std::to_string(audioformat.nb_channels)}
};
}
......@@ -119,10 +119,10 @@ SystemVideoCodecInfo::getCodecSpecifications()
return {
{DRing::Account::ConfProperties::CodecInfo::NAME, name},
{DRing::Account::ConfProperties::CodecInfo::TYPE, (mediaType & MEDIA_AUDIO ? "AUDIO" : "VIDEO")},
{DRing::Account::ConfProperties::CodecInfo::BITRATE, to_string(bitrate)},
{DRing::Account::ConfProperties::CodecInfo::FRAME_RATE, to_string(frameRate)},
{DRing::Account::ConfProperties::CodecInfo::MIN_BITRATE, to_string(minBitrate)},
{DRing::Account::ConfProperties::CodecInfo::MAX_BITRATE, to_string(maxBitrate)},
{DRing::Account::ConfProperties::CodecInfo::BITRATE, std::to_string(bitrate)},
{DRing::Account::ConfProperties::CodecInfo::FRAME_RATE, std::to_string(frameRate)},
{DRing::Account::ConfProperties::CodecInfo::MIN_BITRATE, std::to_string(minBitrate)},
{DRing::Account::ConfProperties::CodecInfo::MAX_BITRATE, std::to_string(maxBitrate)},
};
}
......@@ -161,9 +161,9 @@ AccountAudioCodecInfo::getCodecSpecifications()
return {
{DRing::Account::ConfProperties::CodecInfo::NAME, systemCodecInfo.name},
{DRing::Account::ConfProperties::CodecInfo::TYPE, (systemCodecInfo.mediaType & MEDIA_AUDIO ? "AUDIO" : "VIDEO")},
{DRing::Account::ConfProperties::CodecInfo::BITRATE, to_string(bitrate)},
{DRing::Account::ConfProperties::CodecInfo::SAMPLE_RATE, to_string(audioformat.sample_rate)},
{DRing::Account::ConfProperties::CodecInfo::CHANNEL_NUMBER, to_string(audioformat.nb_channels)}
{DRing::Account::ConfProperties::CodecInfo::BITRATE, std::to_string(bitrate)},
{DRing::Account::ConfProperties::CodecInfo::SAMPLE_RATE, std::to_string(audioformat.sample_rate)},
{DRing::Account::ConfProperties::CodecInfo::CHANNEL_NUMBER, std::to_string(audioformat.nb_channels)}
};
}
......@@ -197,13 +197,13 @@ AccountVideoCodecInfo::getCodecSpecifications()
return {
{DRing::Account::ConfProperties::CodecInfo::NAME, systemCodecInfo.name},
{DRing::Account::ConfProperties::CodecInfo::TYPE, (systemCodecInfo.mediaType & MEDIA_AUDIO ? "AUDIO" : "VIDEO")},
{DRing::Account::ConfProperties::CodecInfo::BITRATE, to_string(bitrate)},
{DRing::Account::ConfProperties::CodecInfo::MAX_BITRATE, to_string(systemCodecInfo.maxBitrate)},
{DRing::Account::ConfProperties::CodecInfo::MIN_BITRATE, to_string(systemCodecInfo.minBitrate)},
{DRing::Account::ConfProperties::CodecInfo::QUALITY, to_string(quality)},
{DRing::Account::ConfProperties::CodecInfo::MAX_QUALITY, to_string(systemCodecInfo.maxQuality)},
{DRing::Account::ConfProperties::CodecInfo::MIN_QUALITY, to_string(systemCodecInfo.minQuality)},
{DRing::Account::ConfProperties::CodecInfo::FRAME_RATE, to_string(frameRate)},
{DRing::Account::ConfProperties::CodecInfo::BITRATE, std::to_string(bitrate)},
{DRing::Account::ConfProperties::CodecInfo::MAX_BITRATE, std::to_string(systemCodecInfo.maxBitrate)},
{DRing::Account::ConfProperties::CodecInfo::MIN_BITRATE, std::to_string(systemCodecInfo.minBitrate)},
{DRing::Account::ConfProperties::CodecInfo::QUALITY, std::to_string(quality)},
{DRing::Account::ConfProperties::CodecInfo::MAX_QUALITY, std::to_string(systemCodecInfo.maxQuality)},
{DRing::Account::ConfProperties::CodecInfo::MIN_QUALITY, std::to_string(systemCodecInfo.minQuality)},
{DRing::Account::ConfProperties::CodecInfo::FRAME_RATE, std::to_string(frameRate)},
{DRing::Account::ConfProperties::CodecInfo::AUTO_QUALITY_ENABLED, bool_to_str(isAutoQualityEnabled)}
};
}
......
......@@ -99,9 +99,9 @@ MediaEncoder::setOptions(const MediaStream& opts)
void
MediaEncoder::setOptions(const MediaDescription& args)
{
libav_utils::setDictValue(&options_, "payload_type", jami::to_string(args.payload_type));
libav_utils::setDictValue(&options_, "max_rate", jami::to_string(args.codec->bitrate));
libav_utils::setDictValue(&options_, "crf", jami::to_string(args.codec->quality));
libav_utils::setDictValue(&options_, "payload_type", std::to_string(args.payload_type));
libav_utils::setDictValue(&options_, "max_rate", std::to_string(args.codec->bitrate));
libav_utils::setDictValue(&options_, "crf", std::to_string(args.codec->quality));
if (not args.parameters.empty())
libav_utils::setDictValue(&options_, "parameters", args.parameters);
......
......@@ -83,7 +83,7 @@ public:
auto rates = getRateList(chan, size);
std::vector<std::string> rates_str {rates.size()};
std::transform(rates.begin(), rates.end(), rates_str.begin(),
[](FrameRate r) { return jami::to_string(r.real()); });
[](FrameRate r) { return std::to_string(r.real()); });
cap[chan][sz.str()] = std::move(rates_str);
}
......@@ -124,7 +124,7 @@ public:
std::stringstream video_size;
video_size << max_size.first << "x" << max_size.second;
settings.video_size = video_size.str();
settings.framerate = jami::to_string(max_size_rate.real());
settings.framerate = std::to_string(max_size_rate.real());
JAMI_WARN("Default video settings: %s, %s FPS", settings.video_size.c_str(),
settings.framerate.c_str());
}
......@@ -141,7 +141,7 @@ public:
settings.name = params.name;
settings.channel = params.channel_name;
settings.video_size = sizeToString(params.width, params.height);
settings.framerate = jami::to_string(params.framerate.real());
settings.framerate = std::to_string(params.framerate.real());
return settings;
}
......
......@@ -540,12 +540,12 @@ VideoRtpSession::storeVideoBitrateInfo() {
if (codecVideo) {
codecVideo->setCodecSpecifications({
{DRing::Account::ConfProperties::CodecInfo::BITRATE, jami::to_string(videoBitrateInfo_.videoBitrateCurrent)},
{DRing::Account::ConfProperties::CodecInfo::MIN_BITRATE, jami::to_string(videoBitrateInfo_.videoBitrateMin)},
{DRing::Account::ConfProperties::CodecInfo::MAX_BITRATE, jami::to_string(videoBitrateInfo_.videoBitrateMax)},
{DRing::Account::ConfProperties::CodecInfo::QUALITY, jami::to_string(videoBitrateInfo_.videoQualityCurrent)},
{DRing::Account::ConfProperties::CodecInfo::MIN_QUALITY, jami::to_string(videoBitrateInfo_.videoQualityMin)},
{DRing::Account::ConfProperties::CodecInfo::MAX_QUALITY, jami::to_string(videoBitrateInfo_.videoQualityMax)}
{DRing::Account::ConfProperties::CodecInfo::BITRATE, std::to_string(videoBitrateInfo_.videoBitrateCurrent)},
{DRing::Account::ConfProperties::CodecInfo::MIN_BITRATE, std::to_string(videoBitrateInfo_.videoBitrateMin)},
{DRing::Account::ConfProperties::CodecInfo::MAX_BITRATE, std::to_string(videoBitrateInfo_.videoBitrateMax)},
{DRing::Account::ConfProperties::CodecInfo::QUALITY, std::to_string(videoBitrateInfo_.videoQualityCurrent)},
{DRing::Account::ConfProperties::CodecInfo::MIN_QUALITY, std::to_string(videoBitrateInfo_.videoQualityMin)},
{DRing::Account::ConfProperties::CodecInfo::MAX_QUALITY, std::to_string(videoBitrateInfo_.videoQualityMax)}
});
if (histoQuality_.size() > MAX_SIZE_HISTO_QUALITY_)
......
......@@ -365,7 +365,7 @@ AudioPreference::createAudioLayer()
if (audioApi_ == JACK_API_STR) {
try {
if (auto ret = system("jack_lsp > /dev/null"))
throw std::runtime_error("Error running jack_lsp: " + to_string(ret));
throw std::runtime_error("Error running jack_lsp: " + std::to_string(ret));
return new JackLayer(*this);
} catch (const std::runtime_error& e) {
JAMI_ERR("%s", e.what());
......
......@@ -195,7 +195,7 @@ Sdp::setMediaDescriptorLines(bool audio, bool holding, sip_utils::KeyExchangePro
enc_name = accountAudioCodec->systemCodecInfo.name;
if (accountAudioCodec->audioformat.nb_channels > 1) {
channels = jami::to_string(accountAudioCodec->audioformat.nb_channels);
channels = std::to_string(accountAudioCodec->audioformat.nb_channels);
rtpmap.param.ptr = (char *) channels.c_str();
rtpmap.param.slen = strlen(channels.c_str()); // don't include NULL terminator
}
......
......@@ -622,9 +622,9 @@ SIPAccount::getAccountDetails() const
}
a.emplace(Conf::CONFIG_ACCOUNT_PASSWORD, std::move(password));
a.emplace(Conf::CONFIG_LOCAL_PORT, jami::to_string(localPort_));
a.emplace(Conf::CONFIG_LOCAL_PORT, std::to_string(localPort_));
a.emplace(Conf::CONFIG_ACCOUNT_ROUTESET, serviceRoute_);
a.emplace(Conf::CONFIG_ACCOUNT_REGISTRATION_EXPIRE, jami::to_string(registrationExpire_));
a.emplace(Conf::CONFIG_ACCOUNT_REGISTRATION_EXPIRE, std::to_string(registrationExpire_));
a.emplace(Conf::CONFIG_KEEP_ALIVE_ENABLED, keepAliveEnabled_ ? TRUE_STR : FALSE_STR);
a.emplace(Conf::CONFIG_PRESENCE_ENABLED, presence_ and presence_->isEnabled()? TRUE_STR : FALSE_STR);
......@@ -645,7 +645,7 @@ std::map<std::string, std::string>
SIPAccount::getVolatileAccountDetails() const
{
auto a = SIPAccountBase::getVolatileAccountDetails();
a.emplace(Conf::CONFIG_ACCOUNT_REGISTRATION_STATE_CODE, jami::to_string(registrationStateDetailed_.first));
a.emplace(Conf::CONFIG_ACCOUNT_REGISTRATION_STATE_CODE, std::to_string(registrationStateDetailed_.first));
a.emplace(Conf::CONFIG_ACCOUNT_REGISTRATION_STATE_DESC, registrationStateDetailed_.second);
a.emplace(DRing::Account::VolatileProperties::InstantMessaging::OFF_CALL, TRUE_STR);
......@@ -669,7 +669,7 @@ SIPAccount::getVolatileAccountDetails() const
a.emplace(name_str.str(), ca->toString());
ca = ca->issuer;
}
a.emplace(DRing::TlsTransport::TLS_PEER_CA_NUM, jami::to_string(n));
a.emplace(DRing::TlsTransport::TLS_PEER_CA_NUM, std::to_string(n));
}
return a;
......@@ -1665,7 +1665,7 @@ SIPAccount::getTlsSettings() const
{
return {
{Conf::CONFIG_TLS_ENABLE, tlsEnable_ ? TRUE_STR : FALSE_STR},
{Conf::CONFIG_TLS_LISTENER_PORT, jami::to_string(tlsListenerPort_)},
{Conf::CONFIG_TLS_LISTENER_PORT, std::to_string(tlsListenerPort_)},
{Conf::CONFIG_TLS_CA_LIST_FILE, tlsCaListFile_},
{Conf::CONFIG_TLS_CERTIFICATE_FILE, tlsCertificateFile_},
{Conf::CONFIG_TLS_PRIVATE_KEY_FILE, tlsPrivateKeyFile_},
......
......@@ -138,8 +138,8 @@ addRangeToDetails(std::map<std::string, std::string> &a, const char *minKey,
const char *maxKey,
const std::pair<uint16_t, uint16_t> &range)
{
a.emplace(minKey, jami::to_string(range.first));
a.emplace(maxKey, jami::to_string(range.second));
a.emplace(minKey, std::to_string(range.first));
a.emplace(maxKey, std::to_string(range.second));
}
void SIPAccountBase::serialize(YAML::Emitter &out) const
......@@ -265,7 +265,7 @@ SIPAccountBase::getAccountDetails() const
a.emplace(Conf::CONFIG_ACCOUNT_DTMF_TYPE, dtmfType_);
a.emplace(Conf::CONFIG_LOCAL_INTERFACE, interface_);
a.emplace(Conf::CONFIG_PUBLISHED_PORT, jami::to_string(publishedPort_));
a.emplace(Conf::CONFIG_PUBLISHED_PORT, std::to_string(publishedPort_));
a.emplace(Conf::CONFIG_PUBLISHED_SAMEAS_LOCAL, publishedSameasLocal_ ? TRUE_STR : FALSE_STR);
a.emplace(Conf::CONFIG_PUBLISHED_ADDRESS, publishedIpAddress_);
......@@ -289,7 +289,7 @@ SIPAccountBase::getVolatileAccountDetails() const
if (isIP2IP())
a[Conf::CONFIG_ACCOUNT_REGISTRATION_STATUS] = "READY";
a.emplace(Conf::CONFIG_TRANSPORT_STATE_CODE, jami::to_string(transportStatus_));
a.emplace(Conf::CONFIG_TRANSPORT_STATE_CODE, std::to_string(transportStatus_));
a.emplace(Conf::CONFIG_TRANSPORT_STATE_DESC, transportError_);
return a;
}
......
......@@ -1231,7 +1231,7 @@ SIPCall::getDetails() const
ca = ca->issuer;
}
details.emplace(DRing::TlsTransport::TLS_PEER_CA_NUM,
jami::to_string(n));
std::to_string(n));
} else {
details.emplace(DRing::TlsTransport::TLS_PEER_CERT, "");
details.emplace(DRing::TlsTransport::TLS_PEER_CA_NUM, "");
......
......@@ -1187,7 +1187,7 @@ SIPVoIPLink::resolveSrvName(const std::string &name, pjsip_transport_type_e type
/*.addr = */{{(char*)name.c_str(), name_size}, port},
};
const auto token = std::hash<std::string>()(name + to_string(type));
const auto token = std::hash<std::string>()(name + std::to_string(type));
getResolveCallbackMap().registerCallback(token,
[=,cb=std::move(cb)](pj_status_t s, const pjsip_server_addresses* r) {
try {
......
......@@ -97,11 +97,11 @@ Smartools::setResolution(const std::string& id, int width, int height)
{
std::lock_guard<std::mutex> lk(mutexInfo_);
if(id == "local"){
information_["local width"] = to_string(width);
information_["local height"] = to_string(height);
information_["local width"] = std::to_string(width);
information_["local height"] = std::to_string(height);
} else {
information_["remote width"] = to_string(width);
information_["remote height"] = to_string(height);
information_["remote width"] = std::to_string(width);
information_["remote height"] = std::to_string(height);
}
}
......
......@@ -39,21 +39,12 @@ bool_to_str(bool b) noexcept
return b ? TRUE_STR : FALSE_STR;
}
std::string to_string(double value);
#ifdef _WIN32
std::wstring to_wstring(const std::string& s);
std::string decodeMultibyteString(const std::string& s);
std::string bstrToStdString(BSTR bstr);
#endif
template <typename T>
inline std::string
to_string(T &&value)
{
return std::to_string(std::forward<T>(value));
}
static inline int
stoi(const std::string& str)
{
......
......@@ -1184,7 +1184,7 @@ UPnPContext::removeMappingsByLocalIPAndDescription(const UPnPIGD& igd, const std
std::unique_ptr<IXML_Document, decltype(ixmlDocument_free)&> action(nullptr, ixmlDocument_free);
IXML_Document* action_ptr = nullptr;
UpnpAddToAction(&action_ptr, "GetGenericPortMappingEntry", igd.getServiceType().c_str(),
"NewPortMappingIndex", jami::to_string(entry_idx).c_str());
"NewPortMappingIndex", std::to_string(entry_idx).c_str());
action.reset(action_ptr);
std::unique_ptr<IXML_Document, decltype(ixmlDocument_free)&> response(nullptr, ixmlDocument_free);
......
......@@ -68,9 +68,9 @@ public:
friend bool operator!= (const Mapping& cRedir1, const Mapping& cRedir2);
uint16_t getPortExternal() const { return port_external_; }
std::string getPortExternalStr() const { return jami::to_string(port_external_); }
std::string getPortExternalStr() const { return std::to_string(port_external_); }
uint16_t getPortInternal() const { return port_internal_; }
std::string getPortInternalStr() const { return jami::to_string(port_internal_); }
std::string getPortInternalStr() const { return std::to_string(port_internal_); }
PortType getType() const { return type_; }
std::string getTypeStr() const { return type_ == PortType::UDP ? "UDP" : "TCP"; }
std::string getDescription() const { return description_; }
......
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