Address some spurious Clang static analyzer warnings
Signed-off-by: Erik Boasson <eb@ilities.com> Fix typo in dlopen_unknown test Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com> Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
		
							parent
							
								
									97c3025e54
								
							
						
					
					
						commit
						68f789d77b
					
				
					 6 changed files with 20 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -403,6 +403,7 @@ void dds_qset_prop (dds_qos_t * __restrict qos, const char * name, const char *
 | 
			
		|||
  dds_qprop_init (qos);
 | 
			
		||||
  if (dds_qprop_get_index (qos, name, &i))
 | 
			
		||||
  {
 | 
			
		||||
    assert (&qos->property.value.props[i] != NULL); /* for Clang static analyzer */
 | 
			
		||||
    dds_free (qos->property.value.props[i].value);
 | 
			
		||||
    qos->property.value.props[i].value = dds_string_dup (value);
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			@ -426,6 +427,7 @@ void dds_qset_bprop (dds_qos_t * __restrict qos, const char * name, const void *
 | 
			
		|||
  dds_qprop_init (qos);
 | 
			
		||||
  if (dds_qbprop_get_index (qos, name, &i))
 | 
			
		||||
  {
 | 
			
		||||
    assert (&qos->property.binary_value.props[i].value != NULL); /* for Clang static analyzer */
 | 
			
		||||
    dds_qos_data_copy_in (&qos->property.binary_value.props[i].value, value, sz, true);
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,6 +11,7 @@
 | 
			
		|||
 */
 | 
			
		||||
#include "CUnit/Test.h"
 | 
			
		||||
#include "dds/dds.h"
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
 * Convenience global policies
 | 
			
		||||
| 
						 | 
				
			
			@ -746,6 +747,7 @@ CU_Test(ddsc_qos, bproperty, .init=qos_init, .fini=qos_fini)
 | 
			
		|||
    CU_ASSERT_FATAL(dds_qget_bprop (g_qos, c_bproperty_names[0], &bvalue, &size));
 | 
			
		||||
    CU_ASSERT_FATAL (bvalue != NULL);
 | 
			
		||||
    CU_ASSERT_EQUAL_FATAL (size, 3);
 | 
			
		||||
    assert (c_bproperty_values[0] != NULL); /* for Clang static analyzer */
 | 
			
		||||
    CU_ASSERT_EQUAL_FATAL (memcmp (bvalue, c_bproperty_values[0], size), 0);
 | 
			
		||||
    dds_free (bvalue);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -754,6 +756,7 @@ CU_Test(ddsc_qos, bproperty, .init=qos_init, .fini=qos_fini)
 | 
			
		|||
    CU_ASSERT_FATAL (dds_qget_bprop (g_qos, c_bproperty_names[0], &bvalue, &size));
 | 
			
		||||
    CU_ASSERT_FATAL (bvalue != NULL);
 | 
			
		||||
    CU_ASSERT_EQUAL_FATAL (size, 3);
 | 
			
		||||
    assert (c_bproperty_values[1] != NULL); /* for Clang static analyzer */
 | 
			
		||||
    CU_ASSERT_EQUAL_FATAL (memcmp (bvalue, c_bproperty_values[1], size), 0);
 | 
			
		||||
    dds_free (bvalue);
 | 
			
		||||
    dds_qset_bprop (g_qos, c_bproperty_names[0], &c_bproperty_values[0], 3);
 | 
			
		||||
| 
						 | 
				
			
			@ -782,11 +785,13 @@ CU_Test(ddsc_qos, bproperty, .init=qos_init, .fini=qos_fini)
 | 
			
		|||
    CU_ASSERT_FATAL (dds_qget_bprop (g_qos, c_bproperty_names[0], &bvalue, &size));
 | 
			
		||||
    CU_ASSERT_FATAL (bvalue != NULL);
 | 
			
		||||
    CU_ASSERT_EQUAL_FATAL (size, 3);
 | 
			
		||||
    assert (c_bproperty_values[0] != NULL); /* for Clang static analyzer */
 | 
			
		||||
    CU_ASSERT_EQUAL_FATAL (memcmp (bvalue, c_bproperty_values[0], size), 0);
 | 
			
		||||
    dds_free (bvalue);
 | 
			
		||||
    CU_ASSERT_FATAL (dds_qget_bprop (g_qos, c_bproperty_names[2], &bvalue, &size));
 | 
			
		||||
    CU_ASSERT_FATAL (bvalue != NULL);
 | 
			
		||||
    CU_ASSERT_EQUAL_FATAL (size, 3);
 | 
			
		||||
    assert (c_bproperty_values[2] != NULL); /* for Clang static analyzer */
 | 
			
		||||
    CU_ASSERT_EQUAL_FATAL (memcmp (bvalue, c_bproperty_values[2], size), 0);
 | 
			
		||||
    dds_free (bvalue);
 | 
			
		||||
    dds_qunset_bprop (g_qos, c_bproperty_names[0]);
 | 
			
		||||
| 
						 | 
				
			
			@ -809,6 +814,7 @@ CU_Test(ddsc_qos, property_mixed, .init=qos_init, .fini=qos_fini)
 | 
			
		|||
    CU_ASSERT_FATAL (dds_qget_bprop (g_qos, c_property_names[0], &bvalue, &size));
 | 
			
		||||
    CU_ASSERT_FATAL (bvalue != NULL);
 | 
			
		||||
    CU_ASSERT_EQUAL_FATAL (size, 3);
 | 
			
		||||
    assert (c_bproperty_values[0] != NULL); /* for Clang static analyzer */
 | 
			
		||||
    CU_ASSERT_EQUAL_FATAL (memcmp (bvalue, c_bproperty_values[0], size), 0);
 | 
			
		||||
    dds_free (bvalue);
 | 
			
		||||
    CU_ASSERT_FATAL (dds_qget_prop (g_qos, c_property_names[0], &value));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -584,7 +584,6 @@ static void send_heartbeat_to_all_readers(struct nn_xpack *xp, struct xevent *ev
 | 
			
		|||
{
 | 
			
		||||
  struct whc_state whcst;
 | 
			
		||||
  nn_mtime_t t_next;
 | 
			
		||||
  int hbansreq = 0;
 | 
			
		||||
  unsigned count = 0;
 | 
			
		||||
 | 
			
		||||
  ddsrt_mutex_lock (&wr->e.lock);
 | 
			
		||||
| 
						 | 
				
			
			@ -592,21 +591,14 @@ static void send_heartbeat_to_all_readers(struct nn_xpack *xp, struct xevent *ev
 | 
			
		|||
  whc_get_state(wr->whc, &whcst);
 | 
			
		||||
 | 
			
		||||
  if (!writer_must_have_hb_scheduled (wr, &whcst))
 | 
			
		||||
  {
 | 
			
		||||
    hbansreq = 1; /* just for trace */
 | 
			
		||||
    t_next.v = T_NEVER;
 | 
			
		||||
  }
 | 
			
		||||
  else if (!writer_hbcontrol_must_send (wr, &whcst, tnow))
 | 
			
		||||
  {
 | 
			
		||||
    hbansreq = 1; /* just for trace */
 | 
			
		||||
    t_next.v = tnow.v + writer_hbcontrol_intv (wr, &whcst, tnow);
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    struct wr_prd_match *m;
 | 
			
		||||
    struct ddsi_guid last_guid = { .prefix = {.u = {0,0,0}}, .entityid = {0} };
 | 
			
		||||
 | 
			
		||||
    hbansreq = writer_hbcontrol_ack_required (wr, &whcst, tnow);
 | 
			
		||||
    const int hbansreq = writer_hbcontrol_ack_required (wr, &whcst, tnow);
 | 
			
		||||
    t_next.v = tnow.v + writer_hbcontrol_intv (wr, &whcst, tnow);
 | 
			
		||||
 | 
			
		||||
    while ((m = ddsrt_avl_lookup_succ (&wr_readers_treedef, &wr->readers, &last_guid)) != NULL)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,6 +15,7 @@
 | 
			
		|||
#include "dds/ddsrt/string.h"
 | 
			
		||||
#include "dds/ddsi/ddsi_security_msg.h"
 | 
			
		||||
#include "mem_ser.h"
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
 | 
			
		||||
static nn_participant_generic_message_t test_msg_in =
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -302,6 +303,7 @@ CU_Test (ddsi_security_msg, serializer)
 | 
			
		|||
 | 
			
		||||
  /* Check serialization result. */
 | 
			
		||||
  size_t cmpsize = (len < sizeof(test_msg_ser)) ? len : sizeof(test_msg_ser);
 | 
			
		||||
  assert(data != NULL); /* for Clang static analyzer */
 | 
			
		||||
  if (memcmp (data, test_msg_ser, cmpsize) != 0)
 | 
			
		||||
  {
 | 
			
		||||
    printf ("memcmp(%d)\n", (int)cmpsize);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue