diff --git a/headers/private/storage/Partition.h b/headers/private/storage/Partition.h index 7e60550563..18e2246094 100644 --- a/headers/private/storage/Partition.h +++ b/headers/private/storage/Partition.h @@ -173,9 +173,10 @@ private: friend class BDiskSystem; friend class BMutablePartition; - BDiskDevice *fDevice; - BPartition *fParent; - user_partition_data *fPartitionData; + BDiskDevice* fDevice; + BPartition* fParent; + user_partition_data* fPartitionData; + Delegate* fDelegate; }; #endif // _PARTITION_H diff --git a/src/kits/storage/Partition.cpp b/src/kits/storage/Partition.cpp index c10d1c0d86..6ee507f58e 100644 --- a/src/kits/storage/Partition.cpp +++ b/src/kits/storage/Partition.cpp @@ -6,9 +6,10 @@ * Ingo Weinhold, bonefish@cs.tu-berlin.de */ - -#include -#include +#include +#include +#include +#include #include #include @@ -23,10 +24,10 @@ #include #include -#include -#include -#include -#include +#include + +#include +#include using std::nothrow; @@ -41,32 +42,6 @@ using std::nothrow; (\see IsEmpty()). */ -// AutoDeleter -/*! \brief Helper class deleting objects automatically. -*/ -template -class AutoDeleter { -public: - inline AutoDeleter(C *data = NULL, bool array = false) - : fData(data), fArray(array) {} - - inline ~AutoDeleter() - { - if (fArray) - delete[] fData; - else - delete fData; - } - - inline void SetTo(C *data, bool array = false) - { - fData = data; - fArray = array; - } - - C *fData; - bool fArray; -}; // compare_string /*! \brief \c NULL aware strcmp(). @@ -97,7 +72,8 @@ compare_string(const char *str1, const char *str2) BPartition::BPartition() : fDevice(NULL), fParent(NULL), - fPartitionData(NULL) + fPartitionData(NULL), + fDelegate(NULL) { } @@ -739,14 +715,14 @@ BPartition::CanMove(BObjectList *unmovableDescendants, int32 descendantCount = _CountDescendants(); partition_id *unmovableIDs = NULL; partition_id *needUnmountingIDs = NULL; - AutoDeleter deleter1; - AutoDeleter deleter2; + ArrayDeleter deleter1; + ArrayDeleter deleter2; if (descendantCount > 0) { // allocate arrays unmovableIDs = new(nothrow) partition_id[descendantCount]; needUnmountingIDs = new(nothrow) partition_id[descendantCount]; - deleter1.SetTo(unmovableIDs, true); - deleter2.SetTo(needUnmountingIDs, true); + deleter1.SetTo(unmovableIDs); + deleter2.SetTo(needUnmountingIDs); if (!unmovableIDs || !needUnmountingIDs) return false; // init arrays