mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 18:03:04 +01:00
Removed a number of unused and suspicious functions
This commit is contained in:
parent
bb0963513a
commit
cb3071606d
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user