mirror of https://github.com/kiwix/libkiwix.git
Hid some symbols in unnamed namespace
This commit is contained in:
parent
83101679a0
commit
135c6f875d
|
@ -49,6 +49,12 @@
|
||||||
#include <sys/sockio.h>
|
#include <sys/sockio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace kiwix
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
size_t write_callback_to_iss(char* ptr, size_t size, size_t nmemb, void* userdata)
|
size_t write_callback_to_iss(char* ptr, size_t size, size_t nmemb, void* userdata)
|
||||||
{
|
{
|
||||||
auto str = static_cast<std::stringstream*>(userdata);
|
auto str = static_cast<std::stringstream*>(userdata);
|
||||||
|
@ -56,7 +62,9 @@ size_t write_callback_to_iss(char* ptr, size_t size, size_t nmemb, void* userdat
|
||||||
return nmemb;
|
return nmemb;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string kiwix::download(const std::string& url) {
|
} // unnamed namespace
|
||||||
|
|
||||||
|
std::string download(const std::string& url) {
|
||||||
auto curl = curl_easy_init();
|
auto curl = curl_easy_init();
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
|
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
|
||||||
|
@ -77,10 +85,14 @@ std::string kiwix::download(const std::string& url) {
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
std::map<std::string,kiwix::IpAddress> getNetworkInterfacesWin() {
|
std::map<std::string, IpAddress> getNetworkInterfacesWin() {
|
||||||
std::map<std::string,kiwix::IpAddress> interfaces;
|
std::map<std::string, IpAddress> interfaces;
|
||||||
|
|
||||||
const int working_buffer_size = 15000;
|
const int working_buffer_size = 15000;
|
||||||
const int max_tries = 3;
|
const int max_tries = 3;
|
||||||
|
@ -145,8 +157,8 @@ std::map<std::string,kiwix::IpAddress> getNetworkInterfacesWin() {
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
std::map<std::string,kiwix::IpAddress> getNetworkInterfacesPosix() {
|
std::map<std::string, IpAddress> getNetworkInterfacesPosix() {
|
||||||
std::map<std::string,kiwix::IpAddress> interfaces;
|
std::map<std::string, IpAddress> interfaces;
|
||||||
|
|
||||||
struct ifaddrs *interfacesHead;
|
struct ifaddrs *interfacesHead;
|
||||||
if (getifaddrs(&interfacesHead) == -1) {
|
if (getifaddrs(&interfacesHead) == -1) {
|
||||||
|
@ -177,7 +189,9 @@ std::map<std::string,kiwix::IpAddress> getNetworkInterfacesPosix() {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::map<std::string,kiwix::IpAddress> kiwix::getNetworkInterfaces() {
|
} // unnamed namespace
|
||||||
|
|
||||||
|
std::map<std::string, IpAddress> getNetworkInterfaces() {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return getNetworkInterfacesWin();
|
return getNetworkInterfacesWin();
|
||||||
#else
|
#else
|
||||||
|
@ -185,9 +199,9 @@ std::map<std::string,kiwix::IpAddress> kiwix::getNetworkInterfaces() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string kiwix::getBestPublicIp(bool ipv6) {
|
std::string getBestPublicIp(bool ipv6) {
|
||||||
kiwix::IpAddress bestPublicIp = kiwix::IpAddress{"127.0.0.1","::1"};
|
IpAddress bestPublicIp = IpAddress{"127.0.0.1","::1"};
|
||||||
std::map<std::string,kiwix::IpAddress> interfaces = getNetworkInterfaces();
|
std::map<std::string, IpAddress> interfaces = getNetworkInterfaces();
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
const char* const prioritizedNames[] =
|
const char* const prioritizedNames[] =
|
||||||
|
@ -215,7 +229,9 @@ std::string kiwix::getBestPublicIp(bool ipv6) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string kiwix::getBestPublicIp()
|
std::string getBestPublicIp()
|
||||||
{
|
{
|
||||||
return getBestPublicIp(false);
|
return getBestPublicIp(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace kiwix
|
||||||
|
|
Loading…
Reference in New Issue