[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Bkde-workspace=5D_ksplash/ksplashx=3A_Fix_non-gcc_bu?=
From:       Alberto Mattea <alberto () mattea ! info>
Date:       2011-06-27 14:31:26
Message-ID: 20110627143126.3A871A60A9 () git ! kde ! org
[Download RAW message or body]

Git commit 51ff00ae5a0019ecaa5928a05c5e2e427c24d229 by Alberto Mattea.
Committed on 27/06/2011 at 16:28.
Pushed by mattea into branch 'master'.

Fix non-gcc build
Patch by tropikhajma
CCBUG: 276559

M  +4    -2    ksplash/ksplashx/main.cpp     

http://commits.kde.org/kde-workspace/51ff00ae5a0019ecaa5928a05c5e2e427c24d229

diff --git a/ksplash/ksplashx/main.cpp b/ksplash/ksplashx/main.cpp
index 5d133b7..f4d520d 100644
--- a/ksplash/ksplashx/main.cpp
+++ b/ksplash/ksplashx/main.cpp
@@ -25,6 +25,7 @@ along with this program.  If not, see \
<http://www.gnu.org/licenses/>.  #include <errno.h>
 #include <signal.h>
 #include <math.h>
+#include <alloca.h>
 
 int screen_number = 0;
 int number_of_screens = 1;
@@ -101,8 +102,9 @@ int main( int argc, char* argv[] )
                     }
                 // Calculate the array size: part before the dot + length of the \
                screen
                 // string (which is log10 + 1) + 1 for the dot itself + 8 for \
                "DISPLAY=" + \0
-                char envir[breakpos + (int)log10(number_of_screens) + 11];
-                char server_name[breakpos + 1];
+                // We use alloca and casts to allow non-gcc build
+                char *envir; envir = (char*) alloca((breakpos + \
(int)log10((double)number_of_screens) + 11) * sizeof(*envir)); +                char \
*server_name; server_name = (char*) alloca((breakpos + 1)*sizeof(char*));  \
strncpy(server_name, display_name, breakpos);  server_name[breakpos] = '\0';
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic