Don't use references for constant c-types
[ardour.git] / libs / ardour / soundcloud_upload.cc
index c7bd4605df018536254f8d5b6138ce53f461eff0..3c05b5aa78a69cdf06a2b52b2afcb5eb040e5575 100644 (file)
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <iostream>
-#include <pbd/gstdio_compat.h>
+#include "pbd/gstdio_compat.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace PBD;
 
-size_t
+static size_t
 WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
 {
        register int realsize = (int)(size * nmemb);
@@ -52,6 +52,8 @@ WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
 }
 
 SoundcloudUploader::SoundcloudUploader()
+: errorBuffer()
+, caller(0)
 {
        curl_handle = curl_easy_init();
        multi_handle = curl_multi_init();
@@ -118,7 +120,7 @@ SoundcloudUploader::Get_Auth_Token( std::string username, std::string password )
        // perform online request
        CURLcode res = curl_easy_perform(curl_handle);
        if (res != 0) {
-               DEBUG_TRACE (DEBUG::Soundcloud, string_compose ("curl error %1 (%2)", res, curl_easy_strerror(res) ) );
+               DEBUG_TRACE (DEBUG::Soundcloud, string_compose ("curl error %1 (%2)\n", res, curl_easy_strerror(res) ) );
                return "";
        }
 
@@ -146,7 +148,7 @@ int
 SoundcloudUploader::progress_callback(void *caller, double dltotal, double dlnow, double ultotal, double ulnow)
 {
        SoundcloudUploader *scu = (SoundcloudUploader *) caller;
-       DEBUG_TRACE (DEBUG::Soundcloud, string_compose ("%1: uploaded %2 of %3", scu->title, ulnow, ultotal) );
+       DEBUG_TRACE (DEBUG::Soundcloud, string_compose ("%1: uploaded %2 of %3\n", scu->title, ulnow, ultotal) );
        scu->caller->SoundcloudProgress(ultotal, ulnow, scu->title); /* EMIT SIGNAL */
        return 0;
 }
@@ -302,19 +304,19 @@ SoundcloudUploader::Upload(std::string file_path, std::string title, std::string
                XMLNode *root = doc.root();
 
                if (!root) {
-                       DEBUG_TRACE (DEBUG::Soundcloud, "no root XML node!");
+                       DEBUG_TRACE (DEBUG::Soundcloud, "no root XML node!\n");
                        return "";
                }
 
                XMLNode *url_node = root->child("permalink-url");
                if (!url_node) {
-                       DEBUG_TRACE (DEBUG::Soundcloud, "no child node \"permalink-url\" found!");
+                       DEBUG_TRACE (DEBUG::Soundcloud, "no child node \"permalink-url\" found!\n");
                        return "";
                }
 
                XMLNode *text_node = url_node->child("text");
                if (!text_node) {
-                       DEBUG_TRACE (DEBUG::Soundcloud, "no text node found!");
+                       DEBUG_TRACE (DEBUG::Soundcloud, "no text node found!\n");
                        return "";
                }
 
@@ -344,7 +346,7 @@ SoundcloudUploader::setcUrlOptions()
        curl_easy_setopt(curl_handle, CURLOPT_ERRORBUFFER, errorBuffer);
        // Allow redirection
        curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
-       
+
        // Allow connections to time out (without using signals)
        curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
        curl_easy_setopt(curl_handle, CURLOPT_CONNECTTIMEOUT, 30);