From c23d86208cdc1dd6aeec4ba9d2a4b4ef5ab06cd1 Mon Sep 17 00:00:00 2001 From: Saurav Babu Date: Mon, 26 Feb 2018 14:26:23 +0530 Subject: [PATCH] Fixed compile time warnings Signed-off-by: Saurav Babu --- src/mot-agent/ma-subowner.c | 7 ++----- test/provisioningclient.c | 1 - test/subownerclient.c | 34 +++++++++++++++++++++++----------- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/mot-agent/ma-subowner.c b/src/mot-agent/ma-subowner.c index 65adf8f..b711e99 100755 --- a/src/mot-agent/ma-subowner.c +++ b/src/mot-agent/ma-subowner.c @@ -380,6 +380,7 @@ static FILE* _fopen_prvn_mng(const char* path, const char* mode) return fopen(data_dir, mode); } +#if 0 static OCProvisionDev_t* _clone_ocprovision_dev(const OCProvisionDev_t* src) { MA_LOGD(""); @@ -454,6 +455,7 @@ static OCProvisionDev_t* _clone_ocprovision_dev(const OCProvisionDev_t* src) return newDev; } +#endif #ifdef THREAD_COND_WAIT_USED /* @@ -516,11 +518,6 @@ static int _wait_cb_ret(int msec) struct timespec tim, tim2; tim.tv_sec = 0; tim.tv_nsec = 100 * 1000000; -#ifndef THREAD_COND_WAIT_USED - struct timespec request, remaining; - request.tv_sec = msec / 1000; - request.tv_nsec = (msec % 1000) * 1000000; -#endif ma_check_null_ret_error("g_client", g_client, OC_STACK_INVALID_PARAM); diff --git a/test/provisioningclient.c b/test/provisioningclient.c index be39a6f..f8639e9 100644 --- a/test/provisioningclient.c +++ b/test/provisioningclient.c @@ -1392,7 +1392,6 @@ static int selectMultipleOwnershipTrnasferMethod(void) printf(" Entered Wrong Number. Please Enter Again\n"); } - const int preconfOxm = 4; int oxm = 0; for( ; ; ) { diff --git a/test/subownerclient.c b/test/subownerclient.c index cee1a88..9f15523 100644 --- a/test/subownerclient.c +++ b/test/subownerclient.c @@ -71,23 +71,25 @@ extern "C" static const char* SVR_DB_FILE_NAME = "oic_svr_db_subowner_client.dat"; // '_' for separaing from the same constant variable in |srmresourcestrings.c| static const char* PRVN_DB_FILE_NAME = "oic_pdm_subowner.db"; +/* static const OicSecPrm_t SUPPORTED_PRMS[1] = { PRM_PRE_CONFIGURED, }; +*/ // |g_ctx| means provision manager application context and // the following, includes |un/own_list|, could be variables, which |g_ctx| has, // for accessing all function(s) for these, they are declared on global domain -static const char* g_ctx = "SubOwner Client Application Context"; +static char *g_ctx = "SubOwner Client Application Context"; static char* g_svr_fname; static char* g_prvn_fname; static OCProvisionDev_t* g_own_list; static OCProvisionDev_t* g_unown_list; static OCProvisionDev_t* g_motdev_list; static OCProvisionDev_t* g_mowned_list; -static int g_own_cnt; -static int g_unown_cnt; +//static int g_own_cnt; +//static int g_unown_cnt; static int g_motdev_cnt; static int g_mowned_cnt; static bool g_doneCB; @@ -95,12 +97,12 @@ static bool g_doneCB; // function declaration(s) for calling them before implementing static OCProvisionDev_t* getDevInst(const OCProvisionDev_t*, const int); static int printDevList(const OCProvisionDev_t*); -static size_t printUuidList(const OCUuidList_t*); +//static size_t printUuidList(const OCUuidList_t*); static int printResultList(const OCProvisionResult_t*, const int); static void printUuid(const OicUuid_t*); static FILE* fopen_prvnMng(const char*, const char*); static int waitCallbackRet(void); -static int selectTwoDiffNum(int*, int*, const int, const char*); +//static int selectTwoDiffNum(int*, int*, const int, const char*); // callback function(s) for provisioning client using C-level provisioning API static void multipleOwnershipTransferCB(void* ctx, int nOfRes, OCProvisionResult_t* arr, bool hasError) @@ -117,6 +119,7 @@ static void multipleOwnershipTransferCB(void* ctx, int nOfRes, OCProvisionResult g_doneCB = true; } +#if 0 // callback function(s) for provisioning client using C-level provisioning API static void ownershipTransferCB(void* ctx, int nOfRes, OCProvisionResult_t* arr, bool hasError) { @@ -159,6 +162,7 @@ static void provisionCredCB(void* ctx, int nOfRes, OCProvisionResult_t* arr, boo } g_doneCB = true; } +#endif static void provisionAclCB(void* ctx, int nOfRes, OCProvisionResult_t* arr, bool hasError) { @@ -175,8 +179,8 @@ static void provisionAclCB(void* ctx, int nOfRes, OCProvisionResult_t* arr, bool } // response handler for LED requests. -static void LedCB(void *ctx, OCDoHandle UNUSED, - OCClientResponse *clientResponse) +static OCStackApplicationResult LedCB(void *ctx, OCDoHandle UNUSED, + OCClientResponse *clientResponse) { if(clientResponse) { @@ -185,7 +189,8 @@ static void LedCB(void *ctx, OCDoHandle UNUSED, printf("Received OC_STACK_OK from server\n"); if(clientResponse->payload) { - printf("Response ===================> %s\n", clientResponse->payload); + printf("Response ===================> %d\n", + clientResponse->payload->type); } } else if(OC_STACK_RESOURCE_CHANGED == clientResponse->result) @@ -203,6 +208,8 @@ static void LedCB(void *ctx, OCDoHandle UNUSED, } g_doneCB = true; + + return OC_STACK_DELETE_TRANSACTION; } static void inputPinCB(char* pin, size_t len) @@ -608,7 +615,7 @@ static int provisionAclForLed() for( ; 0x20<=getchar(); ); // for removing overflow garbages // '0x20<=code' is character region } - if(0=dev_num) + if(0 < dev_num && g_mowned_cnt >= dev_num) { break; } @@ -653,6 +660,7 @@ PVACL_ERROR: return -1; } +#if 0 static int provisionCred() { // check |unown_list| for registering devices @@ -745,6 +753,7 @@ static int provisionCred() PVPWS_ERROR: return -1; } +#endif static OCProvisionDev_t* getDevInst(const OCProvisionDev_t* dev_lst, const int dev_num) { @@ -789,6 +798,7 @@ static int printDevList(const OCProvisionDev_t* dev_lst) return lst_cnt; } +#if 0 static size_t printUuidList(const OCUuidList_t* uid_lst) { if(!uid_lst) @@ -810,6 +820,7 @@ static size_t printUuidList(const OCUuidList_t* uid_lst) return lst_cnt; } +#endif static int printResultList(const OCProvisionResult_t* rslt_lst, const int rslt_cnt) { @@ -850,7 +861,7 @@ static FILE* fopen_prvnMng(const char* path, const char* mode) // with its own |SVR_DB_FILE_NAME| char data_dir[MAX_FILE_PATH_LEN] = {0,}; - snprintf(data_dir, MAX_FILE_PATH_LEN, "%s/network/%s", + snprintf(data_dir, MAX_FILE_PATH_LEN, "%s/network/%s", tzplatform_getenv(TZ_SYS_GLOBALUSER_DATA), SVR_DB_FILE_NAME); (void)path; // unused |path| parameter @@ -878,6 +889,7 @@ static int waitCallbackRet(void) return 0; } +#if 0 static int selectTwoDiffNum(int* a, int* b, const int max, const char* str) { if(!a || !b || 2>max || !str) @@ -915,6 +927,7 @@ static int selectTwoDiffNum(int* a, int* b, const int max, const char* str) return -1; } +#endif static void printMenu(void) { @@ -955,7 +968,6 @@ int main() // main loop for provisioning manager int mnNum = 0; - int selDevNum = 0; for( ; ; ) { printf("\n"); -- 2.7.4