From 12b2e32abf385b3feb697c442ee79ed8b71d450b Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 22 Mar 2026 17:22:16 +0100 Subject: [FEAT] Kernel: Hybrid kernel harderning. Signed-off-by: Amlal El Mahrouss --- src/kernel/KernelKit/FileMgr.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/kernel/KernelKit/FileMgr.h') diff --git a/src/kernel/KernelKit/FileMgr.h b/src/kernel/KernelKit/FileMgr.h index 87644e68..06af3c2d 100644 --- a/src/kernel/KernelKit/FileMgr.h +++ b/src/kernel/KernelKit/FileMgr.h @@ -3,14 +3,14 @@ // Licensed under the Apache License, Version 2.0 (see LICENSE file) // Official repository: https://github.com/ne-foss-org/nekernel -#ifndef INC_FILEMGR_H -#define INC_FILEMGR_H +#ifndef KERNELKIT_FILEMGR_H +#define KERNELKIT_FILEMGR_H /// @file FileMgr.h /// @brief File Manager Subsystem. /// @author Amlal El Mahrouss (amlal@nekernel.org) -//! Include filesystems that NeKernel supports. +//! Include filesystems that the hybrid kernel supports. #include #include #include @@ -352,7 +352,7 @@ class FileStream final { /// @brief Leak MIME. /// @return The MIME. - Char* MIME() { return const_cast(fMime); } + Char* MIME() { return fMime; } enum { kFileMgrRestrictRead = 100, @@ -364,14 +364,15 @@ class FileStream final { }; private: - NodePtr fFile{nullptr}; - Int32 fFileRestrict{kFileMgrRestrictReadBinary}; - const Char* fMime{kFileMimeGeneric}; + NodePtr fFile{nullptr}; + Int32 fFileRestrict{kFileMgrRestrictReadBinary}; + Char* fMime{const_cast(kFileMimeGeneric)}; }; using FileStreamASCII = FileStream; using FileStreamUTF8 = FileStream; -using FileStreamUTF16 = FileStream; +using FileStreamUTF16 = FileStream; +using FileStreamWide = FileStream; typedef UInt64 CursorType; @@ -423,9 +424,9 @@ inline FileStream::FileStream(const Encoding* path, const Encod /// @brief destructor of the file stream. template inline FileStream::~FileStream() { - mm_free_ptr(fFile); + if (fFile) mm_free_ptr(fFile); fFile = nullptr; } } // namespace Kernel -#endif // ifndef INC_FILEMGR_H +#endif // ifndef KERNELKIT_FILEMGR_H -- cgit v1.2.3