Now compatible with VS2019
This commit is contained in:
Родитель
c771d89e84
Коммит
0b15df7e25
|
@ -93,9 +93,9 @@ jobs:
|
|||
VS2017:
|
||||
vm_image: vs2017-win2016
|
||||
build_type: Release
|
||||
#VS2019:
|
||||
# vm_image: windows-2019
|
||||
# build_type: Debug
|
||||
VS2019:
|
||||
vm_image: windows-2019
|
||||
build_type: Debug
|
||||
|
||||
pool:
|
||||
vmImage: $(vm_image)
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <gnutls/crypto.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <stdexcept>
|
||||
|
||||
namespace azure { namespace storage_lite {
|
||||
std::string hash(const std::string &to_sign, const std::vector<unsigned char> &key)
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
#include "constants.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <filesystem>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <uuid/uuid.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -41,15 +41,19 @@ namespace azure { namespace storage_lite {
|
|||
bool create_or_resize_file(const std::string& path, unsigned long long length) noexcept
|
||||
{
|
||||
#ifdef _WIN32
|
||||
try
|
||||
{
|
||||
std::experimental::filesystem::resize_file(path, static_cast<uintmax_t>(length));
|
||||
}
|
||||
catch (...)
|
||||
HANDLE h_file = CreateFile(path.data(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
if (h_file == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
LARGE_INTEGER distance;
|
||||
distance.QuadPart = length;
|
||||
bool ret = SetFilePointerEx(h_file, distance, nullptr, FILE_BEGIN) && SetEndOfFile(h_file);
|
||||
|
||||
CloseHandle(h_file);
|
||||
return ret;
|
||||
#else
|
||||
auto fd = open(path.c_str(), O_WRONLY, 0770);
|
||||
if (-1 == fd) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче