diff --git a/contrib/src/pcre/SHA512SUMS b/contrib/src/pcre/SHA512SUMS index 5c2c2935b0ac6c02eca60acab8af77a72933d8d0..066d00148cf83e733040c1b35b68c4c2f73c041e 100644 --- a/contrib/src/pcre/SHA512SUMS +++ b/contrib/src/pcre/SHA512SUMS @@ -1 +1 @@ -e94c652b40de60b391e28afbddc67b5a034650f6f62027e52f2d7aef53caf5f0da9f2d4f6872d1558f965dd9d4d696e5e23d2a50f20a4fbc9f0a707fb6f55fae pcre-8.35.tar.bz2 +acd2bc6911be7b518ad4aca3c3ccbe98bdbeabf0e77d6b04009838c7825b563a001377f8c3a6a8a0583ec32ee9fefe05e3c1a69f272fe5084469a6b6c2148fbf pcre-8.36.tar.bz2 diff --git a/contrib/src/pcre/rules.mak b/contrib/src/pcre/rules.mak index d30cee780d4871c4c034f8160a9729029856996e..e6de6149d53df059ed36193c94e6c1063cebec5c 100644 --- a/contrib/src/pcre/rules.mak +++ b/contrib/src/pcre/rules.mak @@ -1,6 +1,6 @@ # Perl Compatible Regular Expression -PCRE_VERSION := 8.35 +PCRE_VERSION := 8.36 PCRE_URL := ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-$(PCRE_VERSION).tar.bz2 PKGS += pcre @@ -22,6 +22,6 @@ pcre: pcre-$(PCRE_VERSION).tar.bz2 .sum-pcre $(MOVE) .pcre: pcre - cd $< && $(HOSTVARS) ./configure $(HOSTCONF) + cd $< && $(HOSTVARS) ./configure --disable-cpp $(HOSTCONF) cd $< && $(MAKE) install touch $@ diff --git a/src/media/audio/sound/tone.cpp b/src/media/audio/sound/tone.cpp index e3a919e3e2b389fdd0c19ae6b30e6387e9ef936f..434bd33750e233a33f77f8a9f14f9ceb1c2cadd1 100644 --- a/src/media/audio/sound/tone.cpp +++ b/src/media/audio/sound/tone.cpp @@ -38,6 +38,7 @@ #include <vector> #include <cmath> +#include <cstdlib> namespace ring { diff --git a/src/media/media_codec.cpp b/src/media/media_codec.cpp index a5a0790a0d39c1fc2c1418499ff926ed02407488..5c0155ef6d79b6c7d13c23fa026f64fea67d5e22 100644 --- a/src/media/media_codec.cpp +++ b/src/media/media_codec.cpp @@ -33,7 +33,9 @@ #include "media_codec.h" #include "account_const.h" -#include <string.h> +#include "string_utils.h" + +#include <string> #include <sstream> namespace ring { @@ -103,9 +105,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, 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)} + {DRing::Account::ConfProperties::CodecInfo::BITRATE, ring::to_string(bitrate)}, + {DRing::Account::ConfProperties::CodecInfo::SAMPLE_RATE, ring::to_string(audioformat.sample_rate)}, + {DRing::Account::ConfProperties::CodecInfo::CHANNEL_NUMBER, ring::to_string(audioformat.nb_channels)} }; } @@ -134,8 +136,8 @@ SystemVideoCodecInfo::getCodecSpecifications() return { {DRing::Account::ConfProperties::CodecInfo::NAME, name}, {DRing::Account::ConfProperties::CodecInfo::TYPE, (mediaType & MEDIA_AUDIO ? "AUDIO" : "VIDEO")}, - {DRing::Account::ConfProperties::CodecInfo::BITRATE, std::to_string(bitrate)}, - {DRing::Account::ConfProperties::CodecInfo::FRAME_RATE, std::to_string(frameRate)} + {DRing::Account::ConfProperties::CodecInfo::BITRATE, ring::to_string(bitrate)}, + {DRing::Account::ConfProperties::CodecInfo::FRAME_RATE, ring::to_string(frameRate)} }; } @@ -161,9 +163,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, 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)} + {DRing::Account::ConfProperties::CodecInfo::BITRATE, ring::to_string(bitrate)}, + {DRing::Account::ConfProperties::CodecInfo::SAMPLE_RATE, ring::to_string(audioformat.sample_rate)}, + {DRing::Account::ConfProperties::CodecInfo::CHANNEL_NUMBER, ring::to_string(audioformat.nb_channels)} }; } @@ -172,15 +174,15 @@ AccountAudioCodecInfo::setCodecSpecifications(const std::map<std::string, std::s { auto it = details.find(DRing::Account::ConfProperties::CodecInfo::BITRATE); if (it != details.end()) - bitrate = std::stoi(it->second); + bitrate = ring::stoi(it->second); it = details.find(DRing::Account::ConfProperties::CodecInfo::SAMPLE_RATE); if (it != details.end()) - audioformat.sample_rate = std::stoi(it->second); + audioformat.sample_rate = ring::stoi(it->second); it = details.find(DRing::Account::ConfProperties::CodecInfo::CHANNEL_NUMBER); if (it != details.end()) - audioformat.nb_channels = std::stoi(it->second); + audioformat.nb_channels = ring::stoi(it->second); } bool @@ -205,8 +207,8 @@ 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, std::to_string(bitrate)}, - {DRing::Account::ConfProperties::CodecInfo::FRAME_RATE, std::to_string(frameRate)} + {DRing::Account::ConfProperties::CodecInfo::BITRATE, ring::to_string(bitrate)}, + {DRing::Account::ConfProperties::CodecInfo::FRAME_RATE, ring::to_string(frameRate)} }; } @@ -215,11 +217,11 @@ AccountVideoCodecInfo::setCodecSpecifications(const std::map<std::string, std::s { auto it = details.find(DRing::Account::ConfProperties::CodecInfo::BITRATE); if (it != details.end()) - bitrate = stoi(it->second); + bitrate = ring::stoi(it->second); it = details.find(DRing::Account::ConfProperties::CodecInfo::FRAME_RATE); if (it != details.end()) - frameRate = stoi(it->second); + frameRate = ring::stoi(it->second); } AccountVideoCodecInfo::~AccountVideoCodecInfo() diff --git a/src/media/video/video_base.cpp b/src/media/video/video_base.cpp index 19744d2b52582528a38159ca2bd16b0237740726..2d58bf855640f3f5824bdcdb71fef5cc0f234e32 100644 --- a/src/media/video/video_base.cpp +++ b/src/media/video/video_base.cpp @@ -99,7 +99,7 @@ static unsigned extractInt(const std::map<std::string, std::string>& settings, const std::string& key) { auto i = settings.find(key); if (i != settings.cend()) - return std::stoi(i->second); + return ring::stoi(i->second); return 0; } diff --git a/src/ringdht/ringaccount.h b/src/ringdht/ringaccount.h index 858a37a9ab3e883837cf61225a489836c5620bc7..4988a04ed5f2c9ec9e2a453901c582f25fb46b20 100644 --- a/src/ringdht/ringaccount.h +++ b/src/ringdht/ringaccount.h @@ -50,6 +50,7 @@ #include <map> #include <chrono> #include <list> +#include <future> /** * @file sipaccount.h diff --git a/src/string_utils.cpp b/src/string_utils.cpp index 98a9351ad46b09615232fc660c6889dc90edae3f..b511f6c83a26b84d358500715174acd54b5cf12c 100644 --- a/src/string_utils.cpp +++ b/src/string_utils.cpp @@ -2,6 +2,7 @@ * Copyright (C) 2014-2015 Savoir-Faire Linux Inc. * * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> + * Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -65,7 +66,7 @@ split_string_to_unsigned(const std::string &s, char delim) while (std::getline(ss, token, delim)) if (not token.empty()) - result.emplace_back(std::stoi(token)); + result.emplace_back(ring::stoi(token)); return result; } diff --git a/src/string_utils.h b/src/string_utils.h index 14af94bcf00faf046a0bfc4e4163d7b036ed1c2f..6e09f64f844c09b01fdf8d8676378d0132b04d4b 100644 --- a/src/string_utils.h +++ b/src/string_utils.h @@ -2,6 +2,7 @@ * Copyright (C) 2014-2015 Savoir-Faire Linux Inc. * * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> + * Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -52,23 +53,44 @@ bool_to_str(bool b) noexcept #ifdef __ANDROID__ +// Rationale: +// Some strings functions are not available on Android NDK as explained here: +// http://stackoverflow.com/questions/17950814/how-to-use-stdstoul-and-stdstoull-in-android/18124627#18124627 +// We implement them by ourself as well as possible here. + template <typename T> -std::string to_string(T &&value) +std::string +to_string(T &&value) { std::ostringstream os; - os << value; return os.str(); } +int +stoi(const std::string& str) +{ + int v; + std::istringstream os(str); + os >> v; + return v; +} + #else template <typename T> -std::string to_string(T &&value) +inline std::string +to_string(T &&value) { return std::to_string(std::forward<T>(value)); } +static inline int +stoi(const std::string& str) +{ + return std::stoi(str); +} + #endif std::string trim(const std::string &s); diff --git a/src/upnp/upnp_context.cpp b/src/upnp/upnp_context.cpp index 652453fe35e08f26af06d4c407d360e2ceeda2e0..68c631444275ba3858ac1be294e3161da96f676e 100644 --- a/src/upnp/upnp_context.cpp +++ b/src/upnp/upnp_context.cpp @@ -921,7 +921,7 @@ UPnPContext::removeMappingsByLocalIPAndDescription(const IGD* igd, const std::st 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", std::to_string(entry_idx).c_str()); + "NewPortMappingIndex", ring::to_string(entry_idx).c_str()); action.reset(action_ptr); std::unique_ptr<IXML_Document, decltype(ixmlDocument_free)&> response(nullptr, ixmlDocument_free); @@ -1059,7 +1059,7 @@ UPnPContext::addPortMapping(const IGD* igd, const Mapping& mapping, int* error_c std::string errorDescription = get_first_doc_item(response.get(), "errorDescription"); RING_WARN("UPnP: %s returned with error: %s: %s", action_name.c_str(), errorCode.c_str(), errorDescription.c_str()); - *error_code = std::stoi(errorCode); + *error_code = ring::stoi(errorCode); return false; } return true; diff --git a/src/upnp/upnp_igd.h b/src/upnp/upnp_igd.h index d27572b660b424163173d335a14d40322c06d92b..90ead0df472003348c02578157f400933c1f4ff0 100644 --- a/src/upnp/upnp_igd.h +++ b/src/upnp/upnp_igd.h @@ -36,6 +36,7 @@ #include "noncopyable.h" #include "ip_utils.h" +#include "string_utils.h" namespace ring { namespace upnp { @@ -72,9 +73,9 @@ public: friend bool operator!= (Mapping &cRedir1, Mapping &cRedir2); uint16_t getPortExternal() const { return port_external_; }; - std::string getPortExternalStr() const { return std::to_string(port_external_); }; + std::string getPortExternalStr() const { return ring::to_string(port_external_); }; uint16_t getPortInternal() const { return port_internal_; }; - std::string getPortInternalStr() const { return std::to_string(port_internal_); }; + std::string getPortInternalStr() const { return ring::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_; };