зеркало из https://github.com/mozilla/gecko-dev.git
Various touchups and warning fixes.
This commit is contained in:
Родитель
440903d251
Коммит
7d683fdc53
|
@ -183,7 +183,7 @@ XPT_GetAddrForOffset(XPTCursor *cursor, PRUint32 offset);
|
|||
XPTMode mode = cursor->state->mode; \
|
||||
if (!(mode == XPT_ENCODE || XPT_Do32(cursor, &new_curs.offset)) || \
|
||||
!CheckForRepeat(cursor, (void **)addrp, pool, \
|
||||
mode == XPT_ENCODE ? size : 0, &new_curs, \
|
||||
mode == XPT_ENCODE ? size : 0u, &new_curs, \
|
||||
&already) || \
|
||||
!(mode == XPT_DECODE || XPT_Do32(cursor, &new_curs.offset))) \
|
||||
return PR_FALSE; \
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#ifdef XP_MAC
|
||||
static char *strdup(const char *c)
|
||||
{
|
||||
char *newStr = malloc(strlen(c) + 1);
|
||||
char *newStr = XPT_MALLOC(strlen(c) + 1);
|
||||
if (newStr)
|
||||
{
|
||||
strcpy(newStr, c);
|
||||
|
@ -37,7 +37,7 @@ static char *strdup(const char *c)
|
|||
|
||||
static PRBool
|
||||
DoInterfaceDirectoryEntry(XPTCursor *cursor,
|
||||
XPTInterfaceDirectoryEntry *ide, PRUint16 index);
|
||||
XPTInterfaceDirectoryEntry *ide, PRUint16 entry_index);
|
||||
|
||||
#if 0
|
||||
/* currently unused */
|
||||
|
@ -228,7 +228,7 @@ XPT_FillInterfaceDirectoryEntry(XPTInterfaceDirectoryEntry *ide,
|
|||
/* InterfaceDirectoryEntry records go in the header */
|
||||
PRBool
|
||||
DoInterfaceDirectoryEntry(XPTCursor *cursor,
|
||||
XPTInterfaceDirectoryEntry *ide, PRUint16 index)
|
||||
XPTInterfaceDirectoryEntry *ide, PRUint16 entry_index)
|
||||
{
|
||||
XPTMode mode = cursor->state->mode;
|
||||
|
||||
|
@ -249,7 +249,7 @@ DoInterfaceDirectoryEntry(XPTCursor *cursor,
|
|||
}
|
||||
|
||||
if (mode == XPT_DECODE)
|
||||
XPT_SetOffsetForAddr(cursor, ide, index);
|
||||
XPT_SetOffsetForAddr(cursor, ide, entry_index);
|
||||
|
||||
#if 0 /* not yet -- we eagerly load for now */
|
||||
/* write the InterfaceDescriptor in the data pool, and the offset
|
||||
|
|
|
@ -23,10 +23,9 @@
|
|||
#include <string.h> /* strchr */
|
||||
|
||||
static PRBool
|
||||
CheckForRepeat(XPTCursor *cursor, void **addrp, XPTPool pool, int len,
|
||||
CheckForRepeat(XPTCursor *cursor, void **addrp, XPTPool pool, PRUint32 len,
|
||||
XPTCursor *new_cursor, PRBool *already);
|
||||
|
||||
|
||||
#define ENCODING(cursor) \
|
||||
((cursor)->state->mode == XPT_ENCODE)
|
||||
|
||||
|
@ -275,7 +274,7 @@ XPT_NewString(PRUint16 length, char *bytes)
|
|||
return NULL;
|
||||
str->length = length;
|
||||
/* Alloc one extra to store the trailing nul. */
|
||||
str->bytes = malloc(length + 1);
|
||||
str->bytes = XPT_MALLOC(length + 1u);
|
||||
if (!str->bytes) {
|
||||
XPT_DELETE(str);
|
||||
return NULL;
|
||||
|
@ -313,7 +312,7 @@ XPT_DoStringInline(XPTCursor *cursor, XPTString **strp)
|
|||
goto error;
|
||||
|
||||
if (mode == XPT_DECODE)
|
||||
if (!(str->bytes = malloc(str->length + 1)))
|
||||
if (!(str->bytes = XPT_MALLOC(str->length + 1u)))
|
||||
goto error;
|
||||
|
||||
for (i = 0; i < str->length; i++)
|
||||
|
@ -376,12 +375,13 @@ XPT_DoCString(XPTCursor *cursor, char **identp)
|
|||
return PR_FALSE;
|
||||
}
|
||||
len = end - start;
|
||||
assert(len > 0);
|
||||
|
||||
ident = XPT_MALLOC(len + 1);
|
||||
ident = XPT_MALLOC(len + 1u);
|
||||
if (!ident)
|
||||
return PR_FALSE;
|
||||
|
||||
memcpy(ident, start, len);
|
||||
memcpy(ident, start, (size_t)len);
|
||||
ident[len] = 0;
|
||||
*identp = ident;
|
||||
|
||||
|
@ -413,7 +413,6 @@ XPT_PUBLIC_API(PRUint32)
|
|||
XPT_GetOffsetForAddr(XPTCursor *cursor, void *addr)
|
||||
{
|
||||
return (PRUint32)XPT_HashTableLookup(cursor->state->pool->offset_map, addr);
|
||||
/* return (PRUint32)PL_HashTableLookup(cursor->state->pool->offset_map, addr); */
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
|
@ -421,8 +420,6 @@ XPT_SetOffsetForAddr(XPTCursor *cursor, void *addr, PRUint32 offset)
|
|||
{
|
||||
return XPT_HashTableAdd(cursor->state->pool->offset_map,
|
||||
addr, (void *)offset) != NULL;
|
||||
/* return PL_HashTableAdd(cursor->state->pool->offset_map, */
|
||||
/* addr, (void *)offset) != NULL; */
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
|
@ -430,20 +427,18 @@ XPT_SetAddrForOffset(XPTCursor *cursor, PRUint32 offset, void *addr)
|
|||
{
|
||||
return XPT_HashTableAdd(cursor->state->pool->offset_map,
|
||||
(void *)offset, addr) != NULL;
|
||||
/* return PL_HashTableAdd(cursor->state->pool->offset_map, */
|
||||
/* addr, (void *)offset) != NULL; */
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(void *)
|
||||
XPT_GetAddrForOffset(XPTCursor *cursor, PRUint32 offset)
|
||||
{
|
||||
return XPT_HashTableLookup(cursor->state->pool->offset_map, (void *)offset);
|
||||
/* return PL_HashTableLookup(cursor->state->pool->offset_map, (void *)offset); */
|
||||
}
|
||||
|
||||
/* Used by XPT_PREAMBLE_NO_ALLOC. */
|
||||
static PRBool
|
||||
CheckForRepeat(XPTCursor *cursor, void **addrp, XPTPool pool, int len,
|
||||
XPTCursor *new_cursor, PRBool *already)
|
||||
CheckForRepeat(XPTCursor *cursor, void **addrp, XPTPool pool, PRUint32 len,
|
||||
XPTCursor *new_cursor, PRBool *already)
|
||||
{
|
||||
void *last = *addrp;
|
||||
|
||||
|
@ -477,7 +472,6 @@ CheckForRepeat(XPTCursor *cursor, void **addrp, XPTPool pool, int len,
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* IIDs are written in struct order, in the usual big-endian way. From the
|
||||
* typelib file spec:
|
||||
|
|
|
@ -635,11 +635,11 @@ XPT_GetStringForType(XPTHeader *header, XPTTypeDescriptor *td,
|
|||
int tag = XPT_TDP_TAG(td->prefix);
|
||||
|
||||
if (tag == TD_INTERFACE_TYPE) {
|
||||
int index = td->type.interface;
|
||||
if (!index || index > header->num_interfaces)
|
||||
int idx = td->type.interface;
|
||||
if (!idx || idx > header->num_interfaces)
|
||||
*type_string = "UNKNOWN_INTERFACE";
|
||||
else
|
||||
*type_string = header->interface_directory[index-1].name;
|
||||
*type_string = header->interface_directory[idx-1].name;
|
||||
} else if (XPT_TDP_IS_POINTER(td->prefix.flags)) {
|
||||
if (XPT_TDP_IS_REFERENCE(td->prefix.flags))
|
||||
*type_string = rtype_array[tag];
|
||||
|
|
|
@ -71,8 +71,8 @@ struct fixElement {
|
|||
};
|
||||
|
||||
/* Global variables. */
|
||||
int trueNumberOfInterfaces = 0;
|
||||
int totalNumberOfInterfaces = 0;
|
||||
PRUint16 trueNumberOfInterfaces = 0;
|
||||
PRUint16 totalNumberOfInterfaces = 0;
|
||||
|
||||
#if defined(XP_MAC) && defined(XPIDL_PLUGIN)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче