simplify x11 path code, had unneeded NULL checks and std namespace
authorCampbell Barton <ideasman42@gmail.com>
Sun, 7 Aug 2011 17:38:36 +0000 (17:38 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 7 Aug 2011 17:38:36 +0000 (17:38 +0000)
intern/ghost/intern/GHOST_SystemPathsX11.cpp
source/blender/windowmanager/intern/wm_event_system.c

index dd89357..135f5c4 100644 (file)
 #include <stdio.h> // for fprintf only
 #include <cstdlib> // for exit
 
-using namespace std;
+#ifdef PREFIX
+static const char *static_path= PREFIX "/share" ;
+#else
+static const char *static_path= NULL;
+#endif
 
 GHOST_SystemPathsX11::GHOST_SystemPathsX11()
 {
@@ -56,21 +60,12 @@ GHOST_SystemPathsX11::~GHOST_SystemPathsX11()
 const GHOST_TUns8* GHOST_SystemPathsX11::getSystemDir() const
 {
        /* no prefix assumes a portable build which only uses bundled scripts */
-#ifdef PREFIX
-       return (GHOST_TUns8*) PREFIX "/share";
-#else
-       return NULL;
-#endif
+       return (const GHOST_TUns8 *)static_path;
 }
 
 const GHOST_TUns8* GHOST_SystemPathsX11::getUserDir() const
 {
-       const char* env = getenv("HOME");
-       if(env) {
-               return (GHOST_TUns8*) env;
-       } else {
-               return NULL;
-       }
+       return (const GHOST_TUns8 *)getenv("HOME");
 }
 
 const GHOST_TUns8* GHOST_SystemPathsX11::getBinaryDir() const
index c1fd903..413ff18 100644 (file)
@@ -2332,8 +2332,8 @@ static void attach_ndof_data(wmEvent* event, const GHOST_TEventNDOFMotionData* g
        data->tx = s * ghost->tx;
 
        data->rx = s * ghost->rx;
-       data->rx = s * ghost->ry;
-       data->rx = s * ghost->rz;
+       data->ry = s * ghost->ry;
+       data->rz = s * ghost->rz;
 
        if (U.ndof_flag & NDOF_ZOOM_UPDOWN)
                {