From 61084e53b501a6a10b6f10f645d96078c5f0a2b9 Mon Sep 17 00:00:00 2001 From: Alex Wilson Date: Thu, 22 Dec 2011 14:16:44 -0700 Subject: [PATCH] Remove clamping in new BSplitLayout methods. Since clamping the index for these methods could lead to confusing side effects, we'll just avoid the clamping, and let things segfault when the programmer goes out of bounds. Closes #7902 --- src/kits/interface/SplitLayout.cpp | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/kits/interface/SplitLayout.cpp b/src/kits/interface/SplitLayout.cpp index a71fa6d299..c1094cdd3f 100644 --- a/src/kits/interface/SplitLayout.cpp +++ b/src/kits/interface/SplitLayout.cpp @@ -465,11 +465,6 @@ BSplitLayout::SetItemWeight(BLayoutItem* item, float weight) bool BSplitLayout::IsCollapsible(int32 index) const { - if (index < 0) - index = 0; - if (index > CountItems()) - index = CountItems() - 1; - return _ItemLayoutInfo(ItemAt(index))->isCollapsible; } @@ -491,11 +486,6 @@ BSplitLayout::SetCollapsible(int32 index, bool collapsible) void BSplitLayout::SetCollapsible(int32 first, int32 last, bool collapsible) { - if (first < 0) - first = 0; - if (last < 0 || last > CountItems()) - last = CountItems() - 1; - for (int32 i = first; i <= last; i++) _ItemLayoutInfo(ItemAt(i))->isCollapsible = collapsible; } @@ -504,11 +494,6 @@ BSplitLayout::SetCollapsible(int32 first, int32 last, bool collapsible) bool BSplitLayout::IsItemCollapsed(int32 index) const { - if (index < 0) - index = 0; - if (index > CountItems()) - index = CountItems() - 1; - return _ItemLayoutInfo(ItemAt(index))->isVisible; } @@ -516,11 +501,6 @@ BSplitLayout::IsItemCollapsed(int32 index) const void BSplitLayout::SetItemCollapsed(int32 index, bool collapsed) { - if (index < 0) - index = 0; - if (index > CountItems()) - index = CountItems() - 1; - ItemAt(index)->SetVisible(collapsed); InvalidateLayout(true);