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
This commit is contained in:
Axel Dörfler 2005-12-11 19:37:18 +00:00
parent cc094b2cb8
commit e68b762659
3 changed files with 9 additions and 14 deletions

View File

@ -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];
}

View File

@ -37,8 +37,8 @@ All rights reserved.
#ifndef __OPEN_HASH_TABLE__
#define __OPEN_HASH_TABLE__
#include <malloc.h>
#include <new.h>
#include <new>
#include <stdlib.h>
namespace BPrivate {
@ -259,7 +259,7 @@ OpenHashElementArray<Element>::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<Element>::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;

View File

@ -90,6 +90,10 @@ All rights reserved.
#include "WidgetAttributeText.h"
using std::min;
using std::max;
const float kDoubleClickTresh = 6;
const float kCountViewWidth = 62;