Remove R3 compatibility details from BPropertyInfo, fix memory leak and implement endian-ness
aware flatten and unflatten code. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@844 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
/ Description: Utility class for maintain scripting information
|
||||
/
|
||||
/ Copyright 1997-98, Be Incorporated, All Rights Reserved
|
||||
/ Modified for use with OpenBeOS.
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
@@ -16,12 +17,28 @@
|
||||
#include <Flattenable.h>
|
||||
#include <TypeConstants.h> /* For convenience */
|
||||
|
||||
/*
|
||||
* The following define is used to turn off a number of member functions
|
||||
* and member variables in BPropertyInfo which are only there to faciliate
|
||||
* BeOS R3 compatibility. Be changed the property_info structure between
|
||||
* R3 and R4 and these functions ensure that BPropertyInfo is backward
|
||||
* compatible. However, between R3 and R4, Be changed the Intel executable
|
||||
* format so R4 was not backward compatible with R3.
|
||||
*
|
||||
* Because OpenBeOS is only targetting Intel platform compatibility at this
|
||||
* time, there is no need for R3 compatibility in OpenBeOS. By default
|
||||
* these members will be turned off with the R3_COMPATIBLE define.
|
||||
*/
|
||||
#undef R3_COMPATIBLE
|
||||
|
||||
#ifdef R3_COMPATIBLE
|
||||
struct _oproperty_info_;
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- the property_info structure ------------------------------*/
|
||||
|
||||
|
||||
struct _oproperty_info_;
|
||||
|
||||
struct compound_type {
|
||||
struct field_pair {
|
||||
char *name; // name of entry in message
|
||||
@@ -103,29 +120,30 @@ virtual void _ReservedPropertyInfo4();
|
||||
BPropertyInfo(const BPropertyInfo &);
|
||||
BPropertyInfo &operator=(const BPropertyInfo &);
|
||||
void FreeMem();
|
||||
void FreeInfoArray(property_info *p, int32);
|
||||
void FreeInfoArray(value_info *p, int32);
|
||||
void FreeInfoArray(_oproperty_info_ *p, int32);
|
||||
static property_info *ConvertToNew(const _oproperty_info_ *p);
|
||||
static _oproperty_info_ *ConvertFromNew(const property_info *p);
|
||||
|
||||
property_info *fPropInfo;
|
||||
value_info *fValueInfo;
|
||||
int32 fPropCount;
|
||||
bool fInHeap;
|
||||
bool fOldInHeap;
|
||||
uint16 fValueCount;
|
||||
#ifndef R3_COMPATIBLE
|
||||
uint32 _reserved[4];
|
||||
#else
|
||||
_oproperty_info_ *fOldPropInfo;
|
||||
bool fOldInHeap;
|
||||
uint32 _reserved[2]; /* was 4 */
|
||||
|
||||
/* Deprecated */
|
||||
private:
|
||||
static property_info *ConvertToNew(const _oproperty_info_ *p);
|
||||
static _oproperty_info_ *ConvertFromNew(const property_info *p);
|
||||
const property_info *PropertyInfo() const;
|
||||
BPropertyInfo(property_info *p,
|
||||
bool free_on_delete);
|
||||
static bool MatchCommand(uint32, int32, property_info *);
|
||||
static bool MatchSpecifier(uint32, property_info *);
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
@@ -64,6 +64,38 @@ virtual void _ReservedPositionIO4();
|
||||
int32 _reserved[2];
|
||||
};
|
||||
|
||||
|
||||
class BMemoryIO : public BPositionIO {
|
||||
public:
|
||||
BMemoryIO(void *p, size_t len);
|
||||
BMemoryIO(const void *p, size_t len);
|
||||
virtual ~BMemoryIO();
|
||||
|
||||
virtual ssize_t ReadAt(off_t pos, void *buffer, size_t size);
|
||||
virtual ssize_t WriteAt(off_t pos, const void *buffer, size_t size);
|
||||
|
||||
virtual off_t Seek(off_t pos, uint32 seek_mode);
|
||||
virtual off_t Position() const;
|
||||
|
||||
virtual status_t SetSize(off_t size);
|
||||
|
||||
/*----- Private or reserved ---------------*/
|
||||
private:
|
||||
virtual void _ReservedMemoryIO1();
|
||||
virtual void _ReservedMemoryIO2();
|
||||
|
||||
BMemoryIO(const BMemoryIO &);
|
||||
BMemoryIO &operator=(const BMemoryIO &);
|
||||
|
||||
bool fReadOnly;
|
||||
char *fBuf;
|
||||
size_t fLen;
|
||||
size_t fPhys;
|
||||
size_t fPos;
|
||||
|
||||
int32 _reserved[1];
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user