From 267a846424820f8933f268531f7aa6bcb2f07106 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Thu, 23 May 2019 10:27:06 +0100
Subject: [PATCH] BUG: incorrect IOobject instance for absolute windows path
 (#1238)

STYLE: remove unused local variables in edgeMeshFormat
---
 applications/test/00-dummy/dummy/dummyLib.C   | 19 ++++++++++++++++++-
 src/OpenFOAM/db/IOobject/IOobject.C           |  4 ++--
 .../edgeMeshFormats/edgeMesh/edgeMeshFormat.C |  9 +--------
 .../extendedEdgeMeshFormat.C                  |  6 +-----
 4 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/applications/test/00-dummy/dummy/dummyLib.C b/applications/test/00-dummy/dummy/dummyLib.C
index 383c431de5..9963595c01 100644
--- a/applications/test/00-dummy/dummy/dummyLib.C
+++ b/applications/test/00-dummy/dummy/dummyLib.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2018 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2018-2019 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -30,6 +30,9 @@ License
 #if defined WM_SP
 # define PRECISION    "SP"
 # define SCALAR_SIZE  (8*sizeof(float))
+#elif defined(WM_SPDP)
+# define PRECISION    "SPDP"
+# define SCALAR_SIZE  (8*sizeof(float))
 #elif defined WM_DP
 # define PRECISION    "DP"
 # define SCALAR_SIZE  (8*sizeof(double))
@@ -38,9 +41,23 @@ License
 # define SCALAR_SIZE  (8*sizeof(long double))
 #endif
 
+// Test additional exported symbols
+#ifdef _WIN32
+    #define defineWindowsLibEntryPoint(libName)                               \
+        extern "C" void lib_##libName##_entry_point() {}
+#else
+    #define defineWindowsLibEntryPoint(libName)  /* Nothing */
+#endif
+
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
+// The 'extern C' export is independent of namespace
+namespace Foam
+{
+    defineWindowsLibEntryPoint(dummyLib);
+}
+
 const std::string Foam::Detail::dummyLib::arch(WM_ARCH);
 
 const std::string Foam::Detail::dummyLib::compiler(WM_COMPILER);
diff --git a/src/OpenFOAM/db/IOobject/IOobject.C b/src/OpenFOAM/db/IOobject/IOobject.C
index 5842fc7218..8ea24003b2 100644
--- a/src/OpenFOAM/db/IOobject/IOobject.C
+++ b/src/OpenFOAM/db/IOobject/IOobject.C
@@ -160,10 +160,10 @@ bool Foam::IOobject::fileNameComponents
         #endif
     )
     {
-        // Absolute path (starts with '/')
+        // Absolute path (starts with '/' or 'd:/')
         // => no local
 
-        instance = path.substr(first, last);
+        instance = path.substr(0, last);
 
         const std::string ending = path.substr(last+1);
         nameLen = ending.size();  // The raw length of name
diff --git a/src/meshTools/edgeMesh/edgeMeshFormats/edgeMesh/edgeMeshFormat.C b/src/meshTools/edgeMesh/edgeMeshFormats/edgeMesh/edgeMeshFormat.C
index 8effdf0309..a5982d6389 100644
--- a/src/meshTools/edgeMesh/edgeMeshFormats/edgeMesh/edgeMeshFormat.C
+++ b/src/meshTools/edgeMesh/edgeMeshFormats/edgeMesh/edgeMeshFormat.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           |
+    \\  /    A nd           | Copyright (C) 2017-2019 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
                             | Copyright (C) 2011-2017 OpenFOAM Foundation
@@ -52,10 +52,6 @@ bool Foam::fileFormats::edgeMeshFormat::read
 {
     clear();
 
-    fileName dir = filename.path();
-    fileName caseName = dir.name();
-    fileName rootPath = dir.path();
-
     // Construct dummy time to use as an objectRegistry
     Time dummyTime
     (
@@ -117,10 +113,7 @@ bool Foam::fileFormats::edgeMeshFormat::read
             << exit(FatalError);
     }
 
-    // read points:
     is  >> pointLst;
-
-    // read edges:
     is  >> edgeLst;
 
     return true;
diff --git a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMeshFormats/extendedEdgeMeshFormat/extendedEdgeMeshFormat.C b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMeshFormats/extendedEdgeMeshFormat/extendedEdgeMeshFormat.C
index fb52a8a00c..9070943bc2 100644
--- a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMeshFormats/extendedEdgeMeshFormat/extendedEdgeMeshFormat.C
+++ b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMeshFormats/extendedEdgeMeshFormat/extendedEdgeMeshFormat.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           |
+    \\  /    A nd           | Copyright (C) 2019 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
                             | Copyright (C) 2013-2017 OpenFOAM Foundation
@@ -50,10 +50,6 @@ bool Foam::fileFormats::extendedEdgeMeshFormat::read
 {
     clear();
 
-    fileName dir = filename.path();
-    fileName caseName = dir.name();
-    fileName rootPath = dir.path();
-
     // Construct dummy time to use as an objectRegistry
     Time dummyTime
     (
-- 
GitLab