Windows compilation fixes

This commit is contained in:
Jason Rhinelander 2020-06-22 21:18:01 -03:00
parent 8e41fda41c
commit d667ff2edd
3 changed files with 11 additions and 6 deletions

View file

@ -406,8 +406,12 @@ build_external(hidapi
) )
set(HIDAPI_FOUND TRUE) set(HIDAPI_FOUND TRUE)
add_static_target(hidapi_libusb hidapi_external ${hidapi_libusb_lib}) add_static_target(hidapi_libusb hidapi_external ${hidapi_libusb_lib})
set(hidapi_links "libusb_vendor;libudev")
if(WIN32)
list(APPEND hidapi_links setupapi)
endif()
set_target_properties(hidapi_libusb PROPERTIES set_target_properties(hidapi_libusb PROPERTIES
INTERFACE_LINK_LIBRARIES "libusb_vendor;libudev" INTERFACE_LINK_LIBRARIES "${hidapi_links}"
INTERFACE_COMPILE_DEFINITIONS HAVE_HIDAPI) INTERFACE_COMPILE_DEFINITIONS HAVE_HIDAPI)

View file

@ -35,6 +35,7 @@
#include <cstdio> #include <cstdio>
#ifdef WIN32 #ifdef WIN32
#include "string_tools.h"
#ifndef STRSAFE_NO_DEPRECATE #ifndef STRSAFE_NO_DEPRECATE
#define STRSAFE_NO_DEPRECATE #define STRSAFE_NO_DEPRECATE
#endif #endif
@ -284,7 +285,7 @@ namespace tools {
{ {
try try
{ {
return string_tools::utf16_to_utf8(psz_path); return epee::string_tools::utf16_to_utf8(psz_path);
} }
catch (const std::exception &e) catch (const std::exception &e)
{ {
@ -352,10 +353,10 @@ namespace tools {
#if defined(WIN32) #if defined(WIN32)
// Maximizing chances for success // Maximizing chances for success
std::wstring wide_replacement_name; std::wstring wide_replacement_name;
try { wide_replacement_name = string_tools::utf8_to_utf16(old_name); } try { wide_replacement_name = epee::string_tools::utf8_to_utf16(old_name); }
catch (...) { return std::error_code(GetLastError(), std::system_category()); } catch (...) { return std::error_code(GetLastError(), std::system_category()); }
std::wstring wide_replaced_name; std::wstring wide_replaced_name;
try { wide_replaced_name = string_tools::utf8_to_utf16(new_name); } try { wide_replaced_name = epee::string_tools::utf8_to_utf16(new_name); }
catch (...) { return std::error_code(GetLastError(), std::system_category()); } catch (...) { return std::error_code(GetLastError(), std::system_category()); }
DWORD attributes = ::GetFileAttributesW(wide_replaced_name.c_str()); DWORD attributes = ::GetFileAttributesW(wide_replaced_name.c_str());

View file

@ -6006,8 +6006,8 @@ void wallet2::store_to(const std::string &path, const epee::wipeable_string &pas
bool success = false; bool success = false;
try { try {
serialization::binary_string_archiver oar; serialization::binary_string_archiver oar;
serialization::serialize(oar, cache_file_data.get()); serialization::serialize(oar, *cache_file_data);
success = save_to_file(new_file, oss.str()); success = save_to_file(new_file, oar.str());
} catch (...) {} } catch (...) {}
THROW_WALLET_EXCEPTION_IF(!success, error::file_save_error, new_file); THROW_WALLET_EXCEPTION_IF(!success, error::file_save_error, new_file);
#else #else