Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
dav1d
Commits
3cf4d32e
Commit
3cf4d32e
authored
Feb 11, 2019
by
Henrik Gramner
Committed by
Henrik Gramner
Feb 11, 2019
Browse files
Use 64-bit versions of fseek and ftell
parent
0d18b15a
Pipeline
#4515
passed with stages
in 8 minutes and 5 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
meson.build
View file @
3cf4d32e
...
...
@@ -89,6 +89,12 @@ if host_machine.system() == 'windows'
cdata
.
set
(
'UNICODE'
,
1
)
# Define to 1 for Unicode (Wide Chars) APIs
cdata
.
set
(
'_UNICODE'
,
1
)
# Define to 1 for Unicode (Wide Chars) APIs
cdata
.
set
(
'__USE_MINGW_ANSI_STDIO'
,
1
)
# Define to force use of MinGW printf
if
cc
.
has_function
(
'fseeko'
,
prefix
:
'#include <stdio.h>'
,
args
:
test_args
)
cdata
.
set
(
'_FILE_OFFSET_BITS'
,
64
)
# Not set by default by Meson on Windows
else
cdata
.
set
(
'fseeko'
,
'_fseeki64'
)
cdata
.
set
(
'ftello'
,
'_ftelli64'
)
endif
endif
# On Windows, we use a compatibility layer to emulate pthread
...
...
src/arm/cpu.c
View file @
3cf4d32e
...
...
@@ -62,7 +62,7 @@ static unsigned parse_proc_cpuinfo(const char *flag) {
// if line is incomplete seek back to avoid splitting the search
// string into two buffers
if
(
!
strchr
(
line
,
'\n'
)
&&
strlen
(
line
)
>
strlen
(
flag
))
{
if
(
fseek
(
file
,
-
strlen
(
flag
),
SEEK_CUR
))
if
(
fseek
o
(
file
,
-
strlen
(
flag
),
SEEK_CUR
))
break
;
}
}
...
...
tests/libfuzzer/main.c
View file @
3cf4d32e
...
...
@@ -25,7 +25,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include
"config.h"
#include
<errno.h>
#include
<inttypes.h>
#include
<limits.h>
#include
<stddef.h>
#include
<stdint.h>
...
...
@@ -40,7 +43,7 @@
int
main
(
const
int
argc
,
char
*
const
*
const
argv
)
{
int
ret
=
-
1
;
FILE
*
f
=
NULL
;
long
fsize
;
int64_t
fsize
;
const
char
*
filename
=
NULL
;
uint8_t
*
data
=
NULL
;
size_t
size
=
0
;
...
...
@@ -56,22 +59,22 @@ int main(const int argc, char *const *const argv) {
goto
error
;
}
if
(
fseek
(
f
,
0
L
,
SEEK_END
)
==
-
1
)
{
if
(
fseek
o
(
f
,
0
,
SEEK_END
)
==
-
1
)
{
fprintf
(
stderr
,
"fseek(%s, 0, SEEK_END) failed: %s
\n
"
,
filename
,
strerror
(
errno
));
goto
error
;
}
if
((
fsize
=
ftell
(
f
))
==
-
1
)
{
if
((
fsize
=
ftell
o
(
f
))
==
-
1
)
{
fprintf
(
stderr
,
"ftell(%s) failed: %s
\n
"
,
filename
,
strerror
(
errno
));
goto
error
;
}
rewind
(
f
);
if
(
fsize
<
0
||
fsize
>
INT_MAX
)
{
fprintf
(
stderr
,
"%s is too large: %
ld
\n
"
,
filename
,
fsize
);
fprintf
(
stderr
,
"%s is too large: %
"
PRId64
"
\n
"
,
filename
,
fsize
);
goto
error
;
}
size
=
fsize
;
size
=
(
size_t
)
fsize
;
if
(
!
(
data
=
malloc
(
size
)))
{
fprintf
(
stderr
,
"failed to allocate: %zu bytes
\n
"
,
size
);
...
...
tools/input/annexb.c
View file @
3cf4d32e
...
...
@@ -77,9 +77,9 @@ static int annexb_open(AnnexbInputContext *const c, const char *const file,
res
=
leb128
(
c
,
&
len
);
if
(
res
<
0
)
break
;
fseek
(
c
->
f
,
len
,
SEEK_CUR
);
fseek
o
(
c
->
f
,
len
,
SEEK_CUR
);
}
fseek
(
c
->
f
,
0
,
SEEK_SET
);
fseek
o
(
c
->
f
,
0
,
SEEK_SET
);
return
0
;
}
...
...
tools/input/ivf.c
View file @
3cf4d32e
...
...
@@ -36,10 +36,6 @@
#include
"input/demuxer.h"
#ifdef _MSC_VER
#define ftello _ftelli64
#endif
typedef
struct
DemuxerPriv
{
FILE
*
f
;
}
IvfInputContext
;
...
...
@@ -85,11 +81,11 @@ static int ivf_open(IvfInputContext *const c, const char *const file,
for
(
*
num_frames
=
0
;;
(
*
num_frames
)
++
)
{
if
((
res
=
fread
(
data
,
4
,
1
,
c
->
f
))
!=
1
)
break
;
// EOF
fseek
(
c
->
f
,
rl32
(
data
)
+
8
,
SEEK_CUR
);
fseek
o
(
c
->
f
,
rl32
(
data
)
+
8
,
SEEK_CUR
);
}
fps
[
0
]
*=
*
num_frames
;
fps
[
1
]
*=
duration
;
fseek
(
c
->
f
,
32
,
SEEK_SET
);
fseek
o
(
c
->
f
,
32
,
SEEK_SET
);
return
0
;
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment