* Don't even try to use the BeOS compatible types on the build platform.

That's just leading to problems.
* Fixed various 64 bit warnings when building libbe_build.so. One of the more
  serious issues, that might bite us, is that 64 bit Linux defines dev_t to
  unsigned long, while Haiku code assumes that it is signed and 32 bit. We'll
  see...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34227 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2009-11-24 23:36:10 +00:00
parent 045852f952
commit a8a03488b1
10 changed files with 155 additions and 170 deletions
-14
View File
@@ -53,18 +53,4 @@
#define __HAIKU_SUBDIR_ARCH_HEADER(subdir, header) \ #define __HAIKU_SUBDIR_ARCH_HEADER(subdir, header) \
<subdir/arch/__HAIKU_ARCH/header> <subdir/arch/__HAIKU_ARCH/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 */ #endif /* _CONFIG_HAIKU_CONFIG_H */
-5
View File
@@ -29,13 +29,8 @@ typedef __haiku_std_int8 __haiku_int8;
typedef __haiku_std_uint8 __haiku_uint8; typedef __haiku_std_uint8 __haiku_uint8;
typedef __haiku_std_int16 __haiku_int16; typedef __haiku_std_int16 __haiku_int16;
typedef __haiku_std_uint16 __haiku_uint16; 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_int32 __haiku_int32;
typedef __haiku_std_uint32 __haiku_uint32; typedef __haiku_std_uint32 __haiku_uint32;
#endif
typedef __haiku_std_int64 __haiku_int64; typedef __haiku_std_int64 __haiku_int64;
typedef __haiku_std_uint64 __haiku_uint64; typedef __haiku_std_uint64 __haiku_uint64;
+7 -5
View File
@@ -353,7 +353,7 @@ BMessage::_PrintToStream(const char* indent) const
if (isprint(*(char *)&value)) { if (isprint(*(char *)&value)) {
printf("'%.4s'", (char *)&value); printf("'%.4s'", (char *)&value);
} else } else
printf("0x%lx", what); printf("0x%" B_PRIx32, what);
printf(") {\n"); printf(") {\n");
field_header *field = fFields; field_header *field = fFields;
@@ -369,7 +369,7 @@ BMessage::_PrintToStream(const char* indent) const
printf("%s %s = ", indent, printf("%s %s = ", indent,
(char *)(fData + field->offset)); (char *)(fData + field->offset));
} else { } else {
printf("%s %s[%ld] = ", indent, printf("%s %s[%" B_PRId32 "] = ", indent,
(char *)(fData + field->offset), j); (char *)(fData + field->offset), j);
} }
@@ -426,8 +426,9 @@ BMessage::_PrintToStream(const char* indent) const
entry_ref ref; entry_ref ref;
BPrivate::entry_ref_unflatten(&ref, (char *)pointer, size); BPrivate::entry_ref_unflatten(&ref, (char *)pointer, size);
printf("entry_ref(device=%ld, directory=%lld, name=\"%s\", ", printf("entry_ref(device=%ld, directory=%" B_PRIdINO
(long)ref.device, ref.directory, ref.name); ", name=\"%s\", ", (long)ref.device, ref.directory,
ref.name);
BPath path(&ref); BPath path(&ref);
printf("path=\"%s\")\n", path.Path()); printf("path=\"%s\")\n", path.Path());
@@ -444,7 +445,8 @@ BMessage::_PrintToStream(const char* indent) const
const ssize_t size = *(const ssize_t *)pointer; const ssize_t size = *(const ssize_t *)pointer;
pointer += sizeof(ssize_t); pointer += sizeof(ssize_t);
if (message.Unflatten((const char *)pointer) != B_OK) { 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; break;
} }
message._PrintToStream(buffer); message._PrintToStream(buffer);
+1 -1
View File
@@ -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)); memcpy((void *)&ref->directory, (const void *)buffer, sizeof(ref->directory));
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)) { + sizeof(ref->directory)) {
ref->set_name(buffer); ref->set_name(buffer);
if (ref->name == NULL) { if (ref->name == NULL) {
+2 -1
View File
@@ -1223,7 +1223,8 @@ set_bits_worker_gray1(const void *inData, int32 inLength, int32 inBPR,
- (inBPR - inRowSkip); - (inBPR - inRowSkip);
const char *outEnd = (const char*)outData + outLength - outBPR; const char *outEnd = (const char*)outData + outLength - outBPR;
char *outRow = (char*)outData + outOffset - outOffset % 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 while ((const char*)reader.pixels <= inEnd
&& (const char*)writer.pixels <= outEnd) { && (const char*)writer.pixels <= outEnd) {
// process one row // process one row
+2 -1
View File
@@ -276,7 +276,8 @@ BRegion::PrintToStream() const
for (long i = 0; i < fCount; i++) { for (long i = 0; i < fCount; i++) {
clipping_rect *rect = &fData[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); i, rect->left, rect->top, rect->right - 1, rect->bottom - 1);
} }
} }
+1 -1
View File
@@ -1086,7 +1086,7 @@ BAppFileInfo::_ReadData(const char *name, int32 id, type_code type,
error = B_NO_MEMORY; error = B_NO_MEMORY;
bufferSize = info.size; bufferSize = info.size;
} }
if (error == B_OK && bufferSize < info.size) if (error == B_OK && (off_t)bufferSize < info.size)
error = B_BAD_VALUE; error = B_BAD_VALUE;
// read the data // read the data
+2 -2
View File
@@ -1071,14 +1071,14 @@ BEntry::Dump(const char *name)
printf("------------------------------------------------------------\n"); printf("------------------------------------------------------------\n");
} }
printf("fCStatus == %ld\n", fCStatus); printf("fCStatus == %" B_PRId32 "\n", fCStatus);
struct stat st; struct stat st;
if (fDirFd != -1 if (fDirFd != -1
&& _kern_read_stat(fDirFd, NULL, false, &st, && _kern_read_stat(fDirFd, NULL, false, &st,
sizeof(struct stat)) == B_OK) { sizeof(struct stat)) == B_OK) {
printf("dir.device == %d\n", (int)st.st_dev); 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 { } else {
printf("dir == NullFd\n"); printf("dir == NullFd\n");
} }
+1 -1
View File
@@ -255,7 +255,7 @@ BNodeInfo::GetIcon(BBitmap *icon, icon_size k) const
error = fNode->GetAttrInfo(attribute, &attrInfo); error = fNode->GetAttrInfo(attribute, &attrInfo);
if (error == B_OK && attrInfo.type != attrType) if (error == B_OK && attrInfo.type != attrType)
error = B_BAD_TYPE; 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? error = B_BAD_VALUE; // TODO: B_BAD_DATA?
// read the attribute // read the attribute
if (error == B_OK) { if (error == B_OK) {
+10 -10
View File
@@ -187,8 +187,8 @@ BMemoryIO::ReadAt(off_t pos, void *buffer, size_t size)
return B_BAD_VALUE; return B_BAD_VALUE;
ssize_t sizeRead = 0; ssize_t sizeRead = 0;
if (pos < fLen) { if (pos < (off_t)fLen) {
sizeRead = min_c(static_cast<off_t>(size), fLen - pos); sizeRead = min_c((off_t)size, (off_t)fLen - pos);
memcpy(buffer, fBuf + pos, sizeRead); memcpy(buffer, fBuf + pos, sizeRead);
} }
return sizeRead; return sizeRead;
@@ -206,12 +206,12 @@ BMemoryIO::WriteAt(off_t pos, const void *buffer, size_t size)
return B_BAD_VALUE; return B_BAD_VALUE;
ssize_t sizeWritten = 0; ssize_t sizeWritten = 0;
if (pos < fPhys) { if (pos < (off_t)fPhys) {
sizeWritten = min_c(static_cast<off_t>(size), fPhys - pos); sizeWritten = min_c((off_t)size, (off_t)fPhys - pos);
memcpy(fBuf + pos, buffer, sizeWritten); memcpy(fBuf + pos, buffer, sizeWritten);
} }
if (pos + sizeWritten > fLen) if (pos + sizeWritten > (off_t)fLen)
fLen = pos + sizeWritten; fLen = pos + sizeWritten;
return sizeWritten; return sizeWritten;
@@ -256,7 +256,7 @@ BMemoryIO::SetSize(off_t size)
if (fReadOnly) if (fReadOnly)
return B_NOT_ALLOWED; return B_NOT_ALLOWED;
if (size <= fPhys) { if (size <= (off_t)fPhys) {
err = B_OK; err = B_OK;
fLen = size; fLen = size;
} }
@@ -313,8 +313,8 @@ BMallocIO::ReadAt(off_t pos, void *buffer, size_t size)
return B_BAD_VALUE; return B_BAD_VALUE;
ssize_t sizeRead = 0; ssize_t sizeRead = 0;
if (pos < fLength) { if (pos < (off_t)fLength) {
sizeRead = min_c(static_cast<off_t>(size), fLength - pos); sizeRead = min_c((off_t)size, (off_t)fLength - pos);
memcpy(buffer, fData + pos, sizeRead); memcpy(buffer, fData + pos, sizeRead);
} }
return sizeRead; return sizeRead;
@@ -328,7 +328,7 @@ BMallocIO::WriteAt(off_t pos, const void *buffer, size_t size)
if (buffer == NULL) if (buffer == NULL)
return B_BAD_VALUE; return B_BAD_VALUE;
size_t newSize = max_c(pos + size, static_cast<off_t>(fLength)); size_t newSize = max_c(pos + (off_t)size, (off_t)fLength);
status_t error = B_OK; status_t error = B_OK;
@@ -386,7 +386,7 @@ BMallocIO::SetSize(off_t size)
} else { } else {
// size != 0, see, if necessary to resize // size != 0, see, if necessary to resize
size_t newSize = (size + fBlockSize - 1) / fBlockSize * fBlockSize; size_t newSize = (size + fBlockSize - 1) / fBlockSize * fBlockSize;
if (size != fMallocSize) { if (size != (off_t)fMallocSize) {
// we need to resize // we need to resize
if (char *newData = static_cast<char*>(realloc(fData, newSize))) { if (char *newData = static_cast<char*>(realloc(fData, newSize))) {
// set the new area to 0 // set the new area to 0