summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/contributions.txt2
-rw-r--r--etc/message.xml17
-rw-r--r--indra/cmake/Boost.cmake18
-rw-r--r--indra/integration_tests/llui_libtest/llui_libtest.cpp5
-rw-r--r--indra/linux_updater/linux_updater.cpp15
-rw-r--r--indra/llaudio/llaudioengine.cpp6
-rw-r--r--indra/llimage/llpngwrapper.cpp18
-rw-r--r--indra/llimage/llpngwrapper.h3
-rw-r--r--indra/llvfs/CMakeLists.txt7
-rw-r--r--indra/llvfs/lldir.cpp6
-rw-r--r--indra/llvfs/lldir.h25
-rw-r--r--indra/llvfs/lldir_linux.cpp62
-rw-r--r--indra/llvfs/lldir_linux.h1
-rw-r--r--indra/llvfs/lldir_mac.cpp61
-rw-r--r--indra/llvfs/lldir_mac.h1
-rw-r--r--indra/llvfs/lldir_solaris.cpp62
-rw-r--r--indra/llvfs/lldir_solaris.h1
-rw-r--r--indra/llvfs/lldir_win32.cpp61
-rw-r--r--indra/llvfs/lldir_win32.h3
-rw-r--r--indra/llvfs/lldiriterator.cpp203
-rw-r--r--indra/llvfs/lldiriterator.h87
-rw-r--r--indra/llvfs/tests/lldir_test.cpp38
-rw-r--r--indra/newview/llappviewer.cpp8
-rw-r--r--indra/newview/llappviewerlinux.cpp5
-rw-r--r--indra/newview/llfloateruipreview.cpp26
-rw-r--r--indra/newview/llinventorymodelbackgroundfetch.cpp4
-rw-r--r--indra/newview/llinventoryobserver.cpp4
-rw-r--r--indra/newview/lllogchat.cpp4
-rw-r--r--indra/newview/llpanelobjectinventory.cpp20
-rw-r--r--indra/newview/llviewerinventory.cpp8
-rw-r--r--indra/newview/llviewermedia.cpp4
-rw-r--r--indra/newview/llviewerregion.cpp8
-rw-r--r--indra/newview/llwaterparammanager.cpp11
-rw-r--r--indra/newview/llwlparammanager.cpp11
-rw-r--r--indra/viewer_components/updater/tests/llupdaterservice_test.cpp6
35 files changed, 360 insertions, 461 deletions
diff --git a/doc/contributions.txt b/doc/contributions.txt
index f21354b406..361560a0ed 100644
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -393,6 +393,7 @@ Kitty Barnett
STORM-288
STORM-799
STORM-800
+ VWR-24217
Kunnis Basiat
VWR-82
VWR-102
@@ -736,6 +737,7 @@ Thickbrick Sleaford
VWR-9287
VWR-13483
VWR-13947
+ VWR-24420
Thraxis Epsilon
SVC-371
VWR-383
diff --git a/etc/message.xml b/etc/message.xml
index 7c4a927cc5..764aea3879 100644
--- a/etc/message.xml
+++ b/etc/message.xml
@@ -678,20 +678,17 @@
<key>EstateChangeInfo</key>
<boolean>true</boolean>
- <key>FetchInventoryDescendents</key>
+ <key>FetchInventoryDescendents2</key>
<boolean>false</boolean>
- <key>WebFetchInventoryDescendents</key>
- <boolean>true</boolean>
-
- <key>FetchInventory</key>
- <boolean>true</boolean>
+ <key>FetchInventory2</key>
+ <boolean>false</boolean>
- <key>FetchLibDescendents</key>
- <boolean>true</boolean>
+ <key>FetchLibDescendents2</key>
+ <boolean>false</boolean>
- <key>FetchLib</key>
- <boolean>true</boolean>
+ <key>FetchLib2</key>
+ <boolean>false</boolean>
<key>UploadBakedTexture</key>
<boolean>true</boolean>
diff --git a/indra/cmake/Boost.cmake b/indra/cmake/Boost.cmake
index 012d3c2ab2..7ce57a5572 100644
--- a/indra/cmake/Boost.cmake
+++ b/indra/cmake/Boost.cmake
@@ -10,8 +10,6 @@ if (STANDALONE)
set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt)
set(BOOST_REGEX_LIBRARY boost_regex-mt)
set(BOOST_SIGNALS_LIBRARY boost_signals-mt)
- set(BOOST_SYSTEM_LIBRARY boost_system-mt)
- set(BOOST_FILESYSTEM_LIBRARY boost_filesystem-mt)
else (STANDALONE)
use_prebuilt_binary(boost)
set(Boost_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
@@ -28,12 +26,6 @@ else (STANDALONE)
set(BOOST_SIGNALS_LIBRARY
optimized libboost_signals-vc71-mt-s-${BOOST_VERSION}
debug libboost_signals-vc71-mt-sgd-${BOOST_VERSION})
- set(BOOST_SYSTEM_LIBRARY
- optimized libboost_system-vc71-mt-s-${BOOST_VERSION}
- debug libboost_system-vc71-mt-sgd-${BOOST_VERSION})
- set(BOOST_FILESYSTEM_LIBRARY
- optimized libboost_filesystem-vc71-mt-s-${BOOST_VERSION}
- debug libboost_filesystem-vc71-mt-sgd-${BOOST_VERSION})
else (MSVC71)
set(BOOST_PROGRAM_OPTIONS_LIBRARY
optimized libboost_program_options-vc80-mt-${BOOST_VERSION}
@@ -44,24 +36,14 @@ else (STANDALONE)
set(BOOST_SIGNALS_LIBRARY
optimized libboost_signals-vc80-mt-${BOOST_VERSION}
debug libboost_signals-vc80-mt-gd-${BOOST_VERSION})
- set(BOOST_SYSTEM_LIBRARY
- optimized libboost_system-vc80-mt-${BOOST_VERSION}
- debug libboost_system-vc80-mt-gd-${BOOST_VERSION})
- set(BOOST_FILESYSTEM_LIBRARY
- optimized libboost_filesystem-vc80-mt-${BOOST_VERSION}
- debug libboost_filesystem-vc80-mt-gd-${BOOST_VERSION})
endif (MSVC71)
elseif (DARWIN)
set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-xgcc40-mt)
set(BOOST_REGEX_LIBRARY boost_regex-xgcc40-mt)
set(BOOST_SIGNALS_LIBRARY boost_signals-xgcc40-mt)
- set(BOOST_SYSTEM_LIBRARY boost_system-xgcc40-mt)
- set(BOOST_FILESYSTEM_LIBRARY boost_filesystem-xgcc40-mt)
elseif (LINUX)
set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-gcc41-mt)
set(BOOST_REGEX_LIBRARY boost_regex-gcc41-mt)
set(BOOST_SIGNALS_LIBRARY boost_signals-gcc41-mt)
- set(BOOST_SYSTEM_LIBRARY boost_system-gcc41-mt)
- set(BOOST_FILESYSTEM_LIBRARY boost_filesystem-gcc41-mt)
endif (WINDOWS)
endif (STANDALONE)
diff --git a/indra/integration_tests/llui_libtest/llui_libtest.cpp b/indra/integration_tests/llui_libtest/llui_libtest.cpp
index 217e26c3ca..c34115ee80 100644
--- a/indra/integration_tests/llui_libtest/llui_libtest.cpp
+++ b/indra/integration_tests/llui_libtest/llui_libtest.cpp
@@ -33,7 +33,6 @@
// linden library includes
#include "llcontrol.h" // LLControlGroup
#include "lldir.h"
-#include "lldiriterator.h"
#include "llerrorcontrol.h"
#include "llfloater.h"
#include "llfontfreetype.h"
@@ -175,9 +174,7 @@ void export_test_floaters()
std::string delim = gDirUtilp->getDirDelimiter();
std::string xui_dir = get_xui_dir() + "en" + delim;
std::string filename;
-
- LLDirIterator iter(xui_dir, "floater_test_*.xml");
- while (iter.next(filename))
+ while (gDirUtilp->getNextFileInDir(xui_dir, "floater_test_*.xml", filename))
{
if (filename.find("_new.xml") != std::string::npos)
{
diff --git a/indra/linux_updater/linux_updater.cpp b/indra/linux_updater/linux_updater.cpp
index 808ab3f64f..d909516bf8 100644
--- a/indra/linux_updater/linux_updater.cpp
+++ b/indra/linux_updater/linux_updater.cpp
@@ -33,7 +33,6 @@
#include "llerrorcontrol.h"
#include "llfile.h"
#include "lldir.h"
-#include "lldiriterator.h"
#include "llxmlnode.h"
#include "lltrans.h"
@@ -56,8 +55,6 @@ typedef struct _updater_app_state {
std::string strings_dirs;
std::string strings_file;
- LLDirIterator *image_dir_iter;
-
GtkWidget *window;
GtkWidget *progress_bar;
GtkWidget *image;
@@ -111,7 +108,7 @@ bool translate_init(std::string comma_delim_path_list,
void updater_app_ui_init(void);
void updater_app_quit(UpdaterAppState *app_state);
void parse_args_and_init(int argc, char **argv, UpdaterAppState *app_state);
-std::string next_image_filename(std::string& image_path, LLDirIterator& iter);
+std::string next_image_filename(std::string& image_path);
void display_error(GtkWidget *parent, std::string title, std::string message);
BOOL install_package(std::string package_file, std::string destination);
BOOL spawn_viewer(UpdaterAppState *app_state);
@@ -177,7 +174,7 @@ void updater_app_ui_init(UpdaterAppState *app_state)
// load the first image
app_state->image = gtk_image_new_from_file
- (next_image_filename(app_state->image_dir, *app_state->image_dir_iter).c_str());
+ (next_image_filename(app_state->image_dir).c_str());
gtk_widget_set_size_request(app_state->image, 340, 310);
gtk_container_add(GTK_CONTAINER(frame), app_state->image);
@@ -208,7 +205,7 @@ gboolean rotate_image_cb(gpointer data)
llassert(data != NULL);
app_state = (UpdaterAppState *) data;
- filename = next_image_filename(app_state->image_dir, *app_state->image_dir_iter);
+ filename = next_image_filename(app_state->image_dir);
gdk_threads_enter();
gtk_image_set_from_file(GTK_IMAGE(app_state->image), filename.c_str());
@@ -217,10 +214,10 @@ gboolean rotate_image_cb(gpointer data)
return TRUE;
}
-std::string next_image_filename(std::string& image_path, LLDirIterator& iter)
+std::string next_image_filename(std::string& image_path)
{
std::string image_filename;
- iter.next(image_filename);
+ gDirUtilp->getNextFileInDir(image_path, "/*.jpg", image_filename);
return image_path + "/" + image_filename;
}
@@ -744,7 +741,6 @@ void parse_args_and_init(int argc, char **argv, UpdaterAppState *app_state)
else if ((!strcmp(argv[i], "--image-dir")) && (++i < argc))
{
app_state->image_dir = argv[i];
- app_state->image_dir_iter = new LLDirIterator(argv[i], "/*.jpg");
}
else if ((!strcmp(argv[i], "--dest")) && (++i < argc))
{
@@ -829,7 +825,6 @@ int main(int argc, char **argv)
}
bool success = !app_state->failure;
- delete app_state->image_dir_iter;
delete app_state;
return success ? 0 : 1;
}
diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp
index c9cb1cd6e7..5e540ad8c5 100644
--- a/indra/llaudio/llaudioengine.cpp
+++ b/indra/llaudio/llaudioengine.cpp
@@ -97,7 +97,11 @@ void LLAudioEngine::setDefaults()
}
mMasterGain = 1.f;
- mInternalGain = 0.f;
+ // Setting mInternalGain to an out of range value fixes the issue reported in STORM-830.
+ // There is an edge case in setMasterGain during startup which prevents setInternalGain from
+ // being called if the master volume setting and mInternalGain both equal 0, so using -1 forces
+ // the if statement in setMasterGain to execute when the viewer starts up.
+ mInternalGain = -1.f;
mNextWindUpdate = 0.f;
mStreamingAudioImpl = NULL;
diff --git a/indra/llimage/llpngwrapper.cpp b/indra/llimage/llpngwrapper.cpp
index fe737e2072..2cc7d3c460 100644
--- a/indra/llimage/llpngwrapper.cpp
+++ b/indra/llimage/llpngwrapper.cpp
@@ -50,8 +50,6 @@ LLPngWrapper::LLPngWrapper()
mCompressionType( 0 ),
mFilterMethod( 0 ),
mFinalSize( 0 ),
- mHasBKGD(false),
- mBackgroundColor(),
mGamma(0.f)
{
}
@@ -111,9 +109,9 @@ void LLPngWrapper::writeFlush(png_structp png_ptr)
}
// Read the PNG file using the libpng. The low-level interface is used here
-// because we want to do various transformations (including setting the
-// matte background if any, and applying gama) which can't be done with
-// the high-level interface. The scanline also begins at the bottom of
+// because we want to do various transformations (including applying gama)
+// which can't be done with the high-level interface.
+// The scanline also begins at the bottom of
// the image (per SecondLife conventions) instead of at the top, so we
// must assign row-pointers in "reverse" order.
BOOL LLPngWrapper::readPng(U8* src, LLImageRaw* rawImage, ImageInfo *infop)
@@ -201,8 +199,7 @@ void LLPngWrapper::normalizeImage()
// 2. Convert grayscales to RGB
// 3. Create alpha layer from transparency
// 4. Ensure 8-bpp for all images
- // 5. Apply background matte if any
- // 6. Set (or guess) gamma
+ // 5. Set (or guess) gamma
if (mColorType == PNG_COLOR_TYPE_PALETTE)
{
@@ -229,12 +226,6 @@ void LLPngWrapper::normalizeImage()
{
png_set_strip_16(mReadPngPtr);
}
- mHasBKGD = png_get_bKGD(mReadPngPtr, mReadInfoPtr, &mBackgroundColor);
- if (mHasBKGD)
- {
- png_set_background(mReadPngPtr, mBackgroundColor,
- PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
- }
#if LL_DARWIN
const F64 SCREEN_GAMMA = 1.8;
@@ -261,7 +252,6 @@ void LLPngWrapper::updateMetaData()
mBitDepth = png_get_bit_depth(mReadPngPtr, mReadInfoPtr);
mColorType = png_get_color_type(mReadPngPtr, mReadInfoPtr);
mChannels = png_get_channels(mReadPngPtr, mReadInfoPtr);
- mHasBKGD = png_get_bKGD(mReadPngPtr, mReadInfoPtr, &mBackgroundColor);
}
// Method to write raw image into PNG at dest. The raw scanline begins
diff --git a/indra/llimage/llpngwrapper.h b/indra/llimage/llpngwrapper.h
index 47a4207d66..739f435996 100644
--- a/indra/llimage/llpngwrapper.h
+++ b/indra/llimage/llpngwrapper.h
@@ -88,9 +88,6 @@ private:
U32 mFinalSize;
- bool mHasBKGD;
- png_color_16p mBackgroundColor;
-
F64 mGamma;
std::string mErrorMessage;
diff --git a/indra/llvfs/CMakeLists.txt b/indra/llvfs/CMakeLists.txt
index a3782d824b..722f4e2bfd 100644
--- a/indra/llvfs/CMakeLists.txt
+++ b/indra/llvfs/CMakeLists.txt
@@ -12,7 +12,6 @@ include_directories(
set(llvfs_SOURCE_FILES
lldir.cpp
- lldiriterator.cpp
lllfsthread.cpp
llpidlock.cpp
llvfile.cpp
@@ -25,7 +24,6 @@ set(llvfs_HEADER_FILES
lldir.h
lldirguard.h
- lldiriterator.h
lllfsthread.h
llpidlock.h
llvfile.h
@@ -62,11 +60,6 @@ list(APPEND llvfs_SOURCE_FILES ${llvfs_HEADER_FILES})
add_library (llvfs ${llvfs_SOURCE_FILES})
-target_link_libraries(llvfs
- ${BOOST_FILESYSTEM_LIBRARY}
- ${BOOST_SYSTEM_LIBRARY}
- )
-
if (DARWIN)
include(CMakeFindFrameworks)
find_library(CARBON_LIBRARY Carbon)
diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp
index ab7d15dfef..64556bcb4c 100644
--- a/indra/llvfs/lldir.cpp
+++ b/indra/llvfs/lldir.cpp
@@ -40,8 +40,6 @@
#include "lltimer.h" // ms_sleep()
#include "lluuid.h"
-#include "lldiriterator.h"
-
#if LL_WINDOWS
#include "lldir_win32.h"
LLDir_Win32 gDirUtil;
@@ -85,9 +83,7 @@ S32 LLDir::deleteFilesInDir(const std::string &dirname, const std::string &mask)
std::string filename;
std::string fullpath;
S32 result;
-
- LLDirIterator iter(dirname, mask);
- while (iter.next(filename))
+ while (getNextFileInDir(dirname, mask, filename))
{
fullpath = dirname;
fullpath += getDirDelimiter();
diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h
index 5ee8bdb542..42996fd051 100644
--- a/indra/llvfs/lldir.h
+++ b/indra/llvfs/lldir.h
@@ -75,6 +75,31 @@ class LLDir
// pure virtual functions
virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask) = 0;
+ /// Walk the files in a directory, with file pattern matching
+ virtual BOOL getNextFileInDir(const std::string& dirname, ///< directory path - must end in trailing slash!
+ const std::string& mask, ///< file pattern string (use "*" for all)
+ std::string& fname ///< output: found file name
+ ) = 0;
+ /**<
+ * @returns true if a file was found, false if the entire directory has been scanned.
+ *
+ * @note that this function is NOT thread safe
+ *
+ * This function may not be used to scan part of a directory, then start a new search of a different
+ * directory, and then restart the first search where it left off; the entire search must run to
+ * completion or be abandoned - there is no restart.
+ *
+ * @bug: See http://jira.secondlife.com/browse/VWR-23697
+ * and/or the tests in test/lldir_test.cpp
+ * This is known to fail with patterns that have both:
+ * a wildcard left of a . and more than one sequential ? right of a .
+ * the pattern foo.??x appears to work
+ * but *.??x or foo?.??x do not
+ *
+ * @todo this really should be rewritten as an iterator object, and the
+ * filtering should be done in a platform-independent way.
+ */
+
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 4ba2f519b0..73f2336f94 100644
--- a/indra/llvfs/lldir_linux.cpp
+++ b/indra/llvfs/lldir_linux.cpp
@@ -242,6 +242,68 @@ U32 LLDir_Linux::countFilesInDir(const std::string &dirname, const std::string &
return (file_count);
}
+// get the next file in the directory
+BOOL LLDir_Linux::getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname)
+{
+ glob_t g;
+ BOOL result = FALSE;
+ fname = "";
+
+ if(!(dirname == mCurrentDir))
+ {
+ // different dir specified, close old search
+ mCurrentDirIndex = -1;
+ mCurrentDirCount = -1;
+ mCurrentDir = dirname;
+ }
+
+ 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)
+ {
+ if((int)g.gl_pathc != mCurrentDirCount)
+ {
+ // Number of matches has changed since the last search, meaning a file has been added or deleted.
+ // Reset the index.
+ mCurrentDirIndex = -1;
+ mCurrentDirCount = g.gl_pathc;
+ }
+
+ mCurrentDirIndex++;
+
+ if(mCurrentDirIndex < (int)g.gl_pathc)
+ {
+// llinfos << "getNextFileInDir: returning number " << mCurrentDirIndex << ", path is " << g.gl_pathv[mCurrentDirIndex] << llendl;
+
+ // The API wants just the filename, not the full path.
+ //fname = g.gl_pathv[mCurrentDirIndex];
+
+ char *s = strrchr(g.gl_pathv[mCurrentDirIndex], '/');
+
+ if(s == NULL)
+ s = g.gl_pathv[mCurrentDirIndex];
+ else if(s[0] == '/')
+ s++;
+
+ fname = s;
+
+ result = TRUE;
+ }
+ }
+
+ globfree(&g);
+ }
+
+ return(result);
+}
+
+
+
+
std::string LLDir_Linux::getCurPath()
{
char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */
diff --git a/indra/llvfs/lldir_linux.h b/indra/llvfs/lldir_linux.h
index ff4c48759a..451e81ae93 100644
--- a/indra/llvfs/lldir_linux.h
+++ b/indra/llvfs/lldir_linux.h
@@ -43,6 +43,7 @@ public:
public:
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*/ 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 2d039527c0..445285aa43 100644
--- a/indra/llvfs/lldir_mac.cpp
+++ b/indra/llvfs/lldir_mac.cpp
@@ -258,6 +258,67 @@ U32 LLDir_Mac::countFilesInDir(const std::string &dirname, const std::string &ma
return (file_count);
}
+// get the next file in the directory
+BOOL LLDir_Mac::getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname)
+{
+ glob_t g;
+ BOOL result = FALSE;
+ fname = "";
+
+ if(!(dirname == mCurrentDir))
+ {
+ // different dir specified, close old search
+ mCurrentDirIndex = -1;
+ mCurrentDirCount = -1;
+ mCurrentDir = dirname;
+ }
+
+ 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)
+ {
+ if(g.gl_pathc != mCurrentDirCount)
+ {
+ // Number of matches has changed since the last search, meaning a file has been added or deleted.
+ // Reset the index.
+ mCurrentDirIndex = -1;
+ mCurrentDirCount = g.gl_pathc;
+ }
+
+ mCurrentDirIndex++;
+
+ if(mCurrentDirIndex < g.gl_pathc)
+ {
+// llinfos << "getNextFileInDir: returning number " << mCurrentDirIndex << ", path is " << g.gl_pathv[mCurrentDirIndex] << llendl;
+
+ // The API wants just the filename, not the full path.
+ //fname = g.gl_pathv[mCurrentDirIndex];
+
+ char *s = strrchr(g.gl_pathv[mCurrentDirIndex], '/');
+
+ if(s == NULL)
+ s = g.gl_pathv[mCurrentDirIndex];
+ else if(s[0] == '/')
+ s++;
+
+ fname = s;
+
+ result = TRUE;
+ }
+ }
+
+ globfree(&g);
+ }
+
+ return(result);
+}
+
+
+
S32 LLDir_Mac::deleteFilesInDir(const std::string &dirname, const std::string &mask)
{
glob_t g;
diff --git a/indra/llvfs/lldir_mac.h b/indra/llvfs/lldir_mac.h
index e60d5e41c2..4eac3c3ae6 100644
--- a/indra/llvfs/lldir_mac.h
+++ b/indra/llvfs/lldir_mac.h
@@ -43,6 +43,7 @@ public:
virtual S32 deleteFilesInDir(const std::string &dirname, const std::string &mask);
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 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 21f8c3acdb..515fd66b6e 100644
--- a/indra/llvfs/lldir_solaris.cpp
+++ b/indra/llvfs/lldir_solaris.cpp
@@ -260,6 +260,68 @@ U32 LLDir_Solaris::countFilesInDir(const std::string &dirname, const std::string
return (file_count);
}
+// get the next file in the directory
+BOOL LLDir_Solaris::getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname)
+{
+ glob_t g;
+ BOOL result = FALSE;
+ fname = "";
+
+ if(!(dirname == mCurrentDir))
+ {
+ // different dir specified, close old search
+ mCurrentDirIndex = -1;
+ mCurrentDirCount = -1;
+ mCurrentDir = dirname;
+ }
+
+ 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)
+ {
+ if((int)g.gl_pathc != mCurrentDirCount)
+ {
+ // Number of matches has changed since the last search, meaning a file has been added or deleted.
+ // Reset the index.
+ mCurrentDirIndex = -1;
+ mCurrentDirCount = g.gl_pathc;
+ }
+
+ mCurrentDirIndex++;
+
+ if(mCurrentDirIndex < (int)g.gl_pathc)
+ {
+// llinfos << "getNextFileInDir: returning number " << mCurrentDirIndex << ", path is " << g.gl_pathv[mCurrentDirIndex] << llendl;
+
+ // The API wants just the filename, not the full path.
+ //fname = g.gl_pathv[mCurrentDirIndex];
+
+ char *s = strrchr(g.gl_pathv[mCurrentDirIndex], '/');
+
+ if(s == NULL)
+ s = g.gl_pathv[mCurrentDirIndex];
+ else if(s[0] == '/')
+ s++;
+
+ fname = s;
+
+ result = TRUE;
+ }
+ }
+
+ globfree(&g);
+ }
+
+ return(result);
+}
+
+
+
+
std::string LLDir_Solaris::getCurPath()
{
char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */
diff --git a/indra/llvfs/lldir_solaris.h b/indra/llvfs/lldir_solaris.h
index f7e1a6301d..4a1794f539 100644
--- a/indra/llvfs/lldir_solaris.h
+++ b/indra/llvfs/lldir_solaris.h
@@ -43,6 +43,7 @@ public:
public:
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*/ BOOL fileExists(const std::string &filename) const;
private:
diff --git a/indra/llvfs/lldir_win32.cpp b/indra/llvfs/lldir_win32.cpp
index 2f96fbbbc1..33718e520d 100644
--- a/indra/llvfs/lldir_win32.cpp
+++ b/indra/llvfs/lldir_win32.cpp
@@ -236,6 +236,67 @@ U32 LLDir_Win32::countFilesInDir(const std::string &dirname, const std::string &
return (file_count);
}
+
+// get the next file in the directory
+BOOL LLDir_Win32::getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname)
+{
+ BOOL fileFound = FALSE;
+ fname = "";
+
+ WIN32_FIND_DATAW FileData;
+ llutf16string pathname = utf8str_to_utf16str(dirname) + utf8str_to_utf16str(mask);
+
+ if (pathname != mCurrentDir)
+ {
+ // different dir specified, close old search
+ if (mCurrentDir[0])
+ {
+ FindClose(mDirSearch_h);
+ }
+ mCurrentDir = pathname;
+
+ // and open new one
+ // Check error opening Directory structure
+ if ((mDirSearch_h = FindFirstFile(pathname.c_str(), &FileData)) != INVALID_HANDLE_VALUE)
+ {
+ fileFound = TRUE;
+ }
+ }
+
+ // Loop to skip over the current (.) and parent (..) directory entries
+ // (apparently returned in Win7 but not XP)
+ do
+ {
+ if ( fileFound
+ && ( (lstrcmp(FileData.cFileName, (LPCTSTR)TEXT(".")) == 0)
+ ||(lstrcmp(FileData.cFileName, (LPCTSTR)TEXT("..")) == 0)
+ )
+ )
+ {
+ fileFound = FALSE;
+ }
+ } while ( mDirSearch_h != INVALID_HANDLE_VALUE
+ && !fileFound
+ && (fileFound = FindNextFile(mDirSearch_h, &FileData)
+ )
+ );
+
+ if (!fileFound && GetLastError() == ERROR_NO_MORE_FILES)
+ {
+ // No more files, so reset to beginning of directory
+ FindClose(mDirSearch_h);
+ mCurrentDir[0] = '\000';
+ }
+
+ if (fileFound)
+ {
+ // convert from TCHAR to char
+ fname = utf16str_to_utf8str(FileData.cFileName);
+ }
+
+ return fileFound;
+}
+
std::string LLDir_Win32::getCurPath()
{
WCHAR w_str[MAX_PATH];
diff --git a/indra/llvfs/lldir_win32.h b/indra/llvfs/lldir_win32.h
index 19c610eb8b..4c932c932c 100644
--- a/indra/llvfs/lldir_win32.h
+++ b/indra/llvfs/lldir_win32.h
@@ -40,12 +40,15 @@ public:
/*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*/ BOOL fileExists(const std::string &filename) const;
/*virtual*/ std::string getLLPluginLauncher();
/*virtual*/ std::string getLLPluginFilename(std::string base_name);
private:
+ BOOL LLDir_Win32::getNextFileInDir(const llutf16string &dirname, const std::string &mask, std::string &fname);
+
void* mDirSearch_h;
llutf16string mCurrentDir;
};
diff --git a/indra/llvfs/lldiriterator.cpp b/indra/llvfs/lldiriterator.cpp
deleted file mode 100644
index 5536ed8f69..0000000000
--- a/indra/llvfs/lldiriterator.cpp
+++ /dev/null
@@ -1,203 +0,0 @@
-/**
- * @file lldiriterator.cpp
- * @brief Iterator through directory entries matching the search pattern.
- *
- * $LicenseInfo:firstyear=2010&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#include "lldiriterator.h"
-
-#include <boost/filesystem.hpp>
-#include <boost/regex.hpp>
-
-namespace fs = boost::filesystem;
-
-static std::string glob_to_regex(const std::string& glob);
-
-class LLDirIterator::Impl
-{
-public:
- Impl(const std::string &dirname, const std::string &mask);
- ~Impl();
-
- bool next(std::string &fname);
-
-private:
- boost::regex mFilterExp;
- fs::directory_iterator mIter;
- bool mIsValid;
-};
-
-LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask)
- : mIsValid(false)
-{
- fs::path dir_path(dirname);
-
- // Check if path exists.
- if (!fs::exists(dir_path))
- {
- llerrs << "Invalid path: \"" << dir_path.string() << "\"" << llendl;
- return;
- }
-
- // Initialize the directory iterator for the given path.
- try
- {
- mIter = fs::directory_iterator(dir_path);
- }
- catch (fs::basic_filesystem_error<fs::path>& e)
- {
- llerrs << e.what() << llendl;
- return;
- }
-
- // Convert the glob mask to a regular expression
- std::string exp = glob_to_regex(mask);
-
- // Initialize boost::regex with the expression converted from
- // the glob mask.
- // An exception is thrown if the expression is not valid.
- try
- {
- mFilterExp.assign(exp);
- }
- catch (boost::regex_error& e)
- {
- llerrs << "\"" << exp << "\" is not a valid regular expression: "
- << e.what() << llendl;
- return;
- }
-
- mIsValid = true;
-}
-
-LLDirIterator::Impl::~Impl()
-{
-}
-
-bool LLDirIterator::Impl::next(std::string &fname)
-{
- fname = "";
-
- if (!mIsValid)
- {
- llerrs << "The iterator is not correctly initialized." << llendl;
- return false;
- }
-
- fs::directory_iterator end_itr; // default construction yields past-the-end
- bool found = false;
- while (mIter != end_itr && !found)
- {
- boost::smatch match;
- std::string name = mIter->path().filename();
- if (found = boost::regex_match(name, match, mFilterExp))
- {
- fname = name;
- }
-
- ++mIter;
- }
-
- return found;
-}
-
-std::string glob_to_regex(const std::string& glob)
-{
- std::string regex;
- regex.reserve(glob.size()<<1);
- S32 braces = 0;
- bool escaped = false;
- bool square_brace_open = false;
-
- for (std::string::const_iterator i = glob.begin(); i != glob.end(); ++i)
- {
- char c = *i;
-
- switch (c)
- {
- case '.':
- regex+="\\.";
- break;
- case '*':
- if (glob.begin() == i)
- {
- regex+="[^.].*";
- }
- else
- {
- regex+= escaped ? "*" : ".*";
- }
- break;
- case '?':
- regex+= escaped ? '?' : '.';
- break;
- case '{':
- braces++;
- regex+='(';
- break;
- case '}':
- if (!braces)
- {
- llerrs << "glob_to_regex: Closing brace without an equivalent opening brace: " << glob << llendl;
- }
-
- regex+=')';
- braces--;
- break;
- case ',':
- regex+= braces ? '|' : c;
- break;
- case '!':
- regex+= square_brace_open ? '^' : c;
- break;
- default:
- regex+=c;
- break;
- }
-
- escaped = ('\\' == c);
- square_brace_open = ('[' == c);
- }
-
- if (braces)
- {
- llerrs << "glob_to_regex: Unterminated brace expression: " << glob << llendl;
- }
-
- return regex;
-}
-
-LLDirIterator::LLDirIterator(const std::string &dirname, const std::string &mask)
-{
- mImpl = new Impl(dirname, mask);
-}
-
-LLDirIterator::~LLDirIterator()
-{
- delete mImpl;
-}
-
-bool LLDirIterator::next(std::string &fname)
-{
- return mImpl->next(fname);
-}
diff --git a/indra/llvfs/lldiriterator.h b/indra/llvfs/lldiriterator.h
deleted file mode 100644
index 0b48be41b3..0000000000
--- a/indra/llvfs/lldiriterator.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * @file lldiriterator.h
- * @brief Iterator through directory entries matching the search pattern.
- *
- * $LicenseInfo:firstyear=2010&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLDIRITERATOR_H
-#define LL_LLDIRITERATOR_H
-
-#include "linden_common.h"
-
-/**
- * Class LLDirIterator
- *
- * Iterates through directory entries matching the search pattern.
- */
-class LLDirIterator
-{
-public:
- /**
- * Constructs LLDirIterator object to search for glob pattern
- * matches in a directory.
- *
- * @param dirname - name of a directory to search in.
- * @param mask - search pattern, a glob expression
- *
- * Wildcards supported in glob expressions:
- * --------------------------------------------------------------
- * | Wildcard | Matches |
- * --------------------------------------------------------------
- * | * |zero or more characters |
- * | ? |exactly one character |
- * | [abcde] |exactly one character listed |
- * | [a-e] |exactly one character in the given range |
- * | [!abcde] |any character that is not listed |
- * | [!a-e] |any character that is not in the given range |
- * | {abc,xyz} |exactly one entire word in the options given |
- * --------------------------------------------------------------
- */
- LLDirIterator(const std::string &dirname, const std::string &mask);
-
- ~LLDirIterator();
-
- /**
- * Searches for the next directory entry matching the glob mask
- * specified upon iterator construction.
- * Returns true if a match is found, sets fname
- * parameter to the name of the matched directory entry and
- * increments the iterator position.
- *
- * Typical usage:
- * <code>
- * LLDirIterator iter(directory, pattern);
- * if ( iter.next(scanResult) )
- * </code>
- *
- * @param fname - name of the matched directory entry.
- * @return true if a match is found, false otherwise.
- */
- bool next(std::string &fname);
-
-protected:
- class Impl;
- Impl* mImpl;
-};
-
-#endif //LL_LLDIRITERATOR_H
diff --git a/indra/llvfs/tests/lldir_test.cpp b/indra/llvfs/tests/lldir_test.cpp
index ea321c5ae9..8788bd63e8 100644
--- a/indra/llvfs/tests/lldir_test.cpp
+++ b/indra/llvfs/tests/lldir_test.cpp
@@ -28,7 +28,6 @@
#include "linden_common.h"
#include "../lldir.h"
-#include "../lldiriterator.h"
#include "../test/lltut.h"
@@ -260,12 +259,13 @@ namespace tut
std::string makeTestFile( const std::string& dir, const std::string& file )
{
- std::string path = dir + file;
+ std::string delim = gDirUtilp->getDirDelimiter();
+ std::string path = dir + delim + file;
LLFILE* handle = LLFile::fopen( path, "w" );
ensure("failed to open test file '"+path+"'", handle != NULL );
// Harbison & Steele, 4th ed., p. 366: "If an error occurs, fputs
// returns EOF; otherwise, it returns some other, nonnegative value."
- ensure("failed to write to test file '"+path+"'", EOF != fputs("test file", handle) );
+ ensure("failed to write to test file '"+path+"'", fputs("test file", handle) >= 0);
fclose(handle);
return path;
}
@@ -290,7 +290,7 @@ namespace tut
}
static const char* DirScanFilename[5] = { "file1.abc", "file2.abc", "file1.xyz", "file2.xyz", "file1.mno" };
-
+
void scanTest(const std::string& directory, const std::string& pattern, bool correctResult[5])
{
@@ -300,8 +300,7 @@ namespace tut
bool filesFound[5] = { false, false, false, false, false };
//std::cerr << "searching '"+directory+"' for '"+pattern+"'\n";
- LLDirIterator iter(directory, pattern);
- while ( found <= 5 && iter.next(scanResult) )
+ while ( found <= 5 && gDirUtilp->getNextFileInDir(directory, pattern, scanResult) )
{
found++;
//std::cerr << " found '"+scanResult+"'\n";
@@ -335,15 +334,15 @@ namespace tut
template<> template<>
void LLDirTest_object_t::test<5>()
- // LLDirIterator::next
+ // getNextFileInDir
{
std::string delim = gDirUtilp->getDirDelimiter();
std::string dirTemp = LLFile::tmpdir();
// Create the same 5 file names of the two directories
- std::string dir1 = makeTestDir(dirTemp + "LLDirIterator");
- std::string dir2 = makeTestDir(dirTemp + "LLDirIterator");
+ std::string dir1 = makeTestDir(dirTemp + "getNextFileInDir");
+ std::string dir2 = makeTestDir(dirTemp + "getNextFileInDir");
std::string dir1files[5];
std::string dir2files[5];
for (int i=0; i<5; i++)
@@ -381,17 +380,19 @@ namespace tut
scanTest(dir2, "file?.x?z", expected7);
// Scan dir2 and see if any file?.??c files are found
- bool expected8[5] = { true, true, false, false, false };
- scanTest(dir2, "file?.??c", expected8);
- scanTest(dir2, "*.??c", expected8);
+ // THESE FAIL ON Mac and Windows, SO ARE COMMENTED OUT FOR NOW
+ // bool expected8[5] = { true, true, false, false, false };
+ // scanTest(dir2, "file?.??c", expected8);
+ // scanTest(dir2, "*.??c", expected8);
// Scan dir1 and see if any *.?n? files are found
bool expected9[5] = { false, false, false, false, true };
scanTest(dir1, "*.?n?", expected9);
// Scan dir1 and see if any *.???? files are found
- bool expected10[5] = { false, false, false, false, false };
- scanTest(dir1, "*.????", expected10);
+ // THIS ONE FAILS ON WINDOWS (returns three charater suffixes) SO IS COMMENTED OUT FOR NOW
+ // bool expected10[5] = { false, false, false, false, false };
+ // scanTest(dir1, "*.????", expected10);
// Scan dir1 and see if any ?????.* files are found
bool expected11[5] = { true, true, true, true, true };
@@ -401,15 +402,6 @@ namespace tut
bool expected12[5] = { false, false, true, true, false };
scanTest(dir1, "??l??.xyz", expected12);
- bool expected13[5] = { true, false, true, false, false };
- scanTest(dir1, "file1.{abc,xyz}", expected13);
-
- bool expected14[5] = { true, true, false, false, false };
- scanTest(dir1, "file[0-9].abc", expected14);
-
- bool expected15[5] = { true, true, false, false, false };
- scanTest(dir1, "file[!a-z].abc", expected15);
-
// clean up all test files and directories
for (int i=0; i<5; i++)
{
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index fab6343864..80c752da9a 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -90,7 +90,6 @@
// Linden library includes
#include "llavatarnamecache.h"
-#include "lldiriterator.h"
#include "llimagej2c.h"
#include "llmemory.h"
#include "llprimitive.h"
@@ -3303,9 +3302,7 @@ void LLAppViewer::migrateCacheDirectory()
S32 file_count = 0;
std::string file_name;
std::string mask = delimiter + "*.*";
-
- LLDirIterator iter(old_cache_dir, mask);
- while (iter.next(file_name))
+ while (gDirUtilp->getNextFileInDir(old_cache_dir, mask, file_name))
{
if (file_name == "." || file_name == "..") continue;
std::string source_path = old_cache_dir + delimiter + file_name;
@@ -3524,8 +3521,7 @@ bool LLAppViewer::initCache()
dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"");
std::string found_file;
- LLDirIterator iter(dir, mask);
- if (iter.next(found_file))
+ if (gDirUtilp->getNextFileInDir(dir, mask, found_file))
{
old_vfs_data_file = dir + gDirUtilp->getDirDelimiter() + found_file;
diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp
index fc7a27e5e0..898cc1c0ba 100644
--- a/indra/newview/llappviewerlinux.cpp
+++ b/indra/newview/llappviewerlinux.cpp
@@ -30,7 +30,6 @@
#include "llcommandlineparser.h"
-#include "lldiriterator.h"
#include "llmemtype.h"
#include "llurldispatcher.h" // SLURL from other app instance
#include "llviewernetwork.h"
@@ -505,9 +504,7 @@ std::string LLAppViewerLinux::generateSerialNumber()
// trawl /dev/disk/by-uuid looking for a good-looking UUID to grab
std::string this_name;
-
- LLDirIterator iter(uuiddir, "*");
- while (iter.next(this_name))
+ while (gDirUtilp->getNextFileInDir(uuiddir, "*", this_name))
{
if (this_name.length() > best.length() ||
(this_name.length() == best.length() &&
diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp
index 182d3d23f1..11b3379814 100644
--- a/indra/newview/llfloateruipreview.cpp
+++ b/indra/newview/llfloateruipreview.cpp
@@ -35,7 +35,6 @@
#include "llfloateruipreview.h" // Own header
// Internal utility
-#include "lldiriterator.h"
#include "lleventtimer.h"
#include "llexternaleditor.h"
#include "llrender.h"
@@ -482,11 +481,9 @@ BOOL LLFloaterUIPreview::postBuild()
std::string language_directory;
std::string xui_dir = get_xui_dir(); // directory containing localizations -- don't forget trailing delim
mLanguageSelection->removeall(); // clear out anything temporarily in list from XML
-
- LLDirIterator iter(xui_dir, "*");
while(found) // for every directory
{
- if((found = iter.next(language_directory))) // get next directory
+ if((found = gDirUtilp->getNextFileInDir(xui_dir, "*", language_directory))) // get next directory
{
std::string full_path = xui_dir + language_directory;
if(LLFile::isfile(full_path.c_str())) // if it's not a directory, skip it
@@ -638,51 +635,42 @@ void LLFloaterUIPreview::refreshList()
mFileList->clearRows(); // empty list
std::string name;
BOOL found = TRUE;
-
- LLDirIterator floater_iter(getLocalizedDirectory(), "floater_*.xml");
while(found) // for every floater file that matches the pattern
{
- if((found = floater_iter.next(name))) // get next file matching pattern
+ if((found = gDirUtilp->getNextFileInDir(getLocalizedDirectory(), "floater_*.xml", name))) // get next file matching pattern
{
addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path)
}
}
found = TRUE;
-
- LLDirIterator inspect_iter(getLocalizedDirectory(), "inspect_*.xml");
while(found) // for every inspector file that matches the pattern
{
- if((found = inspect_iter.next(name))) // get next file matching pattern
+ if((found = gDirUtilp->getNextFileInDir(getLocalizedDirectory(), "inspect_*.xml", name))) // get next file matching pattern
{
addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path)
}
}
found = TRUE;
-
- LLDirIterator menu_iter(getLocalizedDirectory(), "menu_*.xml");
while(found) // for every menu file that matches the pattern
{
- if((found = menu_iter.next(name))) // get next file matching pattern
+ if((found = gDirUtilp->getNextFileInDir(getLocalizedDirectory(), "menu_*.xml", name))) // get next file matching pattern
{
addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path)
}
}
found = TRUE;
-
- LLDirIterator panel_iter(getLocalizedDirectory(), "panel_*.xml");
while(found) // for every panel file that matches the pattern
{
- if((found = panel_iter.next(name))) // get next file matching pattern
+ if((found = gDirUtilp->getNextFileInDir(getLocalizedDirectory(), "panel_*.xml", name))) // get next file matching pattern
{
addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path)
}
}
- found = TRUE;
- LLDirIterator sidepanel_iter(getLocalizedDirectory(), "sidepanel_*.xml");
+ found = TRUE;
while(found) // for every sidepanel file that matches the pattern
{
- if((found = sidepanel_iter.next(name))) // get next file matching pattern
+ if((found = gDirUtilp->getNextFileInDir(getLocalizedDirectory(), "sidepanel_*.xml", name))) // get next file matching pattern
{
addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path)
}
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
index eab8f187a7..570e48d526 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.cpp
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -181,7 +181,7 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
if (mBackgroundFetchActive && gAgent.getRegion())
{
// If we'll be using the capability, we'll be sending batches and the background thing isn't as important.
- std::string url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents");
+ std::string url = gAgent.getRegion()->getCapability("FetchInventoryDescendents2");
if (!url.empty())
{
bulkFetch(url);
@@ -604,7 +604,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
}
if (body_lib["folders"].size())
{
- std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents");
+ std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents2");
LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(body_lib, recursive_cats);
LLHTTPClient::post(url_lib, body_lib, fetcher, 300.0);
diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp
index 91ff8c7867..0fd4b2bee5 100644
--- a/indra/newview/llinventoryobserver.cpp
+++ b/indra/newview/llinventoryobserver.cpp
@@ -203,8 +203,8 @@ void fetch_items_from_llsd(const LLSD& items_llsd)
{
if (!items_llsd.size() || gDisconnected) return;
LLSD body;
- body[0]["cap_name"] = "FetchInventory";
- body[1]["cap_name"] = "FetchLib";
+ body[0]["cap_name"] = "FetchInventory2";
+ body[1]["cap_name"] = "FetchLib2";
for (S32 i=0; i<items_llsd.size();i++)
{
if (items_llsd[i]["owner_id"].asString() == gAgent.getID().asString())
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp
index b09cfbe907..9adf374c71 100644
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -32,7 +32,6 @@
#include "lltrans.h"
#include "llviewercontrol.h"
-#include "lldiriterator.h"
#include "llinstantmessage.h"
#include "llsingleton.h" // for LLSingleton
@@ -602,8 +601,7 @@ std::string LLLogChat::oldLogFileName(std::string filename)
//LL_INFOS("") << "Checking:" << directory << " for " << pattern << LL_ENDL;/* uncomment if you want to verify step, delete on commit */
std::vector<std::string> allfiles;
- LLDirIterator iter(directory, pattern);
- while (iter.next(scanResult))
+ while (gDirUtilp->getNextFileInDir(directory, pattern, scanResult))
{
//LL_INFOS("") << "Found :" << scanResult << LL_ENDL;
allfiles.push_back(scanResult);
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index 211b9cf4b1..0b6267c9e6 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -766,22 +766,12 @@ BOOL LLTaskCategoryBridge::startDrag(EDragAndDropType* type, LLUUID* id) const
LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
if(object)
{
- const LLInventoryItem *inv = dynamic_cast<LLInventoryItem*>(object->getInventoryObject(mUUID));
- if (inv)
+ const LLInventoryObject* cat = object->getInventoryObject(mUUID);
+ if ( (cat) && (move_inv_category_world_to_agent(mUUID, LLUUID::null, FALSE)) )
{
- const LLPermissions& perm = inv->getPermissions();
- bool can_copy = gAgent.allowOperation(PERM_COPY, perm,
- GP_OBJECT_MANIPULATE);
- if((can_copy && perm.allowTransferTo(gAgent.getID()))
- || object->permYouOwner())
-// || gAgent.isGodlike())
-
- {
- *type = LLViewerAssetType::lookupDragAndDropType(inv->getType());
-
- *id = inv->getUUID();
- return TRUE;
- }
+ *type = LLViewerAssetType::lookupDragAndDropType(cat->getType());
+ *id = mUUID;
+ return TRUE;
}
}
}
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index b3642a2c1e..cc851e676b 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -366,11 +366,11 @@ void LLViewerInventoryItem::fetchFromServer(void) const
{
if(gAgent.getID() != mPermissions.getOwner())
{
- url = region->getCapability("FetchLib");
+ url = region->getCapability("FetchLib2");
}
else
{
- url = region->getCapability("FetchInventory");
+ url = region->getCapability("FetchInventory2");
}
}
else
@@ -648,7 +648,7 @@ bool LLViewerInventoryCategory::fetch()
std::string url;
if (gAgent.getRegion())
{
- url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents");
+ url = gAgent.getRegion()->getCapability("FetchInventoryDescendents2");
}
else
{
@@ -660,7 +660,7 @@ bool LLViewerInventoryCategory::fetch()
}
else
{ //Deprecated, but if we don't have a capability, use the old system.
- llinfos << "WebFetchInventoryDescendents capability not found. Using deprecated UDP message." << llendl;
+ llinfos << "FetchInventoryDescendents2 capability not found. Using deprecated UDP message." << llendl;
LLMessageSystem* msg = gMessageSystem;
msg->newMessage("FetchInventoryDescendents");
msg->nextBlock("AgentData");
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 8a0d0a6623..d3b6dcd86f 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -54,7 +54,6 @@
#include "llfilepicker.h"
#include "llnotifications.h"
-#include "lldiriterator.h"
#include "llevent.h" // LLSimpleListener
#include "llnotificationsutil.h"
#include "lluuid.h"
@@ -1116,8 +1115,7 @@ void LLViewerMedia::clearAllCookies()
}
// the hard part: iterate over all user directories and delete the cookie file from each one
- LLDirIterator dir_iter(base_dir, "*_*");
- while (dir_iter.next(filename))
+ while(gDirUtilp->getNextFileInDir(base_dir, "*_*", filename))
{
target = base_dir;
target += filename;
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 3b2cfe656f..c7649001c5 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -1379,11 +1379,12 @@ void LLViewerRegion::setSeedCapability(const std::string& url)
capabilityNames.append("DispatchRegionInfo");
capabilityNames.append("EstateChangeInfo");
capabilityNames.append("EventQueueGet");
- capabilityNames.append("FetchInventory");
capabilityNames.append("ObjectMedia");
capabilityNames.append("ObjectMediaNavigate");
- capabilityNames.append("FetchLib");
- capabilityNames.append("FetchLibDescendents");
+ capabilityNames.append("FetchLib2");
+ capabilityNames.append("FetchLibDescendents2");
+ capabilityNames.append("FetchInventory2");
+ capabilityNames.append("FetchInventoryDescendents2");
capabilityNames.append("GetDisplayNames");
capabilityNames.append("GetTexture");
capabilityNames.append("GroupProposalBallot");
@@ -1423,7 +1424,6 @@ void LLViewerRegion::setSeedCapability(const std::string& url)
capabilityNames.append("ViewerMetrics");
capabilityNames.append("ViewerStartAuction");
capabilityNames.append("ViewerStats");
- capabilityNames.append("WebFetchInventoryDescendents");
// Please add new capabilities alphabetically to reduce
// merge conflicts.
diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp
index 4f6ec4ca61..d239347810 100644
--- a/indra/newview/llwaterparammanager.cpp
+++ b/indra/newview/llwaterparammanager.cpp
@@ -33,7 +33,6 @@
#include "pipeline.h"
#include "llsky.h"
-#include "lldiriterator.h"
#include "llfloaterreg.h"
#include "llsliderctrl.h"
#include "llspinctrl.h"
@@ -86,12 +85,11 @@ void LLWaterParamManager::loadAllPresets(const std::string& file_name)
std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", ""));
LL_DEBUGS2("AppInit", "Shaders") << "Loading Default water settings from " << path_name << LL_ENDL;
- bool found = true;
- LLDirIterator app_settings_iter(path_name, "*.xml");
+ bool found = true;
while(found)
{
std::string name;
- found = app_settings_iter.next(name);
+ found = gDirUtilp->getNextFileInDir(path_name, "*.xml", name);
if(found)
{
@@ -113,12 +111,11 @@ void LLWaterParamManager::loadAllPresets(const std::string& file_name)
std::string path_name2(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/water", ""));
LL_DEBUGS2("AppInit", "Shaders") << "Loading User water settings from " << path_name2 << LL_ENDL;
- found = true;
- LLDirIterator user_settings_iter(path_name2, "*.xml");
+ found = true;
while(found)
{
std::string name;
- found = user_settings_iter.next(name);
+ found = gDirUtilp->getNextFileInDir(path_name2, "*.xml", name);
if(found)
{
name=name.erase(name.length()-4);
diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp
index 848efcbb49..e5f52dfc97 100644
--- a/indra/newview/llwlparammanager.cpp
+++ b/indra/newview/llwlparammanager.cpp
@@ -31,7 +31,6 @@
#include "pipeline.h"
#include "llsky.h"
-#include "lldiriterator.h"
#include "llfloaterreg.h"
#include "llsliderctrl.h"
#include "llspinctrl.h"
@@ -101,12 +100,11 @@ void LLWLParamManager::loadPresets(const std::string& file_name)
std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", ""));
LL_DEBUGS2("AppInit", "Shaders") << "Loading Default WindLight settings from " << path_name << LL_ENDL;
- bool found = true;
- LLDirIterator app_settings_iter(path_name, "*.xml");
+ bool found = true;
while(found)
{
std::string name;
- found = app_settings_iter.next(name);
+ found = gDirUtilp->getNextFileInDir(path_name, "*.xml", name);
if(found)
{
@@ -128,12 +126,11 @@ void LLWLParamManager::loadPresets(const std::string& file_name)
std::string path_name2(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", ""));
LL_DEBUGS2("AppInit", "Shaders") << "Loading User WindLight settings from " << path_name2 << LL_ENDL;
- found = true;
- LLDirIterator user_settings_iter(path_name2, "*.xml");
+ found = true;
while(found)
{
std::string name;
- found = user_settings_iter.next(name);
+ found = gDirUtilp->getNextFileInDir(path_name2, "*.xml", name);
if(found)
{
name=name.erase(name.length()-4);
diff --git a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp
index e19d5724f1..88ab5a2284 100644
--- a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp
+++ b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp
@@ -59,6 +59,12 @@ class LLDir_Mock : public LLDir
return 0;
}
+ BOOL getNextFileInDir(const std::string &dirname,
+ const std::string &mask,
+ std::string &fname)
+ {
+ return false;
+ }
void getRandomFileInDir(const std::string &dirname,
const std::string &mask,
std::string &fname) {}