Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
3c9fe0cc
Kaydet (Commit)
3c9fe0cc
authored
Ock 06, 1999
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Changes for long file support by Steve Clift.
(This also redoes my previous patch, but better.)
üst
cdd9ae00
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
11 deletions
+53
-11
fileobject.c
Objects/fileobject.c
+53
-11
No files found.
Objects/fileobject.c
Dosyayı görüntüle @
3c9fe0cc
...
...
@@ -249,18 +249,33 @@ file_seek(f, args)
PyFileObject
*
f
;
PyObject
*
args
;
{
long
offset
;
int
whence
;
int
ret
;
off_t
offset
;
PyObject
*
offobj
;
if
(
f
->
f_fp
==
NULL
)
return
err_closed
();
whence
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"l|i"
,
&
offset
,
&
whence
))
if
(
!
PyArg_ParseTuple
(
args
,
"O|i"
,
&
offobj
,
&
whence
))
return
NULL
;
#if !defined(HAVE_LARGEFILE_SUPPORT)
offset
=
PyInt_AsLong
(
offobj
);
#else
offset
=
PyLong_Check
(
offobj
)
?
PyLong_AsLongLong
(
offobj
)
:
PyInt_AsLong
(
offobj
);
#endif
if
(
PyErr_Occurred
())
return
NULL
;
Py_BEGIN_ALLOW_THREADS
errno
=
0
;
#if defined(HAVE_FSEEKO)
ret
=
fseeko
(
f
->
f_fp
,
offset
,
whence
);
#elif defined(HAVE_FSEEK64)
ret
=
fseek64
(
f
->
f_fp
,
offset
,
whence
);
#else
ret
=
fseek
(
f
->
f_fp
,
offset
,
whence
);
#endif
Py_END_ALLOW_THREADS
if
(
ret
!=
0
)
{
PyErr_SetFromErrno
(
PyExc_IOError
);
...
...
@@ -277,21 +292,38 @@ file_truncate(f, args)
PyFileObject
*
f
;
PyObject
*
args
;
{
long
newsize
;
int
ret
;
off_t
newsize
;
PyObject
*
newsizeobj
;
if
(
f
->
f_fp
==
NULL
)
return
err_closed
();
newsize
=
-
1
;
if
(
!
PyArg_ParseTuple
(
args
,
"|
l"
,
&
newsize
))
{
newsize
obj
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"|
O"
,
&
newsizeobj
))
return
NULL
;
}
if
(
newsize
<
0
)
{
if
(
newsizeobj
!=
NULL
)
{
#if !defined(HAVE_LARGEFILE_SUPPORT)
newsize
=
PyInt_AsLong
(
newsizeobj
);
#else
newsize
=
PyLong_Check
(
newsizeobj
)
?
PyLong_AsLongLong
(
newsizeobj
)
:
PyInt_AsLong
(
newsizeobj
);
#endif
if
(
PyErr_Occurred
())
return
NULL
;
}
else
{
/* Default to current position*/
Py_BEGIN_ALLOW_THREADS
errno
=
0
;
newsize
=
ftell
(
f
->
f_fp
);
/* default to current position*/
#if defined(HAVE_FTELLO) && defined(HAVE_LARGEFILE_SUPPORT)
newsize
=
ftello
(
f
->
f_fp
);
#elif defined(HAVE_FTELL64) && defined(HAVE_LARGEFILE_SUPPORT)
newsize
=
ftell64
(
f
->
f_fp
);
#else
newsize
=
ftell
(
f
->
f_fp
);
#endif
Py_END_ALLOW_THREADS
if
(
newsize
==
-
1
L
)
{
if
(
newsize
==
-
1
)
{
PyErr_SetFromErrno
(
PyExc_IOError
);
clearerr
(
f
->
f_fp
);
return
NULL
;
...
...
@@ -322,21 +354,31 @@ file_tell(f, args)
PyFileObject
*
f
;
PyObject
*
args
;
{
long
offset
;
off_t
offset
;
if
(
f
->
f_fp
==
NULL
)
return
err_closed
();
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
Py_BEGIN_ALLOW_THREADS
errno
=
0
;
#if defined(HAVE_FTELLO) && defined(HAVE_LARGEFILE_SUPPORT)
offset
=
ftello
(
f
->
f_fp
);
#elif defined(HAVE_FTELL64) && defined(HAVE_LARGEFILE_SUPPORT)
offset
=
ftell64
(
f
->
f_fp
);
#else
offset
=
ftell
(
f
->
f_fp
);
#endif
Py_END_ALLOW_THREADS
if
(
offset
==
-
1
L
)
{
if
(
offset
==
-
1
)
{
PyErr_SetFromErrno
(
PyExc_IOError
);
clearerr
(
f
->
f_fp
);
return
NULL
;
}
#if !defined(HAVE_LARGEFILE_SUPPORT)
return
PyInt_FromLong
(
offset
);
#else
return
PyLong_FromLongLong
(
offset
);
#endif
}
static
PyObject
*
...
...
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