gcc 4 fixes.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29602 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-03-18 22:43:47 +00:00
parent 5ef44d9bfc
commit 98092e9867
13 changed files with 54 additions and 41 deletions

View File

@ -130,9 +130,9 @@ public:
friend class HashMap<Key, Value>;
typedef OpenHashTable<HashMapTableDefinition<Key, Value> > ElementTable;
HashMap<Key, Value>* fMap;
ElementTable::Iterator fIterator;
Element* fElement;
HashMap<Key, Value>* fMap;
typename ElementTable::Iterator fIterator;
Element* fElement;
};
HashMap();

View File

@ -97,7 +97,7 @@ UserlandFSServer::Init(const char* fileSystem, port_id port)
RETURN_ERROR(error);
// create the notification request port
fNotificationRequestPort = new(nothrow) RequestPort(kRequestPortSize);
fNotificationRequestPort = new(std::nothrow) RequestPort(kRequestPortSize);
if (!fNotificationRequestPort)
RETURN_ERROR(B_NO_MEMORY);
error = fNotificationRequestPort->InitCheck();
@ -105,7 +105,7 @@ UserlandFSServer::Init(const char* fileSystem, port_id port)
RETURN_ERROR(error);
// now create the request threads
fRequestThreads = new(nothrow) RequestThread[kRequestThreadCount];
fRequestThreads = new(std::nothrow) RequestThread[kRequestThreadCount];
if (!fRequestThreads)
RETURN_ERROR(B_NO_MEMORY);
for (int32 i = 0; i < kRequestThreadCount; i++) {

View File

@ -8,6 +8,7 @@
#include <new>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include "AutoDeleter.h"
@ -53,7 +54,7 @@ HaikuKernelVolume::HaikuKernelVolume(FileSystem* fileSystem, dev_t id,
fVolume.sub_volume = NULL;
fVolume.super_volume = NULL;
fVolume.file_system = fFSModule;
fVolume.file_system_name = "dummy"; // TODO: Init correctly!
fVolume.file_system_name = strdup("dummy"); // TODO: Init correctly!
fVolume.haikuVolume = this;
}

View File

@ -1877,7 +1877,7 @@ cache_start_transaction(void* _cache)
cache->last_transaction->id);
}
cache_transaction* transaction = new(nothrow) cache_transaction;
cache_transaction* transaction = new(std::nothrow) cache_transaction;
if (transaction == NULL)
return B_NO_MEMORY;
@ -2096,7 +2096,7 @@ cache_detach_sub_transaction(void* _cache, int32 id,
return B_BAD_VALUE;
// create a new transaction for the sub transaction
cache_transaction* newTransaction = new(nothrow) cache_transaction;
cache_transaction* newTransaction = new(std::nothrow) cache_transaction;
if (transaction == NULL)
return B_NO_MEMORY;
@ -2466,7 +2466,7 @@ block_cache_delete(void* _cache, bool allowWrites)
void*
block_cache_create(int fd, off_t numBlocks, size_t blockSize, bool readOnly)
{
block_cache* cache = new(nothrow) block_cache(fd, numBlocks, blockSize,
block_cache* cache = new(std::nothrow) block_cache(fd, numBlocks, blockSize,
readOnly);
if (cache == NULL)
return NULL;

View File

@ -3,6 +3,8 @@
// debugging
#define BA_DEFINE_INLINES 1
#include <new>
#include "AllocationInfo.h"
#include "BlockAllocator.h"
#include "BlockAllocatorArea.h"
@ -23,7 +25,7 @@ BlockAllocator::BlockAllocator(size_t areaSize)
{
// create and init buckets
fBucketCount = bucket_containing_size(areaSize) + 1;
fBuckets = new(nothrow) AreaBucket[fBucketCount];
fBuckets = new(std::nothrow) AreaBucket[fBucketCount];
size_t minSize = 0;
for (int32 i = 0; i < fBucketCount; i++) {
size_t maxSize = (1 << i) * kMinNetBlockSize;

View File

@ -33,4 +33,4 @@ bucket_containing_min_size(size_t size)
{ return (size ? bucket_containing_size(size - 1) + 1 : 0); }
#endif BLOCK_ALLOCATOR_MISC_H
#endif // BLOCK_ALLOCATOR_MISC_H

View File

@ -1,5 +1,7 @@
// BlockReferenceManager.cpp
#include <new>
#include "AllocationInfo.h"
#include "Block.h"
#include "BlockAllocator.h" // only for BA_PANIC
@ -119,7 +121,7 @@ BlockReferenceManager::Table::Init(int32 size)
{
status_t error = (size > 0 ? B_OK : B_BAD_VALUE);
if (error == B_OK) {
fReferences = new(nothrow) BlockReference[size];
fReferences = new(std::nothrow) BlockReference[size];
if (fReferences)
fSize = size;
else

View File

@ -1,5 +1,7 @@
// Directory.cpp
#include <new>
#include "AllocationInfo.h"
#include "Debug.h"
#include "Directory.h"
@ -75,7 +77,7 @@ Directory::CreateDirectory(const char *name, Directory **directory)
status_t error = (name && directory ? B_OK : B_BAD_VALUE);
if (error == B_OK) {
// create directory
if (Directory *node = new(nothrow) Directory(GetVolume())) {
if (Directory *node = new(std::nothrow) Directory(GetVolume())) {
error = _CreateCommon(node, name);
// deletes the node on failure
if (error == B_OK)
@ -93,7 +95,7 @@ Directory::CreateFile(const char *name, File **file)
status_t error = (name && file ? B_OK : B_BAD_VALUE);
if (error == B_OK) {
// create file
if (File *node = new(nothrow) File(GetVolume())) {
if (File *node = new(std::nothrow) File(GetVolume())) {
error = _CreateCommon(node, name);
// deletes the node on failure
if (error == B_OK)
@ -111,7 +113,7 @@ Directory::CreateSymLink(const char *name, const char *path, SymLink **symLink)
status_t error = (name && symLink ? B_OK : B_BAD_VALUE);
if (error == B_OK) {
// create symlink
if (SymLink *node = new(nothrow) SymLink(GetVolume())) {
if (SymLink *node = new(std::nothrow) SymLink(GetVolume())) {
error = node->SetLinkedPath(path);
if (error == B_OK) {
error = _CreateCommon(node, name);
@ -152,7 +154,7 @@ Directory::CreateEntry(Node *node, const char *name, Entry **_entry)
status_t error = (node ? B_OK : B_BAD_VALUE);
if (error == B_OK) {
// create an entry
Entry *entry = new(nothrow) Entry(name);
Entry *entry = new(std::nothrow) Entry(name);
if (entry) {
error = entry->InitCheck();
if (error == B_OK) {

View File

@ -4,14 +4,14 @@
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@ -19,7 +19,7 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
//
// Except as contained in this notice, the name of a copyright holder shall
// not be used in advertising or otherwise to promote the sale, use or other
// dealings in this Software without prior written authorization of the
@ -28,10 +28,11 @@
#ifndef LIST_H
#define LIST_H
#include <new.h>
#include <stdlib.h>
#include <string.h>
#include <new>
#include <SupportDefs.h>
template<typename ITEM>

View File

@ -45,8 +45,9 @@ All rights reserved.
#ifndef __OPEN_HASH_TABLE__
#define __OPEN_HASH_TABLE__
#include <malloc.h>
#include <new.h>
#include <new>
#include <stdlib.h>
#include "AreaUtils.h"
#include "Misc.h"

View File

@ -7,12 +7,12 @@
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@ -31,6 +31,8 @@
#include <stdio.h>
#include <sys/stat.h>
#include <new>
#include <fs_index.h>
#include <fs_query.h>
#include <KernelExport.h>
@ -272,7 +274,7 @@ ramfs_mount(nspace_id nsid, const char */*device*/, ulong flags,
// allocate and init the volume
Volume *volume = NULL;
if (error == B_OK) {
volume = new(nothrow) Volume;
volume = new(std::nothrow) Volume;
if (!volume)
SET_ERROR(error, B_NO_MEMORY);
if (error == B_OK)
@ -312,7 +314,7 @@ ramfs_unmount(void *ns)
// ramfs_initialize
static
int
int
ramfs_initialize(const char */*deviceName*/, void */*parameters*/,
size_t /*len*/)
{
@ -630,7 +632,7 @@ ramfs_create(void *ns, void *_dir, const char *name, int openMode,
// create the file cookie
FileCookie *cookie = NULL;
if (error == B_OK) {
cookie = new(nothrow) FileCookie(openMode);
cookie = new(std::nothrow) FileCookie(openMode);
if (!cookie)
SET_ERROR(error, B_NO_MEMORY);
}
@ -713,7 +715,7 @@ FUNCTION(("node: %Ld\n", node->GetID()));
// create the cookie
FileCookie *cookie = NULL;
if (error == B_OK) {
cookie = new(nothrow) FileCookie(openMode);
cookie = new(std::nothrow) FileCookie(openMode);
if (!cookie)
SET_ERROR(error, B_NO_MEMORY);
}
@ -1275,7 +1277,7 @@ FUNCTION(("dir: (%Lu)\n", node->GetID()));
}
// create a DirectoryCookie
if (error == B_OK) {
DirectoryCookie *cookie = new(nothrow) DirectoryCookie(dir);
DirectoryCookie *cookie = new(std::nothrow) DirectoryCookie(dir);
if (cookie) {
error = cookie->Suspend();
if (error == B_OK)
@ -1343,7 +1345,7 @@ ramfs_rewind_dir(void */*ns*/, void */*_node*/, void *_cookie)
{
FUNCTION_START();
// No locking needed, since the Directory is guaranteed to live at this
// time and for iterators there is a separate locking.
// time and for iterators there is a separate locking.
DirectoryCookie *cookie = (DirectoryCookie*)_cookie;
// no need to Resume(), iterator remains suspended
status_t error = cookie->Rewind();
@ -1358,7 +1360,7 @@ ramfs_close_dir(void */*ns*/, void *DARG(_node), void *_cookie)
FUNCTION_START();
FUNCTION(("dir: (%Lu)\n", ((Node*)_node)->GetID()));
// No locking needed, since the Directory is guaranteed to live at this
// time and for iterators there is a separate locking.
// time and for iterators there is a separate locking.
DirectoryCookie *cookie = (DirectoryCookie*)_cookie;
cookie->Unset();
return B_OK;
@ -1514,7 +1516,7 @@ ramfs_read_link(void *ns, void *_node, char *buffer, size_t *bufferSize)
// ramfs_open_attrdir
static
int
int
ramfs_open_attrdir(void *ns, void *_node, void **cookie)
{
FUNCTION_START();
@ -1527,7 +1529,7 @@ ramfs_open_attrdir(void *ns, void *_node, void **cookie)
// create iterator
AttributeIterator *iterator = NULL;
if (error == B_OK) {
iterator = new(nothrow) AttributeIterator(node);
iterator = new(std::nothrow) AttributeIterator(node);
if (iterator)
error = iterator->Suspend();
else
@ -1550,7 +1552,7 @@ ramfs_close_attrdir(void */*ns*/, void */*_node*/, void *cookie)
{
FUNCTION_START();
// No locking needed, since the Node is guaranteed to live at this time
// and for iterators there is a separate locking.
// and for iterators there is a separate locking.
AttributeIterator *iterator = (AttributeIterator*)cookie;
iterator->Unset();
return B_OK;
@ -1563,7 +1565,7 @@ ramfs_free_attrdir_cookie(void */*ns*/, void */*_node*/, void *cookie)
{
FUNCTION_START();
// No locking needed, since the Node is guaranteed to live at this time
// and for iterators there is a separate locking.
// and for iterators there is a separate locking.
AttributeIterator *iterator = (AttributeIterator*)cookie;
delete iterator;
return B_OK;
@ -1576,7 +1578,7 @@ ramfs_rewind_attrdir(void */*ns*/, void */*_node*/, void *cookie)
{
FUNCTION_START();
// No locking needed, since the Node is guaranteed to live at this time
// and for iterators there is a separate locking.
// and for iterators there is a separate locking.
AttributeIterator *iterator = (AttributeIterator*)cookie;
// no need to Resume(), iterator remains suspended
status_t error = iterator->Rewind();
@ -1585,7 +1587,7 @@ ramfs_rewind_attrdir(void */*ns*/, void */*_node*/, void *cookie)
// ramfs_read_attrdir
static
int
int
ramfs_read_attrdir(void *ns, void */*_node*/, void *cookie, long *count,
struct dirent *buffer, size_t bufferSize)
{
@ -1782,7 +1784,7 @@ ramfs_open_indexdir(void *ns, void **_cookie)
if (VolumeReadLocker locker = volume) {
// check whether an index directory exists
if (volume->GetIndexDirectory()) {
IndexDirCookie *cookie = new(nothrow) IndexDirCookie;
IndexDirCookie *cookie = new(std::nothrow) IndexDirCookie;
if (cookie)
*_cookie = cookie;
else

View File

@ -8,7 +8,9 @@
*/
#include <signal.h>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <KernelExport.h>

View File

@ -7,7 +7,7 @@
* Axel Dörfler, axeld@pinc-software.de.
*/
#include <string>
#include <string.h>
#include <KernelExport.h>