From c622c19e50e8befa76cf0400be2628f9d54d9eb6 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 6 Feb 2010 18:08:47 +0000 Subject: [PATCH] ISO C++ forbids variable length array 'buf' git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@281 e54a6e83-5905-42d5-8d5c-058d10e6a962 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/7db92a4c363a0d81d7e9dec39dc26c16a10b6060 Author: Jacek Jendrzej Date: 2010-02-06 (Sat, 06 Feb 2010) ------------------ This commit was generated by Migit --- lib/libtuxtxt/tuxtxt.cpp | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/lib/libtuxtxt/tuxtxt.cpp b/lib/libtuxtxt/tuxtxt.cpp index c480de263..1607086b5 100644 --- a/lib/libtuxtxt/tuxtxt.cpp +++ b/lib/libtuxtxt/tuxtxt.cpp @@ -83,7 +83,7 @@ void gethotlist() if (!fgets(line, sizeof(line), hl)) break; - if (1 == sscanf(line, "%x", &hotlist[maxhotlist+1])) + if (1 == sscanf(line, "%x", (unsigned int*)&hotlist[maxhotlist+1])) { if (hotlist[maxhotlist+1] >= 0x100 && hotlist[maxhotlist+1] <= 0x899) { @@ -4084,33 +4084,37 @@ void FillTrapez(int x0, int y0, int l0, int xoffset1, int h, int l1, int color) } void FlipHorz(int x, int y, int w, int h) { - unsigned char buf[w*4]; + unsigned char *buf= new unsigned char[w*4]; unsigned char *p = lfb + x*4 + y * fix_screeninfo.line_length; int w1,h1; - - for (h1 = 0 ; h1 < h ; h1++) - { - memcpy(buf,p,w*4); - for (w1 = 0 ; w1 < w ; w1++) + if(buf != NULL){ + for (h1 = 0 ; h1 < h ; h1++) { - memcpy(p+w1*4,buf+((w-w1)*4)-4,4); + memcpy(buf,p,w*4); + for (w1 = 0 ; w1 < w ; w1++) + { + memcpy(p+w1*4,buf+((w-w1)*4)-4,4); + } + p += fix_screeninfo.line_length; } - p += fix_screeninfo.line_length; + delete [] buf; } } void FlipVert(int x, int y, int w, int h) { - unsigned char buf[w*4]; + unsigned char *buf= new unsigned char[w*4]; unsigned char *p = lfb + x*4 + y * fix_screeninfo.line_length, *p1, *p2; int h1; - - for (h1 = 0 ; h1 < h/2 ; h1++) - { - p1 = (p+(h1*fix_screeninfo.line_length)); - p2 = (p+(h-(h1+1))*fix_screeninfo.line_length); - memcpy(buf,p1,w*4); - memcpy(p1,p2,w*4); - memcpy(p2,buf,w*4); + if(buf != NULL){ + for (h1 = 0 ; h1 < h/2 ; h1++) + { + p1 = (p+(h1*fix_screeninfo.line_length)); + p2 = (p+(h-(h1+1))*fix_screeninfo.line_length); + memcpy(buf,p1,w*4); + memcpy(p1,p2,w*4); + memcpy(p2,buf,w*4); + } + delete [] buf; } }