зеркало из https://github.com/mozilla/pjs.git
more primitives and over-complex macros. next stop: bit-handling (not yet part of seamonkey)
This commit is contained in:
Родитель
547ab2daeb
Коммит
77a5ac0f52
|
@ -69,6 +69,8 @@ struct XPTInterfaceDirectoryEntry {
|
||||||
XPTInterfaceDescriptor *interface_descriptor;
|
XPTInterfaceDescriptor *interface_descriptor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define XPT_IDE_SIZE (16 + 4 + 4 + 4)
|
||||||
|
|
||||||
struct XPTInterfaceDescriptor {
|
struct XPTInterfaceDescriptor {
|
||||||
XPTInterfaceDescriptorEntry *parent_interface;
|
XPTInterfaceDescriptorEntry *parent_interface;
|
||||||
uint16 num_methods;
|
uint16 num_methods;
|
||||||
|
@ -160,7 +162,7 @@ struct XPTTypeDescriptor {
|
||||||
|
|
||||||
struct XPTString {
|
struct XPTString {
|
||||||
uint16 length;
|
uint16 length;
|
||||||
char bytes[];
|
char *bytes;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||||
/*
|
/*
|
||||||
* The contents of this file are subject to the Netscape Public License
|
* The contents of this file are subject to the Netscape Public License
|
||||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||||
|
@ -23,37 +23,48 @@
|
||||||
#ifndef __xpt_xdr_h__
|
#ifndef __xpt_xdr_h__
|
||||||
#define __xpt_xdr_h__
|
#define __xpt_xdr_h__
|
||||||
|
|
||||||
#include "xpt_struct.h"
|
|
||||||
#include "prosdep.h"
|
#include "prosdep.h"
|
||||||
#include "plhash.h"
|
#include "plhash.h"
|
||||||
|
|
||||||
typedef struct XPTXDRState XPTXDRState;
|
typedef struct XPTState XPTState;
|
||||||
typedef struct XPTXDRDatapool XPTXDRDatapool;
|
typedef struct XPTDatapool XPTDatapool;
|
||||||
|
typedef struct XPTCursor XPTCursor;
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
XPT_DoString(XPTXDRState *state, XPTString **strp);
|
XPT_DoString(XPTCursor *cursor, XPTString **strp);
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
XPT_DoIdentifier(XPTState *state, char **identp);
|
XPT_DoIdentifier(XPTCursor *cursor, char **identp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX need to think about ordering and API issues for offset<->addr
|
* We can't include nsID.h, because it's full of C++ goop and we're not doing
|
||||||
* XXX conversion
|
* C++ here, so we define our own minimal struct. We protect against multiple
|
||||||
|
* definitions of this struct, though, and use the same field naming.
|
||||||
*/
|
*/
|
||||||
PRBool
|
|
||||||
XPT_GetOffsetForAddr(XPTXDRState *state, void *addr, uint32 *offsetp);
|
#ifndef nsID_h__
|
||||||
|
struct nsID {
|
||||||
|
PRUint32 m0;
|
||||||
|
PRUint16 m1;
|
||||||
|
PRUint16 m2;
|
||||||
|
PRUint8 m3[8];
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct nsID nsID;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
XPT_GetAddrForOffset(XPTXDRState *state, uint32 offset, void **addr);
|
XPT_DoIID(XPTCursor *cursor, nsID *iidp);
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
XPT_Do32(XPTXDRState *state, uint32 *u32p);
|
XPT_Do32(XPTCursor *cursor, uint32 *u32p);
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
XPT_Do16(XPTXDRState *state, uint16 *u16p);
|
XPT_Do16(XPTCursor *cursor, uint16 *u16p);
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
XPT_Do8(XPTXDRState *state, uint8 *u8p);
|
XPT_Do8(XPTCursor *cursor, uint8 *u8p);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When working with bitfields, use the DoBits call with a uint8.
|
* When working with bitfields, use the DoBits call with a uint8.
|
||||||
|
@ -66,30 +77,70 @@ XPT_Do8(XPTXDRState *state, uint8 *u8p);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
XPT_DoBits(XPTXDRState *state, uint8 *u8p, uintN nbits);
|
XPT_DoBits(XPTCursor *cursor, uint8 *u8p, uintN nbits);
|
||||||
|
|
||||||
/* returns the number of bits skipped, which should be 0-7 */
|
/* returns the number of bits skipped, which should be 0-7 */
|
||||||
int
|
int
|
||||||
XPT_FlushBits(XPTXDRState *state);
|
XPT_FlushBits(XPTCursor *cursor);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
XPTXDR_ENCODE,
|
XPT_ENCODE,
|
||||||
XPTXDR_DECODE
|
XPT_DECODE
|
||||||
} XPTXDRMode;
|
} XPTMode;
|
||||||
|
|
||||||
struct XPTXDRState {
|
typedef enum {
|
||||||
XPTXDRMode mode;
|
XPT_HEADER = 0,
|
||||||
XPTXDRDatapool *pool;
|
XPT_DATA = 1
|
||||||
|
} XPTPool;
|
||||||
|
|
||||||
|
struct XPTState {
|
||||||
|
XPTMode mode;
|
||||||
|
XPTDatapool pools[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct XPTXDRDatapool {
|
struct XPTDatapool {
|
||||||
PLHash *offset_map;
|
PLHash *offset_map;
|
||||||
char *data;
|
char *data;
|
||||||
uint32 point;
|
uint32 count;
|
||||||
uint8 bit;
|
uint8 bit;
|
||||||
uint32 allocated;
|
uint32 allocated;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct XPTCursor {
|
||||||
|
XPTState *state;
|
||||||
|
XPTPool pool;
|
||||||
|
uint32 offset;
|
||||||
|
uint32 len;
|
||||||
|
}
|
||||||
|
|
||||||
|
XPTState *
|
||||||
|
XPT_NewXDRState(XPTMode mode);
|
||||||
|
|
||||||
|
void
|
||||||
|
XPT_DestroyXDRState(XPTState *state);
|
||||||
|
|
||||||
|
void
|
||||||
|
XPT_GetXDRData(XPTState *state, XPTPool pool, char **data, uint32 *len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* On CreateCursor:
|
||||||
|
* cursors are used to track position within the byte stream.
|
||||||
|
* In encode/write mode, the cursor reserves an area of memory for a structure.
|
||||||
|
* In decode/read mode, it simply tracks position.
|
||||||
|
*
|
||||||
|
* Usage will commonly be something like this (taken from XPT_DoString) for
|
||||||
|
* out-of-line structures:
|
||||||
|
*
|
||||||
|
* // create my_cursor and reserve memory as required
|
||||||
|
* XPT_CreateCursor(parent_cursor, XPT_DATA, str->length + 2, &my_cursor);
|
||||||
|
* // write mode: store the offset for this structure in the parent cursor
|
||||||
|
* // read mode: adjust my_cursor to point to the write offset
|
||||||
|
* XPT_Do32(parent_cursor, &my_cursor->offset);
|
||||||
|
*/
|
||||||
|
|
||||||
|
PRBool
|
||||||
|
XPT_CreateCursor(XPTCursor *base, XPTPool pool, uint32 len, XPTCursor *cursor);
|
||||||
|
|
||||||
/* increase the data allocation for the pool by XPT_GROW_CHUNK */
|
/* increase the data allocation for the pool by XPT_GROW_CHUNK */
|
||||||
#define XPT_GROW_CHUNK 8192
|
#define XPT_GROW_CHUNK 8192
|
||||||
PRBool
|
PRBool
|
||||||
|
@ -102,12 +153,62 @@ XPT_GrowPool(XPTXDRDatapool *pool);
|
||||||
# define XPTXDR_SWAB16(x) x
|
# define XPTXDR_SWAB16(x) x
|
||||||
#elif defined IS_LITTLE_ENDIAN
|
#elif defined IS_LITTLE_ENDIAN
|
||||||
# define XPTXDR_SWAB32(x) (((x) >> 24) | \
|
# define XPTXDR_SWAB32(x) (((x) >> 24) | \
|
||||||
(((x) >> 8) & 0xff00) | \
|
(((x) >> 8) & 0xff00) | \
|
||||||
(((x) << 8) & 0xff0000) | \
|
(((x) << 8) & 0xff0000) | \
|
||||||
((x) << 24))
|
((x) << 24))
|
||||||
# define XPTXDR_SWAB16(x) (((x) >> 8) | ((x) << 8))
|
# define XPTXDR_SWAB16(x) (((x) >> 8) | ((x) << 8))
|
||||||
#else
|
#else
|
||||||
# error "unknown byte order"
|
# error "unknown byte order"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we're decoding, we want to read the offset before we check
|
||||||
|
* for already-decoded values.
|
||||||
|
*
|
||||||
|
* Then we check for repetition: CheckForRepeat will see if we've already
|
||||||
|
* encoded/decoded this value, and if so will set offset/addr correctly
|
||||||
|
* and make already be true. If not, it will set up the cursor for
|
||||||
|
* encoding (reserve space) or decoding (seek to correct location) as
|
||||||
|
* appropriate. In the encode case, it will also set the addr->offset
|
||||||
|
* mapping.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define XPT_PREAMBLE_(cursor, addrp, pool, size, new_curs, already, \
|
||||||
|
ALLOC_CODE) { \
|
||||||
|
XPTMode mode = cursor->state->mode; \
|
||||||
|
if (!(mode == XPT_ENCODE || XPT_Do32(cursor, &new_curs.offset)) || \
|
||||||
|
!XPT_CheckForRepeat(cursor, (void **)addrp, pool, \
|
||||||
|
mode == XPT_ENCODE ? size : 0, &new_curs, \
|
||||||
|
&already) || \
|
||||||
|
!(mode == XPT_DECODE || XPT_Do32(cursor, &new_curs.offset))) \
|
||||||
|
return PR_FALSE; \
|
||||||
|
if (already) \
|
||||||
|
return PR_TRUE; \
|
||||||
|
ALLOC_CODE; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define XPT_ALLOC \
|
||||||
|
if (mode == XPT_DECODE) { \
|
||||||
|
*addrp = localp = PR_NEWZAP(XPTType); \
|
||||||
|
if (!localp || \
|
||||||
|
!XPT_SetAddrForOffset(new_curs, localp) \
|
||||||
|
return PR_FALSE; \
|
||||||
|
} else { \
|
||||||
|
localp = *addrp; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define XPT_PREAMBLE(cursor, addrp, pool, size, new_curs, already) \
|
||||||
|
XPT_PREAMBLE_(cursor, addrp, pool, size, new_curs, already, XPT_ALLOC)
|
||||||
|
|
||||||
|
#define XPT_PREAMBLE_NO_ALLOC(cursor, addrp, pool, size, new_curs, already) \
|
||||||
|
XPT_PREAMBLE_(cursor, addrp, pool, size, new_curs, already, ;)
|
||||||
|
|
||||||
|
|
||||||
|
#define XPT_ERROR_HANDLE(free_it) \
|
||||||
|
error: \
|
||||||
|
if (cursor->state->mode == XPT_DECODE) \
|
||||||
|
PR_FREE_IF(free_it); \
|
||||||
|
return PR_FALSE;
|
||||||
|
|
||||||
|
|
||||||
#endif /* __xpt_xdr_h__ */
|
#endif /* __xpt_xdr_h__ */
|
||||||
|
|
|
@ -69,6 +69,8 @@ struct XPTInterfaceDirectoryEntry {
|
||||||
XPTInterfaceDescriptor *interface_descriptor;
|
XPTInterfaceDescriptor *interface_descriptor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define XPT_IDE_SIZE (16 + 4 + 4 + 4)
|
||||||
|
|
||||||
struct XPTInterfaceDescriptor {
|
struct XPTInterfaceDescriptor {
|
||||||
XPTInterfaceDescriptorEntry *parent_interface;
|
XPTInterfaceDescriptorEntry *parent_interface;
|
||||||
uint16 num_methods;
|
uint16 num_methods;
|
||||||
|
@ -160,7 +162,7 @@ struct XPTTypeDescriptor {
|
||||||
|
|
||||||
struct XPTString {
|
struct XPTString {
|
||||||
uint16 length;
|
uint16 length;
|
||||||
char bytes[];
|
char *bytes;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||||
/*
|
/*
|
||||||
* The contents of this file are subject to the Netscape Public License
|
* The contents of this file are subject to the Netscape Public License
|
||||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||||
|
@ -23,37 +23,48 @@
|
||||||
#ifndef __xpt_xdr_h__
|
#ifndef __xpt_xdr_h__
|
||||||
#define __xpt_xdr_h__
|
#define __xpt_xdr_h__
|
||||||
|
|
||||||
#include "xpt_struct.h"
|
|
||||||
#include "prosdep.h"
|
#include "prosdep.h"
|
||||||
#include "plhash.h"
|
#include "plhash.h"
|
||||||
|
|
||||||
typedef struct XPTXDRState XPTXDRState;
|
typedef struct XPTState XPTState;
|
||||||
typedef struct XPTXDRDatapool XPTXDRDatapool;
|
typedef struct XPTDatapool XPTDatapool;
|
||||||
|
typedef struct XPTCursor XPTCursor;
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
XPT_DoString(XPTXDRState *state, XPTString **strp);
|
XPT_DoString(XPTCursor *cursor, XPTString **strp);
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
XPT_DoIdentifier(XPTState *state, char **identp);
|
XPT_DoIdentifier(XPTCursor *cursor, char **identp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX need to think about ordering and API issues for offset<->addr
|
* We can't include nsID.h, because it's full of C++ goop and we're not doing
|
||||||
* XXX conversion
|
* C++ here, so we define our own minimal struct. We protect against multiple
|
||||||
|
* definitions of this struct, though, and use the same field naming.
|
||||||
*/
|
*/
|
||||||
PRBool
|
|
||||||
XPT_GetOffsetForAddr(XPTXDRState *state, void *addr, uint32 *offsetp);
|
#ifndef nsID_h__
|
||||||
|
struct nsID {
|
||||||
|
PRUint32 m0;
|
||||||
|
PRUint16 m1;
|
||||||
|
PRUint16 m2;
|
||||||
|
PRUint8 m3[8];
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct nsID nsID;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
XPT_GetAddrForOffset(XPTXDRState *state, uint32 offset, void **addr);
|
XPT_DoIID(XPTCursor *cursor, nsID *iidp);
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
XPT_Do32(XPTXDRState *state, uint32 *u32p);
|
XPT_Do32(XPTCursor *cursor, uint32 *u32p);
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
XPT_Do16(XPTXDRState *state, uint16 *u16p);
|
XPT_Do16(XPTCursor *cursor, uint16 *u16p);
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
XPT_Do8(XPTXDRState *state, uint8 *u8p);
|
XPT_Do8(XPTCursor *cursor, uint8 *u8p);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When working with bitfields, use the DoBits call with a uint8.
|
* When working with bitfields, use the DoBits call with a uint8.
|
||||||
|
@ -66,30 +77,70 @@ XPT_Do8(XPTXDRState *state, uint8 *u8p);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
XPT_DoBits(XPTXDRState *state, uint8 *u8p, uintN nbits);
|
XPT_DoBits(XPTCursor *cursor, uint8 *u8p, uintN nbits);
|
||||||
|
|
||||||
/* returns the number of bits skipped, which should be 0-7 */
|
/* returns the number of bits skipped, which should be 0-7 */
|
||||||
int
|
int
|
||||||
XPT_FlushBits(XPTXDRState *state);
|
XPT_FlushBits(XPTCursor *cursor);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
XPTXDR_ENCODE,
|
XPT_ENCODE,
|
||||||
XPTXDR_DECODE
|
XPT_DECODE
|
||||||
} XPTXDRMode;
|
} XPTMode;
|
||||||
|
|
||||||
struct XPTXDRState {
|
typedef enum {
|
||||||
XPTXDRMode mode;
|
XPT_HEADER = 0,
|
||||||
XPTXDRDatapool *pool;
|
XPT_DATA = 1
|
||||||
|
} XPTPool;
|
||||||
|
|
||||||
|
struct XPTState {
|
||||||
|
XPTMode mode;
|
||||||
|
XPTDatapool pools[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct XPTXDRDatapool {
|
struct XPTDatapool {
|
||||||
PLHash *offset_map;
|
PLHash *offset_map;
|
||||||
char *data;
|
char *data;
|
||||||
uint32 point;
|
uint32 count;
|
||||||
uint8 bit;
|
uint8 bit;
|
||||||
uint32 allocated;
|
uint32 allocated;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct XPTCursor {
|
||||||
|
XPTState *state;
|
||||||
|
XPTPool pool;
|
||||||
|
uint32 offset;
|
||||||
|
uint32 len;
|
||||||
|
}
|
||||||
|
|
||||||
|
XPTState *
|
||||||
|
XPT_NewXDRState(XPTMode mode);
|
||||||
|
|
||||||
|
void
|
||||||
|
XPT_DestroyXDRState(XPTState *state);
|
||||||
|
|
||||||
|
void
|
||||||
|
XPT_GetXDRData(XPTState *state, XPTPool pool, char **data, uint32 *len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* On CreateCursor:
|
||||||
|
* cursors are used to track position within the byte stream.
|
||||||
|
* In encode/write mode, the cursor reserves an area of memory for a structure.
|
||||||
|
* In decode/read mode, it simply tracks position.
|
||||||
|
*
|
||||||
|
* Usage will commonly be something like this (taken from XPT_DoString) for
|
||||||
|
* out-of-line structures:
|
||||||
|
*
|
||||||
|
* // create my_cursor and reserve memory as required
|
||||||
|
* XPT_CreateCursor(parent_cursor, XPT_DATA, str->length + 2, &my_cursor);
|
||||||
|
* // write mode: store the offset for this structure in the parent cursor
|
||||||
|
* // read mode: adjust my_cursor to point to the write offset
|
||||||
|
* XPT_Do32(parent_cursor, &my_cursor->offset);
|
||||||
|
*/
|
||||||
|
|
||||||
|
PRBool
|
||||||
|
XPT_CreateCursor(XPTCursor *base, XPTPool pool, uint32 len, XPTCursor *cursor);
|
||||||
|
|
||||||
/* increase the data allocation for the pool by XPT_GROW_CHUNK */
|
/* increase the data allocation for the pool by XPT_GROW_CHUNK */
|
||||||
#define XPT_GROW_CHUNK 8192
|
#define XPT_GROW_CHUNK 8192
|
||||||
PRBool
|
PRBool
|
||||||
|
@ -102,12 +153,62 @@ XPT_GrowPool(XPTXDRDatapool *pool);
|
||||||
# define XPTXDR_SWAB16(x) x
|
# define XPTXDR_SWAB16(x) x
|
||||||
#elif defined IS_LITTLE_ENDIAN
|
#elif defined IS_LITTLE_ENDIAN
|
||||||
# define XPTXDR_SWAB32(x) (((x) >> 24) | \
|
# define XPTXDR_SWAB32(x) (((x) >> 24) | \
|
||||||
(((x) >> 8) & 0xff00) | \
|
(((x) >> 8) & 0xff00) | \
|
||||||
(((x) << 8) & 0xff0000) | \
|
(((x) << 8) & 0xff0000) | \
|
||||||
((x) << 24))
|
((x) << 24))
|
||||||
# define XPTXDR_SWAB16(x) (((x) >> 8) | ((x) << 8))
|
# define XPTXDR_SWAB16(x) (((x) >> 8) | ((x) << 8))
|
||||||
#else
|
#else
|
||||||
# error "unknown byte order"
|
# error "unknown byte order"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we're decoding, we want to read the offset before we check
|
||||||
|
* for already-decoded values.
|
||||||
|
*
|
||||||
|
* Then we check for repetition: CheckForRepeat will see if we've already
|
||||||
|
* encoded/decoded this value, and if so will set offset/addr correctly
|
||||||
|
* and make already be true. If not, it will set up the cursor for
|
||||||
|
* encoding (reserve space) or decoding (seek to correct location) as
|
||||||
|
* appropriate. In the encode case, it will also set the addr->offset
|
||||||
|
* mapping.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define XPT_PREAMBLE_(cursor, addrp, pool, size, new_curs, already, \
|
||||||
|
ALLOC_CODE) { \
|
||||||
|
XPTMode mode = cursor->state->mode; \
|
||||||
|
if (!(mode == XPT_ENCODE || XPT_Do32(cursor, &new_curs.offset)) || \
|
||||||
|
!XPT_CheckForRepeat(cursor, (void **)addrp, pool, \
|
||||||
|
mode == XPT_ENCODE ? size : 0, &new_curs, \
|
||||||
|
&already) || \
|
||||||
|
!(mode == XPT_DECODE || XPT_Do32(cursor, &new_curs.offset))) \
|
||||||
|
return PR_FALSE; \
|
||||||
|
if (already) \
|
||||||
|
return PR_TRUE; \
|
||||||
|
ALLOC_CODE; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define XPT_ALLOC \
|
||||||
|
if (mode == XPT_DECODE) { \
|
||||||
|
*addrp = localp = PR_NEWZAP(XPTType); \
|
||||||
|
if (!localp || \
|
||||||
|
!XPT_SetAddrForOffset(new_curs, localp) \
|
||||||
|
return PR_FALSE; \
|
||||||
|
} else { \
|
||||||
|
localp = *addrp; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define XPT_PREAMBLE(cursor, addrp, pool, size, new_curs, already) \
|
||||||
|
XPT_PREAMBLE_(cursor, addrp, pool, size, new_curs, already, XPT_ALLOC)
|
||||||
|
|
||||||
|
#define XPT_PREAMBLE_NO_ALLOC(cursor, addrp, pool, size, new_curs, already) \
|
||||||
|
XPT_PREAMBLE_(cursor, addrp, pool, size, new_curs, already, ;)
|
||||||
|
|
||||||
|
|
||||||
|
#define XPT_ERROR_HANDLE(free_it) \
|
||||||
|
error: \
|
||||||
|
if (cursor->state->mode == XPT_DECODE) \
|
||||||
|
PR_FREE_IF(free_it); \
|
||||||
|
return PR_FALSE;
|
||||||
|
|
||||||
|
|
||||||
#endif /* __xpt_xdr_h__ */
|
#endif /* __xpt_xdr_h__ */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче