Fixed a few coding style violations and GCC4 warnings.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31555 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2009-07-14 11:26:15 +00:00
parent 3bc54daf84
commit 5422febd0b
5 changed files with 40 additions and 23 deletions
+9 -5
View File
@@ -3132,22 +3132,26 @@ BContainerWindow::MarkAttributeMenu(BMenu *menu)
for (int32 index = 0; index < count; index++) { for (int32 index = 0; index < count; index++) {
BMenuItem *item = menu->ItemAt(index); BMenuItem *item = menu->ItemAt(index);
int32 attrHash; int32 attrHash;
if (item->Message()) if (item->Message()) {
if (item->Message()->FindInt32("attr_hash", &attrHash) == B_OK) if (item->Message()->FindInt32("attr_hash", &attrHash) == B_OK)
item->SetMarked(PoseView()->ColumnFor((uint32)attrHash) != 0); item->SetMarked(PoseView()->ColumnFor((uint32)attrHash) != 0);
else else
item->SetMarked(false); item->SetMarked(false);
}
BMenu *submenu = item->Submenu(); BMenu *submenu = item->Submenu();
if (submenu) { if (submenu) {
int32 count2 = submenu->CountItems(); int32 count2 = submenu->CountItems();
for (int32 subindex = 0; subindex < count2; subindex++) { for (int32 subindex = 0; subindex < count2; subindex++) {
item = submenu->ItemAt(subindex); item = submenu->ItemAt(subindex);
if (item->Message()) if (item->Message()) {
if (item->Message()->FindInt32("attr_hash", &attrHash) == B_OK) if (item->Message()->FindInt32("attr_hash", &attrHash)
item->SetMarked(PoseView()->ColumnFor((uint32)attrHash) != 0); == B_OK) {
else item->SetMarked(PoseView()->ColumnFor((uint32)attrHash)
!= 0);
} else
item->SetMarked(false); item->SetMarked(false);
}
} }
} }
} }
+16 -10
View File
@@ -236,17 +236,19 @@ FSClipboardAddPoses(const node_ref *directory, PoseList *list, uint32 moveMode,
MakeModeNameFromRefName(modeName, refName); MakeModeNameFromRefName(modeName, refName);
if (clearClipboard) { if (clearClipboard) {
if (clip->AddInt32(modeName, (int32)moveMode) == B_OK) if (clip->AddInt32(modeName, (int32)moveMode) == B_OK) {
if (clip->AddRef(refName, model->EntryRef()) == B_OK) { if (clip->AddRef(refName, model->EntryRef()) == B_OK) {
pose->SetClipboardMode(moveMode); pose->SetClipboardMode(moveMode);
clipNode.node = *node; clipNode.node = *node;
updateMessage.AddData("tcnode", T_CLIPBOARD_NODE, &clipNode, updateMessage.AddData("tcnode", T_CLIPBOARD_NODE,
sizeof(TClipboardNodeRef), true, listCount); &clipNode, sizeof(TClipboardNodeRef), true,
listCount);
refsAdded++; refsAdded++;
} else } else
clip->RemoveName(modeName); clip->RemoveName(modeName);
}
} else { } else {
if (clip->ReplaceInt32(modeName, (int32)moveMode) == B_OK) { if (clip->ReplaceInt32(modeName, (int32)moveMode) == B_OK) {
// replace old mode if entry already exists in clipboard // replace old mode if entry already exists in clipboard
@@ -254,8 +256,9 @@ FSClipboardAddPoses(const node_ref *directory, PoseList *list, uint32 moveMode,
pose->SetClipboardMode(moveMode); pose->SetClipboardMode(moveMode);
clipNode.node = *node; clipNode.node = *node;
updateMessage.AddData("tcnode", T_CLIPBOARD_NODE, &clipNode, updateMessage.AddData("tcnode", T_CLIPBOARD_NODE,
sizeof(TClipboardNodeRef), true, listCount); &clipNode, sizeof(TClipboardNodeRef), true,
listCount);
refsAdded++; refsAdded++;
} else { } else {
@@ -263,9 +266,11 @@ FSClipboardAddPoses(const node_ref *directory, PoseList *list, uint32 moveMode,
clipNode.node = *node; clipNode.node = *node;
clipNode.moveMode = kDelete; // note removing node clipNode.moveMode = kDelete; // note removing node
updateMessage.AddData("tcnode", T_CLIPBOARD_NODE, &clipNode, updateMessage.AddData("tcnode", T_CLIPBOARD_NODE,
sizeof(TClipboardNodeRef), true, listCount); &clipNode, sizeof(TClipboardNodeRef), true,
clipNode.moveMode = moveMode; // set it back to current value listCount);
clipNode.moveMode = moveMode;
// set it back to current value
} }
} else { } else {
// add it if it doesn't exist // add it if it doesn't exist
@@ -274,8 +279,9 @@ FSClipboardAddPoses(const node_ref *directory, PoseList *list, uint32 moveMode,
pose->SetClipboardMode(moveMode); pose->SetClipboardMode(moveMode);
clipNode.node = *node; clipNode.node = *node;
updateMessage.AddData("tcnode", T_CLIPBOARD_NODE, &clipNode, updateMessage.AddData("tcnode", T_CLIPBOARD_NODE,
sizeof(TClipboardNodeRef), true, listCount); &clipNode, sizeof(TClipboardNodeRef), true,
listCount);
refsAdded++; refsAdded++;
} else { } else {
+3 -1
View File
@@ -2467,11 +2467,13 @@ TAttrView::RestoreState(const BMessage &message, int32 index)
int32 logicMenuSelectedIndex; int32 logicMenuSelectedIndex;
BMenuField *field = dynamic_cast<BMenuField *>(FindView("Logic")); BMenuField *field = dynamic_cast<BMenuField *>(FindView("Logic"));
if (message.FindInt32("logicalRelation", index, &logicMenuSelectedIndex) == B_OK) if (message.FindInt32("logicalRelation", index,
&logicMenuSelectedIndex) == B_OK) {
if (field) if (field)
field->Menu()->ItemAt(logicMenuSelectedIndex)->SetMarked(true); field->Menu()->ItemAt(logicMenuSelectedIndex)->SetMarked(true);
else else
AddLogicMenu(logicMenuSelectedIndex == 0); AddLogicMenu(logicMenuSelectedIndex == 0);
}
} }
+2 -1
View File
@@ -1681,7 +1681,8 @@ NodeCacheEntry::Hash() const
uint32 uint32
NodeCacheEntry::Hash(const node_ref *node) NodeCacheEntry::Hash(const node_ref *node)
{ {
return node->device ^ ((uint32 *)&node->node)[0] ^ ((uint32 *)&node->node)[1]; return node->device ^ ((uint32 *)&node->node)[0]
^ ((uint32 *)&node->node)[1];
} }
+10 -6
View File
@@ -1108,14 +1108,15 @@ AttributeView::ModelChanged(Model *model, BMessage *message)
// device, while the model is set to the device of the volume // device, while the model is set to the device of the volume
// directly - this hack works for volumes that are mounted in // directly - this hack works for volumes that are mounted in
// the root directory // the root directory
|| model->IsVolume() || (model->IsVolume()
&& itemNode.device == 1 && itemNode.device == 1
&& itemNode.node == model->NodeRef()->node) { && itemNode.node == model->NodeRef()->node)) {
model->UpdateEntryRef(&dirNode, name); model->UpdateEntryRef(&dirNode, name);
BString title; BString title;
title << name << " info"; title << name << " info";
Window()->SetTitle(title.String()); Window()->SetTitle(title.String());
WidgetAttributeText::AttrAsString(model, &fPathStr, kAttrPath, B_STRING_TYPE, 0, this); WidgetAttributeText::AttrAsString(model, &fPathStr, kAttrPath,
B_STRING_TYPE, 0, this);
} }
break; break;
} }
@@ -1123,9 +1124,11 @@ AttributeView::ModelChanged(Model *model, BMessage *message)
case B_STAT_CHANGED: case B_STAT_CHANGED:
if (model->OpenNode() == B_OK) { if (model->OpenNode() == B_OK) {
WidgetAttributeText::AttrAsString(model, &fCreatedStr, WidgetAttributeText::AttrAsString(model, &fCreatedStr,
kAttrStatCreated, B_TIME_TYPE, drawBounds.Width() - kBorderMargin, this); kAttrStatCreated, B_TIME_TYPE, drawBounds.Width()
- kBorderMargin, this);
WidgetAttributeText::AttrAsString(model, &fModifiedStr, WidgetAttributeText::AttrAsString(model, &fModifiedStr,
kAttrStatModified, B_TIME_TYPE, drawBounds.Width() - kBorderMargin, this); kAttrStatModified, B_TIME_TYPE, drawBounds.Width()
- kBorderMargin, this);
// don't change the size if it's a directory // don't change the size if it's a directory
if (!model->IsDirectory()) { if (!model->IsDirectory()) {
@@ -1144,7 +1147,8 @@ AttributeView::ModelChanged(Model *model, BMessage *message)
if (message->FindString("attr", &attrName) == B_OK) { if (message->FindString("attr", &attrName) == B_OK) {
if (strcmp(attrName, kAttrLargeIcon) == 0 if (strcmp(attrName, kAttrLargeIcon) == 0
|| strcmp(attrName, kAttrIcon) == 0) { || strcmp(attrName, kAttrIcon) == 0) {
Invalidate(BRect(10, 10, 10 + B_LARGE_ICON, 10 + B_LARGE_ICON)); Invalidate(BRect(10, 10, 10 + B_LARGE_ICON, 10
+ B_LARGE_ICON));
} else if (strcmp(attrName, kAttrMIMEType) == 0) { } else if (strcmp(attrName, kAttrMIMEType) == 0) {