summaryrefslogtreecommitdiff
path: root/indra/llvfs
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llvfs')
-rw-r--r--indra/llvfs/lldir.cpp74
-rw-r--r--indra/llvfs/lldir.h5
-rw-r--r--indra/llvfs/lldir_linux.cpp18
-rw-r--r--indra/llvfs/lldir_solaris.cpp18
-rw-r--r--indra/llvfs/lldir_win32.cpp12
-rw-r--r--indra/llvfs/lllfsthread.cpp6
-rw-r--r--indra/llvfs/lllfsthread.h10
-rw-r--r--indra/llvfs/llvfs.cpp87
-rw-r--r--indra/llvfs/llvfs.h10
-rw-r--r--indra/llvfs/llvfsthread.h6
10 files changed, 117 insertions, 129 deletions
diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp
index 3604d3f86f..766c1c85b4 100644
--- a/indra/llvfs/lldir.cpp
+++ b/indra/llvfs/lldir.cpp
@@ -100,7 +100,7 @@ S32 LLDir::deleteFilesInDir(const std::string &dirname, const std::string &mask)
S32 retry_count = 0;
while (retry_count < 5)
{
- if (0 != LLFile::remove(fullpath.c_str()))
+ if (0 != LLFile::remove(fullpath))
{
result = errno;
llwarns << "Problem removing " << fullpath << " - errorcode: "
@@ -381,10 +381,44 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subd
return expanded_filename;
}
+std::string LLDir::getBaseFileName(const std::string& filepath, bool strip_exten) const
+{
+ std::size_t offset = filepath.find_last_of(getDirDelimiter());
+ offset = (offset == std::string::npos) ? 0 : offset+1;
+ std::string res = filepath.substr(offset, std::string::npos);
+ if (strip_exten)
+ {
+ offset = res.find_last_of('.');
+ if (offset != std::string::npos &&
+ offset != 0) // if basename STARTS with '.', don't strip
+ {
+ res = res.substr(0, offset);
+ }
+ }
+ return res;
+}
+
+std::string LLDir::getDirName(const std::string& filepath) const
+{
+ std::size_t offset = filepath.find_last_of(getDirDelimiter());
+ S32 len = (offset == std::string::npos) ? 0 : offset;
+ std::string dirname = filepath.substr(0, len);
+ return dirname;
+}
+
+std::string LLDir::getExtension(const std::string& filepath) const
+{
+ std::string basename = getBaseFileName(filepath, false);
+ std::size_t offset = basename.find_last_of('.');
+ std::string exten = (offset == std::string::npos || offset == 0) ? "" : basename.substr(offset+1);
+ LLStringUtil::toLower(exten);
+ return exten;
+}
+
std::string LLDir::getTempFilename() const
{
LLUUID random_uuid;
- char uuid_str[64]; /* Flawfinder: ignore */
+ std::string uuid_str;
random_uuid.generate();
random_uuid.toString(uuid_str);
@@ -404,15 +438,15 @@ void LLDir::setLindenUserDir(const std::string &first, const std::string &last)
{
// some platforms have case-sensitive filesystems, so be
// utterly consistent with our firstname/lastname case.
- LLString firstlower(first);
- LLString::toLower(firstlower);
- LLString lastlower(last);
- LLString::toLower(lastlower);
+ std::string firstlower(first);
+ LLStringUtil::toLower(firstlower);
+ std::string lastlower(last);
+ LLStringUtil::toLower(lastlower);
mLindenUserDir = getOSUserAppDir();
mLindenUserDir += mDirDelimiter;
- mLindenUserDir += firstlower.c_str();
+ mLindenUserDir += firstlower;
mLindenUserDir += "_";
- mLindenUserDir += lastlower.c_str();
+ mLindenUserDir += lastlower;
}
else
{
@@ -441,15 +475,15 @@ void LLDir::setPerAccountChatLogsDir(const std::string &first, const std::string
{
// some platforms have case-sensitive filesystems, so be
// utterly consistent with our firstname/lastname case.
- LLString firstlower(first);
- LLString::toLower(firstlower);
- LLString lastlower(last);
- LLString::toLower(lastlower);
+ std::string firstlower(first);
+ LLStringUtil::toLower(firstlower);
+ std::string lastlower(last);
+ LLStringUtil::toLower(lastlower);
mPerAccountChatLogsDir = getChatLogsDir();
mPerAccountChatLogsDir += mDirDelimiter;
- mPerAccountChatLogsDir += firstlower.c_str();
+ mPerAccountChatLogsDir += firstlower;
mPerAccountChatLogsDir += "_";
- mPerAccountChatLogsDir += lastlower.c_str();
+ mPerAccountChatLogsDir += lastlower;
}
else
{
@@ -476,13 +510,13 @@ bool LLDir::setCacheDir(const std::string &path)
}
else
{
- LLFile::mkdir(path.c_str());
+ LLFile::mkdir(path);
std::string tempname = path + mDirDelimiter + "temp";
- LLFILE* file = LLFile::fopen(tempname.c_str(),"wt");
+ LLFILE* file = LLFile::fopen(tempname,"wt");
if (file)
{
fclose(file);
- LLFile::remove(tempname.c_str());
+ LLFile::remove(tempname);
mCacheDir = path;
return true;
}
@@ -515,15 +549,15 @@ void dir_exists_or_crash(const std::string &dir_name)
#if LL_WINDOWS
// *FIX: lame - it doesn't do the same thing on windows. not so
// important since we don't deploy simulator to windows boxes.
- LLFile::mkdir(dir_name.c_str(), 0700);
+ LLFile::mkdir(dir_name, 0700);
#else
struct stat dir_stat;
- if(0 != LLFile::stat(dir_name.c_str(), &dir_stat))
+ if(0 != LLFile::stat(dir_name, &dir_stat))
{
S32 stat_rv = errno;
if(ENOENT == stat_rv)
{
- if(0 != LLFile::mkdir(dir_name.c_str(), 0700)) // octal
+ if(0 != LLFile::mkdir(dir_name, 0700)) // octal
{
llerrs << "Unable to create directory: " << dir_name << llendl;
}
diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h
index 4426935e5c..6e7166c81d 100644
--- a/indra/llvfs/lldir.h
+++ b/indra/llvfs/lldir.h
@@ -93,6 +93,11 @@ class LLDir
std::string getExpandedFilename(ELLPath location, const std::string &filename) const;
std::string getExpandedFilename(ELLPath location, const std::string &subdir, const std::string &filename) const;
+ // Base and Directory name extraction
+ std::string getBaseFileName(const std::string& filepath, bool strip_exten = false) const;
+ std::string getDirName(const std::string& filepath) const;
+ std::string getExtension(const std::string& filepath) const; // Excludes '.', e.g getExtension("foo.wav") == "wav"
+
// random filename in common temporary directory
std::string getTempFilename() const;
diff --git a/indra/llvfs/lldir_linux.cpp b/indra/llvfs/lldir_linux.cpp
index 222c97156e..7fa30b0ff1 100644
--- a/indra/llvfs/lldir_linux.cpp
+++ b/indra/llvfs/lldir_linux.cpp
@@ -142,8 +142,8 @@ void LLDir_Linux::initAppDirs(const std::string &app_name)
{
mAppName = app_name;
- LLString upper_app_name(app_name);
- LLString::toUpper(upper_app_name);
+ std::string upper_app_name(app_name);
+ LLStringUtil::toUpper(upper_app_name);
char* app_home_env = getenv((upper_app_name + "_USER_DIR").c_str()); /* Flawfinder: ignore */
if (app_home_env)
@@ -157,14 +157,14 @@ void LLDir_Linux::initAppDirs(const std::string &app_name)
mOSUserAppDir = mOSUserDir;
mOSUserAppDir += "/";
mOSUserAppDir += ".";
- LLString lower_app_name(app_name);
- LLString::toLower(lower_app_name);
+ std::string lower_app_name(app_name);
+ LLStringUtil::toLower(lower_app_name);
mOSUserAppDir += lower_app_name;
}
// create any directories we expect to write to.
- int res = LLFile::mkdir(mOSUserAppDir.c_str());
+ int res = LLFile::mkdir(mOSUserAppDir);
if (res == -1)
{
if (errno != EEXIST)
@@ -175,7 +175,7 @@ void LLDir_Linux::initAppDirs(const std::string &app_name)
}
}
- res = LLFile::mkdir(getExpandedFilename(LL_PATH_LOGS,"").c_str());
+ res = LLFile::mkdir(getExpandedFilename(LL_PATH_LOGS,""));
if (res == -1)
{
if (errno != EEXIST)
@@ -184,7 +184,7 @@ void LLDir_Linux::initAppDirs(const std::string &app_name)
}
}
- res = LLFile::mkdir(getExpandedFilename(LL_PATH_USER_SETTINGS,"").c_str());
+ res = LLFile::mkdir(getExpandedFilename(LL_PATH_USER_SETTINGS,""));
if (res == -1)
{
if (errno != EEXIST)
@@ -193,7 +193,7 @@ void LLDir_Linux::initAppDirs(const std::string &app_name)
}
}
- res = LLFile::mkdir(getExpandedFilename(LL_PATH_CACHE,"").c_str());
+ res = LLFile::mkdir(getExpandedFilename(LL_PATH_CACHE,""));
if (res == -1)
{
if (errno != EEXIST)
@@ -202,7 +202,7 @@ void LLDir_Linux::initAppDirs(const std::string &app_name)
}
}
- res = LLFile::mkdir(getExpandedFilename(LL_PATH_MOZILLA_PROFILE,"").c_str());
+ res = LLFile::mkdir(getExpandedFilename(LL_PATH_MOZILLA_PROFILE,""));
if (res == -1)
{
if (errno != EEXIST)
diff --git a/indra/llvfs/lldir_solaris.cpp b/indra/llvfs/lldir_solaris.cpp
index b13d3d05ea..2e6f616a3a 100644
--- a/indra/llvfs/lldir_solaris.cpp
+++ b/indra/llvfs/lldir_solaris.cpp
@@ -152,8 +152,8 @@ void LLDir_Solaris::initAppDirs(const std::string &app_name)
{
mAppName = app_name;
- LLString upper_app_name(app_name);
- LLString::toUpper(upper_app_name);
+ std::string upper_app_name(app_name);
+ LLStringUtil::toUpper(upper_app_name);
char* app_home_env = getenv((upper_app_name + "_USER_DIR").c_str()); /* Flawfinder: ignore */
if (app_home_env)
@@ -167,14 +167,14 @@ void LLDir_Solaris::initAppDirs(const std::string &app_name)
mOSUserAppDir = mOSUserDir;
mOSUserAppDir += "/";
mOSUserAppDir += ".";
- LLString lower_app_name(app_name);
- LLString::toLower(lower_app_name);
+ std::string lower_app_name(app_name);
+ LLStringUtil::toLower(lower_app_name);
mOSUserAppDir += lower_app_name;
}
// create any directories we expect to write to.
- int res = LLFile::mkdir(mOSUserAppDir.c_str());
+ int res = LLFile::mkdir(mOSUserAppDir);
if (res == -1)
{
if (errno != EEXIST)
@@ -185,7 +185,7 @@ void LLDir_Solaris::initAppDirs(const std::string &app_name)
}
}
- res = LLFile::mkdir(getExpandedFilename(LL_PATH_LOGS,"").c_str());
+ res = LLFile::mkdir(getExpandedFilename(LL_PATH_LOGS,""));
if (res == -1)
{
if (errno != EEXIST)
@@ -194,7 +194,7 @@ void LLDir_Solaris::initAppDirs(const std::string &app_name)
}
}
- res = LLFile::mkdir(getExpandedFilename(LL_PATH_USER_SETTINGS,"").c_str());
+ res = LLFile::mkdir(getExpandedFilename(LL_PATH_USER_SETTINGS,""));
if (res == -1)
{
if (errno != EEXIST)
@@ -203,7 +203,7 @@ void LLDir_Solaris::initAppDirs(const std::string &app_name)
}
}
- res = LLFile::mkdir(getExpandedFilename(LL_PATH_CACHE,"").c_str());
+ res = LLFile::mkdir(getExpandedFilename(LL_PATH_CACHE,""));
if (res == -1)
{
if (errno != EEXIST)
@@ -212,7 +212,7 @@ void LLDir_Solaris::initAppDirs(const std::string &app_name)
}
}
- res = LLFile::mkdir(getExpandedFilename(LL_PATH_MOZILLA_PROFILE,"").c_str());
+ res = LLFile::mkdir(getExpandedFilename(LL_PATH_MOZILLA_PROFILE,""));
if (res == -1)
{
if (errno != EEXIST)
diff --git a/indra/llvfs/lldir_win32.cpp b/indra/llvfs/lldir_win32.cpp
index 17723b36d1..0632813b15 100644
--- a/indra/llvfs/lldir_win32.cpp
+++ b/indra/llvfs/lldir_win32.cpp
@@ -141,7 +141,7 @@ void LLDir_Win32::initAppDirs(const std::string &app_name)
mOSUserAppDir += "\\";
mOSUserAppDir += app_name;
- int res = LLFile::mkdir(mOSUserAppDir.c_str());
+ int res = LLFile::mkdir(mOSUserAppDir);
if (res == -1)
{
if (errno != EEXIST)
@@ -153,7 +153,7 @@ void LLDir_Win32::initAppDirs(const std::string &app_name)
}
//dumpCurrentDirectories();
- res = LLFile::mkdir(getExpandedFilename(LL_PATH_LOGS,"").c_str());
+ res = LLFile::mkdir(getExpandedFilename(LL_PATH_LOGS,""));
if (res == -1)
{
if (errno != EEXIST)
@@ -162,7 +162,7 @@ void LLDir_Win32::initAppDirs(const std::string &app_name)
}
}
- res = LLFile::mkdir(getExpandedFilename(LL_PATH_USER_SETTINGS,"").c_str());
+ res = LLFile::mkdir(getExpandedFilename(LL_PATH_USER_SETTINGS,""));
if (res == -1)
{
if (errno != EEXIST)
@@ -171,7 +171,7 @@ void LLDir_Win32::initAppDirs(const std::string &app_name)
}
}
- res = LLFile::mkdir(getExpandedFilename(LL_PATH_CACHE,"").c_str());
+ res = LLFile::mkdir(getExpandedFilename(LL_PATH_CACHE,""));
if (res == -1)
{
if (errno != EEXIST)
@@ -180,7 +180,7 @@ void LLDir_Win32::initAppDirs(const std::string &app_name)
}
}
- res = LLFile::mkdir(getExpandedFilename(LL_PATH_MOZILLA_PROFILE,"").c_str());
+ res = LLFile::mkdir(getExpandedFilename(LL_PATH_MOZILLA_PROFILE,""));
if (res == -1)
{
if (errno != EEXIST)
@@ -349,7 +349,7 @@ BOOL LLDir_Win32::fileExists(const std::string &filename)
llstat stat_data;
// Check the age of the file
// Now, we see if the files we've gathered are recent...
- int res = LLFile::stat(filename.c_str(), &stat_data);
+ int res = LLFile::stat(filename, &stat_data);
if (!res)
{
return TRUE;
diff --git a/indra/llvfs/lllfsthread.cpp b/indra/llvfs/lllfsthread.cpp
index 76e25e2272..daede0bfc0 100644
--- a/indra/llvfs/lllfsthread.cpp
+++ b/indra/llvfs/lllfsthread.cpp
@@ -81,7 +81,7 @@ LLLFSThread::~LLLFSThread()
//----------------------------------------------------------------------------
-LLLFSThread::handle_t LLLFSThread::read(const LLString& filename, /* Flawfinder: ignore */
+LLLFSThread::handle_t LLLFSThread::read(const std::string& filename, /* Flawfinder: ignore */
U8* buffer, S32 offset, S32 numbytes,
Responder* responder, U32 priority)
{
@@ -104,7 +104,7 @@ LLLFSThread::handle_t LLLFSThread::read(const LLString& filename, /* Flawfinder:
return handle;
}
-LLLFSThread::handle_t LLLFSThread::write(const LLString& filename,
+LLLFSThread::handle_t LLLFSThread::write(const std::string& filename,
U8* buffer, S32 offset, S32 numbytes,
Responder* responder, U32 priority)
{
@@ -130,7 +130,7 @@ LLLFSThread::handle_t LLLFSThread::write(const LLString& filename,
LLLFSThread::Request::Request(LLLFSThread* thread,
handle_t handle, U32 priority,
- operation_t op, const LLString& filename,
+ operation_t op, const std::string& filename,
U8* buffer, S32 offset, S32 numbytes,
Responder* responder) :
QueuedRequest(handle, priority, FLAG_AUTO_COMPLETE),
diff --git a/indra/llvfs/lllfsthread.h b/indra/llvfs/lllfsthread.h
index 2a23f550e7..7592ee1839 100644
--- a/indra/llvfs/lllfsthread.h
+++ b/indra/llvfs/lllfsthread.h
@@ -75,7 +75,7 @@ public:
public:
Request(LLLFSThread* thread,
handle_t handle, U32 priority,
- operation_t op, const LLString& filename,
+ operation_t op, const std::string& filename,
U8* buffer, S32 offset, S32 numbytes,
Responder* responder);
@@ -95,7 +95,7 @@ public:
{
return mBuffer;
}
- const LLString& getFilename()
+ const std::string& getFilename()
{
return mFileName;
}
@@ -108,7 +108,7 @@ public:
LLLFSThread* mThread;
operation_t mOperation;
- LLString mFileName;
+ std::string mFileName;
U8* mBuffer; // dest for reads, source for writes, new UUID for rename
S32 mOffset; // offset into file, -1 = append (WRITE only)
@@ -124,10 +124,10 @@ public:
~LLLFSThread();
// Return a Request handle
- handle_t read(const LLString& filename, /* Flawfinder: ignore */
+ handle_t read(const std::string& filename, /* Flawfinder: ignore */
U8* buffer, S32 offset, S32 numbytes,
Responder* responder, U32 pri=0);
- handle_t write(const LLString& filename,
+ handle_t write(const std::string& filename,
U8* buffer, S32 offset, S32 numbytes,
Responder* responder, U32 pri=0);
diff --git a/indra/llvfs/llvfs.cpp b/indra/llvfs/llvfs.cpp
index cb04dee834..07c6124544 100644
--- a/indra/llvfs/llvfs.cpp
+++ b/indra/llvfs/llvfs.cpp
@@ -232,7 +232,7 @@ struct LLVFSFileBlock_less
const S32 LLVFSFileBlock::SERIAL_SIZE = 34;
-LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL read_only, const U32 presize, const BOOL remove_after_crash)
+LLVFS::LLVFS(const std::string& index_filename, const std::string& data_filename, const BOOL read_only, const U32 presize, const BOOL remove_after_crash)
: mRemoveAfterCrash(remove_after_crash)
{
mDataMutex = new LLMutex(0);
@@ -244,15 +244,8 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
}
mValid = VFSVALID_OK;
mReadOnly = read_only;
- mIndexFilename = new char[strlen(index_filename) + 1]; /* Flawfinder: ignore */
- mDataFilename = new char[strlen(data_filename) + 1]; /* Flawfinder: ignore */
- if (mIndexFilename == NULL || mDataFilename == NULL)
- {
- LL_ERRS("VFS") << "Memory Allocation Failure" << LL_ENDL;
- return;
- }
- strcpy(mIndexFilename, index_filename); /* Flawfinder: ignore */
- strcpy(mDataFilename, data_filename); /* Flawfinder: ignore */
+ mIndexFilename = index_filename;
+ mDataFilename = data_filename;
const char *file_mode = mReadOnly ? "rb" : "r+b";
@@ -276,23 +269,13 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
{
LL_WARNS("VFS") << "Can't open VFS data file " << mDataFilename << " attempting to use alternate" << LL_ENDL;
- char *temp_index = new char[strlen(mIndexFilename) + 10]; /* Flawfinder: ignore */
- if (!temp_index)
- {
- LL_ERRS("VFS") << "Out of the memory in LLVFS::LLVFS()" << LL_ENDL;
- return;
- }
- char *temp_data = new char[strlen(mDataFilename) + 10]; /* Flawfinder: ignore */
- if (!temp_data)
- {
- LL_ERRS("VFS") << "Out of the memory in LLVFS::LLVFS()" << LL_ENDL;
- return;
- }
+ std::string temp_index;
+ std::string temp_data;
for (U32 count = 0; count < 256; count++)
{
- sprintf(temp_index, "%s.%u", mIndexFilename, count); /* Flawfinder: ignore */
- sprintf(temp_data, "%s.%u", mDataFilename, count); /* Flawfinder: ignore */
+ temp_index = mIndexFilename + llformat(".%u",count);
+ temp_data = mDataFilename + llformat(".%u", count);
// try just opening, then creating, each alternate
if ((mDataFP = openAndLock(temp_data, "r+b", FALSE)))
@@ -312,14 +295,9 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
{
LL_WARNS("VFS") << "Couldn't open vfs data file after trying many alternates" << LL_ENDL;
mValid = VFSVALID_BAD_CANNOT_CREATE;
- delete[] temp_index;
- delete[] temp_data;
return;
}
- delete[] mIndexFilename;
- delete[] mDataFilename;
-
mIndexFilename = temp_index;
mDataFilename = temp_data;
}
@@ -335,13 +313,7 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
if (!mReadOnly && mRemoveAfterCrash)
{
llstat marker_info;
- char* marker = new char[strlen(mDataFilename) + strlen(".open") + 1]; /* Flawfinder: ignore */
- if (!marker )
- {
- LL_ERRS("VFS") << "Out of memory in LLVFS::LLVFS()" << LL_ENDL;
- return;
- }
- sprintf(marker, "%s.open", mDataFilename); /* Flawfinder: ignore */
+ std::string marker = mDataFilename + ".open";
if (!LLFile::stat(marker, &marker_info))
{
// marker exists, kill the lock and the VFS files
@@ -366,8 +338,6 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
presizeDataFile(presize);
}
}
- delete [] marker;
- marker = NULL;
}
// determine the real file size
@@ -590,21 +560,13 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r
// Open marker file to look for bad shutdowns
if (!mReadOnly && mRemoveAfterCrash)
{
- char* marker = new char[strlen(mDataFilename) + strlen(".open") + 1];
- if (!marker)
- {
- LL_ERRS("VFS") << "Out of memory in LLVFS::LLVFS()" << LL_ENDL;
- return;
- }
- sprintf(marker, "%s.open", mDataFilename); /* Flawfinder: ignore */
+ std::string marker = mDataFilename + ".open";
LLFILE* marker_fp = LLFile::fopen(marker, "w"); /* Flawfinder: ignore */
if (marker_fp)
{
fclose(marker_fp);
marker_fp = NULL;
}
- delete [] marker;
- marker = NULL;
}
LL_WARNS("VFS") << "Using index file " << mIndexFilename << LL_ENDL;
@@ -640,23 +602,10 @@ LLVFS::~LLVFS()
// Remove marker file
if (!mReadOnly && mRemoveAfterCrash)
{
- char* marker_file = new char[strlen(mDataFilename) + strlen(".open") + 1];
- if (marker_file == NULL)
- {
- LL_ERRS("VFS") << "Memory Allocation Failure" << LL_ENDL;
- return;
- }
- sprintf(marker_file, "%s.open", mDataFilename); /* Flawfinder: ignore */
- LLFile::remove(marker_file);
- delete [] marker_file;
- marker_file = NULL;
+ std::string marker = mDataFilename + ".open";
+ LLFile::remove(marker);
}
- delete[] mIndexFilename;
- mIndexFilename = NULL;
- delete[] mDataFilename;
- mDataFilename = NULL;
-
delete mDataMutex;
}
@@ -2042,9 +1991,9 @@ void LLVFS::dumpStatistics()
}
// Debug Only!
-LLString get_extension(LLAssetType::EType type)
+std::string get_extension(LLAssetType::EType type)
{
- LLString extension;
+ std::string extension;
switch(type)
{
case LLAssetType::AT_TEXTURE:
@@ -2085,7 +2034,7 @@ void LLVFS::listFiles()
if (length != BLOCK_LENGTH_INVALID && size > 0)
{
LLUUID id = file_spec.mFileID;
- LLString extension = get_extension(file_spec.mFileType);
+ std::string extension = get_extension(file_spec.mFileType);
llinfos << " File: " << id
<< " Type: " << LLAssetType::getDesc(file_spec.mFileType)
<< " Size: " << size
@@ -2117,8 +2066,8 @@ void LLVFS::dumpFiles()
getData(id, type, buffer, 0, size);
lockData();
- LLString extension = get_extension(type);
- LLString filename = id.asString() + extension;
+ std::string extension = get_extension(type);
+ std::string filename = id.asString() + extension;
llinfos << " Writing " << filename << llendl;
apr_file_t* file = ll_apr_file_open(filename, LL_APR_WB);
ll_apr_file_write(file, buffer, size);
@@ -2135,7 +2084,7 @@ void LLVFS::dumpFiles()
//============================================================================
// static
-LLFILE *LLVFS::openAndLock(const char *filename, const char *mode, BOOL read_lock)
+LLFILE *LLVFS::openAndLock(const std::string& filename, const char* mode, BOOL read_lock)
{
#if LL_WINDOWS
@@ -2153,7 +2102,7 @@ LLFILE *LLVFS::openAndLock(const char *filename, const char *mode, BOOL read_loc
fl.l_start = 0;
fl.l_len = 1;
#else // !LL_SOLARIS
- if (strstr(mode, "w"))
+ if (strchr(mode, 'w') != NULL)
{
fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */
if (fp)
diff --git a/indra/llvfs/llvfs.h b/indra/llvfs/llvfs.h
index 8ed0afe12f..071305d3e6 100644
--- a/indra/llvfs/llvfs.h
+++ b/indra/llvfs/llvfs.h
@@ -78,7 +78,7 @@ class LLVFS
{
public:
// Pass 0 to not presize
- LLVFS(const char *index_filename, const char *data_filename, const BOOL read_only, const U32 presize, const BOOL remove_after_crash);
+ LLVFS(const std::string& index_filename, const std::string& data_filename, const BOOL read_only, const U32 presize, const BOOL remove_after_crash);
~LLVFS();
BOOL isValid() const { return (VFSVALID_OK == mValid); }
@@ -131,8 +131,8 @@ protected:
void sync(LLVFSFileBlock *block, BOOL remove = FALSE);
void presizeDataFile(const U32 size);
- static LLFILE *openAndLock(const char *filename, const char *mode, BOOL read_lock);
- static void unlockAndClose(LLFILE *fp);
+ static LLFILE *openAndLock(const std::string& filename, const char* mode, BOOL read_lock);
+ static void unlockAndClose(FILE *fp);
// Can initiate LRU-based file removal to make space.
// The immune file block will not be removed.
@@ -158,8 +158,8 @@ protected:
std::deque<S32> mIndexHoles;
- char *mIndexFilename;
- char *mDataFilename;
+ std::string mIndexFilename;
+ std::string mDataFilename;
BOOL mReadOnly;
EVFSValid mValid;
diff --git a/indra/llvfs/llvfsthread.h b/indra/llvfs/llvfsthread.h
index 6028199055..4e20e98d1d 100644
--- a/indra/llvfs/llvfsthread.h
+++ b/indra/llvfs/llvfsthread.h
@@ -87,9 +87,9 @@ public:
}
std::string getFilename()
{
- char tbuf[40]; /* Flawfinder: ignore */
- mFileID.toString(tbuf);
- return std::string(tbuf);
+ std::string tstring;
+ mFileID.toString(tstring);
+ return tstring;
}
/*virtual*/ bool processRequest();