replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / service / resource-container / examples / HueSampleBundle / src / HueConnector.cpp
index 5a5a956..297faa1 100644 (file)
@@ -68,8 +68,8 @@ void HueConnector::disconnect()
 std::string HueConnector::transmit(std::string target, std::string payload)
 {
     std::cout << "Transmitting to " << target << " " << payload << endl;
-    CURL *curl;
-    CURLcode res;
+    CURL *curl = NULL;
+    CURLcode res = CURLE_OK;
     struct curl_slist *headers = NULL; /* http headers to send with request */
     /* set content type */
     headers = curl_slist_append(headers, "Accept: application/json");
@@ -95,7 +95,9 @@ std::string HueConnector::transmit(std::string target, std::string payload)
         res = curl_easy_perform(curl);
         /* Check for errors */
         if (res != CURLE_OK)
+        {
             fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
+        }
 
         /* always cleanup */
         curl_easy_cleanup(curl);
@@ -112,8 +114,8 @@ static int writer(char *data, size_t size, size_t nmemb, std::string *buffer_in)
 std::string HueConnector::read(std::string target)
 {
     std::cout << "Reading from to " << target << endl;
-    CURL *curl;
-    CURLcode res;
+    CURL *curl = NULL;
+    CURLcode res = CURLE_OK;
     struct curl_slist *headers = NULL; /* http headers to send with request */
     /* set content type */
     headers = curl_slist_append(headers, "Accept: application/json");