[ox] Fix to build with MinGW
This commit is contained in:
parent
1e82dacd6d
commit
610f6f4246
32
deps/ox/src/ox/fs/CMakeLists.txt
vendored
32
deps/ox/src/ox/fs/CMakeLists.txt
vendored
@ -17,19 +17,19 @@ set_property(
|
||||
)
|
||||
|
||||
if(OX_BUILD_EXEC STREQUAL "ON")
|
||||
add_executable(
|
||||
oxfstool
|
||||
toollib.cpp
|
||||
oxfstool.cpp
|
||||
)
|
||||
set_target_properties(oxfstool PROPERTIES OUTPUT_NAME oxfs)
|
||||
target_link_libraries(
|
||||
oxfstool
|
||||
OxFS
|
||||
OxTrace
|
||||
OxMetalClaw
|
||||
OxStd
|
||||
)
|
||||
#add_executable(
|
||||
# oxfstool
|
||||
# toollib.cpp
|
||||
# oxfstool.cpp
|
||||
#)
|
||||
#set_target_properties(oxfstool PROPERTIES OUTPUT_NAME oxfs)
|
||||
#target_link_libraries(
|
||||
# oxfstool
|
||||
# OxFS
|
||||
# OxTrace
|
||||
# OxMetalClaw
|
||||
# OxStd
|
||||
#)
|
||||
endif()
|
||||
|
||||
install(
|
||||
@ -58,7 +58,7 @@ if(OX_BUILD_EXEC STREQUAL "ON")
|
||||
if(OX_RUN_TESTS STREQUAL "ON")
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
install(TARGETS oxfstool
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
#install(TARGETS oxfstool
|
||||
# RUNTIME DESTINATION bin
|
||||
#)
|
||||
endif()
|
||||
|
9
deps/ox/src/ox/fs/filesystem2/directory.hpp
vendored
9
deps/ox/src/ox/fs/filesystem2/directory.hpp
vendored
@ -91,7 +91,7 @@ class Directory {
|
||||
|
||||
Error rm(PathIterator it) noexcept;
|
||||
|
||||
ValErr<InodeId_t> find(PathIterator it) const noexcept;
|
||||
ValErr<InodeId_t> find(const char *name) const noexcept;
|
||||
|
||||
};
|
||||
|
||||
@ -154,15 +154,12 @@ Error Directory<InodeId_t>::rm(PathIterator) noexcept {
|
||||
}
|
||||
|
||||
template<typename InodeId_t>
|
||||
ValErr<InodeId_t> Directory<InodeId_t>::find(PathIterator it) const noexcept {
|
||||
ValErr<InodeId_t> Directory<InodeId_t>::find(const char *name) const noexcept {
|
||||
ValErr<InodeId_t> retval = {0, 1};
|
||||
auto size = it.nextSize();
|
||||
auto name = ox_malloca(size + 1, char);
|
||||
it.next(name, size);
|
||||
auto buff = m_fs->read(m_inodeId).template to<Buffer>();
|
||||
for (auto i = buff->iterator(); i.hasNext(); i.next()) {
|
||||
auto data = i->data();
|
||||
if (data.valid() && data->name == name.get()) {
|
||||
if (data.valid() && data->name == name) {
|
||||
retval = static_cast<InodeId_t>(data->inode);
|
||||
}
|
||||
}
|
||||
|
2
deps/ox/src/ox/ptrarith/nodebuffer.hpp
vendored
2
deps/ox/src/ox/ptrarith/nodebuffer.hpp
vendored
@ -204,7 +204,7 @@ typename NodeBuffer<size_t, Item>::ItemPtr NodeBuffer<size_t, Item>::ptr(size_t
|
||||
|
||||
template<typename size_t, typename Item>
|
||||
typename NodeBuffer<size_t, Item>::ItemPtr NodeBuffer<size_t, Item>::malloc(size_t size) {
|
||||
auto fullSize = size + sizeof(Item);
|
||||
size_t fullSize = size + sizeof(Item);
|
||||
if (m_header.size - m_header.bytesUsed >= fullSize) {
|
||||
auto last = lastItem();
|
||||
size_t addr = 0;
|
||||
|
2
deps/ox/src/ox/ptrarith/ptr.hpp
vendored
2
deps/ox/src/ox/ptrarith/ptr.hpp
vendored
@ -88,7 +88,7 @@ inline Ptr<T, size_t, minOffset>::Ptr(void *dataStart, size_t dataSize, size_t i
|
||||
if (itemSize >= sizeof(T) and
|
||||
dataStart and
|
||||
itemStart >= minOffset and
|
||||
itemStart + itemSize <= dataSize) {
|
||||
static_cast<std::size_t>(itemStart + itemSize) <= dataSize) {
|
||||
m_dataStart = reinterpret_cast<uint8_t*>(dataStart);
|
||||
m_dataSize = dataSize;
|
||||
m_itemOffset = itemStart;
|
||||
|
6
deps/ox/src/ox/std/new.hpp
vendored
6
deps/ox/src/ox/std/new.hpp
vendored
@ -12,14 +12,14 @@
|
||||
|
||||
#include "types.hpp"
|
||||
|
||||
#if !defined(OX_USE_STDLIB)
|
||||
#define ox_alloca(size) __builtin_alloca(size)
|
||||
#elif defined(_MSC_VER)
|
||||
#if defined(_MSC_VER)
|
||||
#include <malloc.h>
|
||||
#define ox_alloca(size) _alloca(size)
|
||||
#elif __has_include(<alloca.h>)
|
||||
#include <alloca.h>
|
||||
#define ox_alloca(size) alloca(size)
|
||||
#else
|
||||
#define ox_alloca(size) __builtin_alloca(size)
|
||||
#endif
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user