diff --git a/headers/build/config/HaikuConfig.h b/headers/build/config/HaikuConfig.h index cb405a162e..5cd7331bc5 100644 --- a/headers/build/config/HaikuConfig.h +++ b/headers/build/config/HaikuConfig.h @@ -53,18 +53,4 @@ #define __HAIKU_SUBDIR_ARCH_HEADER(subdir, header) \ -/* BeOS R5 binary compatibility (gcc 2 on x86) */ -#if defined(__HAIKU_ARCH_X86) && __GNUC__ == 2 -# define __HAIKU_BEOS_COMPATIBLE 1 -#endif - -/* BeOS R5 compatible types */ -#ifdef __HAIKU_ARCH_X86 - /* TODO: This should be "#ifdef __HAIKU_BEOS_COMPATIBLE", but this will - break all gcc 4 C++ optional packages. I.e. switch that at a suitable - time. - */ -# define __HAIKU_BEOS_COMPATIBLE_TYPES 1 -#endif - #endif /* _CONFIG_HAIKU_CONFIG_H */ diff --git a/headers/build/config/types.h b/headers/build/config/types.h index d038d1968b..0bf10d36ea 100644 --- a/headers/build/config/types.h +++ b/headers/build/config/types.h @@ -29,13 +29,8 @@ typedef __haiku_std_int8 __haiku_int8; typedef __haiku_std_uint8 __haiku_uint8; typedef __haiku_std_int16 __haiku_int16; typedef __haiku_std_uint16 __haiku_uint16; -#ifdef __HAIKU_BEOS_COMPATIBLE_TYPES -typedef signed long int __haiku_int32; -typedef unsigned long int __haiku_uint32; -#else typedef __haiku_std_int32 __haiku_int32; typedef __haiku_std_uint32 __haiku_uint32; -#endif typedef __haiku_std_int64 __haiku_int64; typedef __haiku_std_uint64 __haiku_uint64; diff --git a/src/build/libbe/app/Message.cpp b/src/build/libbe/app/Message.cpp index 159d611dd2..e3d0c8deb2 100644 --- a/src/build/libbe/app/Message.cpp +++ b/src/build/libbe/app/Message.cpp @@ -353,7 +353,7 @@ BMessage::_PrintToStream(const char* indent) const if (isprint(*(char *)&value)) { printf("'%.4s'", (char *)&value); } else - printf("0x%lx", what); + printf("0x%" B_PRIx32, what); printf(") {\n"); field_header *field = fFields; @@ -369,7 +369,7 @@ BMessage::_PrintToStream(const char* indent) const printf("%s %s = ", indent, (char *)(fData + field->offset)); } else { - printf("%s %s[%ld] = ", indent, + printf("%s %s[%" B_PRId32 "] = ", indent, (char *)(fData + field->offset), j); } @@ -426,8 +426,9 @@ BMessage::_PrintToStream(const char* indent) const entry_ref ref; BPrivate::entry_ref_unflatten(&ref, (char *)pointer, size); - printf("entry_ref(device=%ld, directory=%lld, name=\"%s\", ", - (long)ref.device, ref.directory, ref.name); + printf("entry_ref(device=%ld, directory=%" B_PRIdINO + ", name=\"%s\", ", (long)ref.device, ref.directory, + ref.name); BPath path(&ref); printf("path=\"%s\")\n", path.Path()); @@ -444,7 +445,8 @@ BMessage::_PrintToStream(const char* indent) const const ssize_t size = *(const ssize_t *)pointer; pointer += sizeof(ssize_t); if (message.Unflatten((const char *)pointer) != B_OK) { - fprintf(stderr, "couldn't unflatten item %ld\n", i); + fprintf(stderr, "couldn't unflatten item %" B_PRId32 + "\n", i); break; } message._PrintToStream(buffer); diff --git a/src/build/libbe/app/MessageUtils.cpp b/src/build/libbe/app/MessageUtils.cpp index d9f6115c5b..2638f539ae 100644 --- a/src/build/libbe/app/MessageUtils.cpp +++ b/src/build/libbe/app/MessageUtils.cpp @@ -73,7 +73,7 @@ entry_ref_unflatten(entry_ref *ref, const char *buffer, size_t size) memcpy((void *)&ref->directory, (const void *)buffer, sizeof(ref->directory)); buffer += sizeof(ref->directory); - if (ref->device != -1 && size > sizeof(ref->device) + if (ref->device != ~(dev_t)0 && size > sizeof(ref->device) + sizeof(ref->directory)) { ref->set_name(buffer); if (ref->name == NULL) { diff --git a/src/build/libbe/interface/Bitmap.cpp b/src/build/libbe/interface/Bitmap.cpp index a021540a3f..044aa89aba 100644 --- a/src/build/libbe/interface/Bitmap.cpp +++ b/src/build/libbe/interface/Bitmap.cpp @@ -1223,7 +1223,8 @@ set_bits_worker_gray1(const void *inData, int32 inLength, int32 inBPR, - (inBPR - inRowSkip); const char *outEnd = (const char*)outData + outLength - outBPR; char *outRow = (char*)outData + outOffset - outOffset % outBPR; - int32 x = max(0L, width - ((char*)outData + outOffset - outRow) * 8) - 1; + int32 x = max((int32)0, + width - (int32)((char*)outData + outOffset - outRow) * 8) - 1; while ((const char*)reader.pixels <= inEnd && (const char*)writer.pixels <= outEnd) { // process one row @@ -1532,36 +1533,36 @@ BBitmap::BBitmap(BMessage *data) { BRect bounds; data->FindRect("_frame", &bounds); - + color_space cspace; data->FindInt32("_cspace", (int32 *)&cspace); - + int32 flags = 0; data->FindInt32("_bmflags", &flags); - + int32 rowbytes = 0; data->FindInt32("_rowbytes", &rowbytes); -flags |= B_BITMAP_NO_SERVER_LINK; +flags |= B_BITMAP_NO_SERVER_LINK; flags &= ~B_BITMAP_ACCEPTS_VIEWS; InitObject(bounds, cspace, flags, rowbytes, B_MAIN_SCREEN_ID); - + if (data->HasData("_data", B_RAW_TYPE) && InitCheck() == B_OK) { ssize_t size = 0; const void *buffer; if (data->FindData("_data", B_RAW_TYPE, &buffer, &size) == B_OK) memcpy(fBasePtr, buffer, size); } - + if (fFlags & B_BITMAP_ACCEPTS_VIEWS) { // BArchivable *obj; // BMessage message; // int i = 0; -// +// // while (data->FindMessage("_view", i++, &message) == B_OK) { // obj = instantiate_object(&message); // BView *view = dynamic_cast(obj); -// +// // if (view) // AddChild(view); // } @@ -1579,7 +1580,7 @@ BBitmap::Instantiate(BMessage *data) { if (validate_instantiation(data, "BBitmap")) return new BBitmap(data); - + return NULL; } @@ -1594,12 +1595,12 @@ status_t BBitmap::Archive(BMessage *data, bool deep) const { BArchivable::Archive(data, deep); - + data->AddRect("_frame", fBounds); data->AddInt32("_cspace", (int32)fColorSpace); data->AddInt32("_bmflags", fFlags); data->AddInt32("_rowbytes", fBytesPerRow); - + if (deep) { if (fFlags & B_BITMAP_ACCEPTS_VIEWS) { // BMessage views; @@ -1612,10 +1613,10 @@ BBitmap::Archive(BMessage *data, bool deep) const // true and it does save all formats as B_RAW_TYPE and it does save // the data even if B_BITMAP_ACCEPTS_VIEWS is set (as opposed to // the BeBook) - + data->AddData("_data", B_RAW_TYPE, fBasePtr, fSize); } - + return B_OK; } @@ -1796,7 +1797,7 @@ BBitmap::ImportBits(const void *data, int32 length, int32 bpr, int32 offset, color_space colorSpace) { status_t error = (InitCheck() == B_OK ? B_OK : B_NO_INIT); - // check params + // check params if (error == B_OK && (data == NULL || offset > fSize || length < 0)) error = B_BAD_VALUE; // get BPR @@ -2080,8 +2081,8 @@ flags &= ~B_BITMAP_ACCEPTS_VIEWS; } else { // // Ask the server (via our owning application) to create a bitmap. // BPrivate::AppServerLink link; -// -// // Attach Data: +// +// // Attach Data: // // 1) BRect bounds // // 2) color_space space // // 3) int32 bitmap_flags @@ -2093,20 +2094,20 @@ flags &= ~B_BITMAP_ACCEPTS_VIEWS; // link.Attach((int32)flags); // link.Attach(bytesPerRow); // link.Attach(screenID.id); -// +// // // Reply Code: SERVER_TRUE // // Reply Data: // // 1) int32 server token // // 2) area_id id of the area in which the bitmap data resides // // 3) int32 area pointer offset used to calculate fBasePtr -// +// // // alternatively, if something went wrong // // Reply Code: SERVER_FALSE // // Reply Data: // // None // int32 code = SERVER_FALSE; // error = link.FlushWithReply(code); -// +// // if (error >= B_OK) { // // *communication* with server successful // if (code == SERVER_TRUE) { @@ -2114,21 +2115,21 @@ flags &= ~B_BITMAP_ACCEPTS_VIEWS; // // Get token // area_id bmparea; // int32 areaoffset; -// +// // link.Read(&fServerToken); // link.Read(&bmparea); // link.Read(&areaoffset); -// +// // // Get the area in which the data resides // fArea = clone_area("shared bitmap area", // (void**)&fBasePtr, // B_ANY_ADDRESS, // B_READ_AREA | B_WRITE_AREA, // bmparea); -// +// // // Jump to the location in the area // fBasePtr = (int8*)fBasePtr + areaoffset; -// +// // fSize = size; // fColorSpace = colorSpace; // fBounds = bounds; @@ -2152,7 +2153,7 @@ flags &= ~B_BITMAP_ACCEPTS_VIEWS; fToken = -1; fOrigArea = -1; } - + fInitError = error; // TODO: on success, handle clearing to white if the flags say so. Needs to be // dependent on color space. @@ -2181,10 +2182,10 @@ BBitmap::CleanUp() } else { // BPrivate::AppServerLink link; // // AS_DELETE_BITMAP: -// // Attached Data: +// // Attached Data: // // 1) int32 server token -// -// // Reply Code: SERVER_TRUE if successful, +// +// // Reply Code: SERVER_TRUE if successful, // // SERVER_FALSE if the buffer was already deleted // // Reply Data: none // // status_t freestat; diff --git a/src/build/libbe/interface/Region.cpp b/src/build/libbe/interface/Region.cpp index ff996dbc11..65f68392c4 100644 --- a/src/build/libbe/interface/Region.cpp +++ b/src/build/libbe/interface/Region.cpp @@ -108,7 +108,7 @@ BRegion::operator=(const BRegion ®ion) fBounds = region.fBounds; fCount = region.fCount; } - + return *this; } @@ -179,7 +179,7 @@ BRegion::RectAt(int32 index) /*const*/ const clipping_rect& r = fData[index]; return BRect(r.left, r.top, r.right - 1, r.bottom - 1); } - + return BRect(); // an invalid BRect } @@ -276,7 +276,8 @@ BRegion::PrintToStream() const for (long i = 0; i < fCount; i++) { clipping_rect *rect = &fData[i]; - printf("data[%ld] = BRect(l:%ld.0, t:%ld.0, r:%ld.0, b:%ld.0)\n", + printf("data[%ld] = BRect(l:%" B_PRId32 ".0, t:%" B_PRId32 ".0, r:%" + B_PRId32 ".0, b:%" B_PRId32 ".0)\n", i, rect->left, rect->top, rect->right - 1, rect->bottom - 1); } } @@ -489,7 +490,7 @@ BRegion::_SetSize(long newSize) MakeEmpty(); return true; } - + if (!fData) { // allocation actually failed fDataSize = 0; diff --git a/src/build/libbe/storage/AppFileInfo.cpp b/src/build/libbe/storage/AppFileInfo.cpp index a10c3feac3..f9dc4d2495 100644 --- a/src/build/libbe/storage/AppFileInfo.cpp +++ b/src/build/libbe/storage/AppFileInfo.cpp @@ -1,5 +1,5 @@ //---------------------------------------------------------------------- -// This software is part of the Haiku distribution and is covered +// This software is part of the Haiku distribution and is covered // by the MIT license. //--------------------------------------------------------------------- /*! @@ -51,7 +51,7 @@ enum { }; // R5 also exports these (Tracker is using them): -// (maybe we better want to drop them silently and declare +// (maybe we better want to drop them silently and declare // the above in a public Haiku header - and use that one in // Tracker when compiled for Haiku) extern const uint32 MINI_ICON_TYPE, LARGE_ICON_TYPE; @@ -675,7 +675,7 @@ BAppFileInfo::GetVersionInfo(version_info *info, version_kind kind) const } else return B_ERROR; - // return result + // return result return B_OK; } @@ -1065,7 +1065,7 @@ BAppFileInfo::_ReadData(const char *name, int32 id, type_code type, size_t &bytesRead, void **allocatedBuffer) const { status_t error = B_OK; - + if (allocatedBuffer) buffer = NULL; @@ -1086,7 +1086,7 @@ BAppFileInfo::_ReadData(const char *name, int32 id, type_code type, error = B_NO_MEMORY; bufferSize = info.size; } - if (error == B_OK && bufferSize < info.size) + if (error == B_OK && (off_t)bufferSize < info.size) error = B_BAD_VALUE; // read the data diff --git a/src/build/libbe/storage/Entry.cpp b/src/build/libbe/storage/Entry.cpp index 88d2a9f2da..42c6c797f2 100644 --- a/src/build/libbe/storage/Entry.cpp +++ b/src/build/libbe/storage/Entry.cpp @@ -41,19 +41,19 @@ using namespace std; /*! \struct entry_ref \brief A filesystem entry represented as a name in a concrete directory. - + entry_refs may refer to pre-existing (concrete) files, as well as non-existing (abstract) files. However, the parent directory of the file \b must exist. - + The result of this dichotomy is a blending of the persistence gained by referring to entries with a reference to their internal filesystem node and the flexibility gained by referring to entries by name. - + For example, if the directory in which the entry resides (or a directory further up in the hierarchy) is moved or renamed, the entry_ref will still refer to the correct file (whereas a pathname to the previous location of the file would now be invalid). - + On the other hand, say that the entry_ref refers to a concrete file. If the file itself is renamed, the entry_ref now refers to an abstract file with the old name (the upside in this case is that abstract entries may be represented by entry_refs @@ -61,7 +61,7 @@ using namespace std; */ -//! Creates an unitialized entry_ref. +//! Creates an unitialized entry_ref. entry_ref::entry_ref() : device((dev_t)-1), @@ -73,12 +73,12 @@ entry_ref::entry_ref() /*! \brief Creates an entry_ref initialized to the given file name in the given directory on the given device. - + \p name may refer to either a pre-existing file in the given directory, or a non-existent file. No explicit checking is done to verify validity of the given arguments, but later use of the entry_ref will fail if \p dev is not a valid device or \p dir is a not a directory on \p dev. - + \param dev the device on which the entry's parent directory resides \param dir the directory in which the entry resides \param name the leaf name of the entry, which is not required to exist @@ -102,12 +102,12 @@ entry_ref::entry_ref(const entry_ref &ref) directory(ref.directory), name(NULL) { - set_name(ref.name); + set_name(ref.name); } /*! Destroys the object and frees the storage allocated for the leaf name, - if necessary. + if necessary. */ entry_ref::~entry_ref() { @@ -117,7 +117,7 @@ entry_ref::~entry_ref() /*! \brief Set the entry_ref's leaf name, freeing the storage allocated for any previous name and then making a copy of the new name. - + \param name pointer to a null-terminated string containing the new name for the entry. May be \c NULL. */ @@ -134,7 +134,7 @@ entry_ref::set_name(const char *newName) return B_NO_MEMORY; } - return B_OK; + return B_OK; } @@ -176,7 +176,7 @@ entry_ref& entry_ref::operator=(const entry_ref &ref) { if (this == &ref) - return *this; + return *this; device = ref.device; directory = ref.directory; @@ -203,22 +203,22 @@ entry_ref::operator=(const entry_ref &ref) /*! \class BEntry \brief A location in the filesystem - + The BEntry class defines objects that represent "locations" in the file system hierarchy. Each location (or entry) is given as a name within a directory. For example, when you create a BEntry thus: - + \code BEntry entry("/boot/home/fido"); \endcode - + ...you're telling the BEntry object to represent the location of the file called fido within the directory \c "/boot/home". - + \author Ingo Weinhold \author Tyler Dauwalder \author Simon Cusack - + \version 0.0.0 */ @@ -246,7 +246,7 @@ BEntry::BEntry() //! Creates a BEntry initialized to the given directory and path combination. /*! If traverse is true and \c dir/path refers to a symlink, the BEntry will refer to the linked file; if false, the BEntry will refer to the symlink itself. - + \param dir directory in which \a path resides \param path relative path reckoned off of \a dir \param traverse whether or not to traverse symlinks @@ -267,7 +267,7 @@ BEntry::BEntry(const BDirectory *dir, const char *path, bool traverse) /*! If traverse is true and \a ref refers to a symlink, the BEntry will refer to the linked file; if false, the BEntry will refer to the symlink itself. - + \param ref the entry_ref referring to the given file \param traverse whether or not symlinks are to be traversed \see SetTo(const entry_ref*, bool) @@ -287,11 +287,11 @@ BEntry::BEntry(const entry_ref *ref, bool traverse) be reckoned off the current working directory. If \a path refers to a symlink and traverse is true, the BEntry will refer to the linked file. If traverse is false, the BEntry will refer to the symlink itself. - + \param path the file of interest - \param traverse whether or not symlinks are to be traversed + \param traverse whether or not symlinks are to be traversed \see SetTo(const char*, bool) - + */ BEntry::BEntry(const char *path, bool traverse) : @@ -354,10 +354,10 @@ BEntry::Exists() const /*! \brief Fills in a stat structure for the entry. The information is copied into the \c stat structure pointed to by \a result. - - \b NOTE: The BStatable object does not cache the stat structure; every time you + + \b NOTE: The BStatable object does not cache the stat structure; every time you call GetStat(), fresh stat information is retrieved. - + \param result pointer to a pre-allocated structure into which the stat information will be copied \return - \c B_OK - Success @@ -374,7 +374,7 @@ BEntry::GetStat(struct stat *result) const /*! \brief Reinitializes the BEntry to the path or directory path combination, resolving symlinks if traverse is true - + \return - \c B_OK - Success - "error code" - Failure @@ -429,7 +429,7 @@ BEntry::SetTo(const entry_ref *ref, bool traverse) /*! \brief Reinitializes the BEntry object to the path, resolving symlinks if traverse is true - + \return - \c B_OK - Success - "error code" - Failure @@ -454,7 +454,7 @@ BEntry::Unset() _kern_close(fDirFd); // BPrivate::Storage::close_dir(fDirFd); } - + // Free our leaf name free(fName); @@ -480,7 +480,7 @@ BEntry::GetRef(entry_ref *ref) const if (ref == NULL) return B_BAD_VALUE; - + struct stat st; status_t error = _kern_read_stat(fDirFd, NULL, false, &st, sizeof(struct stat)); @@ -499,7 +499,7 @@ BEntry::GetRef(entry_ref *ref) const \return - \c B_OK - Success - "error code" - Failure - + */ status_t BEntry::GetPath(BPath *path) const @@ -518,13 +518,13 @@ BEntry::GetPath(BPath *path) const If the function fails, the argument is Unset(). Destructive calls to GetParent() are allowed, i.e.: - - \code - BEntry entry("/boot/home/fido"); - status_t err; - char name[B_FILE_NAME_LENGTH]; - // Spit out the path components backwards, one at a time. + \code + BEntry entry("/boot/home/fido"); + status_t err; + char name[B_FILE_NAME_LENGTH]; + + // Spit out the path components backwards, one at a time. do { entry.GetName(name); printf("> %s\n", name); @@ -534,16 +534,16 @@ BEntry::GetPath(BPath *path) const if (err != B_ENTRY_NOT_FOUND) printf(">> Error: %s\n", strerror(err)); \endcode - + will output: - + \code > fido > home > boot > . \endcode - + \param entry pointer to a pre-allocated BEntry object into which the result is stored \return - \c B_OK - Success @@ -583,10 +583,10 @@ BEntry::GetParent(BEntry *entry) const } -/*! \brief Gets the parent of the BEntry as a BDirectory. +/*! \brief Gets the parent of the BEntry as a BDirectory. If the function fails, the argument is Unset(). - + \param dir pointer to a pre-allocated BDirectory object into which the result is stored \return - \c B_OK - Success @@ -635,7 +635,7 @@ status_t BEntry::GetName(char *buffer) const { status_t result = B_ERROR; - + if (fCStatus != B_OK) { result = B_NO_INIT; } else if (buffer == NULL) { @@ -644,7 +644,7 @@ BEntry::GetName(char *buffer) const strcpy(buffer, fName); result = B_OK; } - + return result; } @@ -652,7 +652,7 @@ BEntry::GetName(char *buffer) const /*! \brief Renames the BEntry to path, replacing an existing entry if clobber is true. NOTE: The BEntry must refer to an existing file. If it is abstract, this method will fail. - + \param path Pointer to a string containing the new name for the entry. May be absolute or relative. If relative, the entry is renamed within its current directory. @@ -663,7 +663,7 @@ BEntry::GetName(char *buffer) const - \c B_OK - Success - \c B_ENTRY_EXISTS - The new location is already taken and \c clobber was \c false - \c B_ENTRY_NOT_FOUND - Attempted to rename an abstract entry - - "error code" - Failure + - "error code" - Failure */ status_t @@ -695,7 +695,7 @@ BEntry::Rename(const char *path, bool clobber) /*! \brief Moves the BEntry to directory or directory+path combination, replacing an existing entry if clobber is true. NOTE: The BEntry must refer to an existing file. If it is abstract, this method will fail. - + \param dir Pointer to a pre-allocated BDirectory into which the entry should be moved. \param path Optional new leaf name for the entry. May be a simple leaf or a relative path; either way, \c path is reckoned off of \c dir. If \c NULL, the entry retains @@ -707,7 +707,7 @@ BEntry::Rename(const char *path, bool clobber) - \c B_OK - Success - \c B_ENTRY_EXISTS - The new location is already taken and \c clobber was \c false - \c B_ENTRY_NOT_FOUND - Attempted to move an abstract entry - - "error code" - Failure + - "error code" - Failure */ status_t BEntry::MoveTo(BDirectory *dir, const char *path, bool clobber) @@ -737,7 +737,7 @@ BEntry::MoveTo(BDirectory *dir, const char *path, bool clobber) the chunk of data they refer to will continue to exist until all such file descriptors are closed. The BEntry object, however, becomes abstract and no longer refers to any actual data in the filesystem. - + \return - B_OK - Success - "error code" - Failure @@ -777,7 +777,7 @@ BEntry::operator==(const BEntry &item) const } else { return false; - } + } } @@ -818,7 +818,7 @@ BEntry::operator=(const BEntry &item) if (fCStatus != B_OK) Unset(); } - + return *this; } @@ -853,7 +853,7 @@ BEntry::set_stat(struct stat &st, uint32 what) If \a path is an absolute path, \a dirFD is ignored. If \a dirFD is -1, path is considered relative to the current directory (unless it is an absolute path, that is). - + The ownership of the file descriptor \a dirFD is transferred to the function, regardless of whether it succeeds or fails. The caller must not close the FD afterwards. @@ -1007,14 +1007,14 @@ status_t BEntry::set_name(const char *name) { if (name == NULL) - return B_BAD_VALUE; - + return B_BAD_VALUE; + free(fName); - + fName = strdup(name); if (!fName) return B_NO_MEMORY; - + return B_OK; } @@ -1070,19 +1070,19 @@ BEntry::Dump(const char *name) printf("%s\n", name); printf("------------------------------------------------------------\n"); } - - printf("fCStatus == %ld\n", fCStatus); - + + printf("fCStatus == %" B_PRId32 "\n", fCStatus); + struct stat st; if (fDirFd != -1 && _kern_read_stat(fDirFd, NULL, false, &st, sizeof(struct stat)) == B_OK) { printf("dir.device == %d\n", (int)st.st_dev); - printf("dir.inode == %lld\n", st.st_ino); + printf("dir.inode == %" B_PRIdINO "\n", st.st_ino); } else { printf("dir == NullFd\n"); } - + printf("leaf == '%s'\n", fName); printf("\n"); @@ -1118,7 +1118,7 @@ get_ref_for_path(const char *path, entry_ref *ref) /*! \brief Returns whether an entry is less than another. The components are compared in order \c device, \c directory, \c name. A \c NULL \c name is less than any non-null name. - + \return - true - a < b - false - a >= b diff --git a/src/build/libbe/storage/NodeInfo.cpp b/src/build/libbe/storage/NodeInfo.cpp index f444f330c1..83a6f50e36 100644 --- a/src/build/libbe/storage/NodeInfo.cpp +++ b/src/build/libbe/storage/NodeInfo.cpp @@ -1,5 +1,5 @@ //---------------------------------------------------------------------- -// This software is part of the Haiku distribution and is covered +// This software is part of the Haiku distribution and is covered // by the MIT license. //--------------------------------------------------------------------- /*! @@ -101,7 +101,7 @@ BNodeInfo::SetTo(BNode *node) - \c B_OK: Everything went fine. - \c B_NO_INIT: The node is not properly initialized. */ -status_t +status_t BNodeInfo::InitCheck() const { return fCStatus; @@ -126,7 +126,7 @@ BNodeInfo::InitCheck() const - \c B_ENTRY_NOT_FOUND: No type is set on the node. - other error codes */ -status_t +status_t BNodeInfo::GetType(char *type) const { // check parameter and initialization @@ -255,7 +255,7 @@ BNodeInfo::GetIcon(BBitmap *icon, icon_size k) const error = fNode->GetAttrInfo(attribute, &attrInfo); if (error == B_OK && attrInfo.type != attrType) error = B_BAD_TYPE; - if (error == B_OK && attrInfo.size != attrSize) + if (error == B_OK && attrInfo.size != (off_t)attrSize) error = B_BAD_VALUE; // TODO: B_BAD_DATA? // read the attribute if (error == B_OK) { @@ -272,7 +272,7 @@ BNodeInfo::GetIcon(BBitmap *icon, icon_size k) const attrSize); } } else { - read = fNode->ReadAttr(attribute, attrType, 0, icon->Bits(), + read = fNode->ReadAttr(attribute, attrType, 0, icon->Bits(), attrSize); } if (error == B_OK) { @@ -312,7 +312,7 @@ BNodeInfo::GetIcon(BBitmap *icon, icon_size k) const and icon size (\a k) do not match. - other error codes */ -status_t +status_t BNodeInfo::SetIcon(const BBitmap *icon, icon_size k) { status_t error = B_OK; @@ -393,7 +393,7 @@ BNodeInfo::SetIcon(const BBitmap *icon, icon_size k) - \c B_BAD_VALUE: \c NULL \a signature or bad app_verb \a verb. - other error codes */ -status_t +status_t BNodeInfo::GetPreferredApp(char *signature, app_verb verb) const { // check parameter and initialization @@ -442,7 +442,7 @@ BNodeInfo::GetPreferredApp(char *signature, app_verb verb) const \c B_MIME_TYPE_LENGTH or bad app_verb \a verb. - other error codes */ -status_t +status_t BNodeInfo::SetPreferredApp(const char *signature, app_verb verb) { // check parameters and initialization @@ -483,7 +483,7 @@ BNodeInfo::SetPreferredApp(const char *signature, app_verb verb) - \c B_BAD_VALUE: \c NULL \a ref. - other error codes */ -status_t +status_t BNodeInfo::GetAppHint(entry_ref *ref) const { // check parameter and initialization @@ -535,7 +535,7 @@ BNodeInfo::GetAppHint(entry_ref *ref) const - \c B_BAD_VALUE: \c NULL \a ref. - other error codes */ -status_t +status_t BNodeInfo::SetAppHint(const entry_ref *ref) { // check parameter and initialization @@ -593,7 +593,7 @@ BNodeInfo::SetAppHint(const entry_ref *ref) dimensions (\a icon) and icon size (\a iconSize) do not match. - other error codes */ -status_t +status_t BNodeInfo::GetTrackerIcon(BBitmap *icon, icon_size iconSize) const { // set some icon size related variables @@ -717,7 +717,7 @@ error = B_ENTRY_NOT_FOUND; bitmap dimensions (\a icon) and icon size (\a iconSize) do not match. - other error codes */ -status_t +status_t BNodeInfo::GetTrackerIcon(const entry_ref *ref, BBitmap *icon, icon_size iconSize) { // check ref param @@ -736,17 +736,17 @@ BNodeInfo::GetTrackerIcon(const entry_ref *ref, BBitmap *icon, icon_size iconSiz return error; } -void +void BNodeInfo::_ReservedNodeInfo1() { } -void +void BNodeInfo::_ReservedNodeInfo2() { } -void +void BNodeInfo::_ReservedNodeInfo3() { } diff --git a/src/build/libbe/support/DataIO.cpp b/src/build/libbe/support/DataIO.cpp index 6fece87320..42ca987a49 100644 --- a/src/build/libbe/support/DataIO.cpp +++ b/src/build/libbe/support/DataIO.cpp @@ -105,7 +105,7 @@ BPositionIO::Read(void *buffer, size_t size) ssize_t result = ReadAt(curPos, buffer, size); if (result > 0) Seek(result, SEEK_CUR); - + return result; } @@ -118,7 +118,7 @@ BPositionIO::Write(const void *buffer, size_t size) ssize_t result = WriteAt(curPos, buffer, size); if (result > 0) Seek(result, SEEK_CUR); - + return result; } @@ -158,7 +158,7 @@ BMemoryIO::BMemoryIO(void *p, size_t len) fLen(len), fPhys(len), fPos(0) - + { } @@ -185,10 +185,10 @@ BMemoryIO::ReadAt(off_t pos, void *buffer, size_t size) { if (buffer == NULL || pos < 0) return B_BAD_VALUE; - + ssize_t sizeRead = 0; - if (pos < fLen) { - sizeRead = min_c(static_cast(size), fLen - pos); + if (pos < (off_t)fLen) { + sizeRead = min_c((off_t)size, (off_t)fLen - pos); memcpy(buffer, fBuf + pos, sizeRead); } return sizeRead; @@ -198,22 +198,22 @@ BMemoryIO::ReadAt(off_t pos, void *buffer, size_t size) // WriteAt ssize_t BMemoryIO::WriteAt(off_t pos, const void *buffer, size_t size) -{ +{ if (fReadOnly) return B_NOT_ALLOWED; - + if (buffer == NULL || pos < 0) return B_BAD_VALUE; - - ssize_t sizeWritten = 0; - if (pos < fPhys) { - sizeWritten = min_c(static_cast(size), fPhys - pos); + + ssize_t sizeWritten = 0; + if (pos < (off_t)fPhys) { + sizeWritten = min_c((off_t)size, (off_t)fPhys - pos); memcpy(fBuf + pos, buffer, sizeWritten); } - - if (pos + sizeWritten > fLen) + + if (pos + sizeWritten > (off_t)fLen) fLen = pos + sizeWritten; - + return sizeWritten; } @@ -228,13 +228,13 @@ BMemoryIO::Seek(off_t position, uint32 seek_mode) break; case SEEK_CUR: fPos += position; - break; + break; case SEEK_END: fPos = fLen + position; break; default: break; - } + } return fPos; } @@ -252,11 +252,11 @@ status_t BMemoryIO::SetSize(off_t size) { status_t err = B_ERROR; - + if (fReadOnly) return B_NOT_ALLOWED; - - if (size <= fPhys) { + + if (size <= (off_t)fPhys) { err = B_OK; fLen = size; } @@ -311,10 +311,10 @@ BMallocIO::ReadAt(off_t pos, void *buffer, size_t size) { if (buffer == NULL) return B_BAD_VALUE; - + ssize_t sizeRead = 0; - if (pos < fLength) { - sizeRead = min_c(static_cast(size), fLength - pos); + if (pos < (off_t)fLength) { + sizeRead = min_c((off_t)size, (off_t)fLength - pos); memcpy(buffer, fData + pos, sizeRead); } return sizeRead; @@ -327,14 +327,14 @@ BMallocIO::WriteAt(off_t pos, const void *buffer, size_t size) { if (buffer == NULL) return B_BAD_VALUE; - - size_t newSize = max_c(pos + size, static_cast(fLength)); - + + size_t newSize = max_c(pos + (off_t)size, (off_t)fLength); + status_t error = B_OK; - + if (newSize > fMallocSize) error = SetSize(newSize); - + if (error == B_OK) { memcpy(fData + pos, buffer, size); if (pos + size > fLength) @@ -386,22 +386,22 @@ BMallocIO::SetSize(off_t size) } else { // size != 0, see, if necessary to resize size_t newSize = (size + fBlockSize - 1) / fBlockSize * fBlockSize; - if (size != fMallocSize) { + if (size != (off_t)fMallocSize) { // we need to resize if (char *newData = static_cast(realloc(fData, newSize))) { // set the new area to 0 if (newSize > fMallocSize) - memset(newData + fMallocSize, 0, newSize - fMallocSize); + memset(newData + fMallocSize, 0, newSize - fMallocSize); fData = newData; fMallocSize = newSize; } else // couldn't alloc the memory error = B_NO_MEMORY; } } - + if (error == B_OK) fLength = size; - + return error; }