IOT-2539 Clean unused code warnnings
authorGeorge Nash <george.nash@intel.com>
Mon, 9 Oct 2017 21:48:05 +0000 (14:48 -0700)
committerNathan Heldt-Sheller <nathan.heldt-sheller@intel.com>
Thu, 12 Oct 2017 18:54:47 +0000 (18:54 +0000)
credresource.c:
Removed the [-Wunused-const-variable=] warning
The CRED_EMPTY_ROOT_MAP_SIZE was used in the past but is no longer
referenced anywhere in the code.

provisioningclient.c:
Removed the [-Wunused-const-variable=] warning
The SUPPORTED_PRMS array was used in the past but is no longer
referenced anywhere in the code.

ocserver.cpp
Removed the [-Wunused-variable] warning
Looking at the logs a instance that gDeviceUUID was used could not
be found at any point in time.

stacktest.cpp:
Removed the [-Wunused-variable] warnings
Variables peer, pinNumber, and pmSel were only used in Direct Pairing
related unit tests which were removed as part of IOT-2306.

provisioningclient.cpp:
Removed the [-Wunused-function] warning
The InputPdACL function was only used by the Direct Pairing code
that was removed as part of IOT-2306.

Bug: https://jira.iotivity.org/browse/IOT-2539
Bug: https://jira.iotivity.org/browse/IOT-2306
Change-Id: I80f52619a04ee7eafc83b79b886c1121f61a6ba1
Signed-off-by: George Nash <george.nash@intel.com>
resource/csdk/security/provisioning/sample/provisioningclient.c
resource/csdk/security/provisioning/unittest/secureresourceprovider.cpp
resource/csdk/security/src/credresource.c
resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp
resource/csdk/stack/test/stacktests.cpp
resource/provisioning/examples/provisioningclient.cpp

index f408049369178a3a180fd6a4a871a67447e82ba6..d59dc42d1fd15dc175f61783879f58fbea829a39 100644 (file)
@@ -98,10 +98,6 @@ static const char* ACL_PEMISN[5] = {"CREATE", "READ", "WRITE", "DELETE", "NOTIFY
 static const char* SVR_DB_FILE_NAME = "oic_svr_db_client.dat";
         // '_' for separaing from the same constant variable in |srmresourcestrings.c|
 static const char* PRVN_DB_FILE_NAME = "oic_prvn_mng.db";
-static const OicSecPrm_t  SUPPORTED_PRMS[1] =
-{
-    PRM_PRE_CONFIGURED,
-};
 
 static char* TEST_CERT_NOT_BEFORE = "20170101000000"; // Not before field for certificates, in format YYYYMMDDhhmmss
 static char* TEST_CERT_NOT_AFTER = "20270101000000";  // + ten years
index b9aa6c4cc717434e115781eef400ddeb0e022535..90a6d6a1af43ad97670364350739c3f5538170c4 100644 (file)
@@ -24,7 +24,6 @@ static OicSecAcl_t acl;
 static OCProvisionDev_t pDev1;
 static OCProvisionDev_t pDev2;
 static OicSecCredType_t credType = SYMMETRIC_PAIR_WISE_KEY;
-static OCProvisionDev_t selectedDeviceInfo;
 static OicSecOxm_t oicSecDoxmJustWorks = OIC_JUST_WORKS;
 static OicSecOxm_t oicSecDoxmRandomPin = OIC_RANDOM_DEVICE_PIN;
 static unsigned short timeout = 60;
index 8007c69f03266c980ce3b90157bae4b2334e583d..0a53f649114c816309a4b9d92a001a1569e16f41 100644 (file)
@@ -87,7 +87,6 @@ static const uint16_t CBOR_SIZE = 2048;
 
 /** CRED size - Number of mandatory items. */
 static const uint8_t CRED_ROOT_MAP_SIZE = 4;
-static const uint8_t CRED_EMPTY_ROOT_MAP_SIZE = 2;
 static const uint8_t CRED_MAP_SIZE = 3;
 static const uint8_t ROLEID_MAP_SIZE = 1;
 
index f7d4566ddc2e5107f203687c2a6b37b6daa18c1c..d860593ea9b61b6048bb8c5656014b49372ac24b 100644 (file)
@@ -86,7 +86,6 @@ static bool observeThreadStarted = false;
 char *gResourceUri = (char *)"/a/light";
 static const char *gDateOfManufacture = "2016-01-15";
 static const char *gDeviceName = "myDeviceName";
-static const char *gDeviceUUID = "51b55ddc-ccbb-4cb3-a57f-494eeca13a21";
 static const char *gFirmwareVersion = "myFirmwareVersion";
 static const char *gManufacturerName = "myName";
 static const char *gOperatingSystemVersion = "myOS";
index 36414e0321ddd63050b4d941ec5afa912d37c84e..302b198442223709ddc8d91f3024159a1c20c50e 100644 (file)
@@ -74,9 +74,6 @@ namespace itst = iotivity::test;
 char gDeviceUUID[] = "fe3f9a68-4931-4cb0-9ea4-81702b43116c";
 char gDevicePIID[] = "32684bf3-4c44-47b0-99fe-6a9a59b73a8d";
 char gManufacturerName[] = "myName";
-static OCPrm_t pmSel;
-static char pinNumber;
-static OCDPDev_t peer;
 
 std::chrono::seconds const SHORT_TEST_TIMEOUT = std::chrono::seconds(5);
 std::chrono::seconds const LONG_TEST_TIMEOUT = std::chrono::seconds(450);
index 2bd85653faa9a614f1946bcfffb0d79c13dd90cc..0cd26717c787f33db99d18bd2f6309d1b7b9d932 100644 (file)
@@ -624,84 +624,6 @@ static int InputCredentials(Credential &cred)
    return 0;
 }
 
