Namespace- and gcc3-related fixes

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3405 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
haydentech 2003-06-03 18:29:29 +00:00
parent df1b8782c7
commit a0a3f269a4
10 changed files with 56 additions and 57 deletions

View File

@ -114,7 +114,7 @@ status_t entry_ref::set_name(const char *name)
if (name == NULL) {
this->name = NULL;
} else {
this->name = new(nothrow) char[strlen(name)+1];
this->name = new(std::nothrow) char[strlen(name)+1];
if (this->name == NULL)
return B_NO_MEMORY;
strcpy(this->name, name);
@ -764,7 +764,7 @@ BEntry::Rename(const char *path, bool clobber)
*/
status_t
BEntry::MoveTo(BDirectory *dir, const char *path = NULL, bool clobber)
BEntry::MoveTo(BDirectory *dir, const char *path, bool clobber)
{
if (fCStatus != B_OK)
return B_NO_INIT;
@ -1047,7 +1047,7 @@ BEntry::set_name(const char *name)
delete [] fName;
}
fName = new(nothrow) char[strlen(name)+1];
fName = new(std::nothrow) char[strlen(name)+1];
if (fName == NULL)
return B_NO_MEMORY;

View File

@ -99,7 +99,7 @@ BMimeType::SetTo(const char *mimeType)
fCStatus = B_BAD_VALUE;
} else {
Unset();
fType = new(nothrow) char[strlen(mimeType)+1];
fType = new(std::nothrow) char[strlen(mimeType)+1];
if (fType) {
strcpy(fType, mimeType);
fCStatus = B_OK;

View File

@ -600,7 +600,7 @@ BPath::set_path(const char *path)
const char *oldPath = fName;
// set the new path
if (path) {
fName = new(nothrow) char[strlen(path) + 1];
fName = new(std::nothrow) char[strlen(path) + 1];
if (fName)
strcpy(fName, path);
else

View File

@ -9,7 +9,7 @@
#include <Query.h>
#include <fs_query.h>
#include <new.h>
#include <new>
#include <parsedate.h>
#include <time.h>
@ -95,7 +95,7 @@ BQuery::Clear()
status_t
BQuery::PushAttr(const char *attrName)
{
return _PushNode(new(nothrow) AttributeNode(attrName), true);
return _PushNode(new(std::nothrow) AttributeNode(attrName), true);
}
// PushOp
@ -129,13 +129,13 @@ BQuery::PushOp(query_op op)
case B_ENDS_WITH:
case B_AND:
case B_OR:
error = _PushNode(new(nothrow) BinaryOpNode(op), true);
error = _PushNode(new(std::nothrow) BinaryOpNode(op), true);
break;
case B_NOT:
error = _PushNode(new(nothrow) UnaryOpNode(op), true);
error = _PushNode(new(std::nothrow) UnaryOpNode(op), true);
break;
default:
error = _PushNode(new(nothrow) SpecialOpNode(op), true);
error = _PushNode(new(std::nothrow) SpecialOpNode(op), true);
break;
}
return error;
@ -159,7 +159,7 @@ BQuery::PushOp(query_op op)
status_t
BQuery::PushUInt32(uint32 value)
{
return _PushNode(new(nothrow) UInt32ValueNode(value), true);
return _PushNode(new(std::nothrow) UInt32ValueNode(value), true);
}
// PushInt32
@ -180,7 +180,7 @@ BQuery::PushUInt32(uint32 value)
status_t
BQuery::PushInt32(int32 value)
{
return _PushNode(new(nothrow) Int32ValueNode(value), true);
return _PushNode(new(std::nothrow) Int32ValueNode(value), true);
}
// PushUInt64
@ -201,7 +201,7 @@ BQuery::PushInt32(int32 value)
status_t
BQuery::PushUInt64(uint64 value)
{
return _PushNode(new(nothrow) UInt64ValueNode(value), true);
return _PushNode(new(std::nothrow) UInt64ValueNode(value), true);
}
// PushInt64
@ -222,7 +222,7 @@ BQuery::PushUInt64(uint64 value)
status_t
BQuery::PushInt64(int64 value)
{
return _PushNode(new(nothrow) Int64ValueNode(value), true);
return _PushNode(new(std::nothrow) Int64ValueNode(value), true);
}
// PushFloat
@ -243,7 +243,7 @@ BQuery::PushInt64(int64 value)
status_t
BQuery::PushFloat(float value)
{
return _PushNode(new(nothrow) FloatValueNode(value), true);
return _PushNode(new(std::nothrow) FloatValueNode(value), true);
}
// PushDouble
@ -264,7 +264,7 @@ BQuery::PushFloat(float value)
status_t
BQuery::PushDouble(double value)
{
return _PushNode(new(nothrow) DoubleValueNode(value), true);
return _PushNode(new(std::nothrow) DoubleValueNode(value), true);
}
// PushString
@ -287,7 +287,7 @@ BQuery::PushDouble(double value)
status_t
BQuery::PushString(const char *value, bool caseInsensitive)
{
return _PushNode(new(nothrow) StringNode(value, caseInsensitive), true);
return _PushNode(new(std::nothrow) StringNode(value, caseInsensitive), true);
}
// PushDate
@ -319,7 +319,7 @@ BQuery::PushDate(const char *date)
}
}
if (error == B_OK)
error = _PushNode(new(nothrow) DateNode(date), true);
error = _PushNode(new(std::nothrow) DateNode(date), true);
return error;
}
@ -677,7 +677,7 @@ BQuery::_PushNode(QueryNode *node, bool deleteOnError)
error = B_NOT_ALLOWED;
// allocate the stack, if necessary
if (error == B_OK && !fStack) {
fStack = new(nothrow) QueryStack;
fStack = new(std::nothrow) QueryStack;
if (!fStack)
error = B_NO_MEMORY;
}
@ -705,7 +705,7 @@ BQuery::_SetPredicate(const char *expression)
fPredicate = NULL;
// set the new one
if (expression) {
fPredicate = new(nothrow) char[strlen(expression) + 1];
fPredicate = new(std::nothrow) char[strlen(expression) + 1];
if (fPredicate)
strcpy(fPredicate, expression);
else

View File

@ -822,7 +822,7 @@ ResourceFile::_ReadIndexEntry(resource_parse_info &parseInfo, int32 index,
}
// add the entry
if (result) {
ResourceItem *item = new(nothrow) ResourceItem;
ResourceItem *item = new(std::nothrow) ResourceItem;
if (!item)
throw Exception(B_NO_MEMORY);
item->SetLocation(offset, size);
@ -841,7 +841,7 @@ ResourceFile::_ReadInfoTable(resource_parse_info &parseInfo)
int32 &resourceCount = parseInfo.resource_count;
// read the info table
// alloc memory for the table
char *tableData = new(nothrow) char[parseInfo.info_table_size];
char *tableData = new(std::nothrow) char[parseInfo.info_table_size];
if (!tableData)
throw Exception(B_NO_MEMORY);
int32 dataSize = parseInfo.info_table_size;
@ -849,7 +849,7 @@ ResourceFile::_ReadInfoTable(resource_parse_info &parseInfo)
read_exactly(fFile, parseInfo.info_table_offset, tableData, dataSize,
"Failed to read resource info table.");
//
bool *readIndices = new(nothrow) bool[resourceCount + 1];
bool *readIndices = new(std::nothrow) bool[resourceCount + 1];
// + 1 => always > 0
if (!readIndices)
throw Exception(B_NO_MEMORY);
@ -1074,7 +1074,7 @@ ResourceFile::_WriteResources(ResourcesContainer &container)
// write...
// set the file size
fFile.SetSize(size);
buffer = new(nothrow) char[bufferSize];
buffer = new(std::nothrow) char[bufferSize];
if (!buffer)
throw Exception(B_NO_MEMORY);
void *data = buffer;

View File

@ -39,7 +39,7 @@ BResources::BResources()
fResourceFile(NULL),
fReadOnly(false)
{
fContainer = new(nothrow) ResourcesContainer;
fContainer = new(std::nothrow) ResourcesContainer;
}
// constructor
@ -61,7 +61,7 @@ BResources::BResources(const BFile *file, bool clobber)
fResourceFile(NULL),
fReadOnly(false)
{
fContainer = new(nothrow) ResourcesContainer;
fContainer = new(std::nothrow) ResourcesContainer;
SetTo(file, clobber);
}
@ -109,7 +109,7 @@ BResources::SetTo(const BFile *file, bool clobber)
}
if (error == B_OK) {
fReadOnly = !fFile.IsWritable();
fResourceFile = new(nothrow) ResourceFile;
fResourceFile = new(std::nothrow) ResourceFile;
if (fResourceFile)
error = fResourceFile->SetTo(&fFile, clobber);
else
@ -148,7 +148,7 @@ BResources::Unset()
if (fContainer)
fContainer->MakeEmpty();
else
fContainer = new(nothrow) ResourcesContainer;
fContainer = new(std::nothrow) ResourcesContainer;
fReadOnly = false;
}
@ -383,7 +383,7 @@ BResources::WriteTo(BFile *file)
// set the new file, but keep the old container
if (error == B_OK) {
ResourcesContainer *container = fContainer;
fContainer = new(nothrow) ResourcesContainer;
fContainer = new(std::nothrow) ResourcesContainer;
if (fContainer) {
error = SetTo(file, false);
delete fContainer;
@ -425,7 +425,7 @@ BResources::AddResource(type_code type, int32 id, const void *data,
if (error == B_OK)
error = (fReadOnly ? B_NOT_ALLOWED : B_OK);
if (error == B_OK) {
ResourceItem *item = new(nothrow) ResourceItem;
ResourceItem *item = new(std::nothrow) ResourceItem;
if (!item)
error = B_NO_MEMORY;
if (error == B_OK) {

View File

@ -12,7 +12,6 @@
#include <SymLink.h>
#include <Directory.h>
#include <Entry.h>
#include <Entry.h>
#include <Path.h>
#include "kernel_interface.h"
#include "storage_support.h"
@ -26,7 +25,7 @@ namespace OpenBeOS {
BSymLink::BSymLink()
: BNode()
// WORKAROUND
, fSecretEntry(new(nothrow) BEntry)
, fSecretEntry(new(std::nothrow) BEntry)
{
}
@ -37,7 +36,7 @@ BSymLink::BSymLink()
BSymLink::BSymLink(const BSymLink &link)
: BNode()
// WORKAROUND
, fSecretEntry(new(nothrow) BEntry)
, fSecretEntry(new(std::nothrow) BEntry)
{
*this = link;
}
@ -50,7 +49,7 @@ BSymLink::BSymLink(const BSymLink &link)
BSymLink::BSymLink(const entry_ref *ref)
: BNode()
// WORKAROUND
, fSecretEntry(new(nothrow) BEntry)
, fSecretEntry(new(std::nothrow) BEntry)
{
SetTo(ref);
}
@ -63,7 +62,7 @@ BSymLink::BSymLink(const entry_ref *ref)
BSymLink::BSymLink(const BEntry *entry)
: BNode()
// WORKAROUND
, fSecretEntry(new(nothrow) BEntry)
, fSecretEntry(new(std::nothrow) BEntry)
{
SetTo(entry);
}
@ -76,7 +75,7 @@ BSymLink::BSymLink(const BEntry *entry)
BSymLink::BSymLink(const char *path)
: BNode()
// WORKAROUND
, fSecretEntry(new(nothrow) BEntry)
, fSecretEntry(new(std::nothrow) BEntry)
{
SetTo(path);
}
@ -91,7 +90,7 @@ BSymLink::BSymLink(const char *path)
BSymLink::BSymLink(const BDirectory *dir, const char *path)
: BNode()
// WORKAROUND
, fSecretEntry(new(nothrow) BEntry)
, fSecretEntry(new(std::nothrow) BEntry)
{
SetTo(dir, path);
}

View File

@ -172,7 +172,7 @@ BVolumeRoster::StartWatching(BMessenger messenger)
status_t error = (messenger.IsValid() ? B_OK : B_ERROR);
// clone messenger
if (error == B_OK) {
fTarget = new(nothrow) BMessenger(messenger);
fTarget = new(std::nothrow) BMessenger(messenger);
if (!fTarget)
error = B_NO_MEMORY;
}

View File

@ -14,7 +14,7 @@
#include "LibBeAdapter.h"
#include <algobase.h>
#include <algorithm>
#include <fsproto.h>
#include <errno.h> // errno
#include <new>
@ -253,32 +253,32 @@ BPrivate::Storage::sync( FileDescriptor file )
//! /todo Get rid of DumpLock() at some point (it's only for debugging)
void DumpLock(BPrivate::Storage::FileLock &lock)
{
cout << endl;
cout << "type == ";
std::cout << std::endl;
std::cout << "type == ";
switch (lock.l_type) {
case F_RDLCK:
cout << "F_RDLCK";
std::cout << "F_RDLCK";
break;
case F_WRLCK:
cout << "F_WRLCK";
std::cout << "F_WRLCK";
break;
case F_UNLCK:
cout << "F_UNLCK";
std::cout << "F_UNLCK";
break;
default:
cout << lock.l_type;
std::cout << lock.l_type;
break;
}
cout << endl;
std::cout << std::endl;
cout << "whence == " << lock.l_whence << endl;
cout << "start == " << lock.l_start << endl;
cout << "len == " << lock.l_len << endl;
cout << "pid == " << lock.l_pid << endl;
cout << endl;
std::cout << "whence == " << lock.l_whence << std::endl;
std::cout << "start == " << lock.l_start << std::endl;
std::cout << "len == " << lock.l_len << std::endl;
std::cout << "pid == " << lock.l_pid << std::endl;
std::cout << std::endl;
}
// As best I can tell, fcntl(fd, F_SETLK, lock) and fcntl(fd, F_GETLK, lock)
@ -544,7 +544,7 @@ BPrivate::Storage::rename_attr(FileDescriptor file, const char *oldName,
char *data = NULL;
if (error == B_OK) {
// alloc at least one byte
data = new(nothrow) char[max(info.size, 1LL)];
data = new(std::nothrow) char[max(info.size, 1LL)];
if (data == NULL)
error = B_NO_MEMORY;
}
@ -1072,7 +1072,7 @@ BPrivate::Storage::get_canonical_path(const char *path, char *&result)
{
status_t error = (path ? B_OK : B_BAD_VALUE);
if (error == B_OK) {
result = new(nothrow) char[B_PATH_NAME_LENGTH];
result = new(std::nothrow) char[B_PATH_NAME_LENGTH];
if (!result)
error = B_NO_MEMORY;
if (error == B_OK) {
@ -1117,7 +1117,7 @@ BPrivate::Storage::get_canonical_dir_path(const char *path, char *&result)
{
status_t error = (path ? B_OK : B_BAD_VALUE);
if (error == B_OK) {
result = new(nothrow) char[B_PATH_NAME_LENGTH];
result = new(std::nothrow) char[B_PATH_NAME_LENGTH];
if (!result)
error = B_NO_MEMORY;
if (error == B_OK) {

View File

@ -171,7 +171,7 @@ split_path(const char *fullPath, char **path, char **leaf)
memcpy(*leaf, fullPath + leafStart, len);
(*leaf)[len] = 0;
}
} catch (bad_alloc exception) {
} catch (std::bad_alloc exception) {
if (path)
delete[] *path;
if (leaf)
@ -232,7 +232,7 @@ parse_first_path_component(const char *path, char *&component,
int32 length;
status_t error = parse_first_path_component(path, length, nextComponent);
if (error == B_OK) {
component = new(nothrow) char[length + 1];
component = new(std::nothrow) char[length + 1];
if (component) {
strncpy(component, path, length);
component[length] = '\0';
@ -376,7 +376,7 @@ void escape_path(const char *str, char *result)
void escape_path(char *str)
{
if (str) {
char *copy = new(nothrow) char[strlen(str)+1];
char *copy = new(std::nothrow) char[strlen(str)+1];
if (copy) {
strcpy(copy, str);
escape_path(copy, str);