diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-29 15:01:34 -0500 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-29 15:01:34 -0500 |
| commit | ceabd82ac8e796249feacf39c836034ed5e11c6d (patch) | |
| tree | e446d471a0eaf4ed7ac67e878ce4fb02334a2acb /public | |
| parent | 0376382a848ef5ebbb0e02428c9d1df8a099d8b4 (diff) | |
chore: source code review and fixes.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'public')
12 files changed, 43 insertions, 43 deletions
diff --git a/public/frameworks/CoreFoundation.fwrk/headers/Foundation.h b/public/frameworks/CoreFoundation.fwrk/headers/Foundation.h index 68b00264..a8a31559 100644 --- a/public/frameworks/CoreFoundation.fwrk/headers/Foundation.h +++ b/public/frameworks/CoreFoundation.fwrk/headers/Foundation.h @@ -69,8 +69,8 @@ struct CFRect final { operator bool(); - BOOL SizeMatches(CFRect& rect) noexcept; - BOOL PositionMatches(CFRect& rect) noexcept; + BOOL SizeMatches(CFRect& rect); + BOOL PositionMatches(CFRect& rect); }; union CFGUID final { diff --git a/public/frameworks/CoreFoundation.fwrk/headers/Property.h b/public/frameworks/CoreFoundation.fwrk/headers/Property.h index b8784f68..d16f7742 100644 --- a/public/frameworks/CoreFoundation.fwrk/headers/Property.h +++ b/public/frameworks/CoreFoundation.fwrk/headers/Property.h @@ -42,12 +42,11 @@ class CFProperty final CF_OBJECT { CFString& GetKey(); private: - CFString* fName{nullptr}; - CFPropertyId fValue{0UL}; - CFRef<CFGUID> fGUID{}; + CFString* fName{nullptr}; + CFPropertyId fValue{0UL}; + CFRef<CFGUID> fGUID{}; }; template <SizeT N> using CFPropertyArray = CFArray<CFProperty, N>; } // namespace CF - diff --git a/public/frameworks/CoreFoundation.fwrk/headers/Ref.h b/public/frameworks/CoreFoundation.fwrk/headers/Ref.h index 6757daac..0bc728ce 100644 --- a/public/frameworks/CoreFoundation.fwrk/headers/Ref.h +++ b/public/frameworks/CoreFoundation.fwrk/headers/Ref.h @@ -44,16 +44,16 @@ class CFRef final CF_OBJECT { return *fClass; } - T& Leak() noexcept { return *fClass; } + T& Leak() { return *fClass; } - T& TryLeak() const noexcept { + T& TryLeak() const { MUST_PASS(*fClass); return *fClass; } T operator*() { return *fClass; } - operator bool() noexcept { return fClass; } + operator bool() { return fClass; } private: T* fClass{nullptr}; @@ -83,4 +83,3 @@ class CFNonNullRef final { CFRef<T> fRef{nullptr}; }; } // namespace CF - diff --git a/public/frameworks/CoreFoundation.fwrk/headers/String.h b/public/frameworks/CoreFoundation.fwrk/headers/String.h index 247d3894..2a44d1cb 100644 --- a/public/frameworks/CoreFoundation.fwrk/headers/String.h +++ b/public/frameworks/CoreFoundation.fwrk/headers/String.h @@ -19,7 +19,7 @@ class CFStringBuilder; class CFString final CF_OBJECT { public: CFString() = delete; - + explicit CFString(const SizeT sz); explicit CFString(const Char* str); @@ -40,7 +40,7 @@ class CFStringBuilder final { public: static CFRef<CFString> Construct(const Char*); static const Char* FromBool(const Char*, BOOL); - static const Char* Format(const Char*, const Char*); + static const Char* Format(const Char*, const Char*); static BOOL Equals(const Char, const Char*); static BOOL Equals(const Char*, const Char*); diff --git a/public/frameworks/CoreFoundation.fwrk/src/Foundation.cc b/public/frameworks/CoreFoundation.fwrk/src/Foundation.cc index e5de94a7..d50dbd7b 100644 --- a/public/frameworks/CoreFoundation.fwrk/src/Foundation.cc +++ b/public/frameworks/CoreFoundation.fwrk/src/Foundation.cc @@ -16,14 +16,14 @@ CF::CFRect::operator bool() { /***********************************************************************************/ /// @brief returns true if size matches. /***********************************************************************************/ -BOOL CF::CFRect::SizeMatches(CF::CFRect& rect) noexcept { +BOOL CF::CFRect::SizeMatches(CF::CFRect& rect) { return rect.height == height && rect.width == width; } /***********************************************************************************/ /// @brief returns true if position matches. /***********************************************************************************/ -BOOL CF::CFRect::PositionMatches(CF::CFRect& rect) noexcept { +BOOL CF::CFRect::PositionMatches(CF::CFRect& rect) { return rect.y == y && rect.x == x; } diff --git a/public/frameworks/DiskImage.fwrk/headers/DiskImage.h b/public/frameworks/DiskImage.fwrk/headers/DiskImage.h index 01cfc04a..9028592d 100644 --- a/public/frameworks/DiskImage.fwrk/headers/DiskImage.h +++ b/public/frameworks/DiskImage.fwrk/headers/DiskImage.h @@ -45,16 +45,16 @@ struct DI_DISK_IMAGE { /// @brief Format with an EPM partition. /// @param img disk image structure. /// @return Status code upon completion. -SInt32 DIFormatPartitionEPM(struct DI_DISK_IMAGE& img) noexcept; +SInt32 DIFormatPartitionEPM(struct DI_DISK_IMAGE& img); /// @brief NeFS format over EPM. /// @param img disk image structure. /// @return Status code upon completion. -SInt32 DIFormatFilesystemNeFS(struct DI_DISK_IMAGE& img) noexcept; +SInt32 DIFormatFilesystemNeFS(struct DI_DISK_IMAGE& img); /// @brief OpenHeFS format over EPM. /// @param img disk image structure. /// @return Status code upon completion. -SInt32 DIFormatFilesystemHeFS(struct DI_DISK_IMAGE& img) noexcept; +SInt32 DIFormatFilesystemHeFS(struct DI_DISK_IMAGE& img); } // namespace DI diff --git a/public/frameworks/DiskImage.fwrk/src/DiskImage+EPM.cc b/public/frameworks/DiskImage.fwrk/src/DiskImage+EPM.cc index 28c0cd7d..ab533e20 100644 --- a/public/frameworks/DiskImage.fwrk/src/DiskImage+EPM.cc +++ b/public/frameworks/DiskImage.fwrk/src/DiskImage+EPM.cc @@ -15,7 +15,7 @@ /// @brief EPM format disk /// @param img disk image structure. /// @return Status code upon completion. -SInt32 DI::DIFormatPartitionEPM(struct DI_DISK_IMAGE& img) noexcept { +SInt32 DI::DIFormatPartitionEPM(struct DI_DISK_IMAGE& img) { if (!img.sector_sz || (img.sector_sz % 512 != 0)) return kDIFailureStatus; if (!img.fs_version) return kDIFailureStatus; if (*img.out_name == 0 || *img.disk_name == 0) return kDIFailureStatus; diff --git a/public/frameworks/DiskImage.fwrk/src/DiskImage+HeFS.cc b/public/frameworks/DiskImage.fwrk/src/DiskImage+HeFS.cc index 297650dc..f57de649 100644 --- a/public/frameworks/DiskImage.fwrk/src/DiskImage+HeFS.cc +++ b/public/frameworks/DiskImage.fwrk/src/DiskImage+HeFS.cc @@ -15,7 +15,7 @@ /// @brief format OpenHeFS over an EPM disk. /// @param img disk image structure. /// @return Status code upon completion. -SInt32 DI::DIFormatFilesystemHeFS(struct DI_DISK_IMAGE& img) noexcept { +SInt32 DI::DIFormatFilesystemHeFS(struct DI_DISK_IMAGE& img) { if (!img.sector_sz || (img.sector_sz % kDISectorSz != 0)) return kDIFailureStatus; if (*img.out_name == 0 || *img.disk_name == 0) return kDIFailureStatus; diff --git a/public/frameworks/DiskImage.fwrk/src/DiskImage+NeFS.cc b/public/frameworks/DiskImage.fwrk/src/DiskImage+NeFS.cc index 30c20cf7..562eb598 100644 --- a/public/frameworks/DiskImage.fwrk/src/DiskImage+NeFS.cc +++ b/public/frameworks/DiskImage.fwrk/src/DiskImage+NeFS.cc @@ -15,7 +15,7 @@ /// @brief format NeFS over an EPM disk. /// @param img disk image structure. /// @return Status code upon completion. -SInt32 DI::DIFormatFilesystemNeFS(struct DI_DISK_IMAGE& img) noexcept { +SInt32 DI::DIFormatFilesystemNeFS(struct DI_DISK_IMAGE& img) { if (!img.sector_sz || (img.sector_sz % kDISectorSz != 0)) return kDIFailureStatus; if (*img.out_name == 0 || *img.disk_name == 0) return kDIFailureStatus; diff --git a/public/frameworks/KernelTest.fwrk/headers/TestCase.h b/public/frameworks/KernelTest.fwrk/headers/TestCase.h index c040ca0f..26325d42 100644 --- a/public/frameworks/KernelTest.fwrk/headers/TestCase.h +++ b/public/frameworks/KernelTest.fwrk/headers/TestCase.h @@ -13,7 +13,10 @@ /// @file TestCase.h /// ================================================================================ -#define KT_RUN_TEST(OBJECT) {KTTestCase##OBJECT{}.Run();} +#define KT_RUN_TEST(OBJECT) \ + { \ + KTTestCase##OBJECT{}.Run(); \ + } #define KT_MUST_PASS(MSG, LEFT_COND, RIGHT_COND) \ if (LEFT_COND != RIGHT_COND) { \ diff --git a/public/frameworks/LaunchHelpers.fwrk/headers/Foundation.h b/public/frameworks/LaunchHelpers.fwrk/headers/Foundation.h index de4e6b09..36ce50ac 100644 --- a/public/frameworks/LaunchHelpers.fwrk/headers/Foundation.h +++ b/public/frameworks/LaunchHelpers.fwrk/headers/Foundation.h @@ -25,5 +25,5 @@ struct LHLaunchInfo final { /// @brief Get launch information. /// @return the launch information structure. -LHLaunchInfo* LHGetLaunchInfo(Void) noexcept; +LHLaunchInfo* LHGetLaunchInfo(Void); } // namespace LaunchHelpers
\ No newline at end of file diff --git a/public/tools/diutil/vendor/Dialogs.h b/public/tools/diutil/vendor/Dialogs.h index a59bada3..e5e6d83a 100644 --- a/public/tools/diutil/vendor/Dialogs.h +++ b/public/tools/diutil/vendor/Dialogs.h @@ -175,7 +175,7 @@ namespace internal { #elif __EMSCRIPTEN__ void start(int exit_code); #else - void start_process(std::vector<std::string> const& command); + void start_process(std::vector<std::string> const& command); #endif ~executor(); @@ -490,10 +490,10 @@ inline settings::settings(bool resync) { #if _WIN32 flags(flag::is_vista) = internal::is_vista(); #elif !__APPLE__ - flags(flag::has_zenity) = check_program("zenity"); + flags(flag::has_zenity) = check_program("zenity"); flags(flag::has_matedialog) = check_program("matedialog"); - flags(flag::has_qarma) = check_program("qarma"); - flags(flag::has_kdialog) = check_program("kdialog"); + flags(flag::has_qarma) = check_program("qarma"); + flags(flag::has_kdialog) = check_program("kdialog"); // If multiple helpers are available, try to default to the best one if (flags(flag::has_zenity) && flags(flag::has_kdialog)) { @@ -540,7 +540,7 @@ inline bool settings::check_program(std::string const& program) { (void) program; return false; #else - int exit_code = -1; + int exit_code = -1; internal::executor async; async.start_process({"/bin/sh", "-c", "which " + program}); async.result(&exit_code); @@ -604,7 +604,7 @@ inline std::string path::home() { if (size_max != -1) len = size_t(size_max); #endif std::vector<char> buf(len); - struct passwd pwd, *result; + struct passwd pwd, *result; if (getpwuid_r(getuid(), &pwd, buf.data(), buf.size(), &result) == 0) return result->pw_dir; #endif return "/"; @@ -717,7 +717,7 @@ inline void internal::executor::start_process(std::vector<std::string> const& co } close(in[1]); - m_fd = out[0]; + m_fd = out[0]; auto flags = fcntl(m_fd, F_GETFL); fcntl(m_fd, F_SETFL, flags | O_NONBLOCK); @@ -753,7 +753,7 @@ inline bool internal::executor::ready(int timeout /* = default_wait_timeout */) // FIXME: do something (void) timeout; #else - char buf[BUFSIZ]; + char buf[BUFSIZ]; ssize_t received = read(m_fd, buf, BUFSIZ); // Flawfinder: ignore if (received > 0) { m_stdout += std::string(buf, received); @@ -764,7 +764,7 @@ inline bool internal::executor::ready(int timeout /* = default_wait_timeout */) // (this happens when the calling application handles or ignores SIG_CHLD) and results in // waitpid() failing with ECHILD. Otherwise we assume the child is running and we sleep for // a little while. - int status; + int status; pid_t child = waitpid(m_pid, &status, WNOHANG); if (child != m_pid && (child >= 0 || errno != ECHILD)) { // FIXME: this happens almost always at first iteration @@ -782,8 +782,7 @@ inline bool internal::executor::ready(int timeout /* = default_wait_timeout */) inline void internal::executor::stop() { // Loop until the user closes the dialog - while (!ready()) - ; + while (!ready()); } // dll implementation @@ -879,11 +878,11 @@ inline std::vector<std::string> internal::dialog::desktop_helper() const { #if __APPLE__ return {"osascript"}; #else - return {flags(flag::has_zenity) ? "zenity" + return {flags(flag::has_zenity) ? "zenity" : flags(flag::has_matedialog) ? "matedialog" - : flags(flag::has_qarma) ? "qarma" - : flags(flag::has_kdialog) ? "kdialog" - : "echo"}; + : flags(flag::has_qarma) ? "qarma" + : flags(flag::has_kdialog) ? "kdialog" + : "echo"}; #endif } @@ -1125,9 +1124,9 @@ inline internal::file_dialog::file_dialog(type in_type, std::string const& title // Split the pattern list to check whether "*" is in there; if it // is, we have to disable filters because there is no mechanism in // OS X for the user to override the filter. - std::regex sep("\\s+"); - std::string filter_list; - bool has_filter = true; + std::regex sep("\\s+"); + std::string filter_list; + bool has_filter = true; std::sregex_token_iterator iter(patterns.begin(), patterns.end(), sep, -1); std::sregex_token_iterator end; for (; iter != end; ++iter) { @@ -1236,7 +1235,7 @@ inline std::vector<std::string> internal::file_dialog::vector_result() { return m_vector_result; #else std::vector<std::string> ret; - auto result = m_async->result(); + auto result = m_async->result(); for (;;) { // Split result along newline characters auto i = result.find('\n'); @@ -1569,7 +1568,7 @@ inline message::message(std::string const& title, std::string const& text, if_cancel = button::ok; break; } - m_mappings[1] = if_cancel; + m_mappings[1] = if_cancel; m_mappings[256] = if_cancel; // XXX: I think this was never correct script += " with icon "; switch (_icon) { @@ -1656,7 +1655,7 @@ inline message::message(std::string const& title, std::string const& text, if (_choice == choice::yes_no_cancel) flag += "cancel"; command.push_back(flag); if (_choice == choice::yes_no || _choice == choice::yes_no_cancel) { - m_mappings[0] = button::yes; + m_mappings[0] = button::yes; m_mappings[256] = button::no; } } |