-static OicSecPdAcl_t* InputPdACL()
-{
-    int ret;
-    char *temp_rsc, *temp_pms;
-
-    printf("******************************************************************************\n");
-    printf("-Set ACL policy for target DP device\n");
-    printf("******************************************************************************\n");
-
-    OicSecPdAcl_t *acl = (OicSecPdAcl_t *)OICCalloc(1,sizeof(OicSecPdAcl_t));
-    if (NULL == acl)
-    {
-        OIC_LOG(ERROR, TAG, "Error while memory allocation");
-        return NULL;
-    }
-
-    //Set Resource.
-    printf("Num. of Resource : ");
-    ret = scanf("%" PRIuPTR, &acl->resourcesLen);
-    if ((1 != ret) || (acl->resourcesLen <= 0 || acl->resourcesLen > 50))
-    {
-        printf("Error while input\n");
-        OICFree(acl);
-        return NULL;
-    }
-    printf("-URI of resource\n");
-    printf("ex)/oic/sh/temp/0 (Max_URI_Length: %d Byte )\n", MAX_URI_LENGTH);
-    acl->resources = (char **)OICCalloc(acl->resourcesLen, sizeof(char *));
-    if (NULL == acl->resources)
-    {
-        OIC_LOG(ERROR, TAG, "Error while memory allocation");
-        OICFree(acl);
-        return NULL;
-    }
-    for (size_t i = 0; i < acl->resourcesLen; i++)
-    {
-        printf("[%" PRIuPTR "]Resource : ", i + 1);
-        ret = scanf("%64ms", &temp_rsc);
-        if (1 != ret)
-        {
-            printf("Error while input\n");
-            OICFree(acl->resources);
-            OICFree(acl);
-            return NULL;
-        }
-
-        acl->resources[i] = OICStrdup(temp_rsc);
-        OICFree(temp_rsc);
-        if (NULL == acl->resources[i])
-        {
-            OIC_LOG(ERROR, TAG, "Error while memory allocation");
-            OICFree(acl->resources);
-            OICFree(acl);
-            return NULL;
-        }
-    }
-
-    // Set Permission
-    do
-    {
-        printf("-Set the permission(C,R,U,D,N)\n");
-        printf("ex) CRUDN, CRU_N,..(5 Charaters)\n");
-        printf("Permission : ");
-        ret = scanf("%5ms", &temp_pms);
-        if (1 != ret)
-        {
-            printf("Error while input\n");
-            OICFree(acl->resources);
-            OICFree(acl);
-            return NULL;
-        }
-        ret = CalculateAclPermission(temp_pms, &(acl->permission));
-        OICFree(temp_pms);
-    } while (0 != ret );
-
-    return acl;
-}
-
 OCStackResult displayMutualVerifNumCB(uint8_t mutualVerifNum[MUTUAL_VERIF_NUM_LEN])
 {
     OC_UNUSED(mutualVerifNum);