From 330978decd15e02d7cd23dcead52dc2373d7e5d5 Mon Sep 17 00:00:00 2001 From: Oz Linden <oz@lindenlab.com> Date: Thu, 28 Oct 2010 22:40:37 -0400 Subject: [PATCH] STORM-480 remove (unused) LLDir::getRandomFileInDir --HG-- branch : storm-102 --- indra/llvfs/lldir.h | 2 +- indra/llvfs/lldir_linux.cpp | 39 --------------------------------- indra/llvfs/lldir_linux.h | 1 - indra/llvfs/lldir_mac.cpp | 34 ----------------------------- indra/llvfs/lldir_mac.h | 1 - indra/llvfs/lldir_solaris.cpp | 39 --------------------------------- indra/llvfs/lldir_solaris.h | 1 - indra/llvfs/lldir_win32.cpp | 41 ----------------------------------- indra/llvfs/lldir_win32.h | 1 - 9 files changed, 1 insertion(+), 158 deletions(-) diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h index 643b89199b8..71743d960c3 100644 --- a/indra/llvfs/lldir.h +++ b/indra/llvfs/lldir.h @@ -90,7 +90,7 @@ class LLDir * * @todo this really should be rewritten as an iterator object. */ - virtual void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) = 0; + virtual std::string getCurPath() = 0; virtual BOOL fileExists(const std::string &filename) const = 0; diff --git a/indra/llvfs/lldir_linux.cpp b/indra/llvfs/lldir_linux.cpp index cf5fdd3b4a9..73f2336f94f 100644 --- a/indra/llvfs/lldir_linux.cpp +++ b/indra/llvfs/lldir_linux.cpp @@ -302,46 +302,7 @@ BOOL LLDir_Linux::getNextFileInDir(const std::string &dirname, const std::string } -// get a random file in the directory -void LLDir_Linux::getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) -{ - S32 num_files; - S32 which_file; - DIR *dirp; - dirent *entryp = NULL; - - fname = ""; - - num_files = countFilesInDir(dirname,mask); - if (!num_files) - { - return; - } - - which_file = ll_rand(num_files); - -// llinfos << "Random select file #" << which_file << llendl; - // which_file now indicates the (zero-based) index to which file to play - - if (!((dirp = opendir(dirname.c_str())))) - { - while (which_file--) - { - if (!((entryp = readdir(dirp)))) - { - return; - } - } - - if ((!which_file) && entryp) - { - fname = entryp->d_name; - } - - closedir(dirp); - } -} std::string LLDir_Linux::getCurPath() { diff --git a/indra/llvfs/lldir_linux.h b/indra/llvfs/lldir_linux.h index ef4495a627d..451e81ae93c 100644 --- a/indra/llvfs/lldir_linux.h +++ b/indra/llvfs/lldir_linux.h @@ -44,7 +44,6 @@ class LLDir_Linux : public LLDir virtual std::string getCurPath(); virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask); virtual BOOL getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname); - virtual void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname); /*virtual*/ BOOL fileExists(const std::string &filename) const; /*virtual*/ std::string getLLPluginLauncher(); diff --git a/indra/llvfs/lldir_mac.cpp b/indra/llvfs/lldir_mac.cpp index 290b3bd0db5..445285aa43a 100644 --- a/indra/llvfs/lldir_mac.cpp +++ b/indra/llvfs/lldir_mac.cpp @@ -317,41 +317,7 @@ BOOL LLDir_Mac::getNextFileInDir(const std::string &dirname, const std::string & return(result); } -// get a random file in the directory -void LLDir_Mac::getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) -{ - S32 which_file; - glob_t g; - fname = ""; - - std::string tmp_str; - tmp_str = dirname; - tmp_str += mask; - - if(glob(tmp_str.c_str(), GLOB_NOSORT, NULL, &g) == 0) - { - if(g.gl_pathc > 0) - { - - which_file = ll_rand(g.gl_pathc); - -// llinfos << "getRandomFileInDir: returning number " << which_file << ", path is " << g.gl_pathv[which_file] << llendl; - // The API wants just the filename, not the full path. - //fname = g.gl_pathv[which_file]; - char *s = strrchr(g.gl_pathv[which_file], '/'); - - if(s == NULL) - s = g.gl_pathv[which_file]; - else if(s[0] == '/') - s++; - - fname = s; - } - - globfree(&g); - } -} S32 LLDir_Mac::deleteFilesInDir(const std::string &dirname, const std::string &mask) { diff --git a/indra/llvfs/lldir_mac.h b/indra/llvfs/lldir_mac.h index f80ca47d922..4eac3c3ae6f 100644 --- a/indra/llvfs/lldir_mac.h +++ b/indra/llvfs/lldir_mac.h @@ -44,7 +44,6 @@ class LLDir_Mac : public LLDir virtual std::string getCurPath(); virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask); virtual BOOL getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname); - virtual void getRandomFileInDir(const std::string &dirname, const std::string &ask, std::string &fname); virtual BOOL fileExists(const std::string &filename) const; /*virtual*/ std::string getLLPluginLauncher(); diff --git a/indra/llvfs/lldir_solaris.cpp b/indra/llvfs/lldir_solaris.cpp index 09a96ef6b3c..515fd66b6e9 100644 --- a/indra/llvfs/lldir_solaris.cpp +++ b/indra/llvfs/lldir_solaris.cpp @@ -320,46 +320,7 @@ BOOL LLDir_Solaris::getNextFileInDir(const std::string &dirname, const std::stri } -// get a random file in the directory -void LLDir_Solaris::getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) -{ - S32 num_files; - S32 which_file; - DIR *dirp; - dirent *entryp = NULL; - - fname = ""; - - num_files = countFilesInDir(dirname,mask); - if (!num_files) - { - return; - } - - which_file = ll_rand(num_files); - -// llinfos << "Random select file #" << which_file << llendl; - - // which_file now indicates the (zero-based) index to which file to play - - if (!((dirp = opendir(dirname.c_str())))) - { - while (which_file--) - { - if (!((entryp = readdir(dirp)))) - { - return; - } - } - if ((!which_file) && entryp) - { - fname = entryp->d_name; - } - - closedir(dirp); - } -} std::string LLDir_Solaris::getCurPath() { diff --git a/indra/llvfs/lldir_solaris.h b/indra/llvfs/lldir_solaris.h index 1c21397c381..4a1794f5395 100644 --- a/indra/llvfs/lldir_solaris.h +++ b/indra/llvfs/lldir_solaris.h @@ -44,7 +44,6 @@ class LLDir_Solaris : public LLDir virtual std::string getCurPath(); virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask); virtual BOOL getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname); - virtual void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname); /*virtual*/ BOOL fileExists(const std::string &filename) const; private: diff --git a/indra/llvfs/lldir_win32.cpp b/indra/llvfs/lldir_win32.cpp index ecfa4a07d48..a721552999d 100644 --- a/indra/llvfs/lldir_win32.cpp +++ b/indra/llvfs/lldir_win32.cpp @@ -310,47 +310,6 @@ BOOL LLDir_Win32::getNextFileInDir(const llutf16string &dirname, const std::stri } -// get a random file in the directory -void LLDir_Win32::getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) -{ - S32 num_files; - S32 which_file; - HANDLE random_search_h; - - fname = ""; - - llutf16string pathname = utf8str_to_utf16str(dirname); - pathname += utf8str_to_utf16str(mask); - - WIN32_FIND_DATA FileData; - fname[0] = NULL; - - num_files = countFilesInDir(dirname,mask); - if (!num_files) - { - return; - } - - which_file = ll_rand(num_files); - -// llinfos << "Random select mp3 #" << which_file << llendl; - - // which_file now indicates the (zero-based) index to which file to play - - if ((random_search_h = FindFirstFile(pathname.c_str(), &FileData)) != INVALID_HANDLE_VALUE) - { - while (which_file--) - { - if (!FindNextFile(random_search_h, &FileData)) - { - return; - } - } - FindClose(random_search_h); - - fname = utf16str_to_utf8str(llutf16string(FileData.cFileName)); - } -} std::string LLDir_Win32::getCurPath() { diff --git a/indra/llvfs/lldir_win32.h b/indra/llvfs/lldir_win32.h index 2ec9025250e..38ae690d89a 100644 --- a/indra/llvfs/lldir_win32.h +++ b/indra/llvfs/lldir_win32.h @@ -41,7 +41,6 @@ class LLDir_Win32 : public LLDir /*virtual*/ std::string getCurPath(); /*virtual*/ U32 countFilesInDir(const std::string &dirname, const std::string &mask); /*virtual*/ BOOL getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname); - /*virtual*/ void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname); /*virtual*/ BOOL fileExists(const std::string &filename) const; /*virtual*/ std::string getLLPluginLauncher(); -- GitLab