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
a2e73cb4
Commit
a2e73cb4
authored
4 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
More error handling for cache read and write
parent
25d188b4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/llfilesystem/llfilesystem.cpp
+24
-11
24 additions, 11 deletions
indra/llfilesystem/llfilesystem.cpp
with
24 additions
and
11 deletions
indra/llfilesystem/llfilesystem.cpp
+
24
−
11
View file @
a2e73cb4
...
@@ -81,7 +81,8 @@ BOOL LLFileSystem::read(U8* buffer, S32 bytes)
...
@@ -81,7 +81,8 @@ BOOL LLFileSystem::read(U8* buffer, S32 bytes)
if
(
filep
)
if
(
filep
)
{
{
fseek
(
filep
,
mPosition
,
SEEK_SET
);
fseek
(
filep
,
mPosition
,
SEEK_SET
);
if
(
fread
((
void
*
)
buffer
,
1
,
bytes
,
filep
)
>
0
)
size_t
bytes_read
=
fread
((
void
*
)
buffer
,
1
,
bytes
,
filep
);
if
(
bytes_read
==
bytes
)
{
{
mBytesRead
=
bytes
;
mBytesRead
=
bytes
;
}
}
...
@@ -93,7 +94,8 @@ BOOL LLFileSystem::read(U8* buffer, S32 bytes)
...
@@ -93,7 +94,8 @@ BOOL LLFileSystem::read(U8* buffer, S32 bytes)
if
(
mPosition
<
fsize
)
if
(
mPosition
<
fsize
)
{
{
long
rsize
=
fsize
-
mPosition
;
long
rsize
=
fsize
-
mPosition
;
if
(
fread
((
void
*
)
buffer
,
1
,
rsize
,
filep
)
>
0
)
size_t
bytes_read
=
fread
((
void
*
)
buffer
,
1
,
rsize
,
filep
);
if
(
bytes_read
==
rsize
)
{
{
mBytesRead
=
rsize
;
mBytesRead
=
rsize
;
}
}
...
@@ -150,10 +152,12 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes)
...
@@ -150,10 +152,12 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes)
fseek
(
filep
,
mPosition
,
SEEK_SET
);
fseek
(
filep
,
mPosition
,
SEEK_SET
);
size_t
bytes_written
=
fwrite
((
const
void
*
)
buffer
,
1
,
bytes
,
filep
);
size_t
bytes_written
=
fwrite
((
const
void
*
)
buffer
,
1
,
bytes
,
filep
);
if
(
bytes_written
==
bytes
)
{
mPosition
+=
bytes_written
;
mPosition
+=
bytes_written
;
success
=
TRUE
;
}
success
=
TRUE
;
}
}
else
else
{
{
...
@@ -162,9 +166,12 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes)
...
@@ -162,9 +166,12 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes)
{
{
size_t
bytes_written
=
fwrite
((
const
void
*
)
buffer
,
1
,
bytes
,
filep
);
size_t
bytes_written
=
fwrite
((
const
void
*
)
buffer
,
1
,
bytes
,
filep
);
mPosition
=
bytes_written
;
if
(
bytes_written
==
bytes
)
{
mPosition
=
bytes_written
;
success
=
TRUE
;
success
=
TRUE
;
}
}
}
}
}
}
}
...
@@ -178,9 +185,12 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes)
...
@@ -178,9 +185,12 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes)
size_t
bytes_written
=
fwrite
((
const
void
*
)
buffer
,
1
,
bytes
,
filep
);
size_t
bytes_written
=
fwrite
((
const
void
*
)
buffer
,
1
,
bytes
,
filep
);
mPosition
=
fsize
+
bytes_written
;
if
(
bytes_written
==
bytes
)
{
mPosition
=
fsize
+
bytes_written
;
success
=
TRUE
;
success
=
TRUE
;
}
}
}
}
}
else
else
...
@@ -190,9 +200,12 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes)
...
@@ -190,9 +200,12 @@ BOOL LLFileSystem::write(const U8* buffer, S32 bytes)
{
{
size_t
bytes_written
=
fwrite
((
const
void
*
)
buffer
,
1
,
bytes
,
filep
);
size_t
bytes_written
=
fwrite
((
const
void
*
)
buffer
,
1
,
bytes
,
filep
);
mPosition
=
bytes_written
;
if
(
bytes_written
==
bytes
)
{
mPosition
=
bytes_written
;
success
=
TRUE
;
success
=
TRUE
;
}
}
}
}
}
...
...
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