From 9b800173237fa34f04f958fb974fe5bb4ffddb6a Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 12 Feb 2010 20:58:56 -0500 Subject: [PATCH] Portability - Solaris - Added include of auto.h to allow #ifdef SOLARIS to work. - Put #ifdef around glob arguments that aren't supported on Solaris. - Fixed uninitialized variable that only gcc on Solaris spotted. --- src/Directory.cpp | 1 + src/Path.cpp | 5 +++++ src/text.cpp | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Directory.cpp b/src/Directory.cpp index ab6a9be60..d3ac2bc3d 100644 --- a/src/Directory.cpp +++ b/src/Directory.cpp @@ -31,6 +31,7 @@ #include #include #include "Directory.h" +#include "../auto.h" //////////////////////////////////////////////////////////////////////////////// Directory::Directory () diff --git a/src/Path.cpp b/src/Path.cpp index b6613a0b8..04b6c4706 100644 --- a/src/Path.cpp +++ b/src/Path.cpp @@ -32,6 +32,7 @@ #include #include #include "Path.h" +#include "../auto.h" //////////////////////////////////////////////////////////////////////////////// Path::Path () @@ -201,7 +202,11 @@ std::vector Path::glob (const std::string& pattern) std::vector results; glob_t g; +#ifdef SOLARIS + if (!::glob (pattern.c_str (), GLOB_ERR, NULL, &g)) +#else if (!::glob (pattern.c_str (), GLOB_ERR | GLOB_BRACE | GLOB_TILDE, NULL, &g)) +#endif for (int i = 0; i < (int) g.gl_pathc; ++i) results.push_back (g.gl_pathv[i]); diff --git a/src/text.cpp b/src/text.cpp index 2232c4e06..0ca9aeb37 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -499,7 +499,7 @@ std::string::size_type find ( for (; t <= end - len; ++t) { - int diff; + int diff = 0; for (size_t i = 0; i < len; ++i) if ((diff = tolower (t[i]) - tolower (p[i]))) break; @@ -546,7 +546,7 @@ std::string::size_type find ( for (; t <= end - len; ++t) { - int diff; + int diff = 0; for (size_t i = 0; i < len; ++i) if ((diff = tolower (t[i]) - tolower (p[i]))) break;