From fbb7270e55fa42179f0e2ac5e3804e7744e7bf23 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 1 Nov 2017 13:54:15 +0000 Subject: [PATCH] Replaced getenv(..) usage with osg::getEnvVar(..) --- src/osgViewer/Viewer.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/osgViewer/Viewer.cpp b/src/osgViewer/Viewer.cpp index 8371f6ef6..7908e7460 100644 --- a/src/osgViewer/Viewer.cpp +++ b/src/osgViewer/Viewer.cpp @@ -34,6 +34,8 @@ #include #include +#include + #include #include @@ -495,26 +497,18 @@ void Viewer::realize() // no windows are already set up so set up a default view - const char* ptr = 0; - if ((ptr = getenv("OSG_CONFIG_FILE")) != 0) + std::string value; + if (osg::getEnvVar("OSG_CONFIG_FILE", value)) { - readConfiguration(ptr); + readConfiguration(value); } else { int screenNum = -1; - if ((ptr = getenv("OSG_SCREEN")) != 0) - { - if (strlen(ptr)!=0) screenNum = atoi(ptr); - else screenNum = -1; - } + osg::getEnvVar("OSG_SCREEN", screenNum); int x = -1, y = -1, width = -1, height = -1; - if ((ptr = getenv("OSG_WINDOW")) != 0) - { - std::istringstream iss(ptr); - iss >> x >> y >> width >> height; - } + osg::getEnvVar("OSG_WINDOW", x, y, width, height); if (width>0 && height>0) {