From 9cd953b2e11d0909375b9bd9cf4b9045b7c27729 Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Wed, 30 Sep 2009 21:05:42 +0200 Subject: compile fix: ISO C++ forbids variable length array 'names' --- src/Ewmh.cc | 8 +++++--- src/Gnome.cc | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Ewmh.cc b/src/Ewmh.cc index 82653a5..4062595 100644 --- a/src/Ewmh.cc +++ b/src/Ewmh.cc @@ -822,7 +822,7 @@ void Ewmh::updateWorkspaceNames(BScreen &screen) { const BScreen::WorkspaceNames &workspacenames = screen.getWorkspaceNames(); const size_t number_of_desks = workspacenames.size(); - char *names[number_of_desks]; + char** names = new char*[number_of_desks]; for (size_t i = 0; i < number_of_desks; i++) { names[i] = new char[workspacenames[i].size() + 1]; // +1 for \0 @@ -844,13 +844,15 @@ void Ewmh::updateWorkspaceNames(BScreen &screen) { #else if (XStringListToTextProperty(names, number_of_desks, &text)) { XSetTextProperty(FbTk::App::instance()->display(), screen.rootWindow().window(), - &text, m_net->desktop_names); + &text, m_net->desktop_names); XFree(text.value); } #endif for (size_t i = 0; i < number_of_desks; i++) - delete [] names[i]; + delete[] names[i]; + + delete[] names; } diff --git a/src/Gnome.cc b/src/Gnome.cc index 79f7cf6..3b37e56 100644 --- a/src/Gnome.cc +++ b/src/Gnome.cc @@ -228,7 +228,7 @@ void Gnome::updateWorkspaceNames(BScreen &screen) { size_t number_of_desks = screen.getWorkspaceNames().size(); const BScreen::WorkspaceNames &workspace_names = screen.getWorkspaceNames(); // convert our desktop names to a char * so we can send it - char *names[number_of_desks]; + char** names = new char*[number_of_desks]; for (size_t i = 0; i < number_of_desks; i++) { names[i] = new char[workspace_names[i].size() + 1]; @@ -238,13 +238,15 @@ void Gnome::updateWorkspaceNames(BScreen &screen) { XTextProperty text; if (XStringListToTextProperty(names, number_of_desks, &text)) { XSetTextProperty(FbTk::App::instance()->display(), screen.rootWindow().window(), - &text, m_gnome_wm_win_workspace_names); + &text, m_gnome_wm_win_workspace_names); XFree(text.value); } // destroy name buffers for (size_t i = 0; i < number_of_desks; i++) - delete [] names[i]; + delete[] names[i]; + + delete[] names; } void Gnome::updateCurrentWorkspace(BScreen &screen) { -- cgit v0.11.2