various gcc 4 related build fixes

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18876 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Marcus Overhagen
2006-09-17 17:34:22 +00:00
parent 3ec18e87d6
commit 891a127fec
21 changed files with 78 additions and 73 deletions
+6 -6
View File
@@ -69,8 +69,8 @@ struct net_datalink_module_info {
bool (*is_local_address)(struct net_domain *domain, bool (*is_local_address)(struct net_domain *domain,
const struct sockaddr *address, const struct sockaddr *address,
net_interface **_interface = NULL, net_interface **_interface /* = NULL */,
uint32 *_matchedType = NULL); uint32 *_matchedType /* = NULL*/);
// routes // routes
status_t (*add_route)(struct net_domain *domain, status_t (*add_route)(struct net_domain *domain,
@@ -93,7 +93,7 @@ struct net_address_module_info {
module_info info; module_info info;
status_t (*copy_address)(const sockaddr *from, sockaddr **to, status_t (*copy_address)(const sockaddr *from, sockaddr **to,
bool replaceWithZeros = false, sockaddr *mask = NULL); bool replaceWithZeros /* = false */, const sockaddr *mask /* = NULL*/);
status_t (*mask_address)(const sockaddr *address, const sockaddr *mask, status_t (*mask_address)(const sockaddr *address, const sockaddr *mask,
sockaddr *result); sockaddr *result);
@@ -103,11 +103,11 @@ struct net_address_module_info {
bool (*equal_addresses_and_ports)(const sockaddr *a, const sockaddr *b); bool (*equal_addresses_and_ports)(const sockaddr *a, const sockaddr *b);
bool (*equal_masked_addresses)(const sockaddr *a, const sockaddr *b, bool (*equal_masked_addresses)(const sockaddr *a, const sockaddr *b,
const sockaddr *mask); const sockaddr *mask);
bool (*is_empty_address)(const sockaddr *address, bool checkPort = true); bool (*is_empty_address)(const sockaddr *address, bool checkPort /* = true */);
int32 (*first_mask_bit)(sockaddr *mask); int32 (*first_mask_bit)(const sockaddr *mask);
bool (*check_mask)(sockaddr *address); bool (*check_mask)(const sockaddr *address);
status_t (*print_address)(const sockaddr *address, char **buffer, status_t (*print_address)(const sockaddr *address, char **buffer,
bool printPort); bool printPort);
@@ -716,7 +716,7 @@ ipv4_bind(net_protocol *protocol, struct sockaddr *address)
// only INADDR_ANY and addresses of local interfaces are accepted: // only INADDR_ANY and addresses of local interfaces are accepted:
if (((sockaddr_in *)address)->sin_addr.s_addr == INADDR_ANY if (((sockaddr_in *)address)->sin_addr.s_addr == INADDR_ANY
|| sDatalinkModule->is_local_address(sDomain, address)) { || sDatalinkModule->is_local_address(sDomain, address, NULL, NULL)) {
protocol->socket->address.ss_len = sizeof(struct sockaddr_in); protocol->socket->address.ss_len = sizeof(struct sockaddr_in);
// explicitly set length, as our callers can't be trusted to // explicitly set length, as our callers can't be trusted to
// always provide the correct length! // always provide the correct length!
@@ -34,7 +34,7 @@
*/ */
static status_t static status_t
ipv4_copy_address(const sockaddr *from, sockaddr **to, ipv4_copy_address(const sockaddr *from, sockaddr **to,
bool replaceWithZeros = false, sockaddr *mask = NULL) bool replaceWithZeros = false, const sockaddr *mask = NULL)
{ {
if (replaceWithZeros) { if (replaceWithZeros) {
*to = (sockaddr *)malloc(sizeof(sockaddr_in)); *to = (sockaddr *)malloc(sizeof(sockaddr_in));
@@ -58,7 +58,7 @@ ipv4_copy_address(const sockaddr *from, sockaddr **to,
if (mask != NULL) { if (mask != NULL) {
((sockaddr_in *)*to)->sin_addr.s_addr ((sockaddr_in *)*to)->sin_addr.s_addr
&= ((sockaddr_in *)mask)->sin_addr.s_addr; &= ((const sockaddr_in *)mask)->sin_addr.s_addr;
} }
} }
return B_OK; return B_OK;
@@ -194,12 +194,12 @@ ipv4_equal_masked_addresses(const sockaddr *a, const sockaddr *b,
that there's no bit set in the mask). that there's no bit set in the mask).
*/ */
static int32 static int32
ipv4_first_mask_bit(sockaddr *_mask) ipv4_first_mask_bit(const sockaddr *_mask)
{ {
if (_mask == NULL) if (_mask == NULL)
return 0; return 0;
uint32 mask = ntohl(((sockaddr_in *)_mask)->sin_addr.s_addr); uint32 mask = ntohl(((const sockaddr_in *)_mask)->sin_addr.s_addr);
// TODO: this can be optimized, there are also some nice assembler mnemonics for this // TODO: this can be optimized, there are also some nice assembler mnemonics for this
int8 bit = 0; int8 bit = 0;
@@ -224,7 +224,7 @@ ipv4_check_mask(const sockaddr *_mask)
if (_mask == NULL) if (_mask == NULL)
return true; return true;
uint32 mask = ntohl(((sockaddr_in *)_mask)->sin_addr.s_addr); uint32 mask = ntohl(((const sockaddr_in *)_mask)->sin_addr.s_addr);
// A mask (from LSB) starts with zeros, after the first one, only ones // A mask (from LSB) starts with zeros, after the first one, only ones
// are allowed: // are allowed:
@@ -364,7 +364,7 @@ ipv4_hash_address_pair(const sockaddr *ourAddress, const sockaddr *peerAddress)
\return B_BAD_VALUE if either \a address or \a checksum is NULL \return B_BAD_VALUE if either \a address or \a checksum is NULL
*/ */
static status_t static status_t
ipv4_checksum_address(Checksum *checksum, const sockaddr *address) ipv4_checksum_address(struct Checksum *checksum, const sockaddr *address)
{ {
if (checksum == NULL || address == NULL) if (checksum == NULL || address == NULL)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -396,4 +396,5 @@ net_address_module_info gIPv4AddressModule = {
ipv4_set_to_empty_address, ipv4_set_to_empty_address,
ipv4_hash_address_pair, ipv4_hash_address_pair,
ipv4_checksum_address, ipv4_checksum_address,
NULL // ipv4_matches_broadcast_address,
}; };
@@ -372,7 +372,7 @@ UdpEndpointManager::DemuxBroadcast(net_buffer *buffer)
} }
connectAddr = (sockaddr *)&endpoint->socket->peer; connectAddr = (sockaddr *)&endpoint->socket->peer;
if (!sAddressModule->is_empty_address(connectAddr)) { if (!sAddressModule->is_empty_address(connectAddr, true)) {
// endpoint is connected to a specific destination, we check if // endpoint is connected to a specific destination, we check if
// this datagram is from there: // this datagram is from there:
if (!sAddressModule->equal_addresses_and_ports(connectAddr, peerAddr)) { if (!sAddressModule->equal_addresses_and_ports(connectAddr, peerAddr)) {
@@ -26,7 +26,6 @@
# define TRACE(x) ; # define TRACE(x) ;
#endif #endif
static benaphore sDomainLock; static benaphore sDomainLock;
static list sDomains; static list sDomains;
+2 -2
View File
@@ -349,9 +349,9 @@ add_route(struct net_domain *_domain, const struct net_route *newRoute)
&route->destination, (newRoute->flags & RTF_DEFAULT) != 0, &route->destination, (newRoute->flags & RTF_DEFAULT) != 0,
newRoute->mask) != B_OK newRoute->mask) != B_OK
|| domain->address_module->copy_address(newRoute->mask, &route->mask, || domain->address_module->copy_address(newRoute->mask, &route->mask,
(newRoute->flags & RTF_DEFAULT) != 0) != B_OK (newRoute->flags & RTF_DEFAULT) != 0, NULL) != B_OK
|| domain->address_module->copy_address(newRoute->gateway, || domain->address_module->copy_address(newRoute->gateway,
&route->gateway) != B_OK) { &route->gateway, false, NULL) != B_OK) {
delete route; delete route;
return B_NO_MEMORY; return B_NO_MEMORY;
} }
@@ -103,13 +103,13 @@ int avcodec(void* handle, avc_cmd_t cmd, void* pin, void* pout)
{ {
// pin char* codec name // pin char* codec name
private_handle_t* h = create_handle(); private_handle_t* h = create_handle();
(private_handle_t**)pout = h; *(private_handle_t***)&pout = h;
if (!h) if (!h)
return -ENOMEM; return -ENOMEM;
if (!h->avcodec) if (!h->avcodec)
{ {
destroy_handle(h); destroy_handle(h);
(private_handle_t**)pout = NULL; *(private_handle_t***)&pout = NULL;
return -1;// better error return -1;// better error
} }
return 0; return 0;
@@ -118,14 +118,14 @@ int avcodec(void* handle, avc_cmd_t cmd, void* pin, void* pout)
{ {
// pin uint32_t codec fourcc // pin uint32_t codec fourcc
private_handle_t* h = create_handle(); private_handle_t* h = create_handle();
(private_handle_t**)pout = h; *(private_handle_t***)&pout = h;
if (!h) if (!h)
return -ENOMEM; return -ENOMEM;
if (!h->avcodec) if (!h->avcodec)
{ {
destroy_handle(h); destroy_handle(h);
(private_handle_t**)pout = NULL; *(private_handle_t***)&pout = NULL;
return -1;// better error return -1;// better error
} }
return 0; return 0;
@@ -134,14 +134,14 @@ int avcodec(void* handle, avc_cmd_t cmd, void* pin, void* pout)
{ {
// pin uint32_t codec fourcc // pin uint32_t codec fourcc
private_handle_t* h = create_handle(); private_handle_t* h = create_handle();
(private_handle_t**)pout = h; *(private_handle_t***)&pout = h;
if (!h) if (!h)
return -ENOMEM; return -ENOMEM;
h->avcodec = avcodec_find_by_fcc((uint32_t) pin); h->avcodec = avcodec_find_by_fcc((uint32_t) pin);
if (!h->avcodec) if (!h->avcodec)
{ {
destroy_handle(h); destroy_handle(h);
(private_handle_t**)pout = NULL; *(private_handle_t***)&pout = NULL;
return -1;// better error return -1;// better error
} }
return 0; return 0;
@@ -163,7 +163,7 @@ int avcodec(void* handle, avc_cmd_t cmd, void* pin, void* pout)
break; break;
case AVC_GET_VERSION: case AVC_GET_VERSION:
(int*) pout = 500; *(int**)&pout = 500;
default: default:
return -1; return -1;
@@ -1507,40 +1507,7 @@ typedef struct AVCodecContext {
} AVCodecContext; } AVCodecContext;
/** struct AVOption;
* AVOption.
*/
typedef struct AVOption {
/** options' name */
const char *name; /* if name is NULL, it indicates a link to next */
/** short English text help or const struct AVOption* subpointer */
const char *help; // const struct AVOption* sub;
/** offset to context structure where the parsed value should be stored */
int offset;
/** options' type */
int type;
#define FF_OPT_TYPE_BOOL 1 ///< boolean - true,1,on (or simply presence)
#define FF_OPT_TYPE_DOUBLE 2 ///< double
#define FF_OPT_TYPE_INT 3 ///< integer
#define FF_OPT_TYPE_STRING 4 ///< string (finished with \0)
#define FF_OPT_TYPE_MASK 0x1f ///< mask for types - upper bits are various flags
//#define FF_OPT_TYPE_EXPERT 0x20 // flag for expert option
#define FF_OPT_TYPE_FLAG (FF_OPT_TYPE_BOOL | 0x40)
#define FF_OPT_TYPE_RCOVERRIDE (FF_OPT_TYPE_STRING | 0x80)
/** min value (min == max -> no limits) */
double min;
/** maximum value for double/int */
double max;
/** default boo [0,1]l/double/int value */
double defval;
/**
* default string value (with optional semicolon delimited extra option-list
* i.e. option1;option2;option3
* defval might select other then first argument as default
*/
const char *defstr;
#define FF_OPT_MAX_DEPTH 10
} AVOption;
/** /**
* Parse option(s) and sets fields in passed structure * Parse option(s) and sets fields in passed structure
@@ -1548,7 +1515,7 @@ typedef struct AVOption {
* @param list list with AVOptions * @param list list with AVOptions
* @param opts string with options for parsing * @param opts string with options for parsing
*/ */
int avoption_parse(void* strct, const AVOption* list, const char* opts); int avoption_parse(void* strct, const struct AVOption* list, const char* opts);
/** /**
@@ -1565,7 +1532,7 @@ typedef struct AVCodec {
int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, int (*decode)(AVCodecContext *, void *outdata, int *outdata_size,
uint8_t *buf, int buf_size); uint8_t *buf, int buf_size);
int capabilities; int capabilities;
const AVOption *options; const struct AVOption *options;
struct AVCodec *next; struct AVCodec *next;
void (*flush)(AVCodecContext *); void (*flush)(AVCodecContext *);
} AVCodec; } AVCodec;
@@ -61,7 +61,43 @@
#define AVOPTION_SUB(ptr) { .name = NULL, .help = (const char*)ptr } #define AVOPTION_SUB(ptr) { .name = NULL, .help = (const char*)ptr }
#define AVOPTION_END() AVOPTION_SUB(NULL) #define AVOPTION_END() AVOPTION_SUB(NULL)
struct AVOption;
/**
* AVOption.
*/
typedef struct AVOption {
/** options' name */
const char *name; /* if name is NULL, it indicates a link to next */
/** short English text help or const struct AVOption* subpointer */
const char *help; // const struct AVOption* sub;
/** offset to context structure where the parsed value should be stored */
int offset;
/** options' type */
int type;
#define FF_OPT_TYPE_BOOL 1 ///< boolean - true,1,on (or simply presence)
#define FF_OPT_TYPE_DOUBLE 2 ///< double
#define FF_OPT_TYPE_INT 3 ///< integer
#define FF_OPT_TYPE_STRING 4 ///< string (finished with \0)
#define FF_OPT_TYPE_MASK 0x1f ///< mask for types - upper bits are various flags
//#define FF_OPT_TYPE_EXPERT 0x20 // flag for expert option
#define FF_OPT_TYPE_FLAG (FF_OPT_TYPE_BOOL | 0x40)
#define FF_OPT_TYPE_RCOVERRIDE (FF_OPT_TYPE_STRING | 0x80)
/** min value (min == max -> no limits) */
double min;
/** maximum value for double/int */
double max;
/** default boo [0,1]l/double/int value */
double defval;
/**
* default string value (with optional semicolon delimited extra option-list
* i.e. option1;option2;option3
* defval might select other then first argument as default
*/
const char *defstr;
#define FF_OPT_MAX_DEPTH 10
} AVOption;
#ifdef HAVE_MMX #ifdef HAVE_MMX
extern const struct AVOption avoptions_common[3 + 5]; extern const struct AVOption avoptions_common[3 + 5];
#else #else
@@ -483,7 +483,7 @@ static int ra144_decode_frame(AVCodecContext * avctx,
*((int16_t *)data)=s; *((int16_t *)data)=s;
if (s>32767) *((int16_t *)data)=32767; if (s>32767) *((int16_t *)data)=32767;
if (s<-32767) *((int16_t *)data)=-32768; if (s<-32767) *((int16_t *)data)=-32768;
((int16_t *)data)++; data = (int16_t *)data + 1;
} }
b+=30; b+=30;
} }
+1 -1
View File
@@ -7,4 +7,4 @@ const uint32 OGG_FILE_FORMAT = 'OggS';
//! for use in media_header.user_data_type //! for use in media_header.user_data_type
const uint32 OGG_PACKET_DATA_TYPE = 'OggP'; const uint32 OGG_PACKET_DATA_TYPE = 'OggP';
#endif _OGG_FORMATS_H #endif // _OGG_FORMATS_H
@@ -106,7 +106,7 @@ retry:
TRACE("oggReader::GetPage: ogg_page_continued: continued page: not ogg\n"); TRACE("oggReader::GetPage: ogg_page_continued: continued page: not ogg\n");
return B_ERROR; return B_ERROR;
} }
#endif STRICT_OGG #endif //STRICT_OGG
// this is a beginning of stream page // this is a beginning of stream page
ogg_stream_state stream; ogg_stream_state stream;
if (ogg_stream_init(&stream, serialno) != 0) { if (ogg_stream_init(&stream, serialno) != 0) {
@@ -121,7 +121,7 @@ retry:
if (ogg_stream_packetout(&stream, &packet) != 1) { if (ogg_stream_packetout(&stream, &packet) != 1) {
#ifdef STRICT_OGG #ifdef STRICT_OGG
return B_ERROR; return B_ERROR;
#endif STRICT_OGG #endif //STRICT_OGG
} }
if (fSeekable) { if (fSeekable) {
fTracks[serialno] = OggSeekable::makeOggSeekable(fSeekable, &fSeekableLock, serialno, packet); fTracks[serialno] = OggSeekable::makeOggSeekable(fSeekable, &fSeekableLock, serialno, packet);
@@ -43,4 +43,4 @@ speex_encoded_media_format()
} }
#endif _OGG_SPEEX_FORMATS_H #endif //_OGG_SPEEX_FORMATS_H
@@ -40,4 +40,4 @@ theora_encoded_media_format()
} }
#endif _OGG_THEORA_FORMATS_H #endif //_OGG_THEORA_FORMATS_H
@@ -89,4 +89,4 @@ tobias_text_encoded_media_format()
} }
#endif _OGG_TOBIAS_FORMATS_H #endif // _OGG_TOBIAS_FORMATS_H
@@ -43,4 +43,4 @@ vorbis_encoded_media_format()
} }
#endif _OGG_VORBIS_FORMATS_H #endif //_OGG_VORBIS_FORMATS_H
@@ -43,4 +43,4 @@ public:
status_t GetSupportedFormats(media_format ** formats, size_t * count); status_t GetSupportedFormats(media_format ** formats, size_t * count);
}; };
#endif _VORBIS_CODEC_PLUGIN_H_ #endif //_VORBIS_CODEC_PLUGIN_H_
+1 -1
View File
@@ -177,7 +177,7 @@ MesaSoftRenderer::UnlockGL()
void void
MesaSoftRenderer::SwapBuffers(bool VSync = false) MesaSoftRenderer::SwapBuffers(bool VSync)
{ {
_mesa_notifySwapBuffers(fContext); _mesa_notifySwapBuffers(fContext);
+2
View File
@@ -109,6 +109,8 @@
#include <Path.h> #include <Path.h>
#include <SupportDefs.h> #include <SupportDefs.h>
using std::vector;
int32 HeyInterpreterThreadHook(void* arg); int32 HeyInterpreterThreadHook(void* arg);
status_t Hey(BMessenger* target, const char* arg, BMessage* reply); status_t Hey(BMessenger* target, const char* arg, BMessage* reply);
@@ -158,7 +158,7 @@ virtualAssertLinkageInvar() const
{ {
QcOrigRowState const *state = CAST(QcOrigRowState const *, *i); QcOrigRowState const *state = CAST(QcOrigRowState const *, *i);
assert( state->fRHS == 0.0); assert( state->fRHS == 0.0);
assert( state->fMRowIndex == i - fStates); assert( state->fMRowIndex == (void *)i - (void *)fStates);
assert( !state->fARowDeleted); assert( !state->fARowDeleted);
} }
} }
+1 -1
View File
@@ -53,7 +53,7 @@ BGLRenderer::UnlockGL()
void void
BGLRenderer::SwapBuffers(bool VSync = false) BGLRenderer::SwapBuffers(bool VSync)
{ {
} }