From 19ca97a70f6b7b41d251eaa76e4d3c980c6eedff Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 24 Jun 2005 20:25:18 +0000 Subject: r7882: Looks like a large patch - but what it actually does is make Samba safe for using our headers and linking with C++ modules. Stops us from using C++ reserved keywords in our code. Jeremy (This used to be commit 9506b8e145982b1160a2f0aee5c9b7a54980940a) --- source3/include/includes.h | 13 ++++++++++++- source3/include/nt_printing.h | 2 +- source3/include/passdb.h | 6 +++--- source3/include/rpc_reg.h | 6 +++--- source3/include/rpc_spoolss.h | 2 +- source3/include/smb.h | 12 +++++------- source3/include/spnego.h | 4 ++-- source3/include/vfs.h | 2 +- 8 files changed, 28 insertions(+), 19 deletions(-) (limited to 'source3/include') diff --git a/source3/include/includes.h b/source3/include/includes.h index da4c98fc72..9ff87557ff 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -25,6 +25,17 @@ #include "config.h" #endif +#ifndef __cplusplus +#define class #error DONT_USE_CPLUSPLUS_RESERVED_NAMES +#define private #error DONT_USE_CPLUSPLUS_RESERVED_NAMES +#define public #error DONT_USE_CPLUSPLUS_RESERVED_NAMES +#define template #error DONT_USE_CPLUSPLUS_RESERVED_NAMES +#define this #error DONT_USE_CPLUSPLUS_RESERVED_NAMES +#define new #error DONT_USE_CPLUSPLUS_RESERVED_NAMES +#define delete #error DONT_USE_CPLUSPLUS_RESERVED_NAMES +#define friend #error DONT_USE_CPLUSPLUS_RESERVED_NAMES +#endif + #include "local.h" #ifdef AIX @@ -55,7 +66,7 @@ #define PRINTF_ATTRIBUTE(a1, a2) #endif -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__cplusplus) /** gcc attribute used on function parameters so that it does not emit * warnings about them being unused. **/ # define UNUSED(param) param __attribute__ ((unused)) diff --git a/source3/include/nt_printing.h b/source3/include/nt_printing.h index ee29636c88..fa53e1d284 100644 --- a/source3/include/nt_printing.h +++ b/source3/include/nt_printing.h @@ -295,7 +295,7 @@ typedef struct ntdevicemode uint32 reserved2; uint32 panningwidth; uint32 panningheight; - uint8 *private; + uint8 *nt_dev_private; } NT_DEVICEMODE; typedef struct nt_printer_info_level_2 diff --git a/source3/include/passdb.h b/source3/include/passdb.h index 9a3dd9c8d3..114585346e 100644 --- a/source3/include/passdb.h +++ b/source3/include/passdb.h @@ -195,7 +195,7 @@ typedef struct sam_passwd const struct pdb_methods *backend_private_methods; void *backend_private_data; void (*backend_private_data_free_fn)(void **); - } private; + } private_u; /* Lets see if the remaining code can get the hint that you are meant to use the pdb_...() functions. */ @@ -221,7 +221,7 @@ typedef struct sam_group { uint32 mem_num; /* Number of member SIDs */ DOM_SID *members; /* SID array */ - } private; + } private_g; } SAM_GROUP; @@ -253,7 +253,7 @@ struct pdb_search { uint32 num_entries; ssize_t cache_size; BOOL search_ended; - void *private; + void *private_data; BOOL (*next_entry)(struct pdb_search *search, struct samr_displayentry *entry); void (*search_end)(struct pdb_search *search); diff --git a/source3/include/rpc_reg.h b/source3/include/rpc_reg.h index c343e9c594..6ef90cd30d 100644 --- a/source3/include/rpc_reg.h +++ b/source3/include/rpc_reg.h @@ -216,7 +216,7 @@ typedef struct { typedef struct { POLICY_HND handle; UNISTR4 name; - UNISTR4 class; + UNISTR4 key_class; uint32 reserved; uint32 access; uint32 *sec_info; @@ -260,11 +260,11 @@ typedef struct { typedef struct { POLICY_HND pol; - UNISTR4 class; + UNISTR4 key_class; } REG_Q_QUERY_KEY; typedef struct { - UNISTR4 class; + UNISTR4 key_class; uint32 num_subkeys; uint32 max_subkeylen; uint32 reserved; /* 0x0000 0000 - according to MSDN (max_subkeysize?) */ diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h index d0422e8d6e..3b88f76588 100755 --- a/source3/include/rpc_spoolss.h +++ b/source3/include/rpc_spoolss.h @@ -517,7 +517,7 @@ typedef struct devicemode uint32 reserved2; uint32 panningwidth; uint32 panningheight; - uint8 *private; + uint8 *dev_private; } DEVICEMODE; diff --git a/source3/include/smb.h b/source3/include/smb.h index 4bf967bf35..658b52a2ff 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -450,11 +450,10 @@ typedef struct files_struct { #include "sysquotas.h" /* used to hold an arbitrary blob of data */ -typedef struct data_blob -{ +typedef struct data_blob_ { uint8 *data; size_t length; - void (*free)(struct data_blob *data_blob); + void (*free)(struct data_blob_ *data_blob); } DATA_BLOB; /* @@ -747,7 +746,7 @@ struct parm_struct { const char *label; parm_type type; - parm_class class; + parm_class p_class; void *ptr; BOOL (*special)(int snum, const char *, char **); const struct enum_list *enum_list; @@ -1586,13 +1585,12 @@ struct nmb_name { unsigned int name_type; }; - /* A netbios node status array element. */ -struct node_status { +typedef struct node_status_ { nstring name; unsigned char type; unsigned char flags; -}; +} NODE_STATUS_STRUCT; /* The extra info from a NetBIOS node status query */ struct node_status_extra { diff --git a/source3/include/spnego.h b/source3/include/spnego.h index b6492ee3c8..8bb13bd354 100644 --- a/source3/include/spnego.h +++ b/source3/include/spnego.h @@ -43,7 +43,7 @@ typedef enum _spnego_negResult { } negResult_t; typedef struct spnego_negTokenInit { - const char **mechTypes; + char **mechTypes; int reqFlags; DATA_BLOB mechToken; DATA_BLOB mechListMIC; @@ -51,7 +51,7 @@ typedef struct spnego_negTokenInit { typedef struct spnego_negTokenTarg { uint8 negResult; - const char *supportedMech; + char *supportedMech; DATA_BLOB responseToken; DATA_BLOB mechListMIC; } negTokenTarg_t; diff --git a/source3/include/vfs.h b/source3/include/vfs.h index e8c6ff32d5..a9d82a0db1 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -231,7 +231,7 @@ struct vfs_ops { ssize_t (*pwrite)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n, SMB_OFF_T offset); SMB_OFF_T (*lseek)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T offset, int whence); ssize_t (*sendfile)(struct vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); - int (*rename)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *old, const char *new); + int (*rename)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *oldname, const char *newname); int (*fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd); int (*stat)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf); int (*fstat)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf); -- cgit