From 793ebfdd1886f5a591ad3c03569cb0afbebe91f4 Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Wed, 20 Feb 2008 20:58:39 +0000 Subject: [PATCH] - fix a few issues to make it compilable with current RosBE - does not yet link svn path=/trunk/; revision=32436 --- rosapps/fraginator/Defragment.cpp | 3 +-- rosapps/fraginator/DriveVolume.cpp | 10 ++++----- rosapps/fraginator/Fraginator.cpp | 9 +++++--- rosapps/fraginator/Fraginator.h | 5 +++-- rosapps/fraginator/MainDialog.cpp | 4 ++-- rosapps/fraginator/MainDialog.h | 2 +- rosapps/fraginator/ReportDialog.h | 2 +- rosapps/fraginator/Unfrag.cpp | 2 +- rosapps/fraginator/Unfrag.h | 9 +++++--- rosapps/fraginator/fraginator.rbuild | 33 ++++++++++++++++++++++++++++ 10 files changed, 59 insertions(+), 20 deletions(-) create mode 100644 rosapps/fraginator/fraginator.rbuild diff --git a/rosapps/fraginator/Defragment.cpp b/rosapps/fraginator/Defragment.cpp index bd97a531753..e62c8608a4f 100644 --- a/rosapps/fraginator/Defragment.cpp +++ b/rosapps/fraginator/Defragment.cpp @@ -78,7 +78,6 @@ int FitName (wchar_t *destination, const wchar_t *path, const wchar_t *filename, return (1); } - Defragment::Defragment (wstring Name, DefragType DefragMethod) { Method = DefragMethod; @@ -245,7 +244,7 @@ void Defragment::Start (void) Info = Volume.GetDBFile (j); - Report.FilesFragments += max (1, Info.Fragments.size()); // add 1 fragment even for 0 bytes/0 cluster files + Report.FilesFragments += max ((size_t)1, Info.Fragments.size()); // add 1 fragment even for 0 bytes/0 cluster files if (Info.Attributes.Process == 0) continue; diff --git a/rosapps/fraginator/DriveVolume.cpp b/rosapps/fraginator/DriveVolume.cpp index be576289b7b..df9406e54cb 100644 --- a/rosapps/fraginator/DriveVolume.cpp +++ b/rosapps/fraginator/DriveVolume.cpp @@ -55,7 +55,7 @@ bool DriveVolume::Open (wstring Name) FILE_SHARE_READ | FILE_SHARE_WRITE, // share type NULL, // security descriptor OPEN_EXISTING, // open type - NULL, // attributes (none) + 0, // attributes (none) NULL // template ); @@ -222,7 +222,7 @@ bool DriveVolume::GetBitmap (void) NULL ); - DWORD LastError = GetLastError (); + //DWORD LastError = GetLastError (); if (Result == FALSE) { @@ -422,7 +422,7 @@ bool DriveVolume::ScanDirectory (wstring DirPrefix, ScanCallback Callback, void { uint64 TotalClusters = 0; - for (int i = 0; i < Info.Fragments.size(); i++) + for (size_t i = 0; i < Info.Fragments.size(); i++) { TotalClusters += Info.Fragments[i].Length; } @@ -597,9 +597,9 @@ bool DriveVolume::GetClusterInfo (FileInfo &Info, HANDLE &HandleResult) Extents = Retrieval->ExtentCount; // Ok, we have the info. Now translate it. hrmrmr - int i; + Info.Fragments.clear (); - for (i = 0; i < Extents; i++) + for (uint64 i = 0; i < Extents; i++) { Extent Add; diff --git a/rosapps/fraginator/Fraginator.cpp b/rosapps/fraginator/Fraginator.cpp index f3096e5f889..5bb2138cf06 100644 --- a/rosapps/fraginator/Fraginator.cpp +++ b/rosapps/fraginator/Fraginator.cpp @@ -4,6 +4,7 @@ *****************************************************************************/ +#define NDEBUG #include "Fraginator.h" #include "Mutex.h" @@ -11,14 +12,15 @@ #include "Defragment.h" #include "MainDialog.h" #include "resource.h" +#ifdef _MSC_VER #include - +#endif HINSTANCE GlobalHInstance = NULL; Defragment *Defrag = NULL; - -int WINAPI WinMain (HINSTANCE HInstance, HINSTANCE HPrevInstance, LPSTR CmdLine, int ShowCmd) +INT WINAPI +wWinMain (HINSTANCE HInstance, HINSTANCE HPrevInstance, LPCWSTR CmdLine, INT ShowCmd) { INITCOMMONCONTROLSEX InitControls; @@ -56,3 +58,4 @@ int WINAPI WinMain (HINSTANCE HInstance, HINSTANCE HPrevInstance, LPSTR CmdLine, return (0); } + diff --git a/rosapps/fraginator/Fraginator.h b/rosapps/fraginator/Fraginator.h index ac26abfdceb..0839ba18833 100644 --- a/rosapps/fraginator/Fraginator.h +++ b/rosapps/fraginator/Fraginator.h @@ -10,7 +10,7 @@ #include "unfrag.h" -#include +#include int WINAPI WinMain (HINSTANCE HInstance, HINSTANCE HPrevInstance, LPSTR CmdLine, int ShowCmd); @@ -20,5 +20,6 @@ Defragment *StartDefragBox (wstring Drive, DefragType Method); extern HINSTANCE GlobalHInstance; extern Defragment *Defrag; +extern INT PASCAL wWinMain (HINSTANCE HInstance, HINSTANCE HPrevInstance, LPCWSTR CmdLine, INT ShowCmd); -#endif // FRAGINATOR_H \ No newline at end of file +#endif // FRAGINATOR_H diff --git a/rosapps/fraginator/MainDialog.cpp b/rosapps/fraginator/MainDialog.cpp index 58f0cf41cfc..c28931b5aeb 100644 --- a/rosapps/fraginator/MainDialog.cpp +++ b/rosapps/fraginator/MainDialog.cpp @@ -21,7 +21,7 @@ LRESULT PriBelowNormID; LRESULT PriIdleID; -void InitDialog (HWND Dlg); +static void InitDialog (HWND Dlg); void UpdateDefragInfo (HWND Dlg); void UpdatePriority (HWND Dlg); wstring GetDefaultTitle (void); @@ -35,7 +35,7 @@ static void InitDialog (HWND Dlg) // Make internal list DWORD DriveMask; HWND DlgItem; - int d; + size_t d; // Clear out wisecracks line for now SetDlgItemText (Dlg, IDC_WISECRACKS, L"\"Defrag, baby!\""); diff --git a/rosapps/fraginator/MainDialog.h b/rosapps/fraginator/MainDialog.h index 88d5496a615..e7efc1048e6 100644 --- a/rosapps/fraginator/MainDialog.h +++ b/rosapps/fraginator/MainDialog.h @@ -11,4 +11,4 @@ INT_PTR CALLBACK MainDialogProc (HWND Dlg, UINT Msg, WPARAM WParam, LPARAM LParam); -#endif // MAINDIALOG_H \ No newline at end of file +#endif // MAINDIALOG_H diff --git a/rosapps/fraginator/ReportDialog.h b/rosapps/fraginator/ReportDialog.h index d5de5559bc7..84f7778b02e 100644 --- a/rosapps/fraginator/ReportDialog.h +++ b/rosapps/fraginator/ReportDialog.h @@ -15,4 +15,4 @@ INT_PTR CALLBACK ReportDialogProc (HWND Dlg, UINT Msg, WPARAM WParam, LPARAM LParam); -#endif // REPORTDIALOG_H \ No newline at end of file +#endif // REPORTDIALOG_H diff --git a/rosapps/fraginator/Unfrag.cpp b/rosapps/fraginator/Unfrag.cpp index 320e7c39865..77802563632 100644 --- a/rosapps/fraginator/Unfrag.cpp +++ b/rosapps/fraginator/Unfrag.cpp @@ -49,7 +49,7 @@ wchar_t *AddCommas (wchar_t *Result, uint64 Number) { wchar_t Temp[128]; int TempLen; - wchar_t *p = NULL; + //wchar_t *p = NULL; int AddCommas = 0; wchar_t *StrPosResult = NULL; wchar_t *StrPosOrig = NULL; diff --git a/rosapps/fraginator/Unfrag.h b/rosapps/fraginator/Unfrag.h index 47e9a75603d..38bcf9aafb7 100644 --- a/rosapps/fraginator/Unfrag.h +++ b/rosapps/fraginator/Unfrag.h @@ -10,8 +10,9 @@ // Blah blah blah your template name is too long ... SO WHAT +#ifdef _MSC_VER #pragma warning (disable: 4786) - +#endif // I forget what this disables #ifdef __ICL @@ -20,17 +21,19 @@ // Hello Mr. Platform SDK, please let us use Windows 2000 only features +#if 0 #ifndef WINVER #define WINVER 0x0500 #define _WIN32_WINNT 0x0500 #endif - +#endif #include #include #include #include - +//#include +#include #define APPNAME_CLI L"Unfrag" #define APPNAME_GUI L"Fraginator" diff --git a/rosapps/fraginator/fraginator.rbuild b/rosapps/fraginator/fraginator.rbuild new file mode 100644 index 00000000000..1903e69f369 --- /dev/null +++ b/rosapps/fraginator/fraginator.rbuild @@ -0,0 +1,33 @@ + + + + . + + 0x0501 + 0x0600 + kernel32 + advapi32 + ntdll + comctl32 + msvcrt + Fraginator.cpp + MainDialog.cpp + Defragment.cpp + DriveVolume.cpp + ReportDialog.cpp + Unfrag.cpp + + + + . + + 0x0501 + 0x0600 + kernel32 + advapi32 + ntdll + Unfrag.cpp + Defragment.cpp + DriveVolume.cpp + +