Fix minor issues identified by clang-700.0.72
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 19 Sep 2015 11:39:05 +0000 (12:39 +0100)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 19 Sep 2015 20:01:10 +0000 (21:01 +0100)
src/main/evaluate.c
src/main/log.c
src/main/map.c
src/main/radattr.c
src/main/tmpl.c
src/modules/rlm_eap/types/rlm_eap_pwd/rlm_eap_pwd.c
src/modules/rlm_mschap/opendir.c

index c64eebd..bd49e8b 100644 (file)
@@ -771,8 +771,6 @@ void radius_pairmove(REQUEST *request, VALUE_PAIR **to, VALUE_PAIR *from, bool d
        REQUEST *fixup = NULL;
        TALLOC_CTX *ctx;
 
-       if (!request) return;
-
        /*
         *      Set up arrays for editing, to remove some of the
         *      O(N^2) dependencies.  This also makes it easier to
index cb2f88c..3ead46e 100644 (file)
@@ -601,7 +601,7 @@ inline bool radlog_debug_enabled(log_type_t type, log_lvl_t lvl, REQUEST *reques
         *      then don't log the message.
         */
        if ((type & L_DBG) &&
-           ((request && request->log.func && (lvl <= request->log.lvl)) ||
+           ((request->log.func && (lvl <= request->log.lvl)) ||
             ((rad_debug_lvl != 0) && (lvl <= rad_debug_lvl)))) {
                return true;
        }
index 88d89c1..bbe3a63 100644 (file)
@@ -340,8 +340,6 @@ int map_afrom_cs(vp_map_t **out, CONF_SECTION *cs,
        *out = NULL;
        tail = out;
 
-       if (!cs) return 0;
-
        /*
         *      The first map has cs as the parent.
         *      The rest have the previous map as the parent.
index 2a6c59b..3badef9 100644 (file)
@@ -695,7 +695,12 @@ static void process_file(const char *root_dir, char const *filename)
                        attr = data;
                        vp = head;
                        while (vp) {
-                               len = rad_vp2attr(&my_packet, &my_original, my_secret, (VALUE_PAIR const **)(void **)&vp,
+                               VALUE_PAIR **pvp = &vp;
+                               VALUE_PAIR const **qvp;
+
+                               memcpy(&qvp, &pvp, sizeof(pvp));
+
+                               len = rad_vp2attr(&my_packet, &my_original, my_secret, qvp,
                                                  attr, data + sizeof(data) - attr);
                                if (len < 0) {
                                        fprintf(stderr, "Failed encoding %s: %s\n",
index 7106f00..ae89b33 100644 (file)
@@ -2197,7 +2197,7 @@ void tmpl_verify(char const *file, int line, vp_tmpl_t const *vpt)
                }
 
                if (vpt->tmpl_da->flags.is_unknown) {
-                       if (vpt->tmpl_da != (DICT_ATTR *)&vpt->data.attribute.unknown.da) {
+                       if (vpt->tmpl_da != (DICT_ATTR const *)&vpt->data.attribute.unknown.da) {
                                FR_FAULT_LOG("CONSISTENCY CHECK FAILED %s[%u]: TMPL_TYPE_ATTR "
                                             "da is marked as unknown, but does not point to the template's "
                                             "unknown da buffer", file, line);
index d1813ab..6220bbd 100644 (file)
@@ -281,7 +281,7 @@ static int mod_process(void *arg, eap_handler_t *handler)
        BIGNUM *x = NULL, *y = NULL;
        char *p;
 
-       if (!handler || ((eap_ds = handler->eap_ds) == NULL) || !inst) return 0;
+       if (((eap_ds = handler->eap_ds) == NULL) || !inst) return 0;
 
        session = (pwd_session_t *)handler->opaque;
        request = handler->request;
index fa8c816..1b37811 100644 (file)
@@ -52,7 +52,7 @@ static rlm_rcode_t getUserNodeRef(REQUEST *request, char* inUserName, char **out
        tDataBuffer             *tDataBuff      = NULL;
        tDirNodeReference       nodeRef         = 0;
        long                    status          = eDSNoErr;
-       char                    *what           = NULL;
+       char const              *what           = NULL;
        char                    *status_name    = NULL;
        tContextData            context         = 0;
        uint32_t                nodeCount       = 0;
@@ -63,9 +63,9 @@ static rlm_rcode_t getUserNodeRef(REQUEST *request, char* inUserName, char **out
        tDataList              *pRecType        = NULL;
        tDataList              *pAttrType       = NULL;
        uint32_t                recCount        = 0;
-       tRecordEntry        *pRecEntry  = NULL;
+       tRecordEntry            *pRecEntry      = NULL;
        tAttributeListRef       attrListRef     = 0;
-       char                *pUserLocation      = NULL;
+       char                    *pUserLocation  = NULL;
        tAttributeValueListRef  valueRef        = 0;
        tDataList              *pUserNode       = NULL;
        rlm_rcode_t             result          = RLM_MODULE_FAIL;