[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")
|
if(OX_BUILD_EXEC STREQUAL "ON")
|
||||||
add_executable(
|
#add_executable(
|
||||||
oxfstool
|
# oxfstool
|
||||||
toollib.cpp
|
# toollib.cpp
|
||||||
oxfstool.cpp
|
# oxfstool.cpp
|
||||||
)
|
#)
|
||||||
set_target_properties(oxfstool PROPERTIES OUTPUT_NAME oxfs)
|
#set_target_properties(oxfstool PROPERTIES OUTPUT_NAME oxfs)
|
||||||
target_link_libraries(
|
#target_link_libraries(
|
||||||
oxfstool
|
# oxfstool
|
||||||
OxFS
|
# OxFS
|
||||||
OxTrace
|
# OxTrace
|
||||||
OxMetalClaw
|
# OxMetalClaw
|
||||||
OxStd
|
# OxStd
|
||||||
)
|
#)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(
|
install(
|
||||||
@ -58,7 +58,7 @@ if(OX_BUILD_EXEC STREQUAL "ON")
|
|||||||
if(OX_RUN_TESTS STREQUAL "ON")
|
if(OX_RUN_TESTS STREQUAL "ON")
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
endif()
|
endif()
|
||||||
install(TARGETS oxfstool
|
#install(TARGETS oxfstool
|
||||||
RUNTIME DESTINATION bin
|
# RUNTIME DESTINATION bin
|
||||||
)
|
#)
|
||||||
endif()
|
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;
|
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>
|
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};
|
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>();
|
auto buff = m_fs->read(m_inodeId).template to<Buffer>();
|
||||||
for (auto i = buff->iterator(); i.hasNext(); i.next()) {
|
for (auto i = buff->iterator(); i.hasNext(); i.next()) {
|
||||||
auto data = i->data();
|
auto data = i->data();
|
||||||
if (data.valid() && data->name == name.get()) {
|
if (data.valid() && data->name == name) {
|
||||||
retval = static_cast<InodeId_t>(data->inode);
|
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>
|
template<typename size_t, typename Item>
|
||||||
typename NodeBuffer<size_t, Item>::ItemPtr NodeBuffer<size_t, Item>::malloc(size_t size) {
|
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) {
|
if (m_header.size - m_header.bytesUsed >= fullSize) {
|
||||||
auto last = lastItem();
|
auto last = lastItem();
|
||||||
size_t addr = 0;
|
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
|
if (itemSize >= sizeof(T) and
|
||||||
dataStart and
|
dataStart and
|
||||||
itemStart >= minOffset and
|
itemStart >= minOffset and
|
||||||
itemStart + itemSize <= dataSize) {
|
static_cast<std::size_t>(itemStart + itemSize) <= dataSize) {
|
||||||
m_dataStart = reinterpret_cast<uint8_t*>(dataStart);
|
m_dataStart = reinterpret_cast<uint8_t*>(dataStart);
|
||||||
m_dataSize = dataSize;
|
m_dataSize = dataSize;
|
||||||
m_itemOffset = itemStart;
|
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"
|
#include "types.hpp"
|
||||||
|
|
||||||
#if !defined(OX_USE_STDLIB)
|
#if defined(_MSC_VER)
|
||||||
#define ox_alloca(size) __builtin_alloca(size)
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#define ox_alloca(size) _alloca(size)
|
#define ox_alloca(size) _alloca(size)
|
||||||
#elif __has_include(<alloca.h>)
|
#elif __has_include(<alloca.h>)
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
#define ox_alloca(size) alloca(size)
|
#define ox_alloca(size) alloca(size)
|
||||||
|
#else
|
||||||
|
#define ox_alloca(size) __builtin_alloca(size)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user