Merge branch 'master' into sam460ex

This commit is contained in:
François Revol 2012-11-03 14:35:39 +01:00
commit 64ba8ce42b
5 changed files with 217 additions and 22 deletions

View File

@ -65,6 +65,7 @@ HAIKU_INCLUDE_SOURCES=0
$urlLine
$sslPkgLine
$sslUrlLine
$webkitFileLine
declare -a functionArgs
expanderRulesFile=`finddir B_COMMON_DATA_DIRECTORY`/expander.rules
if [ -f \${expanderRulesFile} ] ; then
@ -686,7 +687,7 @@ function ConvertJamToBash()
#icuDevelPkgLine=`sed -n -e "$regExp" ${baseDir}/OptionalBuildFeatures`
#ConvertVariableDeclarationLines "$regExp" 'icuDevelPkgLine'
local regExp='/^HAIKU_OPENSSL_PACKAGE/p'
local regExp="/^\s*HAIKU_OPENSSL_PACKAGE = .*-gcc${HAIKU_GCC_VERSION[1]}-/p"
sslPkgLine=`sed -n -e "$regExp" ${baseDir}/OptionalBuildFeatures`
ConvertVariableDeclarationLines "$regExp" 'sslPkgLine'
@ -694,6 +695,10 @@ function ConvertJamToBash()
sslUrlLine=`sed -n -e "$regExp" ${baseDir}/OptionalBuildFeatures`
ConvertVariableDeclarationLines "$regExp" 'sslUrlLine'
local regExp='/^HAIKU_WEBKIT_FILE/p'
webkitFileLine=`sed -n -e "$regExp" ${baseDir}/OptionalBuildFeatures`
ConvertVariableDeclarationLines "$regExp" 'webkitFileLine'
local regExp='/^local\ baseURL/p'
urlLine=`sed -n -e "$regExp" ${baseDir}/OptionalPackages`
urlLine=${urlLine/local\ /''}

View File

@ -378,9 +378,9 @@ public:
bool HasRef(const char* name, int32 n = 0) const;
bool HasMessage(const char* name, int32 n = 0) const;
bool HasFlat(const char* name,
const BFlattenable* ) const;
const BFlattenable* object) const;
bool HasFlat(const char* name, int32 n,
const BFlattenable* ) const;
const BFlattenable* object) const;
bool HasData(const char* name, type_code ,
int32 n = 0) const;
BRect FindRect(const char* name, int32 n = 0) const;
@ -394,6 +394,97 @@ public:
float FindFloat(const char* name, int32 n = 0) const;
double FindDouble(const char* name, int32 n = 0) const;
// Convenience methods
bool GetBool(const char* name,
bool defaultValue) const;
bool GetBool(const char* name, int32 index,
bool defaultValue) const;
int8 GetInt8(const char* name,
int8 defaultValue) const;
int8 GetInt8(const char* name, int32 index,
int8 defaultValue) const;
uint8 GetUInt8(const char* name,
uint8 defaultValue) const;
uint8 GetUInt8(const char* name, int32 index,
uint8 defaultValue) const;
int16 GetInt16(const char* name,
int16 defaultValue) const;
int16 GetInt16(const char* name, int32 index,
int16 defaultValue) const;
uint16 GetUInt16(const char* name,
uint16 defaultValue) const;
uint16 GetUInt16(const char* name, int32 index,
uint16 defaultValue) const;
int32 GetInt32(const char* name,
int32 defaultValue) const;
int32 GetInt32(const char* name, int32 index,
int32 defaultValue) const;
uint32 GetUInt32(const char* name,
uint32 defaultValue) const;
uint32 GetUInt32(const char* name, int32 index,
uint32 defaultValue) const;
int64 GetInt64(const char* name,
int64 defaultValue) const;
int64 GetInt64(const char* name, int32 index,
int64 defaultValue) const;
uint64 GetUInt64(const char* name,
uint64 defaultValue) const;
uint64 GetUInt64(const char* name, int32 index,
uint64 defaultValue) const;
float GetFloat(const char* name,
float defaultValue) const;
float GetFloat(const char* name, int32 index,
float defaultValue) const;
double GetDouble(const char* name,
double defaultValue) const;
double GetDouble(const char* name, int32 index,
double defaultValue) const;
void* GetPointer(const char* name,
const void* defaultValue) const;
void* GetPointer(const char* name, int32 index,
const void* defaultValue) const;
const char* GetString(const char* name,
const char* defaultValue) const;
const char* GetString(const char* name, int32 index,
const char* defaultValue) const;
BAlignment GetAlignment(const char* name, int32 index,
const BAlignment& defaultValue) const;
BAlignment GetAlignment(const char* name,
const BAlignment& defaultValue) const;
BRect GetRect(const char* name, int32 index,
const BRect& defaultValue) const;
BRect GetRect(const char* name,
const BRect& defaultValue) const;
BPoint GetPoint(const char* name, int32 index,
const BPoint& defaultValue) const;
BPoint GetPoint(const char* name,
const BPoint& defaultValue) const;
BSize GetSize(const char* name, int32 index,
const BSize& defaultValue) const;
BSize GetSize(const char* name,
const BSize& defaultValue) const;
// fixed size fields only
status_t SetBool(const char* name, bool value);
status_t SetInt8(const char* name, int8 value);
status_t SetUInt8(const char* name, uint8 value);
status_t SetInt16(const char* name, int16 value);
status_t SetUInt16(const char* name, uint16 value);
status_t SetInt32(const char* name, int32 value);
status_t SetUInt32(const char* name, uint32 value);
status_t SetInt64(const char* name, int64 value);
status_t SetUInt64(const char* name, uint64 value);
status_t SetPointer(const char* name, const void* value);
status_t SetFloat(const char* name, float value);
status_t SetDouble(const char* name, double value);
status_t SetAlignment(const char* name,
const BAlignment& value);
status_t SetPoint(const char* name, const BPoint& value);
status_t SetRect(const char* name, const BRect& value);
status_t SetSize(const char* name, const BSize& value);
status_t SetData(const char* name, type_code type,
const void* data, ssize_t numBytes);
class Private;
struct message_header;
struct field_header;

