From cb3071606d19aa089315200f09c39d8309dd41f6 Mon Sep 17 00:00:00 2001 From: alexpeshkoff Date: Wed, 30 Dec 2009 12:55:52 +0000 Subject: [PATCH] Removed a number of unused and suspicious functions --- src/config/ConfObject.cpp | 3 -- src/vulcan/PathName.cpp | 81 --------------------------------------- src/vulcan/PathName.h | 5 --- 3 files changed, 89 deletions(-) diff --git a/src/config/ConfObject.cpp b/src/config/ConfObject.cpp index 8a98ec6b73..2988c2688f 100644 --- a/src/config/ConfObject.cpp +++ b/src/config/ConfObject.cpp @@ -271,9 +271,6 @@ Firebird::string ConfObject::expand(const char* rawValue) if (!changed) return temp; - // ASF: Do not try to expand relative filenames. It seems better to use $(this), or if necessary - // a new expansion variable. Also, this function is buggy and is returning incorrect values. - // return PathName::expandFilename (temp); return temp; } diff --git a/src/vulcan/PathName.cpp b/src/vulcan/PathName.cpp index bc133db9a6..9e1049d225 100644 --- a/src/vulcan/PathName.cpp +++ b/src/vulcan/PathName.cpp @@ -61,82 +61,6 @@ PathName::~PathName() { } -const char* PathName::getWorkingDirectory() -{ - static char workingDirectory [MAXPATHLEN]; - -#ifdef _WIN32 - GetCurrentDirectory(sizeof (workingDirectory), workingDirectory); -#else - if (workingDirectory [0]) - return workingDirectory; - -#ifdef HAVE_GETCWD - getcwd(workingDirectory, sizeof (workingDirectory)); -#else - getwd(workingDirectory); -#endif - -#endif - - return workingDirectory; -} - -int PathName::findWorkingDirectory(int dpbLength, const UCHAR* dpb, int bufferLength, char* buffer) -{ - const UCHAR* p = dpb; - const UCHAR* const end = dpb + dpbLength; - - if (dpbLength <= 0 || *p++ != isc_dpb_version1) - return 0; - - for (int length = 0; p < end; p += length) - { - const UCHAR verb = *p++; - length = *p++; - length += (*p++) << 8; - - if (verb == isc_dpb_working_directory) - { - const int l = MIN (bufferLength - 1, length); - memcpy (buffer, p, l); - buffer [l] = 0; - return length; - } - } - - return 0; -} - -Firebird::string PathName::expandFilename(const char* fileName, int dpbLength, const UCHAR* dpb) -{ - char workingDirectory [MAXPATHLEN]; - const char *directory; - - if (findWorkingDirectory (dpbLength, dpb, sizeof (workingDirectory), workingDirectory)) - directory = workingDirectory; - else - directory = getWorkingDirectory(); - - return expandFilename (fileName, directory); -} - -Firebird::string PathName::expandFilename(const char* fileName, const char* workingDirectory) -{ - char buffer [MAXPATHLEN]; - int length = merge (fileName, workingDirectory, sizeof (buffer), buffer); - -#ifdef _WIN32 - for (char *p = buffer; *p; ++p) - { - if (*p == '/') - *p = SEPARATOR; - } -#endif - - return Firebird::string(buffer, length); -} - int PathName::merge(const char* fileName, const char* workingDirectory, int bufferLength, char* buffer) { const char* const endBuffer = buffer + bufferLength - 1; @@ -242,11 +166,6 @@ char* PathName::copyCanonical(const char* fileName, char* buffer, const char* en return q; } -Firebird::string PathName::expandFilename(const char* fileName) -{ - return expandFilename (fileName, getWorkingDirectory()); -} - bool PathName::hasDirectory(const char* fileName) { for (const char* p = fileName; *p; ++p) diff --git a/src/vulcan/PathName.h b/src/vulcan/PathName.h index dbce028b36..5004a2787d 100644 --- a/src/vulcan/PathName.h +++ b/src/vulcan/PathName.h @@ -39,14 +39,9 @@ public: PathName(); virtual ~PathName(); - static const char* getWorkingDirectory(); - static int findWorkingDirectory(int dpbLength, const UCHAR* dpb, int bufferLength, char* buffer); - static Firebird::string expandFilename(const char* fileName, int dpbLength, const UCHAR* dpb); - static Firebird::string expandFilename(const char* fileName, const char* workingDirectory); static int merge(const char* fileName, const char* workingDirectory, int bufferLength, char* buffer); static bool isAbsolute(const char* fileName); static char* copyCanonical(const char* fileName, char* buffer, const char* endBuffer); - static Firebird::string expandFilename(const char* fileName); static bool hasDirectory(const char* fileName); static bool pathsEquivalent(const char* path1, const char* path2); };