diff --git a/src/apppstatus.cc b/src/apppstatus.cc index 22efde8b3..7585b455e 100644 --- a/src/apppstatus.cc +++ b/src/apppstatus.cc @@ -786,7 +786,7 @@ void NetStatusControl::linuxUpdate() { } int const count(fNetStatus.getCount()); - bool covered[count]; + asmart covered(new bool[count]); for (int i = 0; i < count; ++i) { covered[i] = (nullptr == fNetStatus[i]); } diff --git a/src/misc.cc b/src/misc.cc index e1ecc6e18..0098deed9 100644 --- a/src/misc.cc +++ b/src/misc.cc @@ -31,6 +31,7 @@ #include "intl.h" #include "ascii.h" +#include "ypointer.h" using namespace ASCII; @@ -736,7 +737,7 @@ int process_close(FILE* fp, int pid) { void show_backtrace(const int limit) { #if defined(HAVE_BACKTRACE_SYMBOLS_FD) && defined(HAVE_EXECINFO_H) const int asize = Elvis(limit, 20); - void *array[asize]; + asmart array(new void*[asize]); const int count = backtrace(array, asize); const char tool[] = "/usr/bin/addr2line"; char* prog = progpath(); diff --git a/src/wmdock.cc b/src/wmdock.cc index 56d5a1ecc..eebcf3671 100644 --- a/src/wmdock.cc +++ b/src/wmdock.cc @@ -357,7 +357,7 @@ void DockApp::proper() { if (intern) { const int count = docks.getCount(); if (count) { - Atom atoms[count]; + asmart atoms(new Atom[count]); for (int i = 0; i < count; ++i) { atoms[i] = Atom(docks[i].client->handle()); } diff --git a/src/wmmgr.cc b/src/wmmgr.cc index fbc6048c1..6316f69e3 100644 --- a/src/wmmgr.cc +++ b/src/wmmgr.cc @@ -3079,7 +3079,7 @@ void YWindowManager::setDesktopCount() { void YWindowManager::setDesktopViewport() { MSG(("setting: _NET_DESKTOP_VIEWPORT")); const int n = 2 * workspaceCount; - Atom data[n]; + asmart data(new Atom[n]); for (int i = 0; i < n; ++i) data[i] = 0; setProperty(_XA_NET_DESKTOP_VIEWPORT, XA_CARDINAL, data, n); diff --git a/src/wmpref.cc b/src/wmpref.cc index f95dabdda..0bfafe8e6 100644 --- a/src/wmpref.cc +++ b/src/wmpref.cc @@ -42,7 +42,7 @@ PrefsMenu::PrefsMenu() : addSubmenu("S_calar", -2, sc = new YMenu, "key"); addSubmenu("St_ring", -2, st = new YMenu, "key"); - int index[count]; + asmart index(new int[count]); for (int i = 0; i < count; ++i) { index[i] = i; } diff --git a/src/yarray.cc b/src/yarray.cc index 58dbffefc..32d2d295c 100644 --- a/src/yarray.cc +++ b/src/yarray.cc @@ -16,6 +16,7 @@ #include "config.h" #include "mstring.h" #include "yarray.h" +#include "ypointer.h" #include #include #include @@ -125,7 +126,7 @@ void YBaseArray::extend(const SizeType extendedCount) { void YBaseArray::moveto(const SizeType index, const SizeType place) { PRECONDITION(index < fCount); PRECONDITION(place < fCount); - unsigned char copy[fElementSize]; + asmart copy(new unsigned char[fElementSize]); memcpy(copy, getElement(index), fElementSize); if (index < place) { memmove(getElement(index), getElement(index + 1), diff --git a/src/yfontxft.cc b/src/yfontxft.cc index 4d09c9d33..6ef8461de 100644 --- a/src/yfontxft.cc +++ b/src/yfontxft.cc @@ -278,7 +278,8 @@ void YXftFont::drawLimitLeft(Graphics& g, XftFont* font, int x, int y, lo -= 1; if (0 < ew) { const int size = lo + 2; - wchar_t copy[size]; + asmart copy(new wchar_t[size]); + memcpy(copy, str, lo * sizeof(wchar_t)); copy[lo] = el; copy[lo + 1] = 0; @@ -310,7 +311,7 @@ void YXftFont::drawLimitRight(Graphics& g, XftFont* font, int x, int y, } if (0 < ew) { const int size = lo + 2; - wchar_t copy[size]; + asmart copy(new wchar_t[size]); memcpy(copy + 1, str + len - lo, lo * sizeof(wchar_t)); copy[0] = el; copy[lo + 1] = 0; diff --git a/src/yxtray.cc b/src/yxtray.cc index 725ab8726..6fc5ab19c 100644 --- a/src/yxtray.cc +++ b/src/yxtray.cc @@ -860,7 +860,7 @@ void YXTray::trayUpdateGeometry(unsigned w, unsigned h, bool visible) { void YXTray::updateTrayWindows() { const int count = fDocked.getCount(); - Window windows[count]; + asmart windows(new Window[count]); for (IterType ec = fDocked.iterator(); ++ec; ) windows[ec.where()] = ec->leader();