View File

@ -30,13 +30,16 @@
// DEALINGS IN THE SOFTWARE.
/*****************************************************************************/
#include "BaseTranslator.h"
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <Catalog.h>
#include <Locale.h>
#include "BaseTranslator.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "BaseTranslator"
@ -546,7 +549,8 @@ BaseTranslator::translate_from_bits_to_bits(BPositionIO *inSource,
if (writ < 0)
break;
remaining -= static_cast<uint32>(writ);
rd = inSource->Read(buf, min(1024, remaining));
rd = inSource->Read(buf, std::min(1024UL,
remaining));
}
if (remaining > 0)

View File

@ -43,13 +43,6 @@
#include <View.h>
#include "TranslatorSettings.h"
#ifndef min
#define min(a,b) ((a < b) ? (a) : (b))
#endif
#ifndef max
#define max(a,b) ((a > b) ? (a) : (b))
#endif
class BaseTranslator : public BTranslator {
public:
BaseTranslator(const char *name, const char *info,

View File

@ -2395,9 +2395,12 @@ BMessage::_SendFlattenedMessage(void *data, int32 size, port_id port,
}
void BMessage::_ReservedMessage1(void) {};
void BMessage::_ReservedMessage2(void) {};
void BMessage::_ReservedMessage3(void) {};
void BMessage::_ReservedMessage1() {}
void BMessage::_ReservedMessage2() {}
void BMessage::_ReservedMessage3() {}
// #pragma mark - Macro definitions for data access methods
/* Relay functions from here on (Add... -> AddData, Find... -> FindData) */
@ -2409,6 +2412,7 @@ BMessage::Add##typeName(const char *name, type val) \
return AddData(name, typeCode, &val, sizeof(type), true); \
} \
\
\
status_t \
BMessage::Find##typeName(const char *name, type *p) const \
{ \
@ -2425,6 +2429,7 @@ BMessage::Find##typeName(const char *name, type *p) const \
return error; \
} \
\
\
status_t \
BMessage::Find##typeName(const char *name, int32 index, type *p) const \
{ \
@ -2441,18 +2446,21 @@ BMessage::Find##typeName(const char *name, int32 index, type *p) const \
return error; \
} \
\
status_t \
BMessage::Replace##typeName(const char *name, type val) \
{ \
return ReplaceData(name, typeCode, 0, &val, sizeof(type)); \
} \
\
status_t \
BMessage::Replace##typeName(const char *name, int32 index, type val) \
BMessage::Replace##typeName(const char *name, type value) \
{ \
return ReplaceData(name, typeCode, index, &val, sizeof(type)); \
return ReplaceData(name, typeCode, 0, &value, sizeof(type)); \
} \
\
\
status_t \
BMessage::Replace##typeName(const char *name, int32 index, type value) \
{ \
return ReplaceData(name, typeCode, index, &value, sizeof(type)); \
} \
\
\
bool \
BMessage::Has##typeName(const char *name, int32 index) const \
{ \
@ -2483,6 +2491,7 @@ BMessage::Has##typeName(const char *name, int32 index) const \
return HasData(name, typeCode, index); \
}
DEFINE_HAS_FUNCTION(Alignment, B_ALIGNMENT_TYPE);
DEFINE_HAS_FUNCTION(String, B_STRING_TYPE);
DEFINE_HAS_FUNCTION(Pointer, B_POINTER_TYPE);
@ -2492,6 +2501,7 @@ DEFINE_HAS_FUNCTION(Message, B_MESSAGE_TYPE);
#undef DEFINE_HAS_FUNCTION
#define DEFINE_LAZY_FIND_FUNCTION(type, typeName, initialize) \
type \
BMessage::Find##typeName(const char *name, int32 index) const \
@ -2501,6 +2511,7 @@ BMessage::Find##typeName(const char *name, int32 index) const \
return val; \
}
DEFINE_LAZY_FIND_FUNCTION(BRect, Rect, BRect());
DEFINE_LAZY_FIND_FUNCTION(BPoint, Point, BPoint());
DEFINE_LAZY_FIND_FUNCTION(const char *, String, NULL);
@ -2514,6 +2525,83 @@ DEFINE_LAZY_FIND_FUNCTION(double, Double, 0);
#undef DEFINE_LAZY_FIND_FUNCTION
#define DEFINE_SET_GET_FUNCTIONS(type, typeName, typeCode) \
type \
BMessage::Get##typeName(const char *name, type defaultValue) const \
{ \
return Get##typeName(name, 0, defaultValue); \
} \
\
\
type \
BMessage::Get##typeName(const char *name, int32 index, \
type defaultValue) const \
{ \
type value; \
if (Find##typeName(name, index, &value) == B_OK) \
return value; \
\
return defaultValue; \
} \
\
\
status_t \
BMessage::Set##typeName(const char *name, type value) \
{ \
return SetData(name, typeCode, &value, sizeof(type)); \
} \
DEFINE_SET_GET_FUNCTIONS(int8, Int8, B_INT8_TYPE);
DEFINE_SET_GET_FUNCTIONS(uint8, UInt8, B_UINT8_TYPE);
DEFINE_SET_GET_FUNCTIONS(int16, Int16, B_INT16_TYPE);
DEFINE_SET_GET_FUNCTIONS(uint16, UInt16, B_UINT16_TYPE);
DEFINE_SET_GET_FUNCTIONS(int32, Int32, B_INT32_TYPE);
DEFINE_SET_GET_FUNCTIONS(uint32, UInt32, B_UINT32_TYPE);
DEFINE_SET_GET_FUNCTIONS(int64, Int64, B_INT64_TYPE);
DEFINE_SET_GET_FUNCTIONS(uint64, UInt64, B_UINT64_TYPE);
DEFINE_SET_GET_FUNCTIONS(bool, Bool, B_BOOL_TYPE);
DEFINE_SET_GET_FUNCTIONS(float, Float, B_FLOAT_TYPE);
DEFINE_SET_GET_FUNCTIONS(double, Double, B_DOUBLE_TYPE);
#undef DEFINE_SET_GET_FUNCTION
#define DEFINE_SET_GET_BY_REFERENCE_FUNCTIONS(type, typeName, typeCode) \
type \
BMessage::Get##typeName(const char *name, const type& defaultValue) const \
{ \
return Get##typeName(name, 0, defaultValue); \
} \
\
\
type \
BMessage::Get##typeName(const char *name, int32 index, \
const type& defaultValue) const \
{ \
type value; \
if (Find##typeName(name, index, &value) == B_OK) \
return value; \
\
return defaultValue; \
} \
\
\
status_t \
BMessage::Set##typeName(const char *name, const type& value) \
{ \
return SetData(name, typeCode, &value, sizeof(type)); \
} \
DEFINE_SET_GET_BY_REFERENCE_FUNCTIONS(BPoint, Point, B_POINT_TYPE);
DEFINE_SET_GET_BY_REFERENCE_FUNCTIONS(BRect, Rect, B_RECT_TYPE);
DEFINE_SET_GET_BY_REFERENCE_FUNCTIONS(BSize, Size, B_SIZE_TYPE);
#undef DEFINE_SET_GET_BY_REFERENCE_FUNCTIONS
status_t
BMessage::AddAlignment(const char *name, const BAlignment &alignment)
{
@ -3044,3 +3132,17 @@ BMessage::HasFlat(const char *name, int32 index, const BFlattenable *object)
{
return HasData(name, object->TypeCode(), index);
}
status_t
BMessage::SetData(const char* name, type_code type, const void* data,
ssize_t numBytes)
{
if (numBytes <= 0 || data == NULL)
return B_BAD_VALUE;
if (ReplaceData(name, type, data, numBytes) == B_OK)
return B_OK;
return AddData(name, type, data, numBytes);
}