Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
7ba93c18
Commit
7ba93c18
authored
5 years ago
by
LJ Sonic
Browse files
Options
Downloads
Patches
Plain Diff
Fix warning and formatting
parent
76bda716
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!985
Shaders next merge
,
!833
Fix compiler warning
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/blua/liolib.c
+6
-8
6 additions, 8 deletions
src/blua/liolib.c
with
6 additions
and
8 deletions
src/blua/liolib.c
+
6
−
8
View file @
7ba93c18
...
...
@@ -34,7 +34,8 @@
#define FMT_FILECALLBACKID "file_callback_%d"
static
const
char
*
whitelist
[]
=
{
// Allow scripters to write files of these types to SRB2's folder
// Allow scripters to write files of these types to SRB2's folder
static
const
char
*
whitelist
[]
=
{
".bmp"
,
".cfg"
,
".csv"
,
...
...
@@ -508,7 +509,6 @@ static int io_readline (lua_State *L) {
static
int
g_write
(
lua_State
*
L
,
FILE
*
f
,
int
arg
)
{
int
nargs
=
lua_gettop
(
L
)
-
1
;
int
status
=
1
;
size_t
count
;
for
(;
nargs
--
;
arg
++
)
{
if
(
lua_type
(
L
,
arg
)
==
LUA_TNUMBER
)
{
/* optimization: could be done exactly as for strings */
...
...
@@ -518,12 +518,10 @@ static int g_write (lua_State *L, FILE *f, int arg) {
else
{
size_t
l
;
const
char
*
s
=
luaL_checklstring
(
L
,
arg
,
&
l
);
count
+=
l
;
if
(
ftell
(
f
)
+
l
>
FILELIMIT
)
{
luaL_error
(
L
,
"write limit bypassed in file. Changes have been discarded."
);
break
;
}
if
(
ftell
(
f
)
+
l
>
FILELIMIT
)
{
luaL_error
(
L
,
"write limit bypassed in file. Changes have been discarded."
);
break
;
}
status
=
status
&&
(
fwrite
(
s
,
sizeof
(
char
),
l
,
f
)
==
l
);
}
}
...
...
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