[ox] Replace __attribute__((packed)) with OX_PACKED
This commit is contained in:
parent
1499f42361
commit
8c576ef9c5
@ -23,7 +23,7 @@ struct StatInfo {
|
||||
};
|
||||
|
||||
template<typename size_t>
|
||||
struct __attribute__((packed)) FileStoreItem: public ptrarith::Item<size_t> {
|
||||
struct OX_PACKED FileStoreItem: public ptrarith::Item<size_t> {
|
||||
ox::LittleEndian<size_t> id = 0;
|
||||
ox::LittleEndian<uint8_t> fileType = 0;
|
||||
ox::LittleEndian<size_t> links = 0;
|
||||
@ -64,7 +64,7 @@ class FileStoreTemplate {
|
||||
static constexpr InodeId_t ReservedInodeEnd = 100;
|
||||
static constexpr auto MaxInode = MaxValue<size_t> / 2;
|
||||
|
||||
struct __attribute__((packed)) FileStoreData {
|
||||
struct OX_PACKED FileStoreData {
|
||||
ox::LittleEndian<size_t> rootNode = 0;
|
||||
ox::Random random;
|
||||
};
|
||||
|
4
deps/ox/src/ox/fs/filesystem/directory.hpp
vendored
4
deps/ox/src/ox/fs/filesystem/directory.hpp
vendored
@ -16,10 +16,10 @@
|
||||
namespace ox {
|
||||
|
||||
template<typename InodeId_t>
|
||||
struct __attribute__((packed)) DirectoryEntry {
|
||||
struct OX_PACKED DirectoryEntry {
|
||||
|
||||
public:
|
||||
struct __attribute__((packed)) DirectoryEntryData {
|
||||
struct OX_PACKED DirectoryEntryData {
|
||||
// DirectoryEntry fields
|
||||
LittleEndian<InodeId_t> inode = 0;
|
||||
char name[MaxFileNameLength];
|
||||
|
2
deps/ox/src/ox/fs/filesystem/filesystem.hpp
vendored
2
deps/ox/src/ox/fs/filesystem/filesystem.hpp
vendored
@ -89,7 +89,7 @@ class FileSystemTemplate: public FileSystem {
|
||||
private:
|
||||
static constexpr auto InodeFsData = 2;
|
||||
|
||||
struct __attribute__((packed)) FileSystemData {
|
||||
struct OX_PACKED FileSystemData {
|
||||
LittleEndian<typename FileStore::InodeId_t> rootDirInode;
|
||||
};
|
||||
|
||||
|
7
deps/ox/src/ox/ptrarith/nodebuffer.hpp
vendored
7
deps/ox/src/ox/ptrarith/nodebuffer.hpp
vendored
@ -8,6 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ox/std/stddef.hpp>
|
||||
#include <ox/std/trace.hpp>
|
||||
|
||||
#include "ptr.hpp"
|
||||
@ -15,10 +16,10 @@
|
||||
namespace ox::ptrarith {
|
||||
|
||||
template<typename size_t, typename Item>
|
||||
class __attribute__((packed)) NodeBuffer {
|
||||
class OX_PACKED NodeBuffer {
|
||||
|
||||
public:
|
||||
struct __attribute__((packed)) Header {
|
||||
struct OX_PACKED Header {
|
||||
ox::LittleEndian<size_t> size = sizeof(Header); // capacity
|
||||
ox::LittleEndian<size_t> bytesUsed = sizeof(Header);
|
||||
ox::LittleEndian<size_t> firstItem = 0;
|
||||
@ -433,7 +434,7 @@ uint8_t *NodeBuffer<size_t, Item>::data() {
|
||||
|
||||
|
||||
template<typename size_t>
|
||||
struct __attribute__((packed)) Item {
|
||||
struct OX_PACKED Item {
|
||||
public:
|
||||
ox::LittleEndian<size_t> prev = 0;
|
||||
ox::LittleEndian<size_t> next = 0;
|
||||
|
2
deps/ox/src/ox/ptrarith/test/tests.cpp
vendored
2
deps/ox/src/ox/ptrarith/test/tests.cpp
vendored
@ -26,7 +26,7 @@ using namespace std;
|
||||
using namespace ox;
|
||||
|
||||
template<typename T>
|
||||
struct __attribute__((packed)) NodeType: public ox::ptrarith::Item<T> {
|
||||
struct OX_PACKED NodeType: public ox::ptrarith::Item<T> {
|
||||
public:
|
||||
size_t fullSize() const {
|
||||
return this->size() + sizeof(*this);
|
||||
|
3
deps/ox/src/ox/std/byteswap.hpp
vendored
3
deps/ox/src/ox/std/byteswap.hpp
vendored
@ -9,6 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "defines.hpp"
|
||||
#include "stddef.hpp"
|
||||
#include "types.hpp"
|
||||
#include "typetraits.hpp"
|
||||
|
||||
@ -58,7 +59,7 @@ template<typename T, bool byteSwap>
|
||||
}
|
||||
|
||||
template<typename T, bool byteSwap>
|
||||
class __attribute__((packed)) ByteSwapInteger {
|
||||
class OX_PACKED ByteSwapInteger {
|
||||
private:
|
||||
T m_value;
|
||||
|
||||
|
3
deps/ox/src/ox/std/random.hpp
vendored
3
deps/ox/src/ox/std/random.hpp
vendored
@ -8,13 +8,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "stddef.hpp"
|
||||
#include "types.hpp"
|
||||
|
||||
namespace ox {
|
||||
|
||||
using RandomSeed = uint64_t[2];
|
||||
|
||||
class __attribute__((packed)) Random {
|
||||
class OX_PACKED Random {
|
||||
private:
|
||||
RandomSeed m_seed;
|
||||
|
||||
|
6
deps/ox/src/ox/std/stddef.hpp
vendored
6
deps/ox/src/ox/std/stddef.hpp
vendored
@ -13,3 +13,9 @@
|
||||
#else
|
||||
#define offsetof(type, member) __builtin_offsetof(type, member)
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define OX_PACKED
|
||||
#else
|
||||
#define OX_PACKED __attribute__((packed))
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user