Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赤子奈落
ygopro
Commits
e542fa5a
Commit
e542fa5a
authored
Feb 18, 2025
by
Chen Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace fread, fwrite
parent
f7ab23da
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
gframe/config.h
gframe/config.h
+1
-1
gframe/replay.cpp
gframe/replay.cpp
+8
-8
No files found.
gframe/config.h
View file @
e542fa5a
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
#define mystrncasecmp strncasecmp
#define mystrncasecmp strncasecmp
#endif
#endif
#include <
stdio.h
>
#include <
cstdio
>
#include <stdlib.h>
#include <stdlib.h>
#include <iostream>
#include <iostream>
#include <algorithm>
#include <algorithm>
...
...
gframe/replay.cpp
View file @
e542fa5a
...
@@ -39,7 +39,7 @@ void Replay::WriteHeader(ReplayHeader& header) {
...
@@ -39,7 +39,7 @@ void Replay::WriteHeader(ReplayHeader& header) {
DWORD
size
;
DWORD
size
;
WriteFile
(
recording_fp
,
&
header
,
sizeof
(
header
),
&
size
,
nullptr
);
WriteFile
(
recording_fp
,
&
header
,
sizeof
(
header
),
&
size
,
nullptr
);
#else
#else
fwrite
(
&
header
,
sizeof
(
header
),
1
,
fp
);
std
::
fwrite
(
&
header
,
sizeof
(
header
),
1
,
fp
);
fflush
(
fp
);
fflush
(
fp
);
#endif
#endif
}
}
...
@@ -54,7 +54,7 @@ void Replay::WriteData(const void* data, size_t length, bool flush) {
...
@@ -54,7 +54,7 @@ void Replay::WriteData(const void* data, size_t length, bool flush) {
DWORD
size
;
DWORD
size
;
WriteFile
(
recording_fp
,
data
,
length
,
&
size
,
nullptr
);
WriteFile
(
recording_fp
,
data
,
length
,
&
size
,
nullptr
);
#else
#else
fwrite
(
data
,
length
,
1
,
fp
);
std
::
fwrite
(
data
,
length
,
1
,
fp
);
if
(
flush
)
if
(
flush
)
fflush
(
fp
);
fflush
(
fp
);
#endif
#endif
...
@@ -97,8 +97,8 @@ void Replay::SaveReplay(const wchar_t* name) {
...
@@ -97,8 +97,8 @@ void Replay::SaveReplay(const wchar_t* name) {
FILE
*
rfp
=
myfopen
(
fname
,
"wb"
);
FILE
*
rfp
=
myfopen
(
fname
,
"wb"
);
if
(
!
rfp
)
if
(
!
rfp
)
return
;
return
;
fwrite
(
&
pheader
,
sizeof
pheader
,
1
,
rfp
);
std
::
fwrite
(
&
pheader
,
sizeof
pheader
,
1
,
rfp
);
fwrite
(
comp_data
,
comp_size
,
1
,
rfp
);
std
::
fwrite
(
comp_data
,
comp_size
,
1
,
rfp
);
fclose
(
rfp
);
fclose
(
rfp
);
}
}
bool
Replay
::
OpenReplay
(
const
wchar_t
*
name
)
{
bool
Replay
::
OpenReplay
(
const
wchar_t
*
name
)
{
...
@@ -116,12 +116,12 @@ bool Replay::OpenReplay(const wchar_t* name) {
...
@@ -116,12 +116,12 @@ bool Replay::OpenReplay(const wchar_t* name) {
is_replaying
=
false
;
is_replaying
=
false
;
replay_size
=
0
;
replay_size
=
0
;
comp_size
=
0
;
comp_size
=
0
;
if
(
fread
(
&
pheader
,
sizeof
pheader
,
1
,
rfp
)
<
1
)
{
if
(
std
::
fread
(
&
pheader
,
sizeof
pheader
,
1
,
rfp
)
<
1
)
{
fclose
(
rfp
);
fclose
(
rfp
);
return
false
;
return
false
;
}
}
if
(
pheader
.
flag
&
REPLAY_COMPRESSED
)
{
if
(
pheader
.
flag
&
REPLAY_COMPRESSED
)
{
comp_size
=
fread
(
comp_data
,
1
,
MAX_COMP_SIZE
,
rfp
);
comp_size
=
std
::
fread
(
comp_data
,
1
,
MAX_COMP_SIZE
,
rfp
);
fclose
(
rfp
);
fclose
(
rfp
);
if
(
pheader
.
datasize
>
MAX_REPLAY_SIZE
)
if
(
pheader
.
datasize
>
MAX_REPLAY_SIZE
)
return
false
;
return
false
;
...
@@ -133,7 +133,7 @@ bool Replay::OpenReplay(const wchar_t* name) {
...
@@ -133,7 +133,7 @@ bool Replay::OpenReplay(const wchar_t* name) {
return
false
;
return
false
;
}
}
}
else
{
}
else
{
replay_size
=
fread
(
replay_data
,
1
,
MAX_REPLAY_SIZE
,
rfp
);
replay_size
=
std
::
fread
(
replay_data
,
1
,
MAX_REPLAY_SIZE
,
rfp
);
fclose
(
rfp
);
fclose
(
rfp
);
comp_size
=
0
;
comp_size
=
0
;
}
}
...
@@ -147,7 +147,7 @@ bool Replay::CheckReplay(const wchar_t* name) {
...
@@ -147,7 +147,7 @@ bool Replay::CheckReplay(const wchar_t* name) {
if
(
!
rfp
)
if
(
!
rfp
)
return
false
;
return
false
;
ReplayHeader
rheader
;
ReplayHeader
rheader
;
size_t
count
=
fread
(
&
rheader
,
sizeof
rheader
,
1
,
rfp
);
size_t
count
=
std
::
fread
(
&
rheader
,
sizeof
rheader
,
1
,
rfp
);
fclose
(
rfp
);
fclose
(
rfp
);
return
count
==
1
&&
rheader
.
id
==
0x31707279
&&
rheader
.
version
>=
0x12d0u
&&
(
rheader
.
version
<
0x1353u
||
(
rheader
.
flag
&
REPLAY_UNIFORM
));
return
count
==
1
&&
rheader
.
id
==
0x31707279
&&
rheader
.
version
>=
0x12d0u
&&
(
rheader
.
version
<
0x1353u
||
(
rheader
.
flag
&
REPLAY_UNIFORM
));
}
}
...
...
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