Some GCC 4.1.0 related build fixes (under Linux/PPC).
Doesn't build yet, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17500 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -80,28 +80,6 @@
|
|||||||
|
|
||||||
/* cpp kit */
|
/* cpp kit */
|
||||||
|
|
||||||
/* -- <typeinfo> */
|
|
||||||
class _IMPEXP_ROOT bad_cast;
|
|
||||||
class _IMPEXP_ROOT bad_typeid;
|
|
||||||
class _IMPEXP_ROOT type_info;
|
|
||||||
|
|
||||||
/* -- <exception> */
|
|
||||||
class _IMPEXP_ROOT exception;
|
|
||||||
class _IMPEXP_ROOT bad_exception;
|
|
||||||
|
|
||||||
/* -- <new.h> */
|
|
||||||
class _IMPEXP_ROOT bad_alloc;
|
|
||||||
|
|
||||||
/* -- <mexcept.h> */
|
|
||||||
class _IMPEXP_ROOT logic_error;
|
|
||||||
class _IMPEXP_ROOT domain_error;
|
|
||||||
class _IMPEXP_ROOT invalid_argument;
|
|
||||||
class _IMPEXP_ROOT length_error;
|
|
||||||
class _IMPEXP_ROOT out_of_range;
|
|
||||||
class _IMPEXP_ROOT runtime_error;
|
|
||||||
class _IMPEXP_ROOT range_error;
|
|
||||||
class _IMPEXP_ROOT overflow_error;
|
|
||||||
|
|
||||||
/* support kit */
|
/* support kit */
|
||||||
class _IMPEXP_BE BArchivable;
|
class _IMPEXP_BE BArchivable;
|
||||||
class _IMPEXP_BE BAutolock;
|
class _IMPEXP_BE BAutolock;
|
||||||
|
|||||||
@@ -95,8 +95,8 @@ class _PointerList_ : public BList {
|
|||||||
public:
|
public:
|
||||||
_PointerList_(const _PointerList_ &list);
|
_PointerList_(const _PointerList_ &list);
|
||||||
_PointerList_(int32 itemsPerBlock = 20, bool owning = false);
|
_PointerList_(int32 itemsPerBlock = 20, bool owning = false);
|
||||||
~_PointerList_();
|
virtual ~_PointerList_();
|
||||||
|
|
||||||
typedef void *(* GenericEachFunction)(void *, void *);
|
typedef void *(* GenericEachFunction)(void *, void *);
|
||||||
typedef int (* GenericCompareFunction)(const void *, const void *);
|
typedef int (* GenericCompareFunction)(const void *, const void *);
|
||||||
typedef int (* GenericCompareFunctionWithState)(const void *, const void *,
|
typedef int (* GenericCompareFunctionWithState)(const void *, const void *,
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
//----------------------------------------------------------------------
|
/*
|
||||||
// This software is part of the OpenBeOS distribution and is covered
|
* Copyright 2002-2006, Haiku Inc.
|
||||||
// by the OpenBeOS license.
|
* Distributed under the terms of the MIT License.
|
||||||
//---------------------------------------------------------------------
|
*
|
||||||
|
* Authors:
|
||||||
|
* Tyler Dauwalder
|
||||||
|
* Ingo Weinhold, [email protected]
|
||||||
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\file ResourceFile.cpp
|
\file ResourceFile.cpp
|
||||||
ResourceFile implementation.
|
ResourceFile implementation.
|
||||||
@@ -19,9 +24,7 @@
|
|||||||
#include "ResourceItem.h"
|
#include "ResourceItem.h"
|
||||||
#include "ResourcesContainer.h"
|
#include "ResourcesContainer.h"
|
||||||
#include "ResourcesDefs.h"
|
#include "ResourcesDefs.h"
|
||||||
//#include "Warnings.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
namespace Storage {
|
namespace Storage {
|
||||||
@@ -117,7 +120,7 @@ calculate_checksum(const void *data, uint32 size)
|
|||||||
const uint8 *current = csData;
|
const uint8 *current = csData;
|
||||||
for (; current < dataEnd; current += 4) {
|
for (; current < dataEnd; current += 4) {
|
||||||
uint32 word = 0;
|
uint32 word = 0;
|
||||||
int32 bytes = min(4L, (int32)(dataEnd - current));
|
int32 bytes = min_c(4L, (int32)(dataEnd - current));
|
||||||
for (int32 i = 0; i < bytes; i++)
|
for (int32 i = 0; i < bytes; i++)
|
||||||
word = (word << 8) + current[i];
|
word = (word << 8) + current[i];
|
||||||
checkSum += word;
|
checkSum += word;
|
||||||
@@ -520,8 +523,8 @@ ResourceFile::_InitELFFile(BFile &file)
|
|||||||
"table exceeds file: %lu.",
|
"table exceeds file: %lu.",
|
||||||
programHeaderTableOffset + programHeaderTableSize);
|
programHeaderTableOffset + programHeaderTableSize);
|
||||||
}
|
}
|
||||||
resourceOffset = max(resourceOffset, programHeaderTableOffset
|
resourceOffset = max_c(resourceOffset, programHeaderTableOffset
|
||||||
+ programHeaderTableSize);
|
+ programHeaderTableSize);
|
||||||
// iterate through the program headers
|
// iterate through the program headers
|
||||||
for (int32 i = 0; i < (int32)programHeaderCount; i++) {
|
for (int32 i = 0; i < (int32)programHeaderCount; i++) {
|
||||||
uint32 shOffset = programHeaderTableOffset + i * programHeaderSize;
|
uint32 shOffset = programHeaderTableOffset + i * programHeaderSize;
|
||||||
@@ -545,8 +548,8 @@ ResourceFile::_InitELFFile(BFile &file)
|
|||||||
throw Exception(B_IO_ERROR, "Invalid ELF section header: "
|
throw Exception(B_IO_ERROR, "Invalid ELF section header: "
|
||||||
"segment exceeds file: %lu.", segmentEnd);
|
"segment exceeds file: %lu.", segmentEnd);
|
||||||
}
|
}
|
||||||
resourceOffset = max(resourceOffset, segmentEnd);
|
resourceOffset = max_c(resourceOffset, segmentEnd);
|
||||||
resourceAlignment = max(resourceAlignment, alignment);
|
resourceAlignment = max_c(resourceAlignment, alignment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -566,8 +569,8 @@ ResourceFile::_InitELFFile(BFile &file)
|
|||||||
"table exceeds file: %lu.",
|
"table exceeds file: %lu.",
|
||||||
sectionHeaderTableOffset + sectionHeaderTableSize);
|
sectionHeaderTableOffset + sectionHeaderTableSize);
|
||||||
}
|
}
|
||||||
resourceOffset = max(resourceOffset, sectionHeaderTableOffset
|
resourceOffset = max_c(resourceOffset, sectionHeaderTableOffset
|
||||||
+ sectionHeaderTableSize);
|
+ sectionHeaderTableSize);
|
||||||
// iterate through the section headers
|
// iterate through the section headers
|
||||||
for (int32 i = 0; i < (int32)sectionHeaderCount; i++) {
|
for (int32 i = 0; i < (int32)sectionHeaderCount; i++) {
|
||||||
uint32 shOffset = sectionHeaderTableOffset + i * sectionHeaderSize;
|
uint32 shOffset = sectionHeaderTableOffset + i * sectionHeaderSize;
|
||||||
@@ -591,7 +594,7 @@ ResourceFile::_InitELFFile(BFile &file)
|
|||||||
throw Exception(B_IO_ERROR, "Invalid ELF section header: "
|
throw Exception(B_IO_ERROR, "Invalid ELF section header: "
|
||||||
"section exceeds file: %lu.", sectionEnd);
|
"section exceeds file: %lu.", sectionEnd);
|
||||||
}
|
}
|
||||||
resourceOffset = max(resourceOffset, sectionEnd);
|
resourceOffset = max_c(resourceOffset, sectionEnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -651,7 +654,7 @@ ResourceFile::_InitPEFFile(BFile &file, const PEFContainerHeader &pefHeader)
|
|||||||
throw Exception(B_IO_ERROR, "Invalid PEF section header: section "
|
throw Exception(B_IO_ERROR, "Invalid PEF section header: section "
|
||||||
"exceeds file: %lu.", sectionEnd);
|
"exceeds file: %lu.", sectionEnd);
|
||||||
}
|
}
|
||||||
resourceOffset = max(resourceOffset, sectionEnd);
|
resourceOffset = max_c(resourceOffset, sectionEnd);
|
||||||
}
|
}
|
||||||
if (resourceOffset >= fileSize) {
|
if (resourceOffset >= fileSize) {
|
||||||
// throw Exception("The PEF object file does not contain resources.");
|
// throw Exception("The PEF object file does not contain resources.");
|
||||||
@@ -829,7 +832,7 @@ ResourceFile::_ReadIndexEntry(resource_parse_info &parseInfo, int32 index,
|
|||||||
}
|
}
|
||||||
// add the entry
|
// add the entry
|
||||||
if (result) {
|
if (result) {
|
||||||
ResourceItem *item = new(nothrow) ResourceItem;
|
ResourceItem *item = new(std::nothrow) ResourceItem;
|
||||||
if (!item)
|
if (!item)
|
||||||
throw Exception(B_NO_MEMORY);
|
throw Exception(B_NO_MEMORY);
|
||||||
item->SetLocation(offset, size);
|
item->SetLocation(offset, size);
|
||||||
@@ -848,7 +851,7 @@ ResourceFile::_ReadInfoTable(resource_parse_info &parseInfo)
|
|||||||
int32 &resourceCount = parseInfo.resource_count;
|
int32 &resourceCount = parseInfo.resource_count;
|
||||||
// read the info table
|
// read the info table
|
||||||
// alloc memory for the table
|
// alloc memory for the table
|
||||||
char *tableData = new(nothrow) char[parseInfo.info_table_size];
|
char *tableData = new(std::nothrow) char[parseInfo.info_table_size];
|
||||||
if (!tableData)
|
if (!tableData)
|
||||||
throw Exception(B_NO_MEMORY);
|
throw Exception(B_NO_MEMORY);
|
||||||
int32 dataSize = parseInfo.info_table_size;
|
int32 dataSize = parseInfo.info_table_size;
|
||||||
@@ -856,7 +859,7 @@ ResourceFile::_ReadInfoTable(resource_parse_info &parseInfo)
|
|||||||
read_exactly(fFile, parseInfo.info_table_offset, tableData, dataSize,
|
read_exactly(fFile, parseInfo.info_table_offset, tableData, dataSize,
|
||||||
"Failed to read resource info table.");
|
"Failed to read resource info table.");
|
||||||
//
|
//
|
||||||
bool *readIndices = new(nothrow) bool[resourceCount + 1];
|
bool *readIndices = new(std::nothrow) bool[resourceCount + 1];
|
||||||
// + 1 => always > 0
|
// + 1 => always > 0
|
||||||
if (!readIndices)
|
if (!readIndices)
|
||||||
throw Exception(B_NO_MEMORY);
|
throw Exception(B_NO_MEMORY);
|
||||||
@@ -1040,12 +1043,12 @@ ResourceFile::_WriteResources(ResourcesContainer &container)
|
|||||||
indexSectionSize = align_value(indexSectionSize,
|
indexSectionSize = align_value(indexSectionSize,
|
||||||
kResourceIndexSectionAlignment);
|
kResourceIndexSectionAlignment);
|
||||||
size += indexSectionSize;
|
size += indexSectionSize;
|
||||||
bufferSize = max((uint32)bufferSize, indexSectionSize);
|
bufferSize = max_c((uint32)bufferSize, indexSectionSize);
|
||||||
// unknown section
|
// unknown section
|
||||||
uint32 unknownSectionOffset = size;
|
uint32 unknownSectionOffset = size;
|
||||||
uint32 unknownSectionSize = kUnknownResourceSectionSize;
|
uint32 unknownSectionSize = kUnknownResourceSectionSize;
|
||||||
size += unknownSectionSize;
|
size += unknownSectionSize;
|
||||||
bufferSize = max((uint32)bufferSize, unknownSectionSize);
|
bufferSize = max_c((uint32)bufferSize, unknownSectionSize);
|
||||||
// data
|
// data
|
||||||
uint32 dataOffset = size;
|
uint32 dataOffset = size;
|
||||||
uint32 dataSize = 0;
|
uint32 dataSize = 0;
|
||||||
@@ -1054,7 +1057,7 @@ ResourceFile::_WriteResources(ResourcesContainer &container)
|
|||||||
if (!item->IsLoaded())
|
if (!item->IsLoaded())
|
||||||
throw Exception(B_IO_ERROR, "Resource is not loaded.");
|
throw Exception(B_IO_ERROR, "Resource is not loaded.");
|
||||||
dataSize += item->DataSize();
|
dataSize += item->DataSize();
|
||||||
bufferSize = max(bufferSize, item->DataSize());
|
bufferSize = max_c(bufferSize, item->DataSize());
|
||||||
}
|
}
|
||||||
size += dataSize;
|
size += dataSize;
|
||||||
// info table
|
// info table
|
||||||
@@ -1078,12 +1081,12 @@ ResourceFile::_WriteResources(ResourcesContainer &container)
|
|||||||
infoTableSize += kResourceInfoSeparatorSize
|
infoTableSize += kResourceInfoSeparatorSize
|
||||||
+ kResourceInfoTableEndSize;
|
+ kResourceInfoTableEndSize;
|
||||||
size += infoTableSize;
|
size += infoTableSize;
|
||||||
bufferSize = max((uint32)bufferSize, infoTableSize);
|
bufferSize = max_c((uint32)bufferSize, infoTableSize);
|
||||||
|
|
||||||
// write...
|
// write...
|
||||||
// set the file size
|
// set the file size
|
||||||
fFile.SetSize(size);
|
fFile.SetSize(size);
|
||||||
buffer = new(nothrow) char[bufferSize];
|
buffer = new(std::nothrow) char[bufferSize];
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
throw Exception(B_NO_MEMORY);
|
throw Exception(B_NO_MEMORY);
|
||||||
void *data = buffer;
|
void *data = buffer;
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
//----------------------------------------------------------------------
|
/*
|
||||||
// This software is part of the OpenBeOS distribution and is covered
|
* Copyright 2002-2006, Haiku Inc.
|
||||||
// by the OpenBeOS license.
|
* Distributed under the terms of the MIT License.
|
||||||
//----------------------------------------------------------------------
|
*
|
||||||
|
* Authors:
|
||||||
|
* Tyler Dauwalder
|
||||||
|
* Ingo Weinhold, [email protected]
|
||||||
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\file storage_support.cpp
|
\file storage_support.cpp
|
||||||
Implementations of miscellaneous internal Storage Kit support functions.
|
Implementations of miscellaneous internal Storage Kit support functions.
|
||||||
@@ -18,8 +23,6 @@
|
|||||||
|
|
||||||
#include "storage_support.h"
|
#include "storage_support.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
namespace Storage {
|
namespace Storage {
|
||||||
|
|
||||||
@@ -333,7 +336,7 @@ parse_first_path_component(const char *path, char *&component,
|
|||||||
int32 length;
|
int32 length;
|
||||||
status_t error = parse_first_path_component(path, length, nextComponent);
|
status_t error = parse_first_path_component(path, length, nextComponent);
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
component = new(nothrow) char[length + 1];
|
component = new(std::nothrow) char[length + 1];
|
||||||
if (component) {
|
if (component) {
|
||||||
strncpy(component, path, length);
|
strncpy(component, path, length);
|
||||||
component[length] = '\0';
|
component[length] = '\0';
|
||||||
@@ -477,7 +480,7 @@ void escape_path(const char *str, char *result)
|
|||||||
void escape_path(char *str)
|
void escape_path(char *str)
|
||||||
{
|
{
|
||||||
if (str) {
|
if (str) {
|
||||||
char *copy = new(nothrow) char[strlen(str)+1];
|
char *copy = new(std::nothrow) char[strlen(str)+1];
|
||||||
if (copy) {
|
if (copy) {
|
||||||
strcpy(copy, str);
|
strcpy(copy, str);
|
||||||
escape_path(copy, str);
|
escape_path(copy, str);
|
||||||
|
|||||||
@@ -2434,7 +2434,7 @@ vm_page_fault(addr_t address, addr_t fault_address, bool is_write, bool is_user,
|
|||||||
area ? area->name : "???", fault_address - (area ? area->base : 0x0));
|
area ? area->name : "???", fault_address - (area ? area->base : 0x0));
|
||||||
|
|
||||||
// We can print a stack trace of the userland thread here.
|
// We can print a stack trace of the userland thread here.
|
||||||
#if 1
|
#if 0
|
||||||
if (area) {
|
if (area) {
|
||||||
struct stack_frame {
|
struct stack_frame {
|
||||||
#ifdef __INTEL__
|
#ifdef __INTEL__
|
||||||
|
|||||||
Reference in New Issue
Block a user