Browse Source

removed C++17 check

pull/2101/head
orignal 3 months ago
parent
commit
cc59003560
  1. 4
      Win32/Win32App.cpp
  2. 2
      libi2pd/ECIESX25519AEADRatchetSession.cpp
  3. 3
      libi2pd/FS.h
  4. 2
      libi2pd/Garlic.cpp
  5. 20
      libi2pd/Log.h
  6. 17
      libi2pd/NetDb.cpp
  7. 2
      libi2pd/RouterContext.cpp
  8. 4
      libi2pd/SSU2Session.cpp
  9. 2
      libi2pd_client/SOCKS.cpp

4
Win32/Win32App.cpp

@ -355,9 +355,7 @@ namespace win32 @@ -355,9 +355,7 @@ namespace win32
}
}
}
#if (__cplusplus >= 201703L) // C++ 17 or higher
[[fallthrough]];
#endif
[fallthrough]];
}
case WM_TRAYICON:
{

2
libi2pd/ECIESX25519AEADRatchetSession.cpp

@ -801,9 +801,7 @@ namespace garlic @@ -801,9 +801,7 @@ namespace garlic
m_State = eSessionStateEstablished;
m_NSRSendTagset = nullptr;
m_EphemeralKeys = nullptr;
#if (__cplusplus >= 201703L) // C++ 17 or higher
[[fallthrough]];
#endif
case eSessionStateEstablished:
if (m_SendReverseKey && receiveTagset->GetTagSetID () == m_NextReceiveRatchet->GetReceiveTagSetID ())
m_SendReverseKey = false; // tag received on new tagset

3
libi2pd/FS.h

@ -16,8 +16,7 @@ @@ -16,8 +16,7 @@
#include <functional>
#ifndef STD_FILESYSTEM
# if (!TARGET_OS_SIMULATOR && \
(__cplusplus >= 201703L) && __has_include(<filesystem>)) // C++ 17 or higher and supports std::filesystem
# if (!TARGET_OS_SIMULATOR && __has_include(<filesystem>)) // supports std::filesystem
# define STD_FILESYSTEM 1
# else
# define STD_FILESYSTEM 0

2
libi2pd/Garlic.cpp

