'libs/gtkmm2ext' - Use 'std::vector' instead of dynamically sized arrays (required to be buildable with MSVC)

This commit is contained in:
John Emmas 2013-08-26 17:28:03 +01:00
parent 9a877a54e8
commit c1a25550d1
2 changed files with 8 additions and 6 deletions

View 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);
}

View 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);