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
|
||||
|
@ -852,6 +852,8 @@ void Ewmh::updateWorkspaceNames(BScreen &screen) {
|
|||
for (size_t i = 0; i < number_of_desks; i++)
|
||||
delete[] names[i];
|
||||
|
||||
delete[] names;
|
||||
|
||||
}
|
||||
|
||||
void Ewmh::updateCurrentWorkspace(BScreen &screen) {
|
||||
|
|
|
@ -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];
|
||||
|
@ -245,6 +245,8 @@ void Gnome::updateWorkspaceNames(BScreen &screen) {
|
|||
// destroy name buffers
|
||||
for (size_t i = 0; i < number_of_desks; i++)
|
||||
delete[] names[i];
|
||||
|
||||
delete[] names;
|
||||
}
|
||||
|
||||
void Gnome::updateCurrentWorkspace(BScreen &screen) {
|
||||
|
|
Loading…
Reference in a new issue