From cf802c7b99da2e78989bbbecf5f86ffb499f0a48 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 14 Dec 2016 22:36:03 -0600 Subject: [PATCH 01/15] Fix a some places where space had been used instead of tabs --- src/ox/fs/filestore.hpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/ox/fs/filestore.hpp b/src/ox/fs/filestore.hpp index 84972fa6e..b21d0bb03 100644 --- a/src/ox/fs/filestore.hpp +++ b/src/ox/fs/filestore.hpp @@ -16,13 +16,13 @@ template class FileStore { public: - typedef uint16_t InodeId_t; + typedef uint16_t InodeId_t; typedef FsT FsSize_t; struct StatInfo { InodeId_t inodeId; FsSize_t size; - uint8_t fileType; + uint8_t fileType; }; private: @@ -31,13 +31,13 @@ class FileStore { FsSize_t prev, next; FsSize_t dataLen; InodeId_t id; - uint8_t refs; - uint8_t fileType; + uint8_t refs; + uint8_t fileType; FsSize_t left, right; FsSize_t size(); void setId(InodeId_t); - void setData(void *data, FsSize_t size); + void setData(void *data, FsSize_t size); void *data(); }; @@ -52,7 +52,7 @@ class FileStore { * @param data the contents of the file * @param dataLen the number of bytes data points to */ - int write(void *data, FsSize_t dataLen, uint8_t fileType = 0); + int write(void *data, FsSize_t dataLen, uint8_t fileType = 0); /** * Writes the given data to a "file" with the given id. @@ -60,7 +60,7 @@ class FileStore { * @param data the contents of the file * @param dataLen the number of bytes data points to */ - int write(InodeId_t id, void *data, FsSize_t dataLen, uint8_t fileType = 0); + int write(InodeId_t id, void *data, FsSize_t dataLen, uint8_t fileType = 0); /** * Removes the inode of the given ID. @@ -92,9 +92,9 @@ class FileStore { */ FsSize_t size(); - static uint8_t version(); - - static uint8_t *format(uint8_t *buffer, FsSize_t size, uint32_t fsType = 0); + static uint8_t version(); + + static uint8_t *format(uint8_t *buffer, FsSize_t size, uint32_t fsType = 0); private: /** @@ -166,11 +166,11 @@ class FileStore { */ void updateInodeAddress(InodeId_t id, FsSize_t addr); - uint8_t *begin() { - return (uint8_t*) this; + uint8_t *begin() { + return (uint8_t*) this; } - uint8_t *end() { + uint8_t *end() { return begin() + this->m_size; } @@ -411,10 +411,10 @@ FsSize_t FileStore::nextInodeAddr() { template void *FileStore::alloc(FsSize_t size) { FsSize_t next = nextInodeAddr(); - if ((next + size) > (uint64_t) end()) { + if ((next + size) > (uint64_t) end()) { compress(firstInode()); next = nextInodeAddr(); - if ((next + size) > (uint64_t) end()) { + if ((next + size) > (uint64_t) end()) { return nullptr; } } @@ -480,7 +480,7 @@ FsSize_t FileStore::ptr(void *ptr) { #ifdef _MSC_VER #pragma warning(disable:4244) #endif - return ((uint8_t*) ptr) - begin(); + return ((uint8_t*) ptr) - begin(); #ifdef _MSC_VER #pragma warning(default:4244) #endif @@ -512,7 +512,7 @@ uint8_t *FileStore::format(uint8_t *buffer, FsSize_t size, uint32_t fs ((Inode*) (fs + 1))->prev = fs->firstInode(); fs->lastInode()->next = sizeof(FileStore); - return (uint8_t*) buffer; + return (uint8_t*) buffer; } typedef FileStore FileStore16; From b40faa70f3dfc0762966beb9be50b9e61c174d77 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 14 Dec 2016 22:36:56 -0600 Subject: [PATCH 02/15] Fix some compiler warnings and an issue with ox_atio. --- src/ox/fs/oxfstool.cpp | 11 +++++++---- src/ox/std/strops.cpp | 2 +- src/ox/std/types.hpp | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/ox/fs/oxfstool.cpp b/src/ox/fs/oxfstool.cpp index baed8b380..4b037ce48 100644 --- a/src/ox/fs/oxfstool.cpp +++ b/src/ox/fs/oxfstool.cpp @@ -5,6 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include #include #include #include @@ -17,6 +18,7 @@ #endif using namespace ox::fs; +using namespace std; const static auto oxfstoolVersion = "1.0.0"; const static auto usage = "usage:\n" @@ -44,7 +46,7 @@ char *loadFileBuff(const char *path, ::size_t *sizeOut = nullptr) { } } -uint64_t bytes(const char *str) { +size_t bytes(const char *str) { auto size = ::ox_strlen(str); const auto lastChar = str[size-1]; auto multiplier = 1; @@ -69,7 +71,7 @@ uint64_t bytes(const char *str) { multiplier = -1; } } - const auto retval = ((uint64_t) ::ox_atoi(copy)) * multiplier; + const auto retval = ((size_t) ox_atoi(copy)) * multiplier; delete copy; return retval; } @@ -79,12 +81,13 @@ int format(int argc, char **args) { auto err = 0; if (argc >= 5) { auto type = ox_atoi(args[2]); + cout << args[3] << endl; auto size = bytes(args[3]); auto path = args[4]; auto buff = (uint8_t*) malloc(size); - printf("Size: %llu bytes\n", size); - printf("Type: %d\n", type); + cout << "Size: " << size << " bytes\n"; + cout << "Type: " << type << endl; if (size < sizeof(FileStore64)) { err = 1; diff --git a/src/ox/std/strops.cpp b/src/ox/std/strops.cpp index 1332ccc11..f1900748b 100644 --- a/src/ox/std/strops.cpp +++ b/src/ox/std/strops.cpp @@ -34,7 +34,7 @@ int ox_atoi(const char *str) { int total = 0; int multiplier = 1; - for (auto i = ox_strlen(str) - 1; i != 0; i--) { + for (auto i = ox_strlen(str) - 1; i != -1; i--) { total += (str[i] - '0') * multiplier; multiplier *= 10; } diff --git a/src/ox/std/types.hpp b/src/ox/std/types.hpp index 0c62a2472..2dbec740c 100644 --- a/src/ox/std/types.hpp +++ b/src/ox/std/types.hpp @@ -7,7 +7,7 @@ */ #pragma once -typedef char int8_t; +typedef signed char int8_t; typedef unsigned char uint8_t; typedef short int16_t; typedef unsigned short uint16_t; From c9a1310e11129ead8e9607c9d813d4a5fa18778b Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 14 Dec 2016 22:46:47 -0600 Subject: [PATCH 03/15] Fix an issue with MSVC int64 type difference --- src/ox/std/types.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ox/std/types.hpp b/src/ox/std/types.hpp index 1c16af4ec..d0a824843 100644 --- a/src/ox/std/types.hpp +++ b/src/ox/std/types.hpp @@ -14,7 +14,11 @@ typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; typedef unsigned uint_t; +#ifdef _MSC_VER +typedef long long int64_t; +#else typedef long int64_t; +#endif typedef unsigned long long uint64_t; namespace ox { From 946853628b2205ce880e2ebe1925e66e34de844f Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 14 Dec 2016 23:11:22 -0600 Subject: [PATCH 04/15] Fix compiler warnings with static vars undefined in template --- src/ox/fs/filesystem.cpp | 7 ------ src/ox/fs/filesystem.hpp | 52 +++++++++++++++++++--------------------- src/ox/fs/oxfstool.cpp | 2 +- src/ox/std/strops.cpp | 2 +- src/ox/std/strops.hpp | 2 +- src/ox/std/types.hpp | 6 +---- 6 files changed, 29 insertions(+), 42 deletions(-) diff --git a/src/ox/fs/filesystem.cpp b/src/ox/fs/filesystem.cpp index d4405c97b..7f488656b 100644 --- a/src/ox/fs/filesystem.cpp +++ b/src/ox/fs/filesystem.cpp @@ -29,12 +29,5 @@ FileSystem *createFileSystem(void *buff) { return fs; } -template<> -FsType FileSystemTemplate::FS_TYPE = OxFS_16; -template<> -FsType FileSystemTemplate::FS_TYPE = OxFS_32; -template<> -FsType FileSystemTemplate::FS_TYPE = OxFS_64; - } } diff --git a/src/ox/fs/filesystem.hpp b/src/ox/fs/filesystem.hpp index 12db462dc..800d2ebc3 100644 --- a/src/ox/fs/filesystem.hpp +++ b/src/ox/fs/filesystem.hpp @@ -49,7 +49,7 @@ class FileSystem { FileSystem *createFileSystem(void *buff); -template +template class FileSystemTemplate: public FileSystem { private: @@ -82,8 +82,6 @@ class FileSystemTemplate: public FileSystem { // static members static typename FileStore::InodeId_t INODE_ROOT_DIR; - static FsType FS_TYPE; - FileStore *store = nullptr; public: @@ -108,21 +106,21 @@ class FileSystemTemplate: public FileSystem { static uint8_t *format(void *buffer, typename FileStore::FsSize_t size, bool useDirectories); }; -template -FileSystemTemplate::FileSystemTemplate(void *buff) { +template +FileSystemTemplate::FileSystemTemplate(void *buff) { store = (FileStore*) buff; } -template -typename FileStore::InodeId_t FileSystemTemplate::INODE_ROOT_DIR = 2; +template +typename FileStore::InodeId_t FileSystemTemplate::INODE_ROOT_DIR = 2; -template -int FileSystemTemplate::mkdir(const char *path) { +template +int FileSystemTemplate::mkdir(const char *path) { return 0; } -template -FileStat FileSystemTemplate::stat(const char *path) { +template +FileStat FileSystemTemplate::stat(const char *path) { FileStat stat; return stat; } @@ -130,8 +128,8 @@ FileStat FileSystemTemplate::stat(const char *path) { #ifdef _MSC_VER #pragma warning(disable:4244) #endif -template -FileStat FileSystemTemplate::stat(uint64_t inode) { +template +FileStat FileSystemTemplate::stat(uint64_t inode) { FileStat stat; auto s = store->stat(inode); stat.size = s.size; @@ -146,8 +144,8 @@ FileStat FileSystemTemplate::stat(uint64_t inode) { #ifdef _MSC_VER #pragma warning(disable:4244) #endif -template -int FileSystemTemplate::read(uint64_t inode, void *buffer, uint64_t size) { +template +int FileSystemTemplate::read(uint64_t inode, void *buffer, uint64_t size) { auto err = 1; auto s = store->stat(inode); if (size == s.size) { @@ -162,8 +160,8 @@ int FileSystemTemplate::read(uint64_t inode, void *buffer, uint64_t s #ifdef _MSC_VER #pragma warning(disable:4244) #endif -template -uint8_t *FileSystemTemplate::read(uint64_t inode, uint64_t *size) { +template +uint8_t *FileSystemTemplate::read(uint64_t inode, uint64_t *size) { auto s = store->stat(inode); auto buff = new uint8_t[s.size]; if (size) { @@ -182,8 +180,8 @@ uint8_t *FileSystemTemplate::read(uint64_t inode, uint64_t *size) { #ifdef _MSC_VER #pragma warning(disable:4244) #endif -template -int FileSystemTemplate::remove(uint64_t inode) { +template +int FileSystemTemplate::remove(uint64_t inode) { return store->remove(inode); } #ifdef _MSC_VER @@ -193,8 +191,8 @@ int FileSystemTemplate::remove(uint64_t inode) { #ifdef _MSC_VER #pragma warning(disable:4244) #endif -template -int FileSystemTemplate::write(uint64_t inode, void *buffer, uint64_t size, uint8_t fileType) { +template +int FileSystemTemplate::write(uint64_t inode, void *buffer, uint64_t size, uint8_t fileType) { return store->write(inode, buffer, size, fileType); } #ifdef _MSC_VER @@ -204,9 +202,9 @@ int FileSystemTemplate::write(uint64_t inode, void *buffer, uint64_t #ifdef _MSC_VER #pragma warning(disable:4244) #endif -template -uint8_t *FileSystemTemplate::format(void *buffer, typename FileStore::FsSize_t size, bool useDirectories) { - buffer = FileStore::format((uint8_t*) buffer, size, (uint32_t) FileSystemTemplate::FS_TYPE); +template +uint8_t *FileSystemTemplate::format(void *buffer, typename FileStore::FsSize_t size, bool useDirectories) { + buffer = FileStore::format((uint8_t*) buffer, size, (uint32_t) FS_TYPE); auto fs = createFileSystem(buffer); if (buffer && useDirectories) { @@ -222,9 +220,9 @@ uint8_t *FileSystemTemplate::format(void *buffer, typename FileStore: #pragma warning(default:4244) #endif -typedef FileSystemTemplate FileSystem16; -typedef FileSystemTemplate FileSystem32; -typedef FileSystemTemplate FileSystem64; +typedef FileSystemTemplate FileSystem16; +typedef FileSystemTemplate FileSystem32; +typedef FileSystemTemplate FileSystem64; } } diff --git a/src/ox/fs/oxfstool.cpp b/src/ox/fs/oxfstool.cpp index 74ea5138a..4f974cccf 100644 --- a/src/ox/fs/oxfstool.cpp +++ b/src/ox/fs/oxfstool.cpp @@ -91,7 +91,7 @@ int format(int argc, char **args) { if (size < sizeof(FileStore64)) { err = 1; - fprintf(stderr, "File system size %llu too small, must be at least %llu\n", (uint64_t) size, (uint64_t) sizeof(FileStore64)); + fprintf(stderr, "File system size %lu too small, must be at least %lu\n", (uint64_t) size, (uint64_t) sizeof(FileStore64)); } if (!err) { diff --git a/src/ox/std/strops.cpp b/src/ox/std/strops.cpp index f1900748b..76c8d5c53 100644 --- a/src/ox/std/strops.cpp +++ b/src/ox/std/strops.cpp @@ -24,7 +24,7 @@ int ox_strcmp(const char *str1, const char *str2) { return retval; } -size_t ox_strlen(const char *str1) { +int ox_strlen(const char *str1) { int len; for (len = 0; str1[len]; len++); return len; diff --git a/src/ox/std/strops.hpp b/src/ox/std/strops.hpp index b67eaff39..1aa2bb095 100644 --- a/src/ox/std/strops.hpp +++ b/src/ox/std/strops.hpp @@ -11,6 +11,6 @@ int ox_strcmp(const char *str1, const char *str2); -size_t ox_strlen(const char *str1); +int ox_strlen(const char *str1); int ox_atoi(const char *str); diff --git a/src/ox/std/types.hpp b/src/ox/std/types.hpp index d0a824843..787b8dd8e 100644 --- a/src/ox/std/types.hpp +++ b/src/ox/std/types.hpp @@ -14,12 +14,8 @@ typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; typedef unsigned uint_t; -#ifdef _MSC_VER -typedef long long int64_t; -#else typedef long int64_t; -#endif -typedef unsigned long long uint64_t; +typedef unsigned long uint64_t; namespace ox { namespace std { From 747f68bb0e2ba40c70454a621849b1950aa728dc Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 14 Dec 2016 23:26:18 -0600 Subject: [PATCH 05/15] Fix memory leak in FileSystem::format --- src/ox/fs/filesystem.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ox/fs/filesystem.hpp b/src/ox/fs/filesystem.hpp index 800d2ebc3..42ccc78f3 100644 --- a/src/ox/fs/filesystem.hpp +++ b/src/ox/fs/filesystem.hpp @@ -214,6 +214,8 @@ uint8_t *FileSystemTemplate::format(void *buffer, typename F fs->write(INODE_ROOT_DIR, dirBuff, useDirectories); } + delete fs; + return (uint8_t*) buffer; } #ifdef _MSC_VER From 7d1dd8df43dd42b2b827f77af0927e40079bdb9a Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 14 Dec 2016 23:37:10 -0600 Subject: [PATCH 06/15] Eliminate heap allocation in FileSystem::format --- src/ox/fs/filesystem.hpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ox/fs/filesystem.hpp b/src/ox/fs/filesystem.hpp index 42ccc78f3..614c461aa 100644 --- a/src/ox/fs/filesystem.hpp +++ b/src/ox/fs/filesystem.hpp @@ -205,17 +205,15 @@ int FileSystemTemplate::write(uint64_t inode, void *buffer, template uint8_t *FileSystemTemplate::format(void *buffer, typename FileStore::FsSize_t size, bool useDirectories) { buffer = FileStore::format((uint8_t*) buffer, size, (uint32_t) FS_TYPE); - auto fs = createFileSystem(buffer); + FileSystemTemplate fs(buffer); if (buffer && useDirectories) { char dirBuff[sizeof(Directory) + sizeof(DirectoryEntry) + 2]; auto *dir = (Directory*) dirBuff; dir->files(); - fs->write(INODE_ROOT_DIR, dirBuff, useDirectories); + fs.write(INODE_ROOT_DIR, dirBuff, useDirectories, FileType::Directory); } - delete fs; - return (uint8_t*) buffer; } #ifdef _MSC_VER From 112ba8a708fb36774a9b976580a6da140c47b3b7 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Thu, 15 Dec 2016 00:12:41 -0600 Subject: [PATCH 07/15] Add CMake install parameters to generate complete dist --- src/ox/fs/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ox/fs/CMakeLists.txt b/src/ox/fs/CMakeLists.txt index d4233a7bb..fcb638c1b 100644 --- a/src/ox/fs/CMakeLists.txt +++ b/src/ox/fs/CMakeLists.txt @@ -21,8 +21,10 @@ install( include/ox/fs ) -install(TARGETS oxfstool +install(TARGETS oxfstool OxFS RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib ) add_subdirectory(test) From 76eb01d5f388defaccac08daa6f436626ac7a645 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 17 Dec 2016 01:24:35 -0600 Subject: [PATCH 08/15] Fix more compiler warnings for MSVC --- src/ox/fs/filesystem.hpp | 12 ++++++------ src/ox/fs/oxfstool.cpp | 6 +++--- src/ox/std/memops.cpp | 8 ++++---- src/ox/std/memops.hpp | 4 ++-- src/ox/std/types.hpp | 6 ++++-- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/ox/fs/filesystem.hpp b/src/ox/fs/filesystem.hpp index 614c461aa..1579022a4 100644 --- a/src/ox/fs/filesystem.hpp +++ b/src/ox/fs/filesystem.hpp @@ -36,9 +36,9 @@ class FileSystem { public: virtual ~FileSystem() {}; - virtual int read(uint64_t inode, void *buffer, uint64_t size) = 0; + virtual int read(uint64_t inode, void *buffer, size_t size) = 0; - virtual uint8_t *read(uint64_t inode, uint64_t *size) = 0; + virtual uint8_t *read(uint64_t inode, size_t *size) = 0; virtual int remove(uint64_t inode) = 0; @@ -91,9 +91,9 @@ class FileSystemTemplate: public FileSystem { int read(const char *path, void *buffer); - uint8_t *read(uint64_t inode, uint64_t *size) override; + uint8_t *read(uint64_t inode, size_t *size) override; - int read(uint64_t inode, void *buffer, uint64_t size) override; + int read(uint64_t inode, void *buffer, size_t size) override; int remove(uint64_t inode) override; @@ -145,7 +145,7 @@ FileStat FileSystemTemplate::stat(uint64_t inode) { #pragma warning(disable:4244) #endif template -int FileSystemTemplate::read(uint64_t inode, void *buffer, uint64_t size) { +int FileSystemTemplate::read(uint64_t inode, void *buffer, size_t size) { auto err = 1; auto s = store->stat(inode); if (size == s.size) { @@ -161,7 +161,7 @@ int FileSystemTemplate::read(uint64_t inode, void *buffer, u #pragma warning(disable:4244) #endif template -uint8_t *FileSystemTemplate::read(uint64_t inode, uint64_t *size) { +uint8_t *FileSystemTemplate::read(uint64_t inode, size_t *size) { auto s = store->stat(inode); auto buff = new uint8_t[s.size]; if (size) { diff --git a/src/ox/fs/oxfstool.cpp b/src/ox/fs/oxfstool.cpp index 4f974cccf..5a420f037 100644 --- a/src/ox/fs/oxfstool.cpp +++ b/src/ox/fs/oxfstool.cpp @@ -91,7 +91,7 @@ int format(int argc, char **args) { if (size < sizeof(FileStore64)) { err = 1; - fprintf(stderr, "File system size %lu too small, must be at least %lu\n", (uint64_t) size, (uint64_t) sizeof(FileStore64)); + cerr << "File system size " << size << " too small, must be at least " << sizeof(FileStore64) << endl; } if (!err) { @@ -139,8 +139,8 @@ int read(int argc, char **args) { if (argc >= 4) { auto fsPath = args[2]; auto inode = ox_atoi(args[3]); - ::size_t fsSize; - uint64_t fileSize; + size_t fsSize; + size_t fileSize; auto fsBuff = loadFileBuff(fsPath, &fsSize); diff --git a/src/ox/std/memops.cpp b/src/ox/std/memops.cpp index fc91a3664..b58713f37 100644 --- a/src/ox/std/memops.cpp +++ b/src/ox/std/memops.cpp @@ -7,18 +7,18 @@ */ #include "memops.hpp" -void *ox_memcpy(void *dest, const void *src, size_t size) { +void *ox_memcpy(void *dest, const void *src, int64_t size) { char *srcBuf = (char*) src; char *dstBuf = (char*) dest; - for (size_t i = 0; i < size; i++) { + for (int64_t i = 0; i < size; i++) { dstBuf[i] = (char) srcBuf[i]; } return dest; } -void *ox_memset(void *ptr, int val, size_t size) { +void *ox_memset(void *ptr, int val, int64_t size) { char *buf = (char*) ptr; - for (size_t i = 0; i < size; i++) { + for (int64_t i = 0; i < size; i++) { buf[i] = val; } return ptr; diff --git a/src/ox/std/memops.hpp b/src/ox/std/memops.hpp index 490c2c3cb..d6b1dc9e1 100644 --- a/src/ox/std/memops.hpp +++ b/src/ox/std/memops.hpp @@ -9,6 +9,6 @@ #include "types.hpp" -void *ox_memcpy(void *src, const void *dest, size_t size); +void *ox_memcpy(void *src, const void *dest, int64_t size); -void *ox_memset(void *ptr, int val, size_t size); +void *ox_memset(void *ptr, int val, int64_t size); diff --git a/src/ox/std/types.hpp b/src/ox/std/types.hpp index 787b8dd8e..6d03aa47c 100644 --- a/src/ox/std/types.hpp +++ b/src/ox/std/types.hpp @@ -14,8 +14,6 @@ typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; typedef unsigned uint_t; -typedef long int64_t; -typedef unsigned long uint64_t; namespace ox { namespace std { @@ -28,8 +26,12 @@ typedef uint32_t Error; #if defined(_LP64) || defined(__ppc64__) || defined(__aarch64__) typedef unsigned long size_t; #elif defined(_WIN64) +typedef long int64_t; +typedef unsigned long uint64_t; typedef uint64_t size_t; #elif defined(_LP32) || defined(__ppc__) || defined(_WIN32) || defined(__arm__) +typedef long long int64_t; +typedef unsigned long long uint64_t; typedef uint32_t size_t; #else #error size_t undefined From e8b27d6935dcb0a2d96bc56f3eea2831672c62af Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 17 Dec 2016 13:05:39 -0600 Subject: [PATCH 09/15] Better define the u/int64 types between different compilers --- src/ox/std/types.hpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ox/std/types.hpp b/src/ox/std/types.hpp index 6d03aa47c..83fcf4c91 100644 --- a/src/ox/std/types.hpp +++ b/src/ox/std/types.hpp @@ -14,6 +14,13 @@ typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; typedef unsigned uint_t; +#ifdef _MSC_VER +typedef long int64_t; +typedef unsigned long uint64_t; +#else +typedef long long int64_t; +typedef unsigned long long uint64_t; +#endif namespace ox { namespace std { @@ -26,12 +33,8 @@ typedef uint32_t Error; #if defined(_LP64) || defined(__ppc64__) || defined(__aarch64__) typedef unsigned long size_t; #elif defined(_WIN64) -typedef long int64_t; -typedef unsigned long uint64_t; typedef uint64_t size_t; #elif defined(_LP32) || defined(__ppc__) || defined(_WIN32) || defined(__arm__) -typedef long long int64_t; -typedef unsigned long long uint64_t; typedef uint32_t size_t; #else #error size_t undefined From 1de6e6efe636db5f4bf5ad7028c0049d4dbc0063 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 17 Dec 2016 13:30:12 -0600 Subject: [PATCH 10/15] Fix types.hpp issues --- src/ox/std/types.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ox/std/types.hpp b/src/ox/std/types.hpp index 83fcf4c91..bc4a2607e 100644 --- a/src/ox/std/types.hpp +++ b/src/ox/std/types.hpp @@ -14,12 +14,12 @@ typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; typedef unsigned uint_t; -#ifdef _MSC_VER -typedef long int64_t; -typedef unsigned long uint64_t; -#else +#if defined(_MSC_VER) || defined(__APPLE__) typedef long long int64_t; typedef unsigned long long uint64_t; +#else +typedef long int64_t; +typedef unsigned long uint64_t; #endif namespace ox { From 931b3fa3cb1b9730f126cdce0ca11a8633c6bc8b Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 17 Dec 2016 14:36:06 -0600 Subject: [PATCH 11/15] Split out make lines cibuild script --- scripts/cibuild | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/cibuild b/scripts/cibuild index 6562daa02..53a64eba9 100755 --- a/scripts/cibuild +++ b/scripts/cibuild @@ -1,5 +1,7 @@ #! /usr/bin/env sh ./scripts/setup_build ./scripts/setup_build_debug -make -j -C build/release all test -make -j -C build/debug all test +make -j -C build/release all +make -j -C build/release test +make -j -C build/debug all +make -j -C build/debug test From cc10689d57c4d80a47eef6a254ec646dfd5ca1a1 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 17 Dec 2016 14:39:05 -0600 Subject: [PATCH 12/15] Add set -e to cibuild script --- scripts/cibuild | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/cibuild b/scripts/cibuild index 53a64eba9..87ccd5c31 100755 --- a/scripts/cibuild +++ b/scripts/cibuild @@ -1,4 +1,7 @@ -#! /usr/bin/env sh +#! /usr/bin/env bash + +set -e + ./scripts/setup_build ./scripts/setup_build_debug make -j -C build/release all From c1eca6afcc47deb16324b3c8e3b2904176d1d58c Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 17 Dec 2016 14:43:52 -0600 Subject: [PATCH 13/15] Add gcc to .travis.yml --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 71360922f..98e6d5b89 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ language: cpp -compiler: clang +compiler: + - clang + - gcc install: - sudo apt-get install cmake script: ./scripts/cibuild From bd00a27e2977ed8f527ca0dde86a55ab42eca15d Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 17 Dec 2016 19:54:06 -0600 Subject: [PATCH 14/15] Make .travis.yml a container based builder --- .travis.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 98e6d5b89..5e75854bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,9 @@ language: cpp +sudo: false compiler: - clang - - gcc -install: - - sudo apt-get install cmake +addons: + apt: + packages: + - cmake script: ./scripts/cibuild From f6e7fd367d5420865e89e688409da7d1b10fc0e6 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 17 Dec 2016 20:00:27 -0600 Subject: [PATCH 15/15] Add dist: trusty to .travis.yml --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 5e75854bd..3c7d22c4b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,9 @@ language: cpp sudo: false +dist: trusty compiler: - clang + - gcc addons: apt: packages: