compile fix: ISO C++ forbids variable length array 'names'
This commit is contained in:
parent
f8c61a1ba2
commit
9cd953b2e1
2 changed files with 10 additions and 6 deletions
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue