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
47fab925
Kaydet (Commit)
47fab925
authored
Şub 18, 2006
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Bug #1366000: cleanup BZ2File.seek() logic. Fixes the case of whence=2, offset>=0.
üst
d5b67150
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
42 deletions
+33
-42
bz2module.c
Modules/bz2module.c
+33
-42
No files found.
Modules/bz2module.c
Dosyayı görüntüle @
47fab925
...
...
@@ -1017,50 +1017,43 @@ BZ2File_seek(BZ2FileObject *self, PyObject *args)
goto
cleanup
;;
}
if
(
offset
<
0
)
{
if
(
where
==
1
)
{
offset
=
self
->
pos
+
offset
;
rewind
=
1
;
}
else
if
(
where
==
2
)
{
if
(
self
->
size
==
-
1
)
{
assert
(
self
->
mode
!=
MODE_READ_EOF
);
for
(;;)
{
Py_BEGIN_ALLOW_THREADS
chunksize
=
Util_UnivNewlineRead
(
&
bzerror
,
self
->
fp
,
buffer
,
buffersize
,
self
);
self
->
pos
+=
chunksize
;
Py_END_ALLOW_THREADS
bytesread
+=
chunksize
;
if
(
bzerror
==
BZ_STREAM_END
)
{
break
;
}
else
if
(
bzerror
!=
BZ_OK
)
{
Util_CatchBZ2Error
(
bzerror
);
goto
cleanup
;
}
if
(
where
==
2
)
{
if
(
self
->
size
==
-
1
)
{
assert
(
self
->
mode
!=
MODE_READ_EOF
);
for
(;;)
{
Py_BEGIN_ALLOW_THREADS
chunksize
=
Util_UnivNewlineRead
(
&
bzerror
,
self
->
fp
,
buffer
,
buffersize
,
self
);
self
->
pos
+=
chunksize
;
Py_END_ALLOW_THREADS
bytesread
+=
chunksize
;
if
(
bzerror
==
BZ_STREAM_END
)
{
break
;
}
else
if
(
bzerror
!=
BZ_OK
)
{
Util_CatchBZ2Error
(
bzerror
);
goto
cleanup
;
}
self
->
mode
=
MODE_READ_EOF
;
self
->
size
=
self
->
pos
;
bytesread
=
0
;
}
offset
=
self
->
size
+
offset
;
if
(
offset
>=
self
->
pos
)
offset
-=
self
->
pos
;
else
rewind
=
1
;
self
->
mode
=
MODE_READ_EOF
;
self
->
size
=
self
->
pos
;
bytesread
=
0
;
}
if
(
offset
<
0
)
offset
=
0
;
}
else
if
(
where
==
0
)
{
if
(
offset
>=
self
->
pos
)
offset
-=
self
->
pos
;
else
rewind
=
1
;
offset
=
self
->
size
+
offset
;
}
else
if
(
where
==
1
)
{
offset
=
self
->
pos
+
offset
;
}
if
(
rewind
)
{
/* Before getting here, offset must be the absolute position the file
* pointer should be set to. */
if
(
offset
>=
self
->
pos
)
{
/* we can move forward */
offset
-=
self
->
pos
;
}
else
{
/* we cannot move back, so rewind the stream */
BZ2_bzReadClose
(
&
bzerror
,
self
->
fp
);
if
(
bzerror
!=
BZ_OK
)
{
Util_CatchBZ2Error
(
bzerror
);
...
...
@@ -1079,11 +1072,9 @@ BZ2File_seek(BZ2FileObject *self, PyObject *args)
goto
cleanup
;
}
self
->
mode
=
MODE_READ
;
}
else
if
(
self
->
mode
==
MODE_READ_EOF
)
{
goto
exit
;
}
if
(
offset
==
0
)
if
(
offset
<=
0
||
self
->
mode
==
MODE_READ_EOF
)
goto
exit
;
/* Before getting here, offset must be set to the number of bytes
...
...
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