Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 501cfd42 authored by Erwin Jansen's avatar Erwin Jansen
Browse files

Series of windows fixes.

This contains a series of fixes to make sure the source can compile with
clang-cl under windows.

- Updates to include specific headers
- Define constants
- Iterate over path v.s. using regex.
- Initialize random generator with unsigned int.

Bug: 186567864
Test: gd/cert/run
Change-Id: I9049573befd459a7149bb2e3625e90ae0f46de3d
parent 418f31a1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <cstring>
#include <initializer_list>
#include <optional>
#include <ostream>
#include <string>

#include "packet/custom_field_fixed_size_interface.h"
+2 −6
Original line number Diff line number Diff line
@@ -33,12 +33,8 @@ void parse_namespace(
    const std::filesystem::path& input_file_relative_path,
    std::vector<std::string>* token) {
  std::filesystem::path gen_namespace = root_namespace / input_file_relative_path;
  std::string gen_namespace_str = gen_namespace.u8string();
  std::regex path_tokenizer("/");
  auto it = std::sregex_token_iterator(gen_namespace_str.cbegin(), gen_namespace_str.cend(), path_tokenizer, -1);
  std::sregex_token_iterator it_end = {};
  for (; it != it_end; ++it) {
    token->push_back(it->str());
  for (auto it = gen_namespace.begin(); it != gen_namespace.end(); ++it) {
    token->push_back(it->string());
  }
}

+5 −0
Original line number Diff line number Diff line
@@ -24,6 +24,11 @@
#include "model/setup/device_boutique.h"
#include "os/log.h"

#ifdef _WIN32
#define F_OK 00
#define R_OK 04
#endif

using std::vector;
using std::chrono::steady_clock;
using std::chrono::system_clock;
+2 −1
Original line number Diff line number Diff line
@@ -145,7 +145,8 @@ const UUID128Bit& Uuid::To128BitBE() const {

Uuid Uuid::GetRandom() {
  Uuid uuid;
  std::independent_bits_engine<std::default_random_engine, 8, uint8_t> engine;
  std::independent_bits_engine<std::default_random_engine, 8, unsigned int>
      engine;
  std::generate(std::begin(uuid.uu), std::end(uuid.uu), std::ref(engine));
  return uuid;
}
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@

#include <stdint.h>
#include <array>
#include <ostream>
#include <string>

namespace bluetooth {