From af55d2db773ea1a490025813ef6c553a3e2971f3 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 14 Dec 2016 22:25:43 -0600 Subject: [PATCH 1/2] Fix several warnings and build issues. --- src/ox/fs/filesystem.hpp | 2 +- src/ox/fs/oxfstool.cpp | 2 +- src/ox/std/types.hpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ox/fs/filesystem.hpp b/src/ox/fs/filesystem.hpp index 58476c3ad..12db462dc 100644 --- a/src/ox/fs/filesystem.hpp +++ b/src/ox/fs/filesystem.hpp @@ -206,7 +206,7 @@ int FileSystemTemplate::write(uint64_t inode, void *buffer, uint64_t #endif template uint8_t *FileSystemTemplate::format(void *buffer, typename FileStore::FsSize_t size, bool useDirectories) { - buffer = FileStore::format((uint8_t*) buffer, size, FS_TYPE); + buffer = FileStore::format((uint8_t*) buffer, size, (uint32_t) FileSystemTemplate::FS_TYPE); auto fs = createFileSystem(buffer); if (buffer && useDirectories) { diff --git a/src/ox/fs/oxfstool.cpp b/src/ox/fs/oxfstool.cpp index baed8b380..c99592c01 100644 --- a/src/ox/fs/oxfstool.cpp +++ b/src/ox/fs/oxfstool.cpp @@ -70,7 +70,7 @@ uint64_t bytes(const char *str) { } } const auto retval = ((uint64_t) ::ox_atoi(copy)) * multiplier; - delete copy; + delete []copy; return retval; } diff --git a/src/ox/std/types.hpp b/src/ox/std/types.hpp index 0c62a2472..1c16af4ec 100644 --- a/src/ox/std/types.hpp +++ b/src/ox/std/types.hpp @@ -7,14 +7,14 @@ */ #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; typedef int int32_t; typedef unsigned int uint32_t; typedef unsigned uint_t; -typedef long long int64_t; +typedef long int64_t; typedef unsigned long long uint64_t; namespace ox { From cf802c7b99da2e78989bbbecf5f86ffb499f0a48 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 14 Dec 2016 22:36:03 -0600 Subject: [PATCH 2/2] 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;