From e68b7626597f4665e41aa23be48748cfd79ef0e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 11 Dec 2005 19:37:18 +0000 Subject: [PATCH] More GCC 4 fixes by Ingo Weinhold - appeared because of the recent removal of new/typeinfo/exception from our headers. Rearranged the IconCache node_ref hash computation to be padding-resistant (at least on PPC, node_ref is 16 bytes long, not 12 as it is with x86 and GCC 2). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15498 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/tracker/IconCache.cpp | 11 +---------- src/kits/tracker/OpenHashTable.h | 8 ++++---- src/kits/tracker/PoseView.cpp | 4 ++++ 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/kits/tracker/IconCache.cpp b/src/kits/tracker/IconCache.cpp index 7cf444ba44..f54f602665 100644 --- a/src/kits/tracker/IconCache.cpp +++ b/src/kits/tracker/IconCache.cpp @@ -1569,16 +1569,7 @@ NodeCacheEntry::Hash() const uint32 NodeCacheEntry::Hash(const node_ref *node) { - struct hasher { - uint32 int1; - uint32 int2; - uint32 int3; - } *tmp; - - STATIC_ASSERT(sizeof(hasher) == sizeof(node_ref)); - - tmp = (hasher *)node; - return tmp->int1 ^ tmp->int2 ^ tmp->int3; + return node->device ^ ((uint32 *)&node->node)[0] ^ ((uint32 *)&node->node)[1]; } diff --git a/src/kits/tracker/OpenHashTable.h b/src/kits/tracker/OpenHashTable.h index ba9a7bf15d..09858541f1 100644 --- a/src/kits/tracker/OpenHashTable.h +++ b/src/kits/tracker/OpenHashTable.h @@ -37,8 +37,8 @@ All rights reserved. #ifndef __OPEN_HASH_TABLE__ #define __OPEN_HASH_TABLE__ -#include -#include +#include +#include namespace BPrivate { @@ -259,7 +259,7 @@ OpenHashElementArray::OpenHashElementArray(int32 initialSize) { fData = (Element *)calloc((size_t)initialSize , sizeof(Element)); if (!fData) - throw bad_alloc(); + throw std::bad_alloc(); } @@ -337,7 +337,7 @@ OpenHashElementArray::Add() int32 newSize = fSize + kGrowChunk; Element *newData = (Element *)calloc((size_t)newSize , sizeof(Element)); if (!newData) - throw bad_alloc(); + throw std::bad_alloc(); memcpy(newData, fData, fSize * sizeof(Element)); free(fData); fData = newData; diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index e3a4ad7884..72b26b68cd 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -90,6 +90,10 @@ All rights reserved. #include "WidgetAttributeText.h" +using std::min; +using std::max; + + const float kDoubleClickTresh = 6; const float kCountViewWidth = 62;