From 17e6de7a37c5c61f45eb724de108daa70905cb8f Mon Sep 17 00:00:00 2001 From: shadow303 Date: Mon, 4 Aug 2003 00:46:53 +0000 Subject: [PATCH] gcc 3 fixes git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4227 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/posix/new | 8 ++-- headers/private/app/LooperList.h | 2 +- headers/private/app/MessageBody.h | 1 + .../private/storage/mime/MimeUpdateThread.h | 2 +- headers/private/storage/mime/SnifferRules.h | 10 ++--- src/kits/app/Application.cpp | 2 +- src/kits/app/Looper.cpp | 8 ++-- src/kits/app/RegistrarThreadManager.cpp | 2 +- src/kits/app/Roster.cpp | 21 ++++----- src/kits/storage/Entry.cpp | 10 ++--- src/kits/storage/File.cpp | 4 +- src/kits/storage/FindDirectory.cpp | 2 +- src/kits/storage/MimeType.cpp | 44 +++++++++---------- src/kits/storage/Node.cpp | 8 ++-- src/kits/storage/NodeInfo.cpp | 1 + src/kits/storage/NodeMonitor.cpp | 2 +- src/kits/storage/Query.cpp | 6 +-- src/kits/storage/ResourceFile.cpp | 8 ++-- src/kits/storage/Statable.cpp | 2 +- src/kits/storage/Volume.cpp | 6 +-- src/kits/storage/kernel_interface.POSIX.cpp | 2 +- .../storage/mime/CreateAppMetaMimeThread.cpp | 2 +- src/kits/storage/mime/Database.cpp | 8 ++-- src/kits/storage/mime/SnifferRules.cpp | 2 +- .../storage/mime/UpdateMimeInfoThread.cpp | 2 +- src/kits/storage/mime/database_access.cpp | 8 ++-- src/kits/storage/mime/database_support.cpp | 10 ++--- src/kits/storage/sniffer/Err.cpp | 4 +- src/kits/storage/sniffer/Parser.cpp | 18 ++++---- src/kits/storage/sniffer/Pattern.cpp | 6 +-- src/kits/support/BlockCache.cpp | 4 +- src/servers/app/server/SysCursor.cpp | 4 +- src/servers/app/server/ViewDriver.cpp | 2 +- 33 files changed, 112 insertions(+), 109 deletions(-) diff --git a/headers/posix/new b/headers/posix/new index 11685b34e3..3f6c32a5ae 100644 --- a/headers/posix/new +++ b/headers/posix/new @@ -45,10 +45,10 @@ void *operator new (size_t) __THROW (std::bad_alloc); void *operator new[] (size_t) __THROW (std::bad_alloc); void operator delete (void *) __THROW(__nothing); void operator delete[] (void *) __THROW(__nothing); -void *operator new (size_t, const nothrow_t&) __THROW(__nothing); -void *operator new[] (size_t, const nothrow_t&) __THROW(__nothing); -void operator delete (void *, const nothrow_t&) __THROW(__nothing); -void operator delete[] (void *, const nothrow_t&) __THROW(__nothing); +void *operator new (size_t, const std::nothrow_t&) __THROW(__nothing); +void *operator new[] (size_t, const std::nothrow_t&) __THROW(__nothing); +void operator delete (void *, const std::nothrow_t&) __THROW(__nothing); +void operator delete[] (void *, const std::nothrow_t&) __THROW(__nothing); // default placement versions of operator new #ifndef _BUILDING_NEW_CPP_ diff --git a/headers/private/app/LooperList.h b/headers/private/app/LooperList.h index 45b30de04f..6ca6fb5eca 100644 --- a/headers/private/app/LooperList.h +++ b/headers/private/app/LooperList.h @@ -66,7 +66,6 @@ class BLooperList BLooper* LooperForName(const char* name); BLooper* LooperForPort(port_id port); - private: struct LooperData { LooperData(); @@ -78,6 +77,7 @@ class BLooperList uint32 id; }; + private: static bool EmptySlotPred(LooperData& Data); struct FindLooperPred { diff --git a/headers/private/app/MessageBody.h b/headers/private/app/MessageBody.h index b44df4a0ea..11c8fdf207 100644 --- a/headers/private/app/MessageBody.h +++ b/headers/private/app/MessageBody.h @@ -93,6 +93,7 @@ public: template status_t AddData(const char* name, const T1& data, type_code type); + status_t AddData(const char* name, type_code type, const void* data, ssize_t numBytes, bool is_fixed_size, int32); status_t FindData(const char* name, type_code type, int32 index, const void** data, ssize_t* numBytes) const; template diff --git a/headers/private/storage/mime/MimeUpdateThread.h b/headers/private/storage/mime/MimeUpdateThread.h index 16e7e257ae..3adad5c3c3 100644 --- a/headers/private/storage/mime/MimeUpdateThread.h +++ b/headers/private/storage/mime/MimeUpdateThread.h @@ -15,7 +15,7 @@ #include #include -#include +#include struct entry_ref; class BMessage; diff --git a/headers/private/storage/mime/SnifferRules.h b/headers/private/storage/mime/SnifferRules.h index 8731dc1b30..ccd69c7a7d 100644 --- a/headers/private/storage/mime/SnifferRules.h +++ b/headers/private/storage/mime/SnifferRules.h @@ -39,11 +39,6 @@ public: status_t DeleteSnifferRule(const char *type); void PrintToStream() const; -private: - status_t BuildRuleList(); - status_t GuessMimeType(BPositionIO *data, BString *type); - ssize_t MaxBytesNeeded(); - status_t ProcessType(const char *type, ssize_t *bytesNeeded); struct sniffer_rule { std::string type; // The mime type that own the rule @@ -53,6 +48,11 @@ private: sniffer_rule(BPrivate::Storage::Sniffer::Rule *rule = NULL); ~sniffer_rule(); }; +private: + status_t BuildRuleList(); + status_t GuessMimeType(BPositionIO *data, BString *type); + ssize_t MaxBytesNeeded(); + status_t ProcessType(const char *type, ssize_t *bytesNeeded); std::list fRuleList; ssize_t fMaxBytesNeeded; diff --git a/src/kits/app/Application.cpp b/src/kits/app/Application.cpp index aeca4ce354..31d304e18d 100644 --- a/src/kits/app/Application.cpp +++ b/src/kits/app/Application.cpp @@ -504,7 +504,7 @@ void BApplication::DispatchMessage(BMessage* message, BHandler* handler) const char *arg = NULL; error = message->FindString("argv", i, &arg); if (error == B_OK && arg) { - argv[i] = new(nothrow) char[strlen(arg) + 1]; + argv[i] = new(std::nothrow) char[strlen(arg) + 1]; if (argv[i]) strcpy(argv[i], arg); else diff --git a/src/kits/app/Looper.cpp b/src/kits/app/Looper.cpp index 08ca365b3b..3abd12c11a 100644 --- a/src/kits/app/Looper.cpp +++ b/src/kits/app/Looper.cpp @@ -73,8 +73,8 @@ port_id _get_looper_port_(const BLooper* looper); bool _use_preferred_target_(BMessage* msg) { return msg->fPreferred; } int32 _get_message_target_(BMessage* msg) { return msg->fTarget; } -uint32 BLooper::sLooperID = B_ERROR; -team_id BLooper::sTeamID = B_ERROR; +uint32 BLooper::sLooperID = (uint32)B_ERROR; +team_id BLooper::sTeamID = (team_id)B_ERROR; enum { @@ -882,7 +882,7 @@ void BLooper::SetCommonFilterList(BList* filters) { for (int32 i = 0; i < fCommonFilters->CountItems(); ++i) { - delete fCommonFilters->ItemAt(i); + delete (BMessageFilter*)fCommonFilters->ItemAt(i); } delete fCommonFilters; @@ -1251,7 +1251,7 @@ DBG(OUT("BLooper::ReadMessageFromPort()\n")); if (msgbuffer) { - delete[] msgbuffer; + delete[] (int8*)msgbuffer; } DBG(OUT("BLooper::ReadMessageFromPort() done: %p\n", bmsg)); diff --git a/src/kits/app/RegistrarThreadManager.cpp b/src/kits/app/RegistrarThreadManager.cpp index 6cf043c862..66720568de 100644 --- a/src/kits/app/RegistrarThreadManager.cpp +++ b/src/kits/app/RegistrarThreadManager.cpp @@ -84,7 +84,7 @@ RegistrarThreadManager::LaunchThread(RegistrarThread *thread) { status_t err = thread ? B_OK : B_BAD_VALUE; if (!err) - err = fThreadCount < kThreadLimit ? B_OK : B_NO_MORE_THREADS; + err = fThreadCount < kThreadLimit ? (status_t)B_OK : (status_t)B_NO_MORE_THREADS; if (!err) { fThreads.push_back(thread); diff --git a/src/kits/app/Roster.cpp b/src/kits/app/Roster.cpp index 2bec15e3bd..0e7bd84c9f 100644 --- a/src/kits/app/Roster.cpp +++ b/src/kits/app/Roster.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -1055,7 +1056,7 @@ BRoster::GetRecentDocuments(BMessage *refList, int32 maxCount, err = msg.AddString("app sig", appSig); fMess.SendMessage(&msg, &reply); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -1096,7 +1097,7 @@ BRoster::GetRecentDocuments(BMessage *refList, int32 maxCount, err = msg.AddString("app sig", appSig); fMess.SendMessage(&msg, &reply); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -1132,7 +1133,7 @@ BRoster::GetRecentFolders(BMessage *refList, int32 maxCount, err = msg.AddString("app sig", appSig); fMess.SendMessage(&msg, &reply); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -1165,7 +1166,7 @@ BRoster::GetRecentApps(BMessage *refList, int32 maxCount) const } fMess.SendMessage(&msg, &reply); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -1205,7 +1206,7 @@ BRoster::AddToRecentDocuments(const entry_ref *doc, const char *appSig) const err = msg.AddString("app sig", (appSig ? appSig : callingAppSig)); fMess.SendMessage(&msg, &reply); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -1242,7 +1243,7 @@ BRoster::AddToRecentFolders(const entry_ref *folder, const char *appSig) const err = msg.AddString("app sig", (appSig ? appSig : callingAppSig)); fMess.SendMessage(&msg, &reply); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -1748,7 +1749,7 @@ DBG(OUT("BRoster::xLaunchAppPrivate() done: %s (%lx)\n", strerror(error), error) bool BRoster::UpdateActiveApp(team_id team) const { - status_t error = (team >= 0 ? B_OK : B_BAD_TEAM_ID); + status_t error = (team >= 0 ? (status_t)B_OK : (status_t)B_BAD_TEAM_ID); // compose the request message BMessage request(B_REG_ACTIVATE_APP); if (error == B_OK) @@ -2208,7 +2209,7 @@ BRoster::AddToRecentApps(const char *appSig) const // evaluate the reply status_t result; if (error == B_OK) - error = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + error = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (error == B_OK) error = reply.FindInt32("result", &result); if (error == B_OK) @@ -2273,7 +2274,7 @@ BRoster::LoadRecentLists(const char *filename) const // evaluate the reply status_t result; if (error == B_OK) - error = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + error = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (error == B_OK) error = reply.FindInt32("result", &result); if (error == B_OK) @@ -2303,7 +2304,7 @@ BRoster::SaveRecentLists(const char *filename) const // evaluate the reply status_t result; if (error == B_OK) - error = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + error = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (error == B_OK) error = reply.FindInt32("result", &result); if (error == B_OK) diff --git a/src/kits/storage/Entry.cpp b/src/kits/storage/Entry.cpp index ab46b601dc..3cc830c98e 100644 --- a/src/kits/storage/Entry.cpp +++ b/src/kits/storage/Entry.cpp @@ -58,8 +58,8 @@ using namespace std; //! Creates an unitialized entry_ref. entry_ref::entry_ref() - : device(-1), - directory(-1), + : device((dev_t)-1), + directory((ino_t)-1), name(NULL) { } @@ -590,8 +590,8 @@ status_t BEntry::GetParent(BEntry *entry) const if (status == B_OK) { // Verify we aren't an entry representing "/" - status = BPrivate::Storage::entry_ref_is_root_dir(&ref) ? B_ENTRY_NOT_FOUND - : B_OK ; + status = BPrivate::Storage::entry_ref_is_root_dir(&ref) ? (status_t)B_ENTRY_NOT_FOUND + : (status_t)B_OK ; if (status == B_OK) { status = ref.set_name("."); @@ -637,7 +637,7 @@ BEntry::GetParent(BDirectory *dir) const if (status == B_OK) { // Verify we aren't an entry representing "/" - status = BPrivate::Storage::entry_ref_is_root_dir(&ref) ? B_ENTRY_NOT_FOUND : B_OK ; + status = BPrivate::Storage::entry_ref_is_root_dir(&ref) ? (status_t)B_ENTRY_NOT_FOUND : (status_t)B_OK ; if (status == B_OK) { // Now point the entry_ref to the parent directory (instead of ourselves) diff --git a/src/kits/storage/File.cpp b/src/kits/storage/File.cpp index f8d8f6c876..2bea92bce2 100644 --- a/src/kits/storage/File.cpp +++ b/src/kits/storage/File.cpp @@ -417,7 +417,7 @@ BFile::WriteAt(off_t location, const void *buffer, size_t size) off_t BFile::Seek(off_t offset, uint32 seekMode) { - off_t result = (InitCheck() == B_OK ? B_OK : B_FILE_ERROR); + off_t result = (InitCheck() == B_OK ? (off_t)B_OK : (off_t)B_FILE_ERROR); if (result == B_OK) result = BPrivate::Storage::seek(get_fd(), offset, seekMode); return result; @@ -433,7 +433,7 @@ BFile::Seek(off_t offset, uint32 seekMode) off_t BFile::Position() const { - off_t result = (InitCheck() == B_OK ? B_OK : B_FILE_ERROR); + off_t result = (InitCheck() == B_OK ? (off_t)B_OK : (off_t)B_FILE_ERROR); if (result == B_OK) result = BPrivate::Storage::get_position(get_fd()); return result; diff --git a/src/kits/storage/FindDirectory.cpp b/src/kits/storage/FindDirectory.cpp index 8b7698091f..b71b729436 100644 --- a/src/kits/storage/FindDirectory.cpp +++ b/src/kits/storage/FindDirectory.cpp @@ -294,7 +294,7 @@ find_directory(directory_which which, BPath *path, bool createIt, { status_t error = (path ? B_OK : B_BAD_VALUE); if (error == B_OK) { - dev_t device = -1; + dev_t device = (dev_t)-1; if (volume && volume->InitCheck() == B_OK) device = volume->Device(); error = find_directory(which, *path, createIt, device); diff --git a/src/kits/storage/MimeType.cpp b/src/kits/storage/MimeType.cpp index 8bf2c022a1..204b044f8b 100644 --- a/src/kits/storage/MimeType.cpp +++ b/src/kits/storage/MimeType.cpp @@ -323,7 +323,7 @@ BMimeType::Install() if (!err) err = BRoster::Private().SendTo(&msg, &reply, true); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -359,7 +359,7 @@ BMimeType::Delete() if (!err) err = BRoster::Private().SendTo(&msg, &reply, true); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -632,7 +632,7 @@ BMimeType::GetSupportingApps(BMessage *signatures) const if (!err) err = BRoster::Private().SendTo(&msg, &reply, true); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -706,7 +706,7 @@ BMimeType::SetPreferredApp(const char *signature, app_verb verb) if (!err) err = BRoster::Private().SendTo(&msg, &reply, true); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -782,7 +782,7 @@ BMimeType::SetAttrInfo(const BMessage *info) if (!err) err = BRoster::Private().SendTo(&msg, &reply, true); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -839,7 +839,7 @@ BMimeType::SetFileExtensions(const BMessage *extensions) if (!err) err = BRoster::Private().SendTo(&msg, &reply, true); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -881,7 +881,7 @@ BMimeType::SetShortDescription(const char *description) if (!err) err = BRoster::Private().SendTo(&msg, &reply, true); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -923,7 +923,7 @@ BMimeType::SetLongDescription(const char *description) if (!err) err = BRoster::Private().SendTo(&msg, &reply, true); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -959,7 +959,7 @@ BMimeType::GetInstalledSupertypes(BMessage *supertypes) if (!err) err = BRoster::Private().SendTo(&msg, &reply, true); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -1018,7 +1018,7 @@ BMimeType::GetInstalledTypes(const char *supertype, BMessage *types) if (!err) err = BRoster::Private().SendTo(&msg, &reply, true); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -1166,7 +1166,7 @@ BMimeType::SetAppHint(const entry_ref *ref) if (!err) err = BRoster::Private().SendTo(&msg, &reply, true); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -1282,13 +1282,13 @@ BMimeType::SetIconForType(const char *type, const BBitmap *icon, icon_size which if (!err) err = BRoster::Private().SendTo(&msg, &reply, true); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) err = result; - delete [] data; + delete [] (int8*)data; return err; } @@ -1348,7 +1348,7 @@ BMimeType::SetSnifferRule(const char *rule) if (!err) err = BRoster::Private().SendTo(&msg, &reply, true); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -1477,7 +1477,7 @@ BMimeType::GuessMimeType(const entry_ref *file, BMimeType *type) if (!err) err = BRoster::Private().SendTo(&msg, &reply, true); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -1515,7 +1515,7 @@ BMimeType::GuessMimeType(const void *buffer, int32 length, BMimeType *type) if (!err) err = BRoster::Private().SendTo(&msg, &reply, true); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -1556,7 +1556,7 @@ BMimeType::GuessMimeType(const char *filename, BMimeType *type) if (!err) err = BRoster::Private().SendTo(&msg, &reply, true); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -1590,7 +1590,7 @@ BMimeType::StartWatching(BMessenger target) if (!err) err = BRoster::Private().SendTo(&msg, &reply, true); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -1619,7 +1619,7 @@ BMimeType::StopWatching(BMessenger target) if (!err) err = BRoster::Private().SendTo(&msg, &reply, true); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -1697,7 +1697,7 @@ BMimeType::DeleteIconForType(const char *type, icon_size which) // DeletePreferredApp //! Deletes the mime type's preferred app for the given verb status_t -BMimeType::DeletePreferredApp(app_verb verb = B_OPEN) +BMimeType::DeletePreferredApp(app_verb verb) { return SetPreferredApp(NULL, verb); } @@ -1799,7 +1799,7 @@ BMimeType::SetSupportedTypes(const BMessage *types, bool fullSync) if (!err) err = BRoster::Private().SendTo(&msg, &reply, true); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) @@ -1837,7 +1837,7 @@ BMimeType::GetAssociatedTypes(const char *extension, BMessage *types) if (!err) err = BRoster::Private().SendTo(&msg, &reply, true); if (!err) - err = reply.what == B_REG_RESULT ? B_OK : B_BAD_REPLY; + err = reply.what == B_REG_RESULT ? (status_t)B_OK : (status_t)B_BAD_REPLY; if (!err) err = reply.FindInt32("result", &result); if (!err) diff --git a/src/kits/storage/Node.cpp b/src/kits/storage/Node.cpp index 6feed10aad..3a4e85509d 100644 --- a/src/kits/storage/Node.cpp +++ b/src/kits/storage/Node.cpp @@ -26,8 +26,8 @@ /*! \brief Creates an uninitialized node_ref object. */ node_ref::node_ref() - : device(-1), - node(-1) + : device((dev_t)-1), + node((ino_t)-1) { } @@ -36,8 +36,8 @@ node_ref::node_ref() \param ref the node_ref to be copied */ node_ref::node_ref(const node_ref &ref) - : device(-1), - node(-1) + : device((dev_t)-1), + node((ino_t)-1) { *this = ref; } diff --git a/src/kits/storage/NodeInfo.cpp b/src/kits/storage/NodeInfo.cpp index a869dfb0af..67b5ca10d4 100644 --- a/src/kits/storage/NodeInfo.cpp +++ b/src/kits/storage/NodeInfo.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include diff --git a/src/kits/storage/NodeMonitor.cpp b/src/kits/storage/NodeMonitor.cpp index c48f3c236c..28cff23ce9 100644 --- a/src/kits/storage/NodeMonitor.cpp +++ b/src/kits/storage/NodeMonitor.cpp @@ -151,7 +151,7 @@ watch_node(const node_ref *node, uint32 flags, const BHandler *handler, // subscribe to... // mount watching if (flags & B_WATCH_MOUNT) { - error = _kstart_watching_vnode_(-1, -1, 0, port, handlerToken); + error = _kstart_watching_vnode_((dev_t)-1, (ino_t)-1, 0, port, handlerToken); flags &= ~B_WATCH_MOUNT; } // node watching diff --git a/src/kits/storage/Query.cpp b/src/kits/storage/Query.cpp index 5165651183..736d7974ad 100644 --- a/src/kits/storage/Query.cpp +++ b/src/kits/storage/Query.cpp @@ -36,7 +36,7 @@ BQuery::BQuery() : BEntryList(), fStack(NULL), fPredicate(NULL), - fDevice(B_ERROR), + fDevice((dev_t)B_ERROR), fLive(false), fPort(B_ERROR), fToken(0), @@ -71,7 +71,7 @@ BQuery::Clear() delete[] fPredicate; fPredicate = NULL; // reset the other parameters - fDevice = B_ERROR; + fDevice = (dev_t)B_ERROR; fLive = false; fPort = B_ERROR; fToken = 0; @@ -344,7 +344,7 @@ BQuery::SetVolume(const BVolume *volume) if (volume->InitCheck() == B_OK) fDevice = volume->Device(); else - fDevice = B_ERROR; + fDevice = (dev_t)B_ERROR; } return error; } diff --git a/src/kits/storage/ResourceFile.cpp b/src/kits/storage/ResourceFile.cpp index f8e2f0e1a3..f9a3a74092 100644 --- a/src/kits/storage/ResourceFile.cpp +++ b/src/kits/storage/ResourceFile.cpp @@ -112,7 +112,7 @@ calculate_checksum(const void *data, uint32 size) const uint8 *current = csData; for (; current < dataEnd; current += 4) { uint32 word = 0; - int32 bytes = min(4L, dataEnd - current); + int32 bytes = min(4L, (int32)(dataEnd - current)); for (int32 i = 0; i < bytes; i++) word = (word << 8) + current[i]; checkSum += word; @@ -1035,12 +1035,12 @@ ResourceFile::_WriteResources(ResourcesContainer &container) indexSectionSize = align_value(indexSectionSize, kResourceIndexSectionAlignment); size += indexSectionSize; - bufferSize = max(bufferSize, indexSectionSize); + bufferSize = max((uint32)bufferSize, indexSectionSize); // unknown section uint32 unknownSectionOffset = size; uint32 unknownSectionSize = kUnknownResourceSectionSize; size += unknownSectionSize; - bufferSize = max(bufferSize, unknownSectionSize); + bufferSize = max((uint32)bufferSize, unknownSectionSize); // data uint32 dataOffset = size; uint32 dataSize = 0; @@ -1071,7 +1071,7 @@ ResourceFile::_WriteResources(ResourcesContainer &container) infoTableSize += kResourceInfoSeparatorSize + kResourceInfoTableEndSize; size += infoTableSize; - bufferSize = max(bufferSize, infoTableSize); + bufferSize = max((uint32)bufferSize, infoTableSize); // write... // set the file size diff --git a/src/kits/storage/Statable.cpp b/src/kits/storage/Statable.cpp index ee7703e0f9..dac0f2d9b3 100644 --- a/src/kits/storage/Statable.cpp +++ b/src/kits/storage/Statable.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include "fsproto.h" #include "kernel_interface.h" diff --git a/src/kits/storage/Volume.cpp b/src/kits/storage/Volume.cpp index dee8eee0e3..10b0d3510f 100644 --- a/src/kits/storage/Volume.cpp +++ b/src/kits/storage/Volume.cpp @@ -55,7 +55,7 @@ namespace OpenBeOS { InitCheck() will return \c B_NO_INIT. */ BVolume::BVolume() - : fDevice(-1), + : fDevice((dev_t)-1), fCStatus(B_NO_INIT) { } @@ -70,7 +70,7 @@ BVolume::BVolume() \param device The device ID of the volume. */ BVolume::BVolume(dev_t device) - : fDevice(-1), + : fDevice((dev_t)-1), fCStatus(B_NO_INIT) { SetTo(device); @@ -146,7 +146,7 @@ BVolume::SetTo(dev_t device) void BVolume::Unset() { - fDevice = -1; + fDevice = (dev_t)-1; fCStatus = B_NO_INIT; } diff --git a/src/kits/storage/kernel_interface.POSIX.cpp b/src/kits/storage/kernel_interface.POSIX.cpp index 42d6a81f01..ec016b59db 100644 --- a/src/kits/storage/kernel_interface.POSIX.cpp +++ b/src/kits/storage/kernel_interface.POSIX.cpp @@ -546,7 +546,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(nothrow) char[max(info.size, (off_t)1LL)]; if (data == NULL) error = B_NO_MEMORY; } diff --git a/src/kits/storage/mime/CreateAppMetaMimeThread.cpp b/src/kits/storage/mime/CreateAppMetaMimeThread.cpp index b67f23b8a3..3e605daac9 100644 --- a/src/kits/storage/mime/CreateAppMetaMimeThread.cpp +++ b/src/kits/storage/mime/CreateAppMetaMimeThread.cpp @@ -82,7 +82,7 @@ CreateAppMetaMimeThread::DoMimeUpdate(const entry_ref *entry, bool *entryIsDir) err = info.size == 16*16 ? B_OK : B_BAD_VALUE; if (!err) { ssize_t bytes = node.ReadAttr("BEOS:M:STD_ICON", kMiniIconType, 0, miniIcon.Bits(), 16*16); - err = bytes == 16*16 ? B_OK : B_FILE_ERROR; + err = bytes == 16*16 ? (status_t)B_OK : (status_t)B_FILE_ERROR; } if (!err) err = mime.SetIcon(&miniIcon, B_MINI_ICON); diff --git a/src/kits/storage/mime/Database.cpp b/src/kits/storage/mime/Database.cpp index 08a7eeb2b7..09d1d13da0 100644 --- a/src/kits/storage/mime/Database.cpp +++ b/src/kits/storage/mime/Database.cpp @@ -360,7 +360,7 @@ Database::SetIconForType(const char *type, const char *fileType, const void *dat if (!err) err = node.WriteAttr(attr.c_str(), attrType, 0, data, attrSize); if (err >= 0) - err = err == (ssize_t)attrSize ? B_OK : B_FILE_ERROR; + err = err == (ssize_t)attrSize ? (status_t)B_OK : (status_t)B_FILE_ERROR; if (!err) { if (fileType) err = SendMonitorUpdate(B_ICON_FOR_TYPE_CHANGED, type, fileType, (which == B_LARGE_ICON), B_META_MIME_MODIFIED); @@ -381,7 +381,7 @@ Database::SetIconForType(const char *type, const char *fileType, const void *dat \param verb \c app_verb action for which the new preferred application is applicable */ status_t -Database::SetPreferredApp(const char *type, const char *signature, app_verb verb = B_OPEN) +Database::SetPreferredApp(const char *type, const char *signature, app_verb verb) { DBG(OUT("Database::SetPreferredApp()\n")); bool didCreate = false; @@ -767,7 +767,7 @@ Database::StopWatching(BMessenger target) DBG(OUT("Database::StopWatching()\n")); status_t err = target.IsValid() ? B_OK : B_BAD_VALUE; if (!err) - err = fMonitorMessengers.find(target) != fMonitorMessengers.end() ? B_OK : B_ENTRY_NOT_FOUND; + err = fMonitorMessengers.find(target) != fMonitorMessengers.end() ? (status_t)B_OK : (status_t)B_ENTRY_NOT_FOUND; if (!err) fMonitorMessengers.erase(target); return err; @@ -925,7 +925,7 @@ Database::DeleteIconForType(const char *type, const char *fileType, icon_size wh - "error code": failure */ status_t -Database::DeletePreferredApp(const char *type, app_verb verb = B_OPEN) +Database::DeletePreferredApp(const char *type, app_verb verb) { status_t err; switch (verb) { diff --git a/src/kits/storage/mime/SnifferRules.cpp b/src/kits/storage/mime/SnifferRules.cpp index d56e97c809..c5e863d7a3 100644 --- a/src/kits/storage/mime/SnifferRules.cpp +++ b/src/kits/storage/mime/SnifferRules.cpp @@ -160,7 +160,7 @@ SnifferRules::GuessMimeType(const entry_ref *ref, BString *type) // Next read that many bytes (or fewer, if the file isn't // that long) into a buffer if (!err) { - buffer = new(nothrow) char[bytes]; + buffer = new(std::nothrow) char[bytes]; if (!buffer) err = B_NO_MEMORY; } diff --git a/src/kits/storage/mime/UpdateMimeInfoThread.cpp b/src/kits/storage/mime/UpdateMimeInfoThread.cpp index d035c3b26f..9d282e3b68 100644 --- a/src/kits/storage/mime/UpdateMimeInfoThread.cpp +++ b/src/kits/storage/mime/UpdateMimeInfoThread.cpp @@ -61,7 +61,7 @@ UpdateMimeInfoThread::DoMimeUpdate(const entry_ref *entry, bool *entryIsDir) if (bytes < B_OK) err = bytes; else - err = (bytes != len ? B_FILE_ERROR : B_OK); + err = (bytes != len ? (status_t)B_FILE_ERROR : (status_t)B_OK); } } return err; diff --git a/src/kits/storage/mime/database_access.cpp b/src/kits/storage/mime/database_access.cpp index 265e7be796..6e383f7708 100644 --- a/src/kits/storage/mime/database_access.cpp +++ b/src/kits/storage/mime/database_access.cpp @@ -260,7 +260,7 @@ get_icon_for_type(const char *type, const char *fileType, BBitmap *icon, char *buffer = NULL; if (otherColorSpace) { // other color space than stored in attribute - buffer = new(nothrow) char[attrSize]; + buffer = new(std::nothrow) char[attrSize]; if (!buffer) err = B_NO_MEMORY; if (!err) @@ -270,7 +270,7 @@ get_icon_for_type(const char *type, const char *fileType, BBitmap *icon, err = node.ReadAttr(attr.c_str(), attrType, 0, icon->Bits(), attrSize); } if (err >= 0) - err = (err == attrSize) ? B_OK : B_FILE_ERROR; + err = (err == attrSize) ? (status_t)B_OK : (status_t)B_FILE_ERROR; if (otherColorSpace) { if (!err) { err = icon->ImportBits(buffer, attrSize, B_ANY_BYTES_PER_ROW, @@ -390,7 +390,7 @@ get_icon_data(const BBitmap *icon, icon_size which, void **data, int32 *dataSize if (!err) { otherColorSpace = (icon->ColorSpace() != B_CMAP8); if (otherColorSpace) { - icon8 = new(nothrow) BBitmap(bounds, B_CMAP8); + icon8 = new(std::nothrow) BBitmap(bounds, B_CMAP8); if (!icon8) err = B_NO_MEMORY; if (!err) @@ -406,7 +406,7 @@ get_icon_data(const BBitmap *icon, icon_size which, void **data, int32 *dataSize } // Alloc a new data buffer if (!err) { - *data = new(nothrow) char[*dataSize]; + *data = new(std::nothrow) char[*dataSize]; if (!*data) err = B_NO_MEMORY; } diff --git a/src/kits/storage/mime/database_support.cpp b/src/kits/storage/mime/database_support.cpp index 5b6e6af1a3..3e9a4be494 100644 --- a/src/kits/storage/mime/database_support.cpp +++ b/src/kits/storage/mime/database_support.cpp @@ -221,14 +221,14 @@ read_mime_attr_message(const char *type, const char *attr, BMessage *msg) if (!err) err = info.type == B_MESSAGE_TYPE ? B_OK : B_BAD_VALUE; if (!err) { - buffer = new(nothrow) char[info.size]; + buffer = new(std::nothrow) char[info.size]; if (!buffer) err = B_NO_MEMORY; } if (!err) err = node.ReadAttr(attr, B_MESSAGE_TYPE, 0, buffer, info.size); if (err >= 0) - err = err == info.size ? B_OK : B_FILE_ERROR; + err = err == info.size ? (status_t)B_OK : (status_t)B_FILE_ERROR; if (!err) err = msg->Unflatten(buffer); delete [] buffer; @@ -247,7 +247,7 @@ read_mime_attr_message(const char *type, const char *attr, BMessage *msg) \param str Pointer to a pre-allocated BString into which the attribute data stored. */ -ssize_t +status_t read_mime_attr_string(const char *type, const char *attr, BString *str) { BNode node; @@ -284,7 +284,7 @@ write_mime_attr(const char *type, const char *attr, const void *data, if (bytes < B_OK) err = bytes; else - err = (bytes != (ssize_t)len ? B_FILE_ERROR : B_OK); + err = (bytes != (ssize_t)len ? (status_t)B_FILE_ERROR : (status_t)B_OK); } return err; } @@ -317,7 +317,7 @@ write_mime_attr_message(const char *type, const char *attr, const BMessage *msg, if (!err) err = node.WriteAttr(attr, B_MESSAGE_TYPE, 0, data.Buffer(), data.BufferLength()); if (err >= 0) - err = err == (ssize_t)data.BufferLength() ? B_OK : B_FILE_ERROR; + err = err == (ssize_t)data.BufferLength() ? (ssize_t)B_OK : (ssize_t)B_FILE_ERROR; return err; } diff --git a/src/kits/storage/sniffer/Err.cpp b/src/kits/storage/sniffer/Err.cpp index 0bb21c0c5a..7c27d42c73 100644 --- a/src/kits/storage/sniffer/Err.cpp +++ b/src/kits/storage/sniffer/Err.cpp @@ -8,7 +8,7 @@ */ #include -#include +#include using namespace BPrivate::Storage::Sniffer; @@ -82,7 +82,7 @@ Err::SetMsg(const char *msg) { fMsg = NULL; } if (msg) { - fMsg = new(nothrow) char[strlen(msg)+1]; + fMsg = new(std::nothrow) char[strlen(msg)+1]; if (fMsg) strcpy(fMsg, msg); } diff --git a/src/kits/storage/sniffer/Parser.cpp b/src/kits/storage/sniffer/Parser.cpp index 4aef7385b0..5848de4f94 100644 --- a/src/kits/storage/sniffer/Parser.cpp +++ b/src/kits/storage/sniffer/Parser.cpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include // For atol(), atof() #include @@ -931,7 +931,7 @@ BPrivate::Storage::Sniffer::tokenTypeToString(TokenType type) { //------------------------------------------------------------------------------ Parser::Parser() - : fOutOfMemErr(new(nothrow) Err("Sniffer parser error: out of memory", -1)) + : fOutOfMemErr(new(std::nothrow) Err("Sniffer parser error: out of memory", -1)) { } @@ -958,7 +958,7 @@ Parser::Parse(const char *rule, Rule *result, BString *parseError) { if (parseError) parseError->SetTo(ErrorMessage(err, rule).c_str()); delete err; - return rule ? B_BAD_MIME_SNIFFER_RULE : B_BAD_VALUE; + return rule ? (status_t)B_BAD_MIME_SNIFFER_RULE : (status_t)B_BAD_VALUE; } } @@ -1006,7 +1006,7 @@ Parser::ParsePriority() { std::vector* Parser::ParseConjList() { - std::vector *list = new(nothrow) std::vector; + std::vector *list = new(std::nothrow) std::vector; if (!list) ThrowOutOfMemError(stream.Pos()); try { @@ -1116,7 +1116,7 @@ Parser::ParseRange() { DisjList* Parser::ParsePatternList(Range range) { - PatternList *list = new(nothrow) PatternList(range); + PatternList *list = new(std::nothrow) PatternList(range); if (!list) ThrowOutOfMemError(stream.Pos()); try { @@ -1146,7 +1146,7 @@ Parser::ParsePatternList(Range range) { DisjList* Parser::ParseRPatternList() { - RPatternList *list = new(nothrow) RPatternList(); + RPatternList *list = new(std::nothrow) RPatternList(); if (!list) ThrowOutOfMemError(stream.Pos()); try { @@ -1181,7 +1181,7 @@ Parser::ParseRPattern() { // Pattern Pattern *pattern = ParsePattern(); - RPattern *result = new(nothrow) RPattern(range, pattern); + RPattern *result = new(std::nothrow) RPattern(range, pattern); if (result) { if (result->InitCheck() == B_OK) return result; @@ -1211,7 +1211,7 @@ Parser::ParsePattern() { // String (i.e. Mask) const Token *t = stream.Get(); if (t->Type() == CharacterString) { - Pattern *result = new(nothrow) Pattern(str, t->String()); + Pattern *result = new(std::nothrow) Pattern(str, t->String()); if (!result) ThrowOutOfMemError(t->Pos()); if (result->InitCheck() == B_OK) { @@ -1228,7 +1228,7 @@ Parser::ParsePattern() { ThrowUnexpectedTokenError(CharacterString, t); } else { // No mask specified. - Pattern *result = new(nothrow) Pattern(str); + Pattern *result = new(std::nothrow) Pattern(str); if (result) { if (result->InitCheck() == B_OK) return result; diff --git a/src/kits/storage/sniffer/Pattern.cpp b/src/kits/storage/sniffer/Pattern.cpp index d0a475808e..a9fc7482cd 100644 --- a/src/kits/storage/sniffer/Pattern.cpp +++ b/src/kits/storage/sniffer/Pattern.cpp @@ -48,7 +48,7 @@ Pattern::GetErr() const { if (fCStatus == B_OK) return NULL; else - return new(nothrow) Err(*fErrorMessage); + return new(std::nothrow) Err(*fErrorMessage); } void dumpStr(const std::string &string, const char *label = NULL) { @@ -157,7 +157,7 @@ Pattern::Sniff(off_t start, off_t size, BPositionIO *data, bool caseInsensitive) bool Pattern::Sniff(off_t start, off_t size, BPositionIO *data, bool caseInsensitive) const { off_t len = fString.length(); - char *buffer = new(nothrow) char[len+1]; + char *buffer = new(std::nothrow) char[len+1]; if (buffer) { ssize_t bytesRead = data->ReadAt(start, buffer, len); // \todo If there are fewer bytes left in the data stream @@ -218,7 +218,7 @@ Pattern::SetStatus(status_t status, const char *msg) { void Pattern::SetErrorMessage(const char *msg) { delete fErrorMessage; - fErrorMessage = (msg) ? (new(nothrow) Err(msg, -1)) : (NULL); + fErrorMessage = (msg) ? (new(std::nothrow) Err(msg, -1)) : (NULL); } diff --git a/src/kits/support/BlockCache.cpp b/src/kits/support/BlockCache.cpp index a500a382a4..41cada841d 100644 --- a/src/kits/support/BlockCache.cpp +++ b/src/kits/support/BlockCache.cpp @@ -44,7 +44,7 @@ object_alloc(size_t Size) static void object_free(void *Data) { - delete[] Data; + delete[] (int8*)Data; } @@ -108,7 +108,7 @@ BBlockCache::BBlockCache(size_t CacheSize, size_t BlockSize, uint32 Type) BBlockCache::~BBlockCache() { - delete[] fCache; + delete[] (int8*)fCache; } diff --git a/src/servers/app/server/SysCursor.cpp b/src/servers/app/server/SysCursor.cpp index 9aba962ebf..c529e7cc87 100644 --- a/src/servers/app/server/SysCursor.cpp +++ b/src/servers/app/server/SysCursor.cpp @@ -286,7 +286,7 @@ status_t CursorSet::FindCursor(cursor_which which, BBitmap **cursor, BPoint *hot { bmp=new BBitmap( msg.FindRect("_frame"), (color_space) msg.FindInt32("_cspace"),true ); - msg.FindData("_data",B_RAW_TYPE,(const void **)&buffer, &bufferLength); + msg.FindData("_data",B_RAW_TYPE,(const void **)&buffer, (ssize_t*)&bufferLength); memcpy(bmp->Bits(), buffer, bufferLength); *cursor=bmp; @@ -330,7 +330,7 @@ status_t CursorSet::FindCursor(cursor_which which, ServerCursor **cursor) if(tempstr.Compare("cursor")==0) { csr=new ServerCursor(msg.FindRect("_frame"),(color_space) msg.FindInt32("_cspace"),0, hotpt); - msg.FindData("_data",B_RAW_TYPE,(const void **)&buffer, &bufferLength); + msg.FindData("_data",B_RAW_TYPE,(const void **)&buffer, (ssize_t*)&bufferLength); memcpy(csr->Bits(), buffer, bufferLength); *cursor=csr; diff --git a/src/servers/app/server/ViewDriver.cpp b/src/servers/app/server/ViewDriver.cpp index 69dbfd8596..9c5c50d344 100644 --- a/src/servers/app/server/ViewDriver.cpp +++ b/src/servers/app/server/ViewDriver.cpp @@ -26,7 +26,7 @@ //------------------------------------------------------------------------------ #include -#include +#include #include #include #include