epee: remove obsolete MyMonero conversion

Also initialize the temp var used when loading scalar arrays.

(cherry picked from commit 7ba5e2cca91497155bd0a72a5e00059a27fa7e38)
This commit is contained in:
selsta
2026-10-04 18:50:24 -04:00
committed by such-gitea
parent f7510618e8
commit 7e797d062a
3 changed files with 3 additions and 37 deletions
-1
View File
@@ -614,7 +614,6 @@ find_package(HIDAPI)
add_definition_if_library_exists(c memset_s "string.h" HAVE_MEMSET_S) add_definition_if_library_exists(c memset_s "string.h" HAVE_MEMSET_S)
add_definition_if_library_exists(c explicit_bzero "strings.h" HAVE_EXPLICIT_BZERO) add_definition_if_library_exists(c explicit_bzero "strings.h" HAVE_EXPLICIT_BZERO)
add_definition_if_function_found(strptime HAVE_STRPTIME)
add_definitions(-DAUTO_INITIALIZE_EASYLOGGINGPP) add_definitions(-DAUTO_INITIALIZE_EASYLOGGINGPP)
@@ -103,7 +103,7 @@ namespace epee
static bool unserialize_stl_container_t_val(stl_container& container, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname) static bool unserialize_stl_container_t_val(stl_container& container, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
{ {
container.clear(); container.clear();
typename stl_container::value_type exchange_val; typename stl_container::value_type exchange_val{};
typename t_storage::harray hval_array = stg.get_first_value(pname, exchange_val, hparent_section); typename t_storage::harray hval_array = stg.get_first_value(pname, exchange_val, hparent_section);
if(!hval_array) return false; if(!hval_array) return false;
container.insert(container.end(), std::move(exchange_val)); container.insert(container.end(), std::move(exchange_val));
@@ -28,18 +28,15 @@
#pragma once #pragma once
#include <boost/regex.hpp>
#include "misc_language.h" #include "misc_language.h"
#include "portable_storage_base.h" #include "portable_storage_base.h"
#include "parserse_base_utils.h"
#include "warnings.h" #include "warnings.h"
#include "misc_log_ex.h" #include "misc_log_ex.h"
#include <boost/lexical_cast.hpp>
#include <boost/numeric/conversion/bounds.hpp> #include <boost/numeric/conversion/bounds.hpp>
#include <limits>
#include <type_traits>
#include <typeinfo> #include <typeinfo>
#include <iomanip>
namespace epee namespace epee
{ {
@@ -140,36 +137,6 @@ POP_WARNINGS
} }
}; };
// For MyMonero/OpenMonero backend compatibility
// MyMonero backend sends amount, fees and timestamp values as strings.
// Until MM backend is updated, this is needed for compatibility between OpenMonero and MyMonero.
template<>
struct convert_to_integral<std::string, uint64_t, false>
{
static void convert(const std::string& from, uint64_t& to)
{
MTRACE("Converting std::string to uint64_t. Source: " << from);
// String only contains digits
if(std::all_of(from.begin(), from.end(), epee::misc_utils::parse::isdigit))
to = boost::lexical_cast<uint64_t>(from);
// MyMonero ISO 8061 timestamp (2017-05-06T16:27:06Z)
else if (boost::regex_match (from, boost::regex("\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\dZ")))
{
// Convert to unix timestamp
#ifdef HAVE_STRPTIME
struct tm tm;
if (strptime(from.c_str(), "%Y-%m-%dT%H:%M:%S", &tm))
#else
std::tm tm = {};
std::istringstream ss(from);
if (ss >> std::get_time(&tm, "%Y-%m-%dT%H:%M:%S"))
#endif
to = std::mktime(&tm);
} else
ASSERT_AND_THROW_WRONG_CONVERSION();
}
};
template<class from_type, class to_type> template<class from_type, class to_type>
struct is_convertable: std::integral_constant<bool, struct is_convertable: std::integral_constant<bool,
std::is_integral<to_type>::value && std::is_integral<to_type>::value &&