8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 14:03:07 +01:00

Removed a number of unused and suspicious functions

This commit is contained in:
alexpeshkoff 2009-12-30 12:55:52 +00:00
parent bb0963513a
commit cb3071606d
3 changed files with 0 additions and 89 deletions

View File

@ -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;
}

View File

@ -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)

View File

@ -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);
};