1
0
mirror of https://github.com/altlinux/admc.git synced 2025-01-09 05:18:22 +03:00

add -Wextra and -Werror compile options

fix all warnings
add UNUSED_ARG() macro's
macro is duplicated because of component boundaries
This commit is contained in:
Dmitry Degtyarev 2021-10-25 12:59:15 +04:00
parent 9e0296d234
commit 864803acd3
42 changed files with 265 additions and 25 deletions

View File

@ -7,7 +7,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# NOTE: neeed largefile options to prevent problems with
# smbclient on 32bit systems
add_compile_options(-Wall -Wshadow -Werror=switch -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
add_compile_options(-Wall -Wextra -Wshadow -Werror -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
# You can get version from spec by first finding Versions keyword.
# After that you can use awk to split line by : and then select second part of it.

View File

@ -59,6 +59,8 @@ QString attribute_display_value(const QString &attribute, const QByteArray &valu
case LargeIntegerSubtype_Timespan: return timespan_display_value(value);
case LargeIntegerSubtype_Integer: return QString(value);
}
return QString();
}
case AttributeType_UTCTime: return datetime_display_value(attribute, value, adconfig);
case AttributeType_GeneralizedTime: return datetime_display_value(attribute, value, adconfig);

View File

@ -62,6 +62,8 @@
#define UNUSED(x) x
#endif
#define UNUSED_ARG(x) (void)(x)
#define MAX_DN_LENGTH 1024
#define MAX_PASSWORD_LENGTH 255
@ -91,6 +93,14 @@ CertStrategy AdInterfacePrivate::s_cert_strat = CertStrategy_Never;
SMBCCTX *AdInterfacePrivate::smbc = NULL;
void get_auth_data_fn(const char *pServer, const char *pShare, char *pWorkgroup, int maxLenWorkgroup, char *pUsername, int maxLenUsername, char *pPassword, int maxLenPassword) {
UNUSED_ARG(pServer);
UNUSED_ARG(pShare);
UNUSED_ARG(pWorkgroup);
UNUSED_ARG(maxLenWorkgroup);
UNUSED_ARG(pUsername);
UNUSED_ARG(maxLenUsername);
UNUSED_ARG(pPassword);
UNUSED_ARG(maxLenPassword);
}
AdInterface::AdInterface() {
@ -1510,6 +1520,8 @@ QList<QString> AdInterfacePrivate::gpo_get_gpt_contents(const QString &gpt_root_
}
bool AdInterface::gpo_delete(const QString &dn, bool *deleted_object) {
UNUSED_ARG(deleted_object);
// NOTE: try to execute both steps, even if first one
// (deleting gpc) fails
@ -1935,7 +1947,7 @@ QList<QString> query_server_for_hosts(const char *dname) {
const long unsigned msg_len = res_search(dname, ns_c_in, ns_t_srv, msg.buf, sizeof(msg.buf));
const bool message_error = (msg_len < 0 || msg_len < sizeof(HEADER));
const bool message_error = (msg_len < sizeof(HEADER));
if (message_error) {
error();
}
@ -2021,6 +2033,8 @@ QList<QString> query_server_for_hosts(const char *dname) {
* Callback for ldap_sasl_interactive_bind_s
*/
int sasl_interact_gssapi(LDAP *ld, unsigned flags, void *indefaults, void *in) {
UNUSED_ARG(flags);
sasl_defaults_gssapi *defaults = (sasl_defaults_gssapi *) indefaults;
sasl_interact_t *interact = (sasl_interact_t *) in;

View File

@ -97,7 +97,7 @@ bool dom_sid_equal(const struct dom_sid *sid1, const struct dom_sid *sid2)
bool sid_append_rid(struct dom_sid *sid, uint32_t rid)
{
if (sid->num_auths < ARRAY_SIZE(sid->sub_auths)) {
if ((size_t) (sid->num_auths) < ARRAY_SIZE(sid->sub_auths)) {
sid->sub_auths[sid->num_auths++] = rid;
return true;
}
@ -495,7 +495,7 @@ char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid)
len = dom_sid_string_buf(sid, buf, sizeof(buf));
if ((len < 0) || (len+1 > sizeof(buf))) {
if ((len < 0) || ((size_t) (len+1) > sizeof(buf))) {
return talloc_strdup(mem_ctx, "(SID ERR)");
}
@ -519,7 +519,7 @@ char *dom_sid_str_buf(const struct dom_sid *sid, struct dom_sid_buf *dst)
{
int ret;
ret = dom_sid_string_buf(sid, dst->buf, sizeof(dst->buf));
if ((ret < 0) || (ret >= sizeof(dst->buf))) {
if ((ret < 0) || ((size_t) ret >= sizeof(dst->buf))) {
strlcpy(dst->buf, "(INVALID SID)", sizeof(dst->buf));
}
return dst->buf;

View File

@ -28,6 +28,8 @@
// #include "includes.h"
// #include "bin/default/librpc/gen_ndr/ndr_misc.h"
#define UNUSED_ARG(x) (void)(x)
_PUBLIC_ enum ndr_err_code ndr_push_GUID(struct ndr_push *ndr, int ndr_flags, const struct GUID *r)
{
NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
@ -68,6 +70,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_GUID(struct ndr_pull *ndr, int ndr_flags, st
static void ndr_print_flags_GUID(struct ndr_print *ndr, const char *name, int unused, const struct GUID *r)
{
UNUSED_ARG(unused);
ndr_print_GUID(ndr, name, r);
}
@ -106,6 +110,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_ndr_syntax_id(struct ndr_pull *ndr, int ndr_
static void ndr_print_flags_ndr_syntax_id(struct ndr_print *ndr, const char *name, int unused, const struct ndr_syntax_id *r)
{
UNUSED_ARG(unused);
ndr_print_ndr_syntax_id(ndr, name, r);
}
@ -149,6 +155,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_policy_handle(struct ndr_pull *ndr, int ndr_
static void ndr_print_flags_policy_handle(struct ndr_print *ndr, const char *name, int unused, const struct policy_handle *r)
{
UNUSED_ARG(unused);
ndr_print_policy_handle(ndr, name, r);
}
@ -162,14 +170,18 @@ _PUBLIC_ void ndr_print_policy_handle(struct ndr_print *ndr, const char *name, c
ndr->depth--;
}
_PUBLIC_ enum ndr_err_code ndr_push_netr_SchannelType(struct ndr_push *ndr, int ndr_flags, enum netr_SchannelType r)
_PUBLIC_ enum ndr_err_code ndr_push_netr_SchannelType(struct ndr_push *ndr, int unused, enum netr_SchannelType r)
{
UNUSED_ARG(unused);
NDR_CHECK(ndr_push_enum_uint1632(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
_PUBLIC_ enum ndr_err_code ndr_pull_netr_SchannelType(struct ndr_pull *ndr, int ndr_flags, enum netr_SchannelType *r)
{
UNUSED_ARG(ndr_flags);
uint16_t v;
NDR_CHECK(ndr_pull_enum_uint1632(ndr, NDR_SCALARS, &v));
*r = v;
@ -225,6 +237,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_KRB5_EDATA_NTSTATUS(struct ndr_pull *ndr, in
static void ndr_print_flags_KRB5_EDATA_NTSTATUS(struct ndr_print *ndr, const char *name, int unused, const struct KRB5_EDATA_NTSTATUS *r)
{
UNUSED_ARG(unused);
ndr_print_KRB5_EDATA_NTSTATUS(ndr, name, r);
}
@ -241,12 +255,16 @@ _PUBLIC_ void ndr_print_KRB5_EDATA_NTSTATUS(struct ndr_print *ndr, const char *n
_PUBLIC_ enum ndr_err_code ndr_push_winreg_Type(struct ndr_push *ndr, int ndr_flags, enum winreg_Type r)
{
UNUSED_ARG(ndr_flags);
NDR_CHECK(ndr_push_enum_uint32(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
_PUBLIC_ enum ndr_err_code ndr_pull_winreg_Type(struct ndr_pull *ndr, int ndr_flags, enum winreg_Type *r)
{
UNUSED_ARG(ndr_flags);
uint32_t v;
NDR_CHECK(ndr_pull_enum_uint32(ndr, NDR_SCALARS, &v));
*r = v;
@ -749,12 +767,16 @@ _PUBLIC_ size_t ndr_size_winreg_Data_GPO(const union winreg_Data_GPO *r, uint32_
_PUBLIC_ enum ndr_err_code ndr_push_netr_SamDatabaseID(struct ndr_push *ndr, int ndr_flags, enum netr_SamDatabaseID r)
{
UNUSED_ARG(ndr_flags);
NDR_CHECK(ndr_push_enum_uint32(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
_PUBLIC_ enum ndr_err_code ndr_pull_netr_SamDatabaseID(struct ndr_pull *ndr, int ndr_flags, enum netr_SamDatabaseID *r)
{
UNUSED_ARG(ndr_flags);
uint32_t v;
NDR_CHECK(ndr_pull_enum_uint32(ndr, NDR_SCALARS, &v));
*r = v;
@ -775,12 +797,16 @@ _PUBLIC_ void ndr_print_netr_SamDatabaseID(struct ndr_print *ndr, const char *na
_PUBLIC_ enum ndr_err_code ndr_push_svcctl_ServerType(struct ndr_push *ndr, int ndr_flags, uint32_t r)
{
UNUSED_ARG(ndr_flags);
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
_PUBLIC_ enum ndr_err_code ndr_pull_svcctl_ServerType(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
{
UNUSED_ARG(ndr_flags);
uint32_t v;
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
*r = v;

View File

@ -25,19 +25,27 @@
#include "samba/ndr_misc.h"
#define UNUSED_ARG(x) (void)(x)
static void ndr_print_flags_dom_sid(struct ndr_print *ndr, const char *name, int unused, const struct dom_sid *r)
{
UNUSED_ARG(unused);
ndr_print_dom_sid(ndr, name, r);
}
static enum ndr_err_code ndr_push_se_privilege(struct ndr_push *ndr, int ndr_flags, uint64_t r)
{
UNUSED_ARG(ndr_flags);
NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
static enum ndr_err_code ndr_pull_se_privilege(struct ndr_pull *ndr, int ndr_flags, uint64_t *r)
{
UNUSED_ARG(ndr_flags);
uint64_t v;
NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &v));
*r = v;
@ -78,12 +86,16 @@ _PUBLIC_ void ndr_print_se_privilege(struct ndr_print *ndr, const char *name, ui
static enum ndr_err_code ndr_push_lsa_SystemAccessModeFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r)
{
UNUSED_ARG(ndr_flags);
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
static enum ndr_err_code ndr_pull_lsa_SystemAccessModeFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
{
UNUSED_ARG(ndr_flags);
uint32_t v;
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
*r = v;
@ -112,12 +124,16 @@ _PUBLIC_ void ndr_print_lsa_SystemAccessModeFlags(struct ndr_print *ndr, const c
_PUBLIC_ enum ndr_err_code ndr_push_security_ace_flags(struct ndr_push *ndr, int ndr_flags, uint8_t r)
{
UNUSED_ARG(ndr_flags);
NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
_PUBLIC_ enum ndr_err_code ndr_pull_security_ace_flags(struct ndr_pull *ndr, int ndr_flags, uint8_t *r)
{
UNUSED_ARG(ndr_flags);
uint8_t v;
NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
*r = v;
@ -141,12 +157,16 @@ _PUBLIC_ void ndr_print_security_ace_flags(struct ndr_print *ndr, const char *na
_PUBLIC_ enum ndr_err_code ndr_push_security_ace_type(struct ndr_push *ndr, int ndr_flags, enum security_ace_type r)
{
UNUSED_ARG(ndr_flags);
NDR_CHECK(ndr_push_enum_uint8(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
_PUBLIC_ enum ndr_err_code ndr_pull_security_ace_type(struct ndr_pull *ndr, int ndr_flags, enum security_ace_type *r)
{
UNUSED_ARG(ndr_flags);
uint8_t v;
NDR_CHECK(ndr_pull_enum_uint8(ndr, NDR_SCALARS, &v));
*r = v;
@ -173,12 +193,16 @@ _PUBLIC_ void ndr_print_security_ace_type(struct ndr_print *ndr, const char *nam
static enum ndr_err_code ndr_push_security_ace_object_flags(struct ndr_push *ndr, int ndr_flags, uint32_t r)
{
UNUSED_ARG(ndr_flags);
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
static enum ndr_err_code ndr_pull_security_ace_object_flags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
{
UNUSED_ARG(ndr_flags);
uint32_t v;
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
*r = v;
@ -536,6 +560,8 @@ _PUBLIC_ enum ndr_err_code ndr_push_security_ace(struct ndr_push *ndr, int ndr_f
static void ndr_print_flags_security_ace(struct ndr_print *ndr, const char *name, int unused, const struct security_ace *r)
{
UNUSED_ARG(unused);
ndr_print_security_ace(ndr, name, r);
}
@ -556,12 +582,16 @@ _PUBLIC_ void ndr_print_security_ace(struct ndr_print *ndr, const char *name, co
static enum ndr_err_code ndr_push_security_acl_revision(struct ndr_push *ndr, int ndr_flags, enum security_acl_revision r)
{
UNUSED_ARG(ndr_flags);
NDR_CHECK(ndr_push_enum_uint1632(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
static enum ndr_err_code ndr_pull_security_acl_revision(struct ndr_pull *ndr, int ndr_flags, enum security_acl_revision *r)
{
UNUSED_ARG(ndr_flags);
uint16_t v;
NDR_CHECK(ndr_pull_enum_uint1632(ndr, NDR_SCALARS, &v));
*r = v;
@ -641,6 +671,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_security_acl(struct ndr_pull *ndr, int ndr_f
static void ndr_print_flags_security_acl(struct ndr_print *ndr, const char *name, int unused, const struct security_acl *r)
{
UNUSED_ARG(unused);
ndr_print_security_acl(ndr, name, r);
}
@ -664,12 +696,16 @@ _PUBLIC_ void ndr_print_security_acl(struct ndr_print *ndr, const char *name, co
_PUBLIC_ enum ndr_err_code ndr_push_security_descriptor_revision(struct ndr_push *ndr, int ndr_flags, enum security_descriptor_revision r)
{
UNUSED_ARG(ndr_flags);
NDR_CHECK(ndr_push_enum_uint8(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
_PUBLIC_ enum ndr_err_code ndr_pull_security_descriptor_revision(struct ndr_pull *ndr, int ndr_flags, enum security_descriptor_revision *r)
{
UNUSED_ARG(ndr_flags);
uint8_t v;
NDR_CHECK(ndr_pull_enum_uint8(ndr, NDR_SCALARS, &v));
*r = v;
@ -688,12 +724,16 @@ _PUBLIC_ void ndr_print_security_descriptor_revision(struct ndr_print *ndr, cons
_PUBLIC_ enum ndr_err_code ndr_push_security_descriptor_type(struct ndr_push *ndr, int ndr_flags, uint16_t r)
{
UNUSED_ARG(ndr_flags);
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
_PUBLIC_ enum ndr_err_code ndr_pull_security_descriptor_type(struct ndr_pull *ndr, int ndr_flags, uint16_t *r)
{
UNUSED_ARG(ndr_flags);
uint16_t v;
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
*r = v;
@ -875,6 +915,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_security_descriptor(struct ndr_pull *ndr, in
static void ndr_print_flags_security_descriptor(struct ndr_print *ndr, const char *name, int unused, const struct security_descriptor *r)
{
UNUSED_ARG(unused);
ndr_print_security_descriptor(ndr, name, r);
}
@ -976,6 +1018,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_sec_desc_buf(struct ndr_pull *ndr, int ndr_f
static void ndr_print_flags_sec_desc_buf(struct ndr_print *ndr, const char *name, int unused, const struct sec_desc_buf *r)
{
UNUSED_ARG(unused);
ndr_print_sec_desc_buf(ndr, name, r);
}
@ -996,12 +1040,16 @@ _PUBLIC_ void ndr_print_sec_desc_buf(struct ndr_print *ndr, const char *name, co
_PUBLIC_ enum ndr_err_code ndr_push_security_GroupAttrs(struct ndr_push *ndr, int ndr_flags, uint32_t r)
{
UNUSED_ARG(ndr_flags);
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
_PUBLIC_ enum ndr_err_code ndr_pull_security_GroupAttrs(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
{
UNUSED_ARG(ndr_flags);
uint32_t v;
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
*r = v;
@ -1076,6 +1124,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_security_token(struct ndr_pull *ndr, int ndr
static void ndr_print_flags_security_token(struct ndr_print *ndr, const char *name, int unused, const struct security_token *r)
{
UNUSED_ARG(unused);
ndr_print_security_token(ndr, name, r);
}
@ -1149,6 +1199,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_security_unix_token(struct ndr_pull *ndr, in
static void ndr_print_flags_security_unix_token(struct ndr_print *ndr, const char *name, int unused, const struct security_unix_token *r)
{
UNUSED_ARG(unused);
ndr_print_security_unix_token(ndr, name, r);
}
@ -1172,12 +1224,16 @@ _PUBLIC_ void ndr_print_security_unix_token(struct ndr_print *ndr, const char *n
_PUBLIC_ enum ndr_err_code ndr_push_security_secinfo(struct ndr_push *ndr, int ndr_flags, uint32_t r)
{
UNUSED_ARG(ndr_flags);
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
_PUBLIC_ enum ndr_err_code ndr_pull_security_secinfo(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
{
UNUSED_ARG(ndr_flags);
uint32_t v;
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
*r = v;
@ -1247,6 +1303,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_LSAP_TOKEN_INFO_INTEGRITY(struct ndr_pull *n
static void ndr_print_flags_LSAP_TOKEN_INFO_INTEGRITY(struct ndr_print *ndr, const char *name, int unused, const struct LSAP_TOKEN_INFO_INTEGRITY *r)
{
UNUSED_ARG(unused);
ndr_print_LSAP_TOKEN_INFO_INTEGRITY(ndr, name, r);
}
@ -1274,12 +1332,16 @@ _PUBLIC_ size_t ndr_size_LSAP_TOKEN_INFO_INTEGRITY(const struct LSAP_TOKEN_INFO_
_PUBLIC_ enum ndr_err_code ndr_push_kerb_EncTypes(struct ndr_push *ndr, int ndr_flags, uint32_t r)
{
UNUSED_ARG(ndr_flags);
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
_PUBLIC_ enum ndr_err_code ndr_pull_kerb_EncTypes(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
{
UNUSED_ARG(ndr_flags);
uint32_t v;
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
*r = v;
@ -1304,12 +1366,16 @@ _PUBLIC_ void ndr_print_kerb_EncTypes(struct ndr_print *ndr, const char *name, u
_PUBLIC_ enum ndr_err_code ndr_push_security_autoinherit(struct ndr_push *ndr, int ndr_flags, uint32_t r)
{
UNUSED_ARG(ndr_flags);
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
_PUBLIC_ enum ndr_err_code ndr_pull_security_autoinherit(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
{
UNUSED_ARG(ndr_flags);
uint32_t v;
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
*r = v;

View File

@ -687,7 +687,7 @@ struct security_ace *security_ace_create(TALLOC_CTX *mem_ctx,
*******************************************************************/
bool security_descriptor_with_ms_nfs(const struct security_descriptor *psd)
{
int i;
uint32_t i;
if (psd->dacl == NULL) {
return false;

View File

@ -218,6 +218,8 @@ void ObjectImpl::fetch(const QModelIndex &index) {
}
bool ObjectImpl::can_drop(const QList<QPersistentModelIndex> &dropped_list, const QSet<int> &dropped_type_list, const QPersistentModelIndex &target, const int target_type) {
UNUSED_ARG(target_type);
const bool dropped_are_all_objects = (dropped_type_list == QSet<int>({ItemType_Object}));
const bool dropped_are_policies = (dropped_type_list == QSet<int>({ItemType_Policy}));
@ -246,6 +248,8 @@ bool ObjectImpl::can_drop(const QList<QPersistentModelIndex> &dropped_list, cons
}
void ObjectImpl::drop(const QList<QPersistentModelIndex> &dropped_list, const QSet<int> &dropped_type_list, const QPersistentModelIndex &target, const int target_type) {
UNUSED_ARG(target_type);
const bool dropped_are_all_objects = (dropped_type_list == QSet<int>({ItemType_Object}));
const bool dropped_are_policies = (dropped_type_list == QSet<int>({ItemType_Policy}));
@ -363,6 +367,8 @@ QSet<QAction *> ObjectImpl::get_custom_actions(const QModelIndex &index, const b
}
QSet<QAction *> ObjectImpl::get_disabled_custom_actions(const QModelIndex &index, const bool single_selection) const {
UNUSED_ARG(single_selection);
QSet<QAction *> out;
const bool cannot_move = index.data(ObjectRole_CannotMove).toBool();
@ -397,6 +403,8 @@ QSet<StandardAction> ObjectImpl::get_standard_actions(const QModelIndex &index,
}
QSet<StandardAction> ObjectImpl::get_disabled_standard_actions(const QModelIndex &index, const bool single_selection) const {
UNUSED_ARG(single_selection);
QSet<StandardAction> out;
const bool cannot_rename = index.data(ObjectRole_CannotRename).toBool();

View File

@ -58,6 +58,9 @@ PolicyImpl::PolicyImpl(ConsoleWidget *console_arg)
}
bool PolicyImpl::can_drop(const QList<QPersistentModelIndex> &dropped_list, const QSet<int> &dropped_type_list, const QPersistentModelIndex &target, const int target_type) {
UNUSED_ARG(target);
UNUSED_ARG(target_type);
const bool dropped_are_objects = (dropped_type_list == QSet<int>({ItemType_Object}));
if (!dropped_are_objects) {
return false;
@ -77,6 +80,9 @@ bool PolicyImpl::can_drop(const QList<QPersistentModelIndex> &dropped_list, cons
}
void PolicyImpl::drop(const QList<QPersistentModelIndex> &dropped_list, const QSet<int> &dropped_type_list, const QPersistentModelIndex &target, const int target_type) {
UNUSED_ARG(target_type);
UNUSED_ARG(dropped_type_list);
const QString policy_dn = target.data(PolicyRole_DN).toString();
const QList<QString> policy_list = {policy_dn};
@ -115,6 +121,8 @@ QList<QAction *> PolicyImpl::get_all_custom_actions() const {
}
QSet<QAction *> PolicyImpl::get_custom_actions(const QModelIndex &index, const bool single_selection) const {
UNUSED_ARG(index);
QSet<QAction *> out;
if (single_selection) {
@ -126,6 +134,8 @@ QSet<QAction *> PolicyImpl::get_custom_actions(const QModelIndex &index, const b
}
QSet<StandardAction> PolicyImpl::get_standard_actions(const QModelIndex &index, const bool single_selection) const {
UNUSED_ARG(index);
QSet<StandardAction> out;
out.insert(StandardAction_Delete);
@ -139,6 +149,8 @@ QSet<StandardAction> PolicyImpl::get_standard_actions(const QModelIndex &index,
}
void PolicyImpl::rename(const QList<QModelIndex> &index_list) {
UNUSED_ARG(index_list);
rename_dialog->open();
}

View File

@ -59,6 +59,8 @@ PolicyRootImpl::PolicyRootImpl(ConsoleWidget *console_arg)
}
void PolicyRootImpl::fetch(const QModelIndex &index) {
UNUSED_ARG(index);
AdInterface ad;
if (ad_failed(ad)) {
return;
@ -91,6 +93,9 @@ QList<QAction *> PolicyRootImpl::get_all_custom_actions() const {
}
QSet<QAction *> PolicyRootImpl::get_custom_actions(const QModelIndex &index, const bool single_selection) const {
UNUSED_ARG(index);
UNUSED_ARG(single_selection);
QSet<QAction *> out;
out.insert(create_policy_action);
@ -99,6 +104,9 @@ QSet<QAction *> PolicyRootImpl::get_custom_actions(const QModelIndex &index, con
}
QSet<StandardAction> PolicyRootImpl::get_standard_actions(const QModelIndex &index, const bool single_selection) const {
UNUSED_ARG(index);
UNUSED_ARG(single_selection);
QSet<StandardAction> out;
out.insert(StandardAction_Refresh);
@ -155,7 +163,7 @@ void PolicyRootImpl::create_policy_in_console(const AdObject &object) {
console_policy_load(row, object);
}
void console_policy_tree_init(ConsoleWidget *console, AdInterface &ad) {
void console_policy_tree_init(ConsoleWidget *console) {
const QList<QStandardItem *> head_row = console->add_scope_item(ItemType_PolicyRoot, QModelIndex());
auto policy_tree_head = head_row[0];
policy_tree_head->setText(QCoreApplication::translate("policy_root_impl", "Group Policy Objects"));

View File

@ -59,6 +59,6 @@ private:
void create_policy_in_console(const AdObject &object);
};
void console_policy_tree_init(ConsoleWidget *console, AdInterface &ad);
void console_policy_tree_init(ConsoleWidget *console);
#endif /* POLICY_ROOT_IMPL_H */

View File

@ -82,12 +82,19 @@ QueryFolderImpl::QueryFolderImpl(ConsoleWidget *console_arg)
}
bool QueryFolderImpl::can_drop(const QList<QPersistentModelIndex> &dropped_list, const QSet<int> &dropped_type_list, const QPersistentModelIndex &target, const int target_type) {
UNUSED_ARG(dropped_list);
UNUSED_ARG(target);
UNUSED_ARG(target_type);
const bool dropped_are_query_item_or_folder = (dropped_type_list - QSet<int>({ItemType_QueryItem, ItemType_QueryFolder})).isEmpty();
return dropped_are_query_item_or_folder;
}
void QueryFolderImpl::drop(const QList<QPersistentModelIndex> &dropped_list, const QSet<int> &dropped_type_list, const QPersistentModelIndex &target, const int target_type) {
UNUSED_ARG(dropped_type_list);
UNUSED_ARG(target_type);
console_query_move(console, dropped_list, target);
}
@ -103,6 +110,8 @@ QList<QAction *> QueryFolderImpl::get_all_custom_actions() const {
}
QSet<QAction *> QueryFolderImpl::get_custom_actions(const QModelIndex &index, const bool single_selection) const {
UNUSED_ARG(index);
QSet<QAction *> out;
if (single_selection) {
@ -115,6 +124,8 @@ QSet<QAction *> QueryFolderImpl::get_custom_actions(const QModelIndex &index, co
}
QSet<StandardAction> QueryFolderImpl::get_standard_actions(const QModelIndex &index, const bool single_selection) const {
UNUSED_ARG(index);
QSet<StandardAction> out;
out.insert(StandardAction_Delete);

View File

@ -98,6 +98,8 @@ QList<QAction *> QueryItemImpl::get_all_custom_actions() const {
}
QSet<QAction *> QueryItemImpl::get_custom_actions(const QModelIndex &index, const bool single_selection) const {
UNUSED_ARG(index);
QSet<QAction *> out;
if (single_selection) {

View File

@ -101,6 +101,8 @@ bool ConsoleDragModel::canDropMimeData(const QMimeData *data, Qt::DropAction, in
}
bool ConsoleDragModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int, int, const QModelIndex &parent) {
UNUSED_ARG(action);
if (!data->hasFormat(MIME_TYPE_CONSOLE)) {
return false;
}

View File

@ -34,27 +34,37 @@ ConsoleImpl::ConsoleImpl(ConsoleWidget *console_arg)
}
void ConsoleImpl::fetch(const QModelIndex &index) {
UNUSED_ARG(index);
}
bool ConsoleImpl::can_drop(const QList<QPersistentModelIndex> &dropped_list, const QSet<int> &dropped_type_list, const QPersistentModelIndex &target, const int target_type) {
UNUSED_ARG(dropped_list);
UNUSED_ARG(dropped_type_list);
UNUSED_ARG(target);
UNUSED_ARG(target_type);
return false;
}
void ConsoleImpl::drop(const QList<QPersistentModelIndex> &dropped_list, const QSet<int> &dropped_type_list, const QPersistentModelIndex &target, const int target_type) {
UNUSED_ARG(dropped_list);
UNUSED_ARG(dropped_type_list);
UNUSED_ARG(target);
UNUSED_ARG(target_type);
}
QString ConsoleImpl::get_description(const QModelIndex &index) const {
UNUSED_ARG(index);
return QString();
}
void ConsoleImpl::activate(const QModelIndex &index) {
UNUSED_ARG(index);
}
void ConsoleImpl::selected_as_scope(const QModelIndex &index) {
UNUSED_ARG(index);
}
QList<QAction *> ConsoleImpl::get_all_custom_actions() const {
@ -62,51 +72,63 @@ QList<QAction *> ConsoleImpl::get_all_custom_actions() const {
}
QSet<QAction *> ConsoleImpl::get_custom_actions(const QModelIndex &index, const bool single_selection) const {
UNUSED_ARG(index);
UNUSED_ARG(single_selection);
return {};
}
QSet<QAction *> ConsoleImpl::get_disabled_custom_actions(const QModelIndex &index, const bool single_selection) const {
UNUSED_ARG(index);
UNUSED_ARG(single_selection);
return {};
}
QSet<StandardAction> ConsoleImpl::get_standard_actions(const QModelIndex &index, const bool single_selection) const {
UNUSED_ARG(index);
UNUSED_ARG(single_selection);
return {};
}
QSet<StandardAction> ConsoleImpl::get_disabled_standard_actions(const QModelIndex &index, const bool single_selection) const {
UNUSED_ARG(index);
UNUSED_ARG(single_selection);
return {};
}
void ConsoleImpl::copy(const QList<QModelIndex> &index_list) {
UNUSED_ARG(index_list);
}
void ConsoleImpl::cut(const QList<QModelIndex> &index_list) {
UNUSED_ARG(index_list);
}
void ConsoleImpl::rename(const QList<QModelIndex> &index_list) {
UNUSED_ARG(index_list);
}
void ConsoleImpl::delete_action(const QList<QModelIndex> &index_list) {
UNUSED_ARG(index_list);
}
void ConsoleImpl::paste(const QList<QModelIndex> &index_list) {
UNUSED_ARG(index_list);
}
void ConsoleImpl::print(const QList<QModelIndex> &index_list) {
UNUSED_ARG(index_list);
}
void ConsoleImpl::refresh(const QList<QModelIndex> &index_list) {
UNUSED_ARG(index_list);
}
void ConsoleImpl::properties(const QList<QModelIndex> &index_list) {
UNUSED_ARG(index_list);
}
QList<QString> ConsoleImpl::column_labels() const {

View File

@ -940,6 +940,8 @@ void ConsoleWidgetPrivate::on_scope_items_about_to_be_removed(const QModelIndex
}
void ConsoleWidgetPrivate::on_focus_changed(QWidget *old, QWidget *now) {
UNUSED_ARG(old);
QAbstractItemView *new_focused_view = qobject_cast<QAbstractItemView *>(now);
if (new_focused_view != nullptr) {

View File

@ -45,6 +45,8 @@ class QMenu;
class ConsoleImpl;
class ConsoleDragModel;
#define UNUSED_ARG(x) (void)(x)
enum ConsoleRolePublic {
ConsoleRole_Type = Qt::UserRole + 19,

View File

@ -42,6 +42,8 @@ AccountOptionEdit::AccountOptionEdit(QCheckBox *check_arg, const AccountOption o
}
void AccountOptionEdit::load_internal(AdInterface &ad, const AdObject &object) {
UNUSED_ARG(ad);
const bool option_is_set = object.get_account_option(option, g_adconfig);
check->setChecked(option_is_set);
}

View File

@ -21,6 +21,7 @@
#include "edits/attribute_edit.h"
#include "tabs/properties_tab.h"
#include "utils.h"
#include <QDebug>
@ -48,6 +49,9 @@ void AttributeEdit::load(AdInterface &ad, const AdObject &object) {
}
bool AttributeEdit::verify(AdInterface &ad, const QString &dn) const {
UNUSED_ARG(ad);
UNUSED_ARG(dn);
return true;
}

View File

@ -23,6 +23,7 @@
#include "adldap.h"
#include "edits/country_combo.h"
#include "globals.h"
#include "utils.h"
#include <QComboBox>
@ -38,6 +39,8 @@ CountryEdit::CountryEdit(QComboBox *combo_arg, QList<AttributeEdit *> *edits_out
}
void CountryEdit::load_internal(AdInterface &ad, const AdObject &object) {
UNUSED_ARG(ad);
country_combo_load(combo, object);
}

View File

@ -22,6 +22,7 @@
#include "adldap.h"
#include "globals.h"
#include "utils.h"
#include <QDateTimeEdit>
@ -41,6 +42,8 @@ DateTimeEdit::DateTimeEdit(QDateTimeEdit *edit_arg, const QString &attribute_arg
}
void DateTimeEdit::load_internal(AdInterface &ad, const AdObject &object) {
UNUSED_ARG(ad);
const QDateTime datetime = object.get_datetime(attribute, g_adconfig);
const QDateTime datetime_local = datetime.toLocalTime();

View File

@ -22,6 +22,7 @@
#include "adldap.h"
#include "globals.h"
#include "utils.h"
#include <QRadioButton>
@ -39,6 +40,8 @@ DelegationEdit::DelegationEdit(QRadioButton *off_button_arg, QRadioButton *on_bu
}
void DelegationEdit::load_internal(AdInterface &ad, const AdObject &object) {
UNUSED_ARG(ad);
const bool is_on = object.get_account_option(AccountOption_TrustedForDelegation, g_adconfig);
if (is_on) {

View File

@ -23,6 +23,7 @@
#include "adldap.h"
#include "edits/expiry_widget.h"
#include "globals.h"
#include "utils.h"
ExpiryEdit::ExpiryEdit(ExpiryWidget *edit_widget_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
: AttributeEdit(edits_out, parent) {
@ -36,6 +37,8 @@ ExpiryEdit::ExpiryEdit(ExpiryWidget *edit_widget_arg, QList<AttributeEdit *> *ed
}
void ExpiryEdit::load_internal(AdInterface &ad, const AdObject &object) {
UNUSED_ARG(ad);
edit_widget->load(object);
}

View File

@ -21,6 +21,7 @@
#include "edits/gpoptions_edit.h"
#include "adldap.h"
#include "utils.h"
#include <QCheckBox>
@ -36,6 +37,8 @@ GpoptionsEdit::GpoptionsEdit(QCheckBox *check_arg, QList<AttributeEdit *> *edits
}
void GpoptionsEdit::load_internal(AdInterface &ad, const AdObject &object) {
UNUSED_ARG(ad);
const QString value = object.get_string(ATTRIBUTE_GPOPTIONS);
const bool checked = (value == GPOPTIONS_BLOCK_INHERITANCE);

View File

@ -21,6 +21,7 @@
#include "edits/group_scope_edit.h"
#include "adldap.h"
#include "utils.h"
#include <QComboBox>
#include <QFormLayout>
@ -45,6 +46,8 @@ GroupScopeEdit::GroupScopeEdit(QComboBox *combo_arg, QList<AttributeEdit *> *edi
void GroupScopeEdit::load_internal(AdInterface &ad, const AdObject &object) {
UNUSED_ARG(ad);
const GroupScope scope = object.get_group_scope();
combo->setCurrentIndex((int) scope);

View File

@ -21,6 +21,7 @@
#include "edits/group_type_edit.h"
#include "adldap.h"
#include "utils.h"
#include <QComboBox>
@ -43,6 +44,8 @@ GroupTypeEdit::GroupTypeEdit(QComboBox *combo_arg, QList<AttributeEdit *> *edits
}
void GroupTypeEdit::load_internal(AdInterface &ad, const AdObject &object) {
UNUSED_ARG(ad);
const GroupType type = object.get_group_type();
combo->setCurrentIndex((int) type);

View File

@ -23,6 +23,7 @@
#include "edits/ui_logon_computers_dialog.h"
#include "adldap.h"
#include "utils.h"
LogonComputersEdit::LogonComputersEdit(QPushButton *button_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
: AttributeEdit(edits_out, parent) {
@ -41,7 +42,8 @@ LogonComputersEdit::LogonComputersEdit(QPushButton *button_arg, QList<AttributeE
}
void LogonComputersEdit::load_internal(AdInterface &ad, const AdObject &object) {
const
UNUSED_ARG(ad);
QString value = object.get_value(ATTRIBUTE_USER_WORKSTATIONS);
dialog->load(value);
}

View File

@ -25,6 +25,7 @@
#include "adldap.h"
#include "edits/expiry_widget.h"
#include "globals.h"
#include "utils.h"
#include <QTableView>
#include <QStandardItemModel>
@ -52,6 +53,8 @@ LogonHoursEdit::LogonHoursEdit(QPushButton *button_arg, QList<AttributeEdit *> *
}
void LogonHoursEdit::load_internal(AdInterface &ad, const AdObject &object) {
UNUSED_ARG(ad);
const QByteArray value = object.get_value(ATTRIBUTE_LOGON_HOURS);
dialog->load(value);
}

View File

@ -23,6 +23,7 @@
#include "adldap.h"
#include "edits/manager_widget.h"
#include "globals.h"
#include "utils.h"
ManagerEdit::ManagerEdit(ManagerWidget *widget_arg, const QString &manager_attribute_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
: AttributeEdit(edits_out, parent) {
@ -37,6 +38,8 @@ ManagerEdit::ManagerEdit(ManagerWidget *widget_arg, const QString &manager_attri
}
void ManagerEdit::load_internal(AdInterface &ad, const AdObject &object) {
UNUSED_ARG(ad);
widget->load(object);
}

View File

@ -43,6 +43,9 @@ PasswordEdit::PasswordEdit(QLineEdit *edit_arg, QLineEdit *confirm_edit_arg, QLi
}
void PasswordEdit::load_internal(AdInterface &ad, const AdObject &object) {
UNUSED_ARG(ad);
UNUSED_ARG(object);
edit->clear();
confirm_edit->clear();
}
@ -53,6 +56,8 @@ void PasswordEdit::set_read_only(const bool read_only) {
}
bool PasswordEdit::verify(AdInterface &ad, const QString &) const {
UNUSED_ARG(ad);
const QString pass = edit->text();
const QString confirm_pass = confirm_edit->text();
if (pass != confirm_pass) {

View File

@ -46,6 +46,8 @@ void ProtectDeletionEdit::set_enabled(const bool enabled) {
}
void ProtectDeletionEdit::load_internal(AdInterface &ad, const AdObject &object) {
UNUSED_ARG(ad);
const bool enabled = ad_security_get_protected_against_deletion(object, g_adconfig);
check->setChecked(enabled);

View File

@ -41,6 +41,8 @@ SamNameEdit::SamNameEdit(QLineEdit *edit_arg, QLineEdit *domain_edit_arg, QList<
}
void SamNameEdit::load_internal(AdInterface &ad, const AdObject &object) {
UNUSED_ARG(ad);
const QString value = object.get_string(ATTRIBUTE_SAM_ACCOUNT_NAME);
edit->setText(value);

View File

@ -45,6 +45,8 @@ StringEdit::StringEdit(QLineEdit *edit_arg, const QString &attribute_arg, QList<
}
void StringEdit::load_internal(AdInterface &ad, const AdObject &object) {
UNUSED_ARG(ad);
const QString value = [=]() {
const QString raw_value = object.get_string(attribute);

View File

@ -22,6 +22,7 @@
#include "adldap.h"
#include "globals.h"
#include "utils.h"
#include <QPlainTextEdit>
@ -54,6 +55,8 @@ StringLargeEdit::StringLargeEdit(QPlainTextEdit *edit_arg, const QString &attrib
}
void StringLargeEdit::load_internal(AdInterface &ad, const AdObject &object) {
UNUSED_ARG(ad);
const QString value = object.get_string(attribute);
edit->setPlainText(value);

View File

@ -41,6 +41,9 @@ QString UnlockEdit::label_text() {
}
void UnlockEdit::load_internal(AdInterface &ad, const AdObject &object) {
UNUSED_ARG(ad);
UNUSED_ARG(object);
check->setChecked(false);
}

View File

@ -50,6 +50,8 @@ void UpnEdit::init_suffixes(AdInterface &ad) {
}
void UpnEdit::load_internal(AdInterface &ad, const AdObject &object) {
UNUSED_ARG(ad);
upn_suffix_combo_load(upn_suffix_combo, object);
const QString prefix = object.get_upn_prefix();

View File

@ -20,6 +20,8 @@
#include "help_browser.h"
#include "utils.h"
#include <QHelpContentWidget>
#include <QHelpEngine>
#include <QHelpIndexWidget>
@ -52,6 +54,8 @@ void HelpBrowser::init(QHelpEngine *help_engine_arg) {
// engine. Returning file data from this function causes it
// to be loaded by text browser.
QVariant HelpBrowser::loadResource(int type, const QUrl &name) {
UNUSED_ARG(type);
const QByteArray file_data = help_engine->fileData(name);
return QVariant(file_data);

View File

@ -380,7 +380,7 @@ void MainWindow::connect_to_server() {
// Load console tree's
console_object_tree_init(ui->console, ad);
console_policy_tree_init(ui->console, ad);
console_policy_tree_init(ui->console);
console_query_tree_init(ui->console);
// Set current scope to object head to load it

View File

@ -70,7 +70,8 @@ const QHash<PolicyResultsColumn, GplinkOption> column_to_option = {
// TODO: need to sync this with changes done through group
// policy tab (just call load after properties is closed?)
PolicyResultsWidget::PolicyResultsWidget(QWidget *parent) {
PolicyResultsWidget::PolicyResultsWidget(QWidget *parent)
: QWidget(parent) {
ui = new Ui::PolicyResultsWidget();
ui->setupUi(this);

View File

@ -132,6 +132,8 @@ void AttributesTab::edit_attribute() {
}
void AttributesTab::load(AdInterface &ad, const AdObject &object) {
UNUSED_ARG(ad);
original.clear();
for (auto attribute : object.attributes()) {

View File

@ -47,6 +47,8 @@ class QMap;
template <typename K, typename T>
class QHash;
#define UNUSED_ARG(x) (void)(x)
#define debug_print(a, args...) printf("%s(%s:%d) " a, __func__, __FILE__, __LINE__, ##args)
#define trace(a, args...) debug_print(a "\n", ##args)

View File

@ -85,7 +85,7 @@ void ADMCTestMemberOfTab::load() {
}
int ADMCTestMemberOfTab::get_group_row(const QString &dn) {
const QString group_name = dn_get_name(group_dn);
const QString group_name = dn_get_name(dn);
for (int row = 0; row < model->rowCount(); row++) {
auto item = model->item(row, 0);