Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
e398c547
Commit
e398c547
authored
1 year ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Tweaks to reduce string operations in file cache
parent
9d259a03
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llfilesystem/llfilesystem.cpp
+14
-11
14 additions, 11 deletions
indra/llfilesystem/llfilesystem.cpp
indra/llfilesystem/llfilesystem.h
+1
-0
1 addition, 0 deletions
indra/llfilesystem/llfilesystem.h
with
15 additions
and
11 deletions
indra/llfilesystem/llfilesystem.cpp
+
14
−
11
View file @
e398c547
...
...
@@ -54,9 +54,9 @@ LLFileSystem::LLFileSystem(const LLUUID& file_id, const LLAssetType::EType file_
{
// build the filename (TODO: we do this in a few places - perhaps we should factor into a single function)
#if LL_WINDOWS
boost
::
filesystem
::
path
filename
(
ll_convert_string_to_wide
(
LLDiskCache
::
metaDataToFilepath
(
file_id
,
file_type
))
)
;
mFilePath
=
ll_convert_string_to_wide
(
LLDiskCache
::
metaDataToFilepath
(
file_id
,
file_type
));
#else
boost
::
filesystem
::
path
filename
(
LLDiskCache
::
metaDataToFilepath
(
file_id
,
file_type
)
)
;
mFilePath
=
LLDiskCache
::
metaDataToFilepath
(
file_id
,
file_type
);
#endif
// update the last access time for the file if it exists - this is required
...
...
@@ -64,10 +64,10 @@ LLFileSystem::LLFileSystem(const LLUUID& file_id, const LLAssetType::EType file_
// way the cache works - it relies on a valid "last accessed time" for
// each file so it knows how to remove the oldest, unused files
boost
::
system
::
error_code
ec
;
bool
exists
=
boost
::
filesystem
::
exists
(
f
ile
name
,
ec
);
bool
exists
=
boost
::
filesystem
::
exists
(
mF
ile
Path
,
ec
);
if
(
exists
&&
!
ec
.
failed
())
{
LLDiskCache
::
updateFileAccessTime
(
f
ile
name
);
LLDiskCache
::
updateFileAccessTime
(
mF
ile
Path
);
}
}
}
...
...
@@ -141,9 +141,7 @@ BOOL LLFileSystem::read(U8* buffer, S32 bytes)
{
BOOL
success
=
FALSE
;
const
std
::
string
filename
=
LLDiskCache
::
metaDataToFilepath
(
mFileID
,
mFileType
);
LLFILE
*
file
=
LLFile
::
fopen
(
filename
,
"rb"
);
LLFILE
*
file
=
LLFile
::
fopen
(
mFilePath
,
TEXT
(
"rb"
));
if
(
file
)
{
if
(
fseek
(
file
,
mPosition
,
SEEK_SET
)
==
0
)
...
...
@@ -183,7 +181,7 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes)
if
(
mMode
==
APPEND
)
{
LLFILE
*
ofs
=
LLFile
::
fopen
(
f
ile
name
,
"a+b"
);
LLFILE
*
ofs
=
LLFile
::
fopen
(
mF
ile
Path
,
TEXT
(
"a+b"
)
)
;
if
(
ofs
)
{
S32
bytes_written
=
fwrite
(
buffer
,
1
,
bytes
,
ofs
);
...
...
@@ -194,7 +192,7 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes)
}
else
if
(
mMode
==
READ_WRITE
)
{
LLFILE
*
ofs
=
LLFile
::
fopen
(
f
ile
name
,
"r+b"
);
LLFILE
*
ofs
=
LLFile
::
fopen
(
mF
ile
Path
,
TEXT
(
"r+b"
)
)
;
if
(
ofs
)
{
if
(
fseek
(
ofs
,
mPosition
,
SEEK_SET
)
==
0
)
...
...
@@ -207,7 +205,7 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes)
}
else
{
ofs
=
LLFile
::
fopen
(
f
ile
name
,
"wb"
);
ofs
=
LLFile
::
fopen
(
mF
ile
Path
,
TEXT
(
"wb"
)
)
;
if
(
ofs
)
{
S32
bytes_written
=
fwrite
(
buffer
,
1
,
bytes
,
ofs
);
...
...
@@ -219,7 +217,7 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes)
}
else
{
LLFILE
*
ofs
=
LLFile
::
fopen
(
f
ile
name
,
"wb"
);
LLFILE
*
ofs
=
LLFile
::
fopen
(
mF
ile
Path
,
TEXT
(
"wb"
)
)
;
if
(
ofs
)
{
S32
bytes_written
=
fwrite
(
buffer
,
1
,
bytes
,
ofs
);
...
...
@@ -285,6 +283,11 @@ BOOL LLFileSystem::rename(const LLUUID& new_id, const LLAssetType::EType new_typ
mFileID
=
new_id
;
mFileType
=
new_type
;
#if LL_WINDOWS
mFilePath
=
ll_convert_string_to_wide
(
LLDiskCache
::
metaDataToFilepath
(
mFileID
,
mFileType
));
#else
mFilePath
=
LLDiskCache
::
metaDataToFilepath
(
mFileID
,
mFileType
);
#endif
return
TRUE
;
}
...
...
This diff is collapsed.
Click to expand it.
indra/llfilesystem/llfilesystem.h
+
1
−
0
View file @
e398c547
...
...
@@ -66,6 +66,7 @@ class LLFileSystem
static
const
S32
APPEND
;
protected:
boost
::
filesystem
::
path
mFilePath
;
LLAssetType
::
EType
mFileType
;
LLUUID
mFileID
;
S32
mPosition
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment