Skip to content

Commit

Permalink
Merge branch 'felixguendling:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-W4 authored Oct 23, 2024
2 parents 036a590 + 56e9191 commit 4b2b813
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
6 changes: 6 additions & 0 deletions include/cista/containers/bitvec.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ struct basic_bitvec {
}
}

void one_out() {
for (auto& b : blocks_) {
b = ~block_t{0};
}
}

void resize(size_type const new_size) {
if (new_size == size_) {
return;
Expand Down
23 changes: 2 additions & 21 deletions include/cista/targets/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <io.h>
#include <windows.h>
#include <string>
#include <system_error>
#endif

#include <cinttypes>
Expand All @@ -27,27 +28,7 @@
namespace cista {

inline std::string last_error_str() {
auto const err = ::GetLastError();
if (err == 0) {
return "no error";
}

struct buf {
~buf() {
if (b_ != nullptr) {
LocalFree(b_);
b_ = nullptr;
}
}
LPSTR b_ = nullptr;
} b;
auto const size = FormatMessageA(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
nullptr, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), b.b_, 0,
nullptr);

return size == 0 ? std::to_string(err) : std::string{b.b_, size};
return std::system_category().message(static_cast<int>(::GetLastError()));
}

inline HANDLE open_file(char const* path, char const* mode) {
Expand Down

0 comments on commit 4b2b813

Please sign in to comment.