Bug 1438257, part 3 - C++-ize XPT files. r=froydnj

These are nominally in C, but I don't see any reason for that, given
that we no longer have external consumers. I got rid of "typedef
struct Foo Foo" at the same time.

Also replace a tab I noticed in the definnition of XPT_ANN_LAST.

MozReview-Commit-ID: CFgfiWmuo6r

--HG--
extra : rebase_source : 0bd79ef3055fe1b68a2ec6eaa6eebd0f7e52f730
This commit is contained in:
Andrew McCreight 2018-02-14 10:10:57 -08:00
parent debcf58ff2
commit 5f1356669e
3 changed files with 14 additions and 34 deletions

View File

@ -15,15 +15,11 @@
#include "mozilla/MemoryReporting.h"
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Simple Arena support. Use with caution!
*/
typedef struct XPTArena XPTArena;
struct XPTArena;
XPTArena*
XPT_NewArena(size_t block_size8, size_t block_size1);
@ -55,8 +51,4 @@ XPT_AssertFailed(const char *s, const char *file, uint32_t lineno)
#define XPT_ASSERT(_expr) ((void)0)
#endif
#ifdef __cplusplus
}
#endif
#endif /* __xpt_arena_h__ */

View File

@ -14,8 +14,6 @@
#include "xpt_arena.h"
#include <stdint.h>
extern "C" {
/*
* Originally, I was going to have structures that exactly matched the on-disk
* representation, but that proved difficult: different compilers can pack
@ -27,14 +25,14 @@ extern "C" {
/* Structures for the typelib components */
typedef struct XPTHeader XPTHeader;
typedef struct XPTInterfaceDirectoryEntry XPTInterfaceDirectoryEntry;
typedef struct XPTInterfaceDescriptor XPTInterfaceDescriptor;
typedef struct XPTConstDescriptor XPTConstDescriptor;
typedef struct XPTMethodDescriptor XPTMethodDescriptor;
typedef struct XPTParamDescriptor XPTParamDescriptor;
typedef struct XPTTypeDescriptor XPTTypeDescriptor;
typedef struct XPTTypeDescriptorPrefix XPTTypeDescriptorPrefix;
struct XPTHeader;
struct XPTInterfaceDirectoryEntry;
struct XPTInterfaceDescriptor;
struct XPTConstDescriptor;
struct XPTMethodDescriptor;
struct XPTParamDescriptor;
struct XPTTypeDescriptor;
struct XPTTypeDescriptorPrefix;
#ifndef nsID_h__
/*
@ -356,11 +354,9 @@ struct XPTMethodDescriptor {
* present.
*/
#define XPT_ANN_LAST 0x80
#define XPT_ANN_LAST 0x80
#define XPT_ANN_IS_LAST(flags) (flags & XPT_ANN_LAST)
#define XPT_ANN_PRIVATE 0x40
#define XPT_ANN_IS_PRIVATE(flags) (flags & XPT_ANN_PRIVATE)
}
#endif /* __xpt_struct_h__ */

View File

@ -15,12 +15,8 @@
using mozilla::NotNull;
#ifdef __cplusplus
extern "C" {
#endif
typedef struct XPTState XPTState;
typedef struct XPTCursor XPTCursor;
struct XPTState;
struct XPTCursor;
bool
XPT_SkipStringInline(NotNull<XPTCursor*> cursor);
@ -47,10 +43,10 @@ XPT_Do8(NotNull<XPTCursor*> cursor, uint8_t *u8p);
bool
XPT_DoHeader(XPTArena *arena, NotNull<XPTCursor*> cursor, XPTHeader **headerp);
typedef enum {
enum XPTPool {
XPT_HEADER = 0,
XPT_DATA = 1
} XPTPool;
};
struct XPTState {
uint32_t data_offset;
@ -79,8 +75,4 @@ XPT_SeekTo(NotNull<XPTCursor*> cursor, uint32_t offset);
void
XPT_SetDataOffset(XPTState *state, uint32_t data_offset);
#ifdef __cplusplus
}
#endif
#endif /* __xpt_xdr_h__ */