Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Richard Gobeille
EDuke32
Commits
6256d4bf
Commit
6256d4bf
authored
Nov 06, 2020
by
Dino Bollinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Duke3D: Fix internal compiler errors when script buffer is resized.
parent
e3109037
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
source/duke3d/src/gamedef.cpp
source/duke3d/src/gamedef.cpp
+8
-2
No files found.
source/duke3d/src/gamedef.cpp
View file @
6256d4bf
...
...
@@ -1046,7 +1046,7 @@ static void C_SetScriptSize(int32_t newsize)
{
if
(
BITPTR_IS_POINTER
(
i
))
{
if
(
EDUKE32_PREDICT_FALSE
(
apScript
[
i
]
<
(
intptr_t
)
apScript
||
apScript
[
i
]
>
=
(
intptr_t
)
g_scriptPtr
))
if
(
EDUKE32_PREDICT_FALSE
(
apScript
[
i
]
<
(
intptr_t
)
apScript
||
apScript
[
i
]
>
(
intptr_t
)
g_scriptPtr
))
{
g_errorCnt
++
;
buildprint
(
"Internal compiler error at "
,
i
,
" (0x"
,
hex
(
i
),
")
\n
"
);
...
...
@@ -1060,11 +1060,17 @@ static void C_SetScriptSize(int32_t newsize)
G_Util_PtrToIdx2
(
&
g_tile
[
0
].
execPtr
,
MAXTILES
,
sizeof
(
tiledata_t
),
apScript
,
P2I_FWD_NON0
);
G_Util_PtrToIdx2
(
&
g_tile
[
0
].
loadPtr
,
MAXTILES
,
sizeof
(
tiledata_t
),
apScript
,
P2I_FWD_NON0
);
size_t
old_bitptr_size
=
(((
g_scriptSize
+
7
)
>>
3
)
+
1
)
*
sizeof
(
uint8_t
);
size_t
new_bitptr_size
=
(((
newsize
+
7
)
>>
3
)
+
1
)
*
sizeof
(
uint8_t
);
auto
newscript
=
(
intptr_t
*
)
Xrealloc
(
apScript
,
newsize
*
sizeof
(
intptr_t
));
bitptr
=
(
uint8_t
*
)
Xrealloc
(
bitptr
,
(((
newsize
+
7
)
>>
3
)
+
1
)
*
sizeof
(
uint8_t
)
);
bitptr
=
(
uint8_t
*
)
Xrealloc
(
bitptr
,
new_bitptr_size
);
if
(
newsize
>
g_scriptSize
)
{
Bmemset
(
&
newscript
[
g_scriptSize
],
0
,
(
newsize
-
g_scriptSize
)
*
sizeof
(
intptr_t
));
Bmemset
(
&
bitptr
[
old_bitptr_size
],
0
,
new_bitptr_size
-
old_bitptr_size
);
}
if
(
apScript
!=
newscript
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment