From: koushik.girijala Date: Mon, 29 Feb 2016 13:08:05 +0000 (+0530) Subject: Fix for issues reported on SVACE tool for CA X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7b6050ab0f8ea9f9b7fcf29720742f094f2cd40d;p=contrib%2Fiotivity.git Fix for issues reported on SVACE tool for CA Fixed issues reported on running svace analysis to CA Change-Id: I761aeccd576744c179da2042917cacf57d6e473b Signed-off-by: koushik.girijala Reviewed-on: https://gerrit.iotivity.org/gerrit/5273 Tested-by: jenkins-iotivity Reviewed-by: Habib Virji --- diff --git a/resource/c_common/ocrandom/src/ocrandom.c b/resource/c_common/ocrandom/src/ocrandom.c index 525ea9f..95472b6 100644 --- a/resource/c_common/ocrandom/src/ocrandom.c +++ b/resource/c_common/ocrandom/src/ocrandom.c @@ -48,6 +48,10 @@ #include #endif +#if !defined(__ANDROID__) || defined(__linux__) || defined(__APPLE__) || defined(__TIZEN__) +#define NANO_SEC 1000000000 +#endif + #ifdef ARDUINO #include "Arduino.h" @@ -106,15 +110,15 @@ int8_t OCSeedRandom() #ifdef __ANDROID__ struct timespec getTs; clock_gettime(CLOCK_MONOTONIC, &getTs); - currentTime = (getTs.tv_sec * (uint64_t)1000000000 + getTs.tv_nsec)/1000; + currentTime = (getTs.tv_sec * (uint64_t)NANO_SEC + getTs.tv_nsec)/1000; #elif _POSIX_TIMERS > 0 struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - currentTime = ts.tv_sec * 1000000 + ts.tv_nsec / 1000; + currentTime = (ts.tv_sec * (uint64_t)NANO_SEC + ts.tv_nsec)/ 1000; #else struct timeval tv; gettimeofday(&tv, NULL); - currentTime = tv.tv_sec * 1000000 + tv.tv_usec; + currentTime = tv.tv_sec * (uint64_t)1000000 + tv.tv_usec; #endif int32_t fd = open("/dev/urandom", O_RDONLY); diff --git a/resource/csdk/connectivity/src/ip_adapter/tizen/caipnwmonitor.c b/resource/csdk/connectivity/src/ip_adapter/tizen/caipnwmonitor.c index 88427f3..437e535 100644 --- a/resource/csdk/connectivity/src/ip_adapter/tizen/caipnwmonitor.c +++ b/resource/csdk/connectivity/src/ip_adapter/tizen/caipnwmonitor.c @@ -254,7 +254,6 @@ u_arraylist_t *CAIPGetInterfaceInformation(int desiredIndex) caglobals.ip.nm.numIfItems = 0; for (size_t i = 0; i < interfaces; i++) { - CAResult_t result = CA_STATUS_OK; struct ifreq* item = &ifr[i]; char *name = item->ifr_name; struct sockaddr_in *sa4 = (struct sockaddr_in *)&item->ifr_addr; @@ -286,7 +285,7 @@ u_arraylist_t *CAIPGetInterfaceInformation(int desiredIndex) } // Add IPv4 interface - result = CAAddInterfaceItem(iflist, ifindex, name, AF_INET, ipv4addr, flags); + CAResult_t result = CAAddInterfaceItem(iflist, ifindex, name, AF_INET, ipv4addr, flags); if (CA_STATUS_OK != result) { goto exit;