From 1b388722b8ee7d5aed646dca229190e88c62e937 Mon Sep 17 00:00:00 2001 From: Daniele Cocca Date: Sat, 27 Mar 2010 02:48:29 +0100 Subject: [PATCH 7/7] Two more useless functions removed. --- myserver/include/base/file/files_utility.h | 2 - myserver/src/base/file/files_utility.cpp | 47 +-------------------------- 2 files changed, 2 insertions(+), 47 deletions(-) diff --git a/myserver/include/base/file/files_utility.h b/myserver/include/base/file/files_utility.h index 77e06a6..f8e79b4 100644 --- a/myserver/include/base/file/files_utility.h +++ b/myserver/include/base/file/files_utility.h @@ -89,8 +89,6 @@ public: static void splitPath (const char* path, char* dir, char*filename); static void splitPath (string const &path, string& dir, string& filename); - static int getFilenameLength (const char*, int *); - static void getFilename (const char* path, char* filename); static void getFilename (string const &path, string& filename); static int rmdir (const char *path); diff --git a/myserver/src/base/file/files_utility.cpp b/myserver/src/base/file/files_utility.cpp index 61c4a88..75b2cfc 100644 --- a/myserver/src/base/file/files_utility.cpp +++ b/myserver/src/base/file/files_utility.cpp @@ -60,7 +60,7 @@ FilesUtility::FilesUtility () } /*! - * This funtion iterates through every character of the path + * This function iterates through every character of the path * The first IF tries to clear out the bars, if it finds one, * just advances one character and starts the cycle again * The second IF tries to find at least two dots. @@ -275,7 +275,7 @@ int FilesUtility::nodeExists (const char* filename) NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, NULL); - int nRet = hFile != INVALID_HANDLE_VALUE ? 1 : 0; + int nRet = (hFile != INVALID_HANDLE_VALUE) ? 1 : 0; CloseHandle (hFile); return nRet; #else @@ -369,49 +369,6 @@ int FilesUtility::chown (const char* filename, string &uid, string &gid) } /*! - *Get the length of the file in the path. - *\param path The full path where get the filename length. - *\param filename A pointer to the start of the file name. - */ -int FilesUtility::getFilenameLength (const char *path, int *filename) -{ - int splitpoint = static_cast (strlen (path) - 1); - while ((splitpoint > 0) && (path[splitpoint] != '/')) - splitpoint--; - *filename = splitpoint + 1; - return *filename; -} - -/*! - * Get the filename from a path. - * Be sure that the filename buffer is at least getFilenameLength (...) bytes - * before call this function. - * \param path The full path to the file. - * \param filename A buffer to fullfill with the file name. - */ -void FilesUtility::getFilename (const char *path, char *filename) -{ - int splitpoint, i = 0, j = 0; - splitpoint = static_cast(strlen (path) - 1); - while ((splitpoint > 0) && (path[splitpoint] != '/')) - splitpoint--; - if ((splitpoint == 0) && (path[splitpoint] != '/')) - strcpy (filename, path); - else - { - splitpoint++; - i=splitpoint; - while (path[i] != 0) - { - filename[j] = path[i]; - j++; - i++; - } - filename[j] = 0; - } -} - -/*! * Get the filename from a path. * \param path The full path to the file. * \param filename A buffer to fullfill with the file name. -- 1.7.0.2