]> git.mxchange.org Git - flightgear.git/commitdiff
Work around a strange link failure on Mac
authorJames Turner <zakalawe@mac.com>
Sun, 20 Sep 2015 14:13:49 +0000 (09:13 -0500)
committerJames Turner <zakalawe@mac.com>
Mon, 21 Sep 2015 00:45:03 +0000 (19:45 -0500)
- Xcode 7 seems to dislike this code as was, adjusted version
links fine. Very odd.

src/GUI/gui_funcs.cxx

index b566f5339eef56da226692e52ac977863271da4e..a839ae6f2052a4d6a4cba7ba2449fd5e9da8b257 100644 (file)
@@ -437,7 +437,24 @@ namespace
 {
     using namespace flightgear;
 
-    class GUISnapShotOperation : 
+    SGPath nextScreenshotPath(const std::string& screenshotDir)
+    {
+        char filename[32];
+        static int count = 1;
+        while (count < 1000) {
+            snprintf(filename, 32, "fgfs-screen-%03d.png", count++);
+            
+            SGPath p(screenshotDir);
+            p.append(filename);
+            if (!p.exists()) {
+                return p;
+            }
+        }
+        
+        return SGPath();
+    }
+    
+    class GUISnapShotOperation :
         public GraphicsContextOperation
     {
     public:
@@ -489,19 +506,7 @@ namespace
                 dir = globals->get_fg_home();
             }
 
-            char filename[24];
-            static int count = 1;
-            while (count < 1000) {
-                snprintf(filename, 24, "fgfs-screen-%03d.png", count++);
-
-                SGPath p(dir);
-                p.append(filename);
-                if (!p.exists()) {
-                    _path.set(p.str());
-                    break;
-                }
-            }
-
+            _path = nextScreenshotPath(dir);
             _xsize = fgGetInt("/sim/startup/xsize");
             _ysize = fgGetInt("/sim/startup/ysize");