'libs/gtkmm2ext' - Use 'std::vector' instead of dynamically sized arrays (required...
authorJohn Emmas <johne53@tiscali.co.uk>
Mon, 26 Aug 2013 16:28:03 +0000 (17:28 +0100)
committerJohn Emmas <johne53@tiscali.co.uk>
Mon, 26 Aug 2013 16:28:03 +0000 (17:28 +0100)
libs/gtkmm2ext/actions.cc
libs/gtkmm2ext/cairocell.cc

index 84a738f278559a84f1a6149327d6e9a8bbaa3abf..200308a254b3bdbafae9b32ed89af930eaf3b115 100644 (file)
@@ -27,6 +27,7 @@
 #include <gtk/gtkuimanager.h>
 #include <gtk/gtkactiongroup.h>
 
+#include <gtkmm.h>
 #include <gtkmm/accelmap.h>
 #include <gtkmm/uimanager.h>
 
@@ -265,15 +266,15 @@ ActionManager::get_action (const char* path)
                path++;
        }
 
-       char copy[len+1];
-       strcpy (copy, path);
-       char* slash = strchr (copy, '/');
+       vector<char> copy(len+1);
+       strcpy (&copy[0], path);
+       char* slash = strchr (&copy[0], '/');
        if (!slash) {
                return RefPtr<Action> ();
        }
        *slash = '\0';
 
-       return get_action (copy, ++slash);
+       return get_action (&copy[0], ++slash);
        
 }
 
index f20f537e1b972f2ebafadde4b55258fed6d14ef8..c449cae5920ed1d4dcc07f0221512c0795ea14cb 100644 (file)
@@ -25,6 +25,7 @@
 #include "gtkmm2ext/utils.h"
 
 using std::string;
+using std::vector;
 using std::map;
 using std::max;
 using std::cerr;
@@ -132,7 +133,7 @@ void
 CairoTextCell::set_size (Cairo::RefPtr<Cairo::Context>& context)
 {
        const uint32_t lim = (uint32_t) ceil (_width_chars);
-       char buf[lim+1];
+       vector<char> buf(lim+1);
        uint32_t n;
        double max_width = 0.0;
        double max_height = 0.0;
@@ -149,7 +150,7 @@ CairoTextCell::set_size (Cairo::RefPtr<Cairo::Context>& context)
                        buf[n] = '0' + digit; 
                }
                
-               context->get_text_extents (buf, ext);
+               context->get_text_extents (&buf[0], ext);
                
                max_width = max (ext.width + ext.x_bearing, max_width);
                max_height = max (ext.height, max_height);