gcc 3 fixes

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4227 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
shadow303 2003-08-04 00:46:53 +00:00
parent 72f334d12f
commit 17e6de7a37
33 changed files with 112 additions and 109 deletions

View File

@ -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_

View File

@ -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
{

View File

@ -93,6 +93,7 @@ public:
template<class T1>
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<class T1>

View File

@ -15,7 +15,7 @@
#include <SupportDefs.h>
#include <list>
#include <pair.h>
#include <utility>
struct entry_ref;
class BMessage;

View File

@ -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<sniffer_rule> fRuleList;
ssize_t fMaxBytesNeeded;

View File

@ -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

View File

@ -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));

View File

@ -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);

View File

@ -30,6 +30,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <AppFileInfo.h>
#include <Application.h>
@ -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)

View File

@ -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)

View File

@ -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;

View File

@ -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);

View File

@ -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)

View File

@ -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;
}

View File

@ -10,6 +10,7 @@
#include <NodeInfo.h>
#include <new>
#include <string.h>
#include <Bitmap.h>
#include <Entry.h>

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -11,7 +11,7 @@
#include <Node.h>
#include <Volume.h>
#include <posix/sys/stat.h>
#include <sys/stat.h>
#include "fsproto.h"
#include "kernel_interface.h"

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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) {

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -8,7 +8,7 @@
*/
#include <sniffer/Err.h>
#include <new.h>
#include <new>
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);
}

View File

@ -15,7 +15,7 @@
#include <sniffer/RPatternList.h>
#include <sniffer/Rule.h>
#include <new.h>
#include <new>
#include <stdio.h>
#include <stdlib.h> // For atol(), atof()
#include <string.h>
@ -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<DisjList*>*
Parser::ParseConjList() {
std::vector<DisjList*> *list = new(nothrow) std::vector<DisjList*>;
std::vector<DisjList*> *list = new(std::nothrow) std::vector<DisjList*>;
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;

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;

View File

@ -26,7 +26,7 @@
//------------------------------------------------------------------------------
#include <stdio.h>
#include <iostream.h>
#include <iostream>
#include <Message.h>
#include <Region.h>
#include <Bitmap.h>