Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
36f8e2d1
Commit
36f8e2d1
authored
Aug 21, 1997
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use lseek instead of ftell; compensate by adding BUFSIZE
parent
c6ef2048
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
Objects/fileobject.c
Objects/fileobject.c
+6
-2
No files found.
Objects/fileobject.c
View file @
36f8e2d1
...
...
@@ -406,13 +406,17 @@ new_buffersize(f, currentsize)
size_t
currentsize
;
{
#ifdef HAVE_FSTAT
#ifndef SEEK_CUR
#define SEEK_CUR 1
#endif
long
pos
,
end
;
struct
stat
st
;
if
(
fstat
(
fileno
(
f
->
f_fp
),
&
st
)
==
0
)
{
end
=
st
.
st_size
;
pos
=
ftell
(
f
->
f_fp
);
pos
=
lseek
(
fileno
(
f
->
f_fp
),
0L
,
SEEK_CUR
);
if
(
end
>
pos
&&
pos
>=
0
)
return
end
-
pos
+
1
;
return
end
-
pos
+
BUFSIZ
;
/* Add BUFSIZ to allow for stdio buffered data */
}
#endif
if
(
currentsize
>
SMALLCHUNK
)
{
...
...
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