diff --git a/src/kits/storage/Entry.cpp b/src/kits/storage/Entry.cpp index 59ed019bc4..3c70bdac0b 100644 --- a/src/kits/storage/Entry.cpp +++ b/src/kits/storage/Entry.cpp @@ -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; diff --git a/src/kits/storage/MimeType.cpp b/src/kits/storage/MimeType.cpp index 22e436012b..b862e0a141 100644 --- a/src/kits/storage/MimeType.cpp +++ b/src/kits/storage/MimeType.cpp @@ -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; diff --git a/src/kits/storage/Path.cpp b/src/kits/storage/Path.cpp index ce99c138d9..03fdd6cbca 100644 --- a/src/kits/storage/Path.cpp +++ b/src/kits/storage/Path.cpp @@ -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 diff --git a/src/kits/storage/Query.cpp b/src/kits/storage/Query.cpp index 41667f1258..adf4d23c76 100644 --- a/src/kits/storage/Query.cpp +++ b/src/kits/storage/Query.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include @@ -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 diff --git a/src/kits/storage/ResourceFile.cpp b/src/kits/storage/ResourceFile.cpp index f3b996474a..b367e1c940 100644 --- a/src/kits/storage/ResourceFile.cpp +++ b/src/kits/storage/ResourceFile.cpp @@ -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; diff --git a/src/kits/storage/Resources.cpp b/src/kits/storage/Resources.cpp index 5bec5aef9e..83d0bc34ea 100644 --- a/src/kits/storage/Resources.cpp +++ b/src/kits/storage/Resources.cpp @@ -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) { diff --git a/src/kits/storage/SymLink.cpp b/src/kits/storage/SymLink.cpp index c0c5ee0245..ad30311d5f 100644 --- a/src/kits/storage/SymLink.cpp +++ b/src/kits/storage/SymLink.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #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); } diff --git a/src/kits/storage/VolumeRoster.cpp b/src/kits/storage/VolumeRoster.cpp index 170df8f31c..892cd24fbe 100644 --- a/src/kits/storage/VolumeRoster.cpp +++ b/src/kits/storage/VolumeRoster.cpp @@ -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; } diff --git a/src/kits/storage/kernel_interface.POSIX.cpp b/src/kits/storage/kernel_interface.POSIX.cpp index 9baccdef97..d740001776 100644 --- a/src/kits/storage/kernel_interface.POSIX.cpp +++ b/src/kits/storage/kernel_interface.POSIX.cpp @@ -14,7 +14,7 @@ #include "LibBeAdapter.h" -#include +#include #include #include // errno #include @@ -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) { diff --git a/src/kits/storage/storage_support.cpp b/src/kits/storage/storage_support.cpp index 0909ee9c29..50e982125c 100644 --- a/src/kits/storage/storage_support.cpp +++ b/src/kits/storage/storage_support.cpp @@ -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);