< prev index next >
src/share/vm/libadt/dict.cpp
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -68,11 +68,11 @@
}
_size = 16; // Size is a power of 2
_cnt = 0; // Dictionary is empty
_bin = (bucket*)_arena->Amalloc_4(sizeof(bucket)*_size);
- memset(_bin,0,sizeof(bucket)*_size);
+ memset((void*)_bin,0,sizeof(bucket)*_size);
}
Dict::Dict(CmpKey initcmp, Hash inithash, Arena *arena, int size)
: _hash(inithash), _cmp(initcmp), _arena(arena) {
int i;
@@ -89,11 +89,11 @@
i=16;
while( i < size ) i <<= 1;
_size = i; // Size is a power of 2
_cnt = 0; // Dictionary is empty
_bin = (bucket*)_arena->Amalloc_4(sizeof(bucket)*_size);
- memset(_bin,0,sizeof(bucket)*_size);
+ memset((void*)_bin,0,sizeof(bucket)*_size);
}
//------------------------------~Dict------------------------------------------
// Delete an existing dictionary.
Dict::~Dict() {
@@ -125,11 +125,11 @@
// lo list depending on the value of the bit.
void Dict::doubhash(void) {
uint oldsize = _size;
_size <<= 1; // Double in size
_bin = (bucket*)_arena->Arealloc(_bin, sizeof(bucket) * oldsize, sizeof(bucket) * _size);
- memset(&_bin[oldsize], 0, oldsize * sizeof(bucket));
+ memset((void*)(&_bin[oldsize]), 0, oldsize * sizeof(bucket));
// Rehash things to spread into new table
for (uint i = 0; i < oldsize; i++) { // For complete OLD table do
bucket *b = &_bin[i]; // Handy shortcut for _bin[i]
if (!b->_keyvals) continue; // Skip empties fast
@@ -161,11 +161,11 @@
//------------------------------Dict-----------------------------------------
// Deep copy a dictionary.
Dict::Dict( const Dict &d ) : _size(d._size), _cnt(d._cnt), _hash(d._hash),_cmp(d._cmp), _arena(d._arena) {
_bin = (bucket*)_arena->Amalloc_4(sizeof(bucket)*_size);
- memcpy( _bin, d._bin, sizeof(bucket)*_size );
+ memcpy( (void*)_bin, (void*)d._bin, sizeof(bucket)*_size );
for( uint i=0; i<_size; i++ ) {
if( !_bin[i]._keyvals ) continue;
_bin[i]._keyvals=(void**)_arena->Amalloc_4( sizeof(void *)*_bin[i]._max*2);
memcpy( _bin[i]._keyvals, d._bin[i]._keyvals,_bin[i]._cnt*2*sizeof(void*));
}
@@ -175,11 +175,11 @@
// Deep copy a dictionary.
Dict &Dict::operator =( const Dict &d ) {
if( _size < d._size ) { // If must have more buckets
_arena = d._arena;
_bin = (bucket*)_arena->Arealloc( _bin, sizeof(bucket)*_size, sizeof(bucket)*d._size );
- memset( &_bin[_size], 0, (d._size-_size)*sizeof(bucket) );
+ memset( (void*)(&_bin[_size]), 0, (d._size-_size)*sizeof(bucket) );
_size = d._size;
}
uint i;
for( i=0; i<_size; i++ ) // All buckets are empty
_bin[i]._cnt = 0; // But leave bucket allocations alone
< prev index next >