From ce0ca9a711fc77fc0334297f828458302ebfc2cd Mon Sep 17 00:00:00 2001 From: src-dev Date: Thu, 4 Dec 2025 18:49:17 -0800 Subject: [PATCH] #pragma once cleanup --- AppActions.h | 1 + ContextMenu.h | 1 + Daemon-X.vcxproj | 2 -- Daemon-X.vcxproj.filters | 3 --- FileBrowserApp.h | 5 +---- FsUtil.h | 8 +++----- GfxPrims.h | 1 + OnScreenKeyboard.h | 1 + PaneModel.h | 7 ++----- PaneRenderer.h | 5 +---- unzipLIBUtil.h | 5 +---- xpatchlib/xpatchlib.cpp | 7 ++++--- xpatchlib/xpatchlib.h | 11 ++++------- xpatchlibUtil.cpp | 9 ++++----- xpatchlibUtil.h | 7 ++----- 15 files changed, 26 insertions(+), 47 deletions(-) diff --git a/AppActions.h b/AppActions.h index d08977a..c8b047c 100644 --- a/AppActions.h +++ b/AppActions.h @@ -1,4 +1,5 @@ #pragma once + #include "PaneModel.h" #include "FsUtil.h" diff --git a/ContextMenu.h b/ContextMenu.h index 0fd1780..08009e9 100644 --- a/ContextMenu.h +++ b/ContextMenu.h @@ -1,4 +1,5 @@ #pragma once + #include #include "XBFont.h" #include "XBInput.h" diff --git a/Daemon-X.vcxproj b/Daemon-X.vcxproj index fe4038d..39614ad 100644 --- a/Daemon-X.vcxproj +++ b/Daemon-X.vcxproj @@ -50,10 +50,8 @@ - - diff --git a/Daemon-X.vcxproj.filters b/Daemon-X.vcxproj.filters index a5e3e85..a0167ae 100644 --- a/Daemon-X.vcxproj.filters +++ b/Daemon-X.vcxproj.filters @@ -197,9 +197,6 @@ Header Files - - Header Files - Header Files diff --git a/FileBrowserApp.h b/FileBrowserApp.h index 8f641a6..9db48d8 100644 --- a/FileBrowserApp.h +++ b/FileBrowserApp.h @@ -1,5 +1,4 @@ -#ifndef FILEBROWSERAPP_H -#define FILEBROWSERAPP_H +#pragma once /* =============================================================================== @@ -182,5 +181,3 @@ private: FLOAT kPaddingX; // left/right text padding inside pane FLOAT kScrollBarW; // scrollbar track width }; - -#endif // FILEBROWSERAPP_H diff --git a/FsUtil.h b/FsUtil.h index 934b626..99f5c6d 100644 --- a/FsUtil.h +++ b/FsUtil.h @@ -1,5 +1,5 @@ -#ifndef FSUTIL_H -#define FSUTIL_H +#pragma once + /* ============================================================================ FsUtil @@ -124,6 +124,4 @@ int DvdDetectMediaSimple(char* outLabel, size_t cap); DWORD DvdGetDriveStateOneShot(void); // Drop old CDFS instance and remap D: cleanly; touches D:\ to force a fresh view. -void DvdColdRemount(); - -#endif // FSUTIL_H +void DvdColdRemount(); \ No newline at end of file diff --git a/GfxPrims.h b/GfxPrims.h index 9db44a0..1af8dd0 100644 --- a/GfxPrims.h +++ b/GfxPrims.h @@ -1,4 +1,5 @@ #pragma once + #include // Transformed/lit vertex for solid rects diff --git a/OnScreenKeyboard.h b/OnScreenKeyboard.h index 9d1fd66..11a2d57 100644 --- a/OnScreenKeyboard.h +++ b/OnScreenKeyboard.h @@ -1,4 +1,5 @@ #pragma once + #include #include #include diff --git a/PaneModel.h b/PaneModel.h index 9630de8..e1a13cd 100644 --- a/PaneModel.h +++ b/PaneModel.h @@ -1,5 +1,4 @@ -#ifndef PANEMODEL_H -#define PANEMODEL_H +#pragma once #include #include "FsUtil.h" @@ -12,6 +11,4 @@ struct Pane { int sel; int scroll; Pane(){ curPath[0]=0; mode=0; sel=0; scroll=0; } -}; - -#endif // PANEMODEL_H +}; \ No newline at end of file diff --git a/PaneRenderer.h b/PaneRenderer.h index 66d8123..2841517 100644 --- a/PaneRenderer.h +++ b/PaneRenderer.h @@ -1,5 +1,4 @@ -#ifndef PANERENDERER_H -#define PANERENDERER_H +#pragma once #include #include "XBFont.h" @@ -108,5 +107,3 @@ private: // Shared width backing field static FLOAT s_sharedSizeColW; }; - -#endif // PANERENDERER_H diff --git a/unzipLIBUtil.h b/unzipLIBUtil.h index 87917c3..e4a267a 100644 --- a/unzipLIBUtil.h +++ b/unzipLIBUtil.h @@ -1,5 +1,4 @@ -#ifndef UNZIPLIBUTIL_H -#define UNZIPLIBUTIL_H +#pragma once #include "unzipLIB.h" #include "FileBrowserApp.h" @@ -21,5 +20,3 @@ int32_t ZipFile_Seek(void* p, int32_t position, int iType); int ExtractCurrentFileWithProgress(UNZIP* zip, const char* dst, bool overwrite); void FreeUnZipBuffer(); - -#endif // UNZIPLIBUTIL_H diff --git a/xpatchlib/xpatchlib.cpp b/xpatchlib/xpatchlib.cpp index d1bcf3e..c908fb8 100644 --- a/xpatchlib/xpatchlib.cpp +++ b/xpatchlib/xpatchlib.cpp @@ -2,7 +2,7 @@ #include #include -int CreateBak(const char* src, bool ovr, int (*Upd)(unsigned long long)) { +int CreateBak(const char* src, bool ovr, bool (*cb)(unsigned long long)) { char dst[512]; strcpy(dst, src); @@ -42,8 +42,9 @@ int CreateBak(const char* src, bool ovr, int (*Upd)(unsigned long long)) { return E_FWRITE_DST; } - if (Upd) { - if (Upd(wb) != 0) { + if (cb) { + if (!cb(wb)) { + free(buf); break; } } diff --git a/xpatchlib/xpatchlib.h b/xpatchlib/xpatchlib.h index 305c9a0..869eaaa 100644 --- a/xpatchlib/xpatchlib.h +++ b/xpatchlib/xpatchlib.h @@ -1,5 +1,4 @@ -#ifndef XPATCHLIB_H -#define XPATCHLIB_H +#pragma once #include @@ -25,8 +24,6 @@ typedef enum { E_OUT_OF_MEMORY, } ErrorCode; -int CreateBak(const char* src, bool ovr, int (*Upd)(unsigned long long)); -int RestoreBak(const char* src, bool ovr); -int ReadVarInt(FILE* fp, unsigned int* ui); - -#endif // XPATCHLIB_H \ No newline at end of file +int CreateBak(const char* source, bool overwrite, bool (*Callback)(unsigned long long)); +int RestoreBak(const char* source, bool overwrite); +int ReadVarInt(FILE* fp, unsigned int* ui); \ No newline at end of file diff --git a/xpatchlibUtil.cpp b/xpatchlibUtil.cpp index 9623b97..a4adab8 100644 --- a/xpatchlibUtil.cpp +++ b/xpatchlibUtil.cpp @@ -4,13 +4,12 @@ // ------------------------------------------------------------------ // CreateBak function with added prog (src-dev) // ------------------------------------------------------------------ -int UpdateBakProgress(ULONGLONG wb) { - +bool UpdateBakProgress(ULONGLONG wb) { if (CopyProgress::g_copyProgFn) { if (!CopyProgress::g_copyProgFn(-wb, NULL, NULL, CopyProgress::g_copyProgUser)) { - return -1; + return false; } - return 0; + return true; } - + return false; } \ No newline at end of file diff --git a/xpatchlibUtil.h b/xpatchlibUtil.h index 06a72c4..d1d952c 100644 --- a/xpatchlibUtil.h +++ b/xpatchlibUtil.h @@ -1,11 +1,8 @@ -#ifndef XPATCHLIBUTIL_H -#define XPATCHLIBUTIL_H +#pragma once #include "FileBrowserApp.h" // ------------------------------------------------------------------ // CreateBak function with added progress (src-dev) // ------------------------------------------------------------------ -int UpdateBakProgress(unsigned long long wb); - -#endif // XPATCHLIBUTIL_H +bool UpdateBakProgress(ULONGLONG wb);