Commit ed9d76c7 authored by Adrien Béraud's avatar Adrien Béraud Committed by Guillaume Roguez

android: fix build

- bump contrib pcre to 8.36
- add missing C++ std functions
- add missing inclusions

Refs #70084

Change-Id: Idd0f94d07d53b0b89dfb03b97c5b467a83b3ff83
Signed-off-by: Guillaume Roguez's avatarGuillaume Roguez <guillaume.roguez@savoirfairelinux.com>
parent 4503d938
e94c652b40de60b391e28afbddc67b5a034650f6f62027e52f2d7aef53caf5f0da9f2d4f6872d1558f965dd9d4d696e5e23d2a50f20a4fbc9f0a707fb6f55fae pcre-8.35.tar.bz2
acd2bc6911be7b518ad4aca3c3ccbe98bdbeabf0e77d6b04009838c7825b563a001377f8c3a6a8a0583ec32ee9fefe05e3c1a69f272fe5084469a6b6c2148fbf pcre-8.36.tar.bz2
# 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 $@
......@@ -38,6 +38,7 @@
#include <vector>
#include <cmath>
#include <cstdlib>
namespace ring {
......
......@@ -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()
......
......@@ -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;
}
......
......@@ -50,6 +50,7 @@
#include <map>
#include <chrono>
#include <list>
#include <future>
/**
* @file sipaccount.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
......@@ -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;
}
......
......@@ -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);
......
......@@ -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;
......
......@@ -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_; };
......
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