@ -1031,9 +1031,7 @@ namespace garlic @@ -1031,9 +1031,7 @@ namespace garlic
case eGarlicDeliveryTypeDestination:
LogPrint (eLogDebug, "Garlic: Type destination");
buf += 32; // TODO: check destination
#if (__cplusplus >= 201703L) // C++ 17 or higher
[[fallthrough]];
#endif
// no break here
case eGarlicDeliveryTypeLocal:
{

20
libi2pd/Log.h

@ -172,16 +172,6 @@ void LogPrint (std::stringstream& s, TValue&& arg) noexcept @@ -172,16 +172,6 @@ void LogPrint (std::stringstream& s, TValue&& arg) noexcept
s << std::forward<TValue>(arg);
}
#if (__cplusplus < 201703L) // below C++ 17
/** internal usage only -- folding args array to single string */
template<typename TValue, typename... TArgs>
void LogPrint (std::stringstream& s, TValue&& arg, TArgs&&... args) noexcept
{
LogPrint (s, std::forward<TValue>(arg));
LogPrint (s, std::forward<TArgs>(args)...);
}
#endif
/**
* @brief Create log message and send it to queue
* @param level Message level (eLogError, eLogInfo, ...)
@ -194,13 +184,7 @@ void LogPrint (LogLevel level, TArgs&&... args) noexcept @@ -194,13 +184,7 @@ void LogPrint (LogLevel level, TArgs&&... args) noexcept
// fold message to single string
std::stringstream ss;
#if (__cplusplus >= 201703L) // C++ 17 or higher
(LogPrint (ss, std::forward<TArgs>(args)), ...);
#else
LogPrint (ss, std::forward<TArgs>(args)...);
#endif
auto msg = std::make_shared<i2p::log::LogMsg>(level, std::time(nullptr), std::move(ss).str());
msg->tid = std::this_thread::get_id();
i2p::log::Logger().Append(msg);
@ -217,11 +201,7 @@ void ThrowFatal (TArgs&&... args) noexcept @@ -217,11 +201,7 @@ void ThrowFatal (TArgs&&... args) noexcept
if (!f) return;
// fold message to single string
std::stringstream ss("");
#if (__cplusplus >= 201703L) // C++ 17 or higher
(LogPrint (ss, std::forward<TArgs>(args)), ...);
#else
LogPrint (ss, std::forward<TArgs>(args)...);
#endif
f (ss.str ());
}

17
libi2pd/NetDb.cpp

@ -1314,12 +1314,8 @@ namespace data @@ -1314,12 +1314,8 @@ namespace data
{
// update selection
m_ExploratorySelection.clear ();
#if (__cplusplus >= 201703L) // C++ 17 or higher
std::vector<std::shared_ptr<const RouterInfo> > eligible;
eligible.reserve (m_RouterInfos.size ());
#else
auto& eligible = m_ExploratorySelection;
#endif
eligible.reserve (m_RouterInfos.size ());
{
// collect eligible from current netdb
bool checkIsReal = i2p::tunnel::tunnels.GetPreciseTunnelCreationSuccessRate () < NETDB_TUNNEL_CREATION_RATE_THRESHOLD; // too low rate
@ -1329,22 +1325,13 @@ namespace data @@ -1329,22 +1325,13 @@ namespace data
(!checkIsReal || (it.second->HasProfile () && it.second->GetProfile ()->IsReal ())))
eligible.push_back (it.second);
}
#if (__cplusplus >= 201703L) // C++ 17 or higher
if (eligible.size () > NETDB_MAX_EXPLORATORY_SELECTION_SIZE)
{
std::sample (eligible.begin(), eligible.end(), std::back_inserter(m_ExploratorySelection),
NETDB_MAX_EXPLORATORY_SELECTION_SIZE, std::mt19937(ts));
}
else
std::swap (m_ExploratorySelection, eligible);
#else
if (m_ExploratorySelection.size () > NETDB_MAX_EXPLORATORY_SELECTION_SIZE)
{
// reduce number of eligible to max selection size
std::shuffle (m_ExploratorySelection.begin(), m_ExploratorySelection.end(), std::mt19937(ts));
m_ExploratorySelection.resize (NETDB_MAX_EXPLORATORY_SELECTION_SIZE);
}
#endif
std::swap (m_ExploratorySelection, eligible);
m_LastExploratorySelectionUpdateTime = ts;
}

2
libi2pd/RouterContext.cpp

@ -626,9 +626,7 @@ namespace i2p @@ -626,9 +626,7 @@ namespace i2p
case low : /* not set */; break;
case extra : caps |= i2p::data::RouterInfo::eExtraBandwidth; break; // 'P'
case unlim : caps |= i2p::data::RouterInfo::eExtraBandwidth;
#if (__cplusplus >= 201703L) // C++ 17 or higher
[[fallthrough]];
#endif
// no break here, extra + high means 'X'
case high : caps |= i2p::data::RouterInfo::eHighBandwidth; break;
}

4
libi2pd/SSU2Session.cpp

@ -587,11 +587,7 @@ namespace transport @@ -587,11 +587,7 @@ namespace transport
if (!resentPackets.empty ())
{
m_LastResendTime = ts;
#if (__cplusplus >= 201703L) // C++ 17 or higher
m_SentPackets.merge (resentPackets);
#else
m_SentPackets.insert (resentPackets.begin (), resentPackets.end ());
#endif
m_WindowSize >>= 1; // /2
if (m_WindowSize < SSU2_MIN_WINDOW_SIZE) m_WindowSize = SSU2_MIN_WINDOW_SIZE;
return resentPackets.size ();

2
libi2pd_client/SOCKS.cpp

@ -444,9 +444,7 @@ namespace proxy @@ -444,9 +444,7 @@ namespace proxy
break;
case CMD_UDP:
if (m_socksv == SOCKS5) break;
#if (__cplusplus >= 201703L) // C++ 17 or higher
[[fallthrough]];
#endif
default:
LogPrint(eLogError, "SOCKS: Invalid command: ", ((int)*sock_buff));
SocksRequestFailed(SOCKS5_GEN_FAIL);

Loading…
Cancel
Save