From 861fb97cf9ad0eec28d559f37b4c3926d440bafb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Thu, 16 Oct 2008 10:05:59 +0000 Subject: [PATCH] Inline Unset and SetTo correctly. I copied the class from BFS which only uses it in a single file... Thx for the gcc4 fixes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28166 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../loader/file_systems/fat/CachedBlock.cpp | 27 +---------------- .../loader/file_systems/fat/CachedBlock.h | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/src/system/boot/loader/file_systems/fat/CachedBlock.cpp b/src/system/boot/loader/file_systems/fat/CachedBlock.cpp index 55b07a577c..1078f7a328 100644 --- a/src/system/boot/loader/file_systems/fat/CachedBlock.cpp +++ b/src/system/boot/loader/file_systems/fat/CachedBlock.cpp @@ -15,8 +15,8 @@ #include #include -#include #include +#include using namespace FATFS; @@ -47,28 +47,3 @@ CachedBlock::~CachedBlock() } -void -CachedBlock::Unset() -{ - fBlockNumber = -1; -} - - -uint8 * -CachedBlock::SetTo(off_t block) -{ - if (block == fBlockNumber) - return fBlock; - if (fBlock == NULL) { - fBlock = (uint8 *)malloc(BlockSize()); - if (fBlock == NULL) - return NULL; - } - - fBlockNumber = block; - if (read_pos(fVolume.Device(), block << BlockShift(), fBlock, BlockSize()) < (ssize_t)BlockSize()) - return NULL; - - return fBlock; -} - diff --git a/src/system/boot/loader/file_systems/fat/CachedBlock.h b/src/system/boot/loader/file_systems/fat/CachedBlock.h index 510e644e1d..4988b42615 100644 --- a/src/system/boot/loader/file_systems/fat/CachedBlock.h +++ b/src/system/boot/loader/file_systems/fat/CachedBlock.h @@ -10,6 +10,8 @@ #include #include +#include +#include #include "Volume.h" @@ -36,6 +38,34 @@ class CachedBlock { uint8 *fBlock; }; + +inline void +CachedBlock::Unset() +{ + fBlockNumber = -1; +} + + +inline uint8 * +CachedBlock::SetTo(off_t block) +{ + if (block == fBlockNumber) + return fBlock; + if (fBlock == NULL) { + fBlock = (uint8 *)malloc(BlockSize()); + if (fBlock == NULL) + return NULL; + } + + fBlockNumber = block; + if (read_pos(fVolume.Device(), block << BlockShift(), fBlock, BlockSize()) < (ssize_t)BlockSize()) + return NULL; + + return fBlock; +} + + } // namespace FATFS + #endif /* CACHED_BLOCK_H */