Tracker: Style fixes, should have no functional change

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