fix novice-level mistake that causes localedir to point to random, reusable (typicall...
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 17 Apr 2015 15:00:33 +0000 (11:00 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 17 Apr 2015 15:00:33 +0000 (11:00 -0400)
gtk2_ardour/bundle_env.h
gtk2_ardour/bundle_env_cocoa.cc
gtk2_ardour/bundle_env_linux.cc
gtk2_ardour/bundle_env_mingw.cc
gtk2_ardour/bundle_env_msvc.cc
gtk2_ardour/main.cc

index 3a2ca4c54d4bb762dc8438485362a117213f2b69..95a26962311ef4bf401bd18653498de36872712d 100644 (file)
 #ifndef __gtk2_ardour_bundle_env_h__
 #define __gtk2_ardour_bundle_env_h__
 
+#include <string>
+
 /** This function must do whatever is necessary to create the right runtime
  * environment for the GTK2 version of ardour, on a per-platform basis. 
  */
 
-void fixup_bundle_environment (int, char* [], const char** localedir);
+void fixup_bundle_environment (int, char* [], std::string & localedir);
 
 /** Load any fonts required by the GTK2 version of ardour, on a per-platform
  * basis.
index 316bc8dce3b2a0a3198b6d33eca0c6ffc786be32..1f55b10954e11478ceb522a28a4459e832bced17 100644 (file)
@@ -52,7 +52,7 @@ using namespace std;
 extern void set_language_preference (); // cocoacarbon.mm
 
 void
-fixup_bundle_environment (int, char* [], const char** localedir)
+fixup_bundle_environment (int, char* [], string & localedir)
 {
        if (!g_getenv ("ARDOUR_BUNDLED")) {
                return;
@@ -84,7 +84,7 @@ fixup_bundle_environment (int, char* [], const char** localedir)
                lpath.push_back (bundle_dir);
                lpath.push_back ("Resources");
                lpath.push_back ("locale");
-               (*localedir) = strdup (Glib::build_filename (lpath).c_str());
+               localedir = strdup (Glib::build_filename (lpath).c_str());
        }
 #endif
                
index 54404b14fb7fa83ae5376432edb54965926ee54e..1766021da115a2ff7618ab048348cc0819c95122 100644 (file)
@@ -46,7 +46,7 @@ using namespace ARDOUR;
 using namespace std;
 
 void
-fixup_bundle_environment (int /*argc*/, char* argv[], const char** localedir)
+fixup_bundle_environment (int /*argc*/, char* argv[], string & localedir)
 {
        /* THIS IS FOR LINUX - its just about the only place where its
         * acceptable to build paths directly using '/'.
@@ -63,14 +63,14 @@ fixup_bundle_environment (int /*argc*/, char* argv[], const char** localedir)
 
 #ifdef ENABLE_NLS
        if (!ARDOUR::translations_are_enabled ()) {
-               (*localedir) = "/this/cannot/exist";
+               localedir = "/this/cannot/exist";
        } else {
                /* force localedir into the bundle */
                vector<string> lpath;
                lpath.push_back (dir_path);
                lpath.push_back ("share");
                lpath.push_back ("locale");
-               (*localedir) = canonical_path (Glib::build_filename (lpath)).c_str();
+               localedir = canonical_path (Glib::build_filename (lpath)).c_str();
        }
 #endif
 
index 312d56def7c73ed76a12a11176cd0d3bb23da8e5..e97bc0bd996b9f93b04e6a66a2a034cfe9efe42d 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include <stdlib.h>
+#inc;ude <string>
 #include "bundle_env.h"
 #include "i18n.h"
 
@@ -84,7 +85,7 @@ get_install_path ()
 
 
 void
-fixup_bundle_environment (int, char* [], const char** localedir)
+fixup_bundle_environment (int, char* [], string & localedir)
 {
        EnvironmentalProtectionAgency::set_global_epa (new EnvironmentalProtectionAgency (true));
        /* what to do ? */
@@ -103,7 +104,7 @@ fixup_bundle_environment (int, char* [], const char** localedir)
                Glib::setenv ("GTK_LOCALEDIR", path, true);
 
                // and return the same path to our caller
-               (*localedir) = strdup (path.c_str());
+               localedir = path;
        }
 
        const char *cstr;
index 08087fa0d1525c6817ac50ffcb85940a6dc346ab..7189892f5f106fb8ceab3099dbd8ee895cacf7dd 100644 (file)
@@ -341,7 +341,7 @@ string clearlooks_la_file;
 }
 
 void
-fixup_bundle_environment (int argc, char* argv[], const char** localedir)
+fixup_bundle_environment (int argc, char* argv[], string & localedir)
 {
        std::string exec_path = argv[0];
        std::string dir_path  = Glib::path_get_dirname (exec_path);
@@ -450,7 +450,7 @@ fixup_bundle_environment (int argc, char* argv[], const char** localedir)
                Glib::setenv ("GTK_LOCALEDIR", path, true);
 
                // and return the same path to our caller
-               (*localedir) = strdup (path.c_str());
+               localedir = path;
        }
 
 
index 5cf43700f1d1781800a64911716bbf6febf4d900..abdfa35877a8e461b925664e20f252b2d408bf74 100644 (file)
@@ -74,7 +74,7 @@ TextReceiver text_receiver ("ardour");
 extern int curvetest (string);
 
 static ARDOUR_UI  *ui = 0;
-static const char* localedir = LOCALEDIR;
+static string localedir (LOCALEDIR);
 
 void
 gui_jack_error ()
@@ -253,7 +253,7 @@ int main (int argc, char *argv[])
 {
        ARDOUR::check_for_old_configuration_files();
 
-       fixup_bundle_environment (argc, argv, &localedir);
+       fixup_bundle_environment (argc, argv, localedir);
 
        load_custom_fonts(); /* needs to happen before any gtk and pango init calls */
 
@@ -277,7 +277,7 @@ int main (int argc, char *argv[])
 #ifdef ENABLE_NLS
        cerr << "bind txt domain [" << PACKAGE << "] to " << localedir << endl;
 
-       (void) bindtextdomain (PACKAGE, localedir);
+       (void) bindtextdomain (PACKAGE, localedir.c_str());
        /* our i18n translations are all in UTF-8, so make sure
           that even if the user locale doesn't specify UTF-8,
           we use that when handling them.
@@ -330,7 +330,7 @@ int main (int argc, char *argv[])
                     << endl;
        }
 
-       if (!ARDOUR::init (ARDOUR_COMMAND_LINE::use_vst, ARDOUR_COMMAND_LINE::try_hw_optimization, localedir)) {
+       if (!ARDOUR::init (ARDOUR_COMMAND_LINE::use_vst, ARDOUR_COMMAND_LINE::try_hw_optimization, localedir.c_str())) {
                error << string_compose (_("could not initialize %1."), PROGRAM_NAME) << endmsg;
                exit (1);
        }
@@ -346,7 +346,7 @@ int main (int argc, char *argv[])
 #endif
 
        try {
-               ui = new ARDOUR_UI (&argc, &argv, localedir);
+               ui = new ARDOUR_UI (&argc, &argv, localedir.c_str());
        } catch (failed_constructor& err) {
                error << string_compose (_("could not create %1 GUI"), PROGRAM_NAME) << endmsg;
                exit (1);