diff --git a/src/kits/tracker/PoseList.cpp b/src/kits/tracker/PoseList.cpp index 4e5d8fd17e..d90e7b077a 100644 --- a/src/kits/tracker/PoseList.cpp +++ b/src/kits/tracker/PoseList.cpp @@ -114,8 +114,8 @@ PoseList::DeepFindPose(const node_ref* node, int32* resultingIndex) const } -PoseList * -PoseList::FindAllPoses(const node_ref *node) const +PoseList* +PoseList::FindAllPoses(const node_ref* node) const { int32 count = CountItems(); PoseList *result = new PoseList(5, false); @@ -131,16 +131,15 @@ PoseList::FindAllPoses(const node_ref *node) const continue; model = model->LinkTo(); - if (model && *model->NodeRef() == *node) { + if (model != NULL && *model->NodeRef() == *node) { result->AddItem(pose); continue; } - if (!model) { - model = new Model(pose->TargetModel()->EntryRef(), true); - if (*model->NodeRef() == *node) + if (model == NULL) { + Model model(pose->TargetModel()->EntryRef(), true); + if (*model.NodeRef() == *node) result->AddItem(pose); - delete model; } } return result; diff --git a/src/kits/tracker/PoseList.h b/src/kits/tracker/PoseList.h index 801a08fc87..072e130cfb 100644 --- a/src/kits/tracker/PoseList.h +++ b/src/kits/tracker/PoseList.h @@ -66,7 +66,7 @@ public: BPose* DeepFindPose(const node_ref* node, int32* index = NULL) const; // same as FindPose, node can be a target of the actual // pose if the pose is a symlink - PoseList *FindAllPoses(const node_ref *node) const; + PoseList* FindAllPoses(const node_ref* node) const; }; // iteration glue, add permutations as needed diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index 70ae3a9dae..f28390f46a 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -2655,7 +2655,7 @@ BPoseView::RemoveColumn(BColumn* columnToRemove, bool runAlert) // the column we removed might just be the one that was used to filter int32 count = fFilteredPoseList->CountItems(); for (int32 i = count - 1; i >= 0; i--) { - BPose *pose = fFilteredPoseList->ItemAt(i); + BPose* pose = fFilteredPoseList->ItemAt(i); if (!FilterPose(pose)) RemoveFilteredPose(pose, i); } @@ -4953,15 +4953,15 @@ BPoseView::MoveSelectionTo(BPoint dropPt, BPoint clickPt, inline void -UpdateWasBrokenSymlinkBinder(BPose *pose, Model *model, int32 index, - BPoseView *poseView, BObjectList *fBrokenLinks) +UpdateWasBrokenSymlinkBinder(BPose* pose, Model* model, int32 index, + BPoseView* poseView, BObjectList* fBrokenLinks) { if (!model->IsSymLink()) return; BPoint loc(0, index * poseView->ListElemHeight()); pose->UpdateWasBrokenSymlink(loc, poseView); - if (model->LinkTo()) + if (model->LinkTo() != NULL) fBrokenLinks->RemoveItem(model); } @@ -4973,7 +4973,7 @@ BPoseView::TryUpdatingBrokenLinks() if (!lock) return; - BObjectList *brokenLinksCopy = new BObjectList(*fBrokenLinks); + BObjectList* brokenLinksCopy = new BObjectList(*fBrokenLinks); // try fixing broken symlinks, and detecting broken ones. EachPoseAndModel(fPoseList, &UpdateWasBrokenSymlinkBinder, this, @@ -4995,7 +4995,7 @@ BPoseView::PoseHandleDeviceUnmounted(BPose* pose, Model* model, int32 index, if (model->NodeRef()->device == device) poseView->DeletePose(model->NodeRef()); else if (model->IsSymLink() - && model->LinkTo() + && model->LinkTo() != NULL && model->LinkTo()->NodeRef()->device == device) poseView->DeleteSymLinkPoseTarget(model->LinkTo()->NodeRef(), pose, index); } @@ -5150,7 +5150,7 @@ BPoseView::FSNotification(const BMessage* message) createPose = false; } - const char *name; + const char* name; if (message->FindString("name", &name) != B_OK) break; #if DEBUG @@ -5165,7 +5165,7 @@ BPoseView::FSNotification(const BMessage* message) // exist yet. We are looking if the just created folder // is 'some_folder' and watch it, expecting the creation of // 'another_folder' later and then report the link as fixed. - Model *model = new Model(&dirNode, &itemNode, name); + Model* model = new Model(&dirNode, &itemNode, name); if (model->IsDirectory()) { BString createdPath(BPath(model->EntryRef()).Path()); BDirectory currentDir(TargetModel()->EntryRef()); @@ -5302,8 +5302,8 @@ BPoseView::FSNotification(const BMessage* message) bool BPoseView::CreateSymlinkPoseTarget(Model* symlink) { - Model *newResolvedModel = NULL; - Model *result = symlink->LinkTo(); + Model* newResolvedModel = NULL; + Model* result = symlink->LinkTo(); if (!result) { BEntry entry(symlink->EntryRef(), true); if (entry.InitCheck() == B_OK) { @@ -5429,7 +5429,7 @@ BPoseView::EntryMoved(const BMessage* message) // rename or move of entry in this directory (or query) int32 index; - BPose *pose = fPoseList->FindPose(&itemNode, &index); + BPose* pose = fPoseList->FindPose(&itemNode, &index); int32 poseListIndex = index; bool visible = true; if (fFiltering) @@ -5489,7 +5489,7 @@ BPoseView::EntryMoved(const BMessage* message) void -BPoseView::WatchParentOf(const entry_ref *ref) +BPoseView::WatchParentOf(const entry_ref* ref) { BPath currentDir(ref); currentDir.GetParent(¤tDir); @@ -5525,7 +5525,7 @@ BPoseView::StopWatchingParentsOf(const entry_ref* ref) if (path.InitCheck() != B_OK) return; - BObjectList *brokenLinksCopy = new BObjectList(*fBrokenLinks); + BObjectList* brokenLinksCopy = new BObjectList(*fBrokenLinks); int32 count = brokenLinksCopy->CountItems(); while (path.GetParent(&path) == B_OK) { @@ -5589,11 +5589,11 @@ BPoseView::AttributeChanged(const BMessage* message) int32 index; attr_info info; - PoseList *posesFound = fPoseList->FindAllPoses(&itemNode); + PoseList* posesFound = fPoseList->FindAllPoses(&itemNode); int32 posesCount = posesFound->CountItems(); for (int i = 0; i < posesCount; i++) { - BPose *pose = posesFound->ItemAt(i); - Model *model = pose->TargetModel(); + BPose* pose = posesFound->ItemAt(i); + Model* model = pose->TargetModel(); if (model->IsSymLink() && *model->NodeRef() != itemNode) // change happened on symlink's target model = model->ResolveIfLink(); @@ -5797,7 +5797,7 @@ BPoseView::DuplicateSelection(BPoint* dropStart, BPoint* dropEnd) // create entry_ref list from selection if (!fSelectionList->IsEmpty()) { - BObjectList *srcList = new BObjectList( + BObjectList* srcList = new BObjectList( fSelectionList->CountItems(), true); CopySelectionListToBListAsEntryRefs(fSelectionList, srcList); @@ -5823,13 +5823,13 @@ BPoseView::SelectPoseAtLocation(BPoint point) void -BPoseView::MoveListToTrash(BObjectList *list, bool selectNext, +BPoseView::MoveListToTrash(BObjectList* list, bool selectNext, bool deleteDirectly) { if (!list->CountItems()) return; - BObjectList *taskList = + BObjectList* taskList = new BObjectList(2, true); // new owning list of tasks @@ -7221,7 +7221,7 @@ BPoseView::WasDoubleClick(const BPose* pose, BPoint point) static void -AddPoseRefToMessage(BPose *, Model* model, BMessage* message) +AddPoseRefToMessage(BPose*, Model* model, BMessage* message) { // Make sure that every file added to the message has its // MIME type set. @@ -7743,7 +7743,7 @@ BPoseView::DeletePose(const node_ref* itemNode, BPose* pose, int32 index) if (pose->TargetModel()->IsSymLink()) { fBrokenLinks->RemoveItem(pose->TargetModel()); StopWatchingParentsOf(pose->TargetModel()->EntryRef()); - Model *target = pose->TargetModel()->LinkTo(); + Model* target = pose->TargetModel()->LinkTo(); if (target) watch_node(target->NodeRef(), B_STOP_WATCHING, this); } diff --git a/src/kits/tracker/PoseView.h b/src/kits/tracker/PoseView.h index 88b30a06dd..f3664128c3 100644 --- a/src/kits/tracker/PoseView.h +++ b/src/kits/tracker/PoseView.h @@ -674,8 +674,8 @@ class BPoseView : public BView { void Delete(const entry_ref&ref, bool selectNext, bool askUser); void RestoreItemsFromTrash(BObjectList*, bool selectNext); - void WatchParentOf(const entry_ref *); - void StopWatchingParentsOf(const entry_ref *); + void WatchParentOf(const entry_ref*); + void StopWatchingParentsOf(const entry_ref*); private: void DrawOpenAnimation(BRect); @@ -698,9 +698,9 @@ class BPoseView : public BView { // used for mime string based icon highliting during a drag BObjectList* fZombieList; PendingNodeMonitorCache pendingNodeMonitorCache; - BObjectList *fColumnList; - BObjectList *fMimeTypeList; - BObjectList *fBrokenLinks; + BObjectList* fColumnList; + BObjectList* fMimeTypeList; + BObjectList* fBrokenLinks; bool fMimeTypeListIsDirty; BViewState* fViewState; bool fStateNeedsSaving;