[IOT-2067] Don't call ConvertUuidToStr from ocprovision
authorDan Mihai <Daniel.Mihai@microsoft.com>
Wed, 19 Apr 2017 19:07:07 +0000 (12:07 -0700)
committerDave Thaler <dthaler@microsoft.com>
Thu, 27 Apr 2017 14:46:22 +0000 (14:46 +0000)
Don't call ConvertUuidToStr from ocprovision and the C++ apps
linking with this library.

Change-Id: Ie440f0d368b3bdc15a5055eb1161b0f33586a375
Signed-off-by: Dan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/19173
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dave Thaler <dthaler@microsoft.com>
resource/csdk/stack/octbstack_product_secured.def
resource/provisioning/src/OCProvisioningManager.cpp

index 14df087..7d93d84 100644 (file)
@@ -1,8 +1,6 @@
 ; Windows octbstack.dll exports that are required for both products and tests,
 ; but only when building with SECURED=1.
 
-ConvertUuidToStr
-
 OCAssertRoles
 OCConfigSelfOwnership
 OCConvertDerCSRToPem
index 8362831..6ebe118 100644 (file)
@@ -19,6 +19,7 @@
  * *****************************************************************/
 
 #include "ocstack.h"
+#include "ocrandom.h"
 #include "srmutility.h"
 #include "base64.h"
 #include "OCProvisioningManager.hpp"
@@ -1489,19 +1490,19 @@ namespace OC
     std::string OCSecureResource::getDeviceID()
     {
         std::ostringstream deviceId("");
-        char *devID = nullptr;
+        char devID[UUID_STRING_SIZE];
 
         validateSecureResource();
 
-        if (OC_STACK_OK == ConvertUuidToStr(&(devPtr->doxm->deviceID), &devID))
+        if (OCConvertUuidToString(devPtr->doxm->deviceID.id, devID))
         {
             deviceId << devID;
-            free(devID);
         }
         else
         {
             oclog() <<"Can not convert uuid to struuid";
         }
+
         return deviceId.str();
     }