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
685e16d7
Kaydet (Commit)
685e16d7
authored
Eki 03, 1995
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed hexbin handling
üst
8150760e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
binhex.py
Lib/binhex.py
+7
-4
No files found.
Lib/binhex.py
Dosyayı görüntüle @
685e16d7
...
@@ -198,6 +198,7 @@ class BinHex:
...
@@ -198,6 +198,7 @@ class BinHex:
self
.
ofp
.
write
(
data
)
self
.
ofp
.
write
(
data
)
def
_writecrc
(
self
):
def
_writecrc
(
self
):
## self.crc = binascii.crc_hqx('\0\0', self.crc) # XXXX Should this be here??
self
.
ofp
.
write
(
struct
.
pack
(
'h'
,
self
.
crc
))
self
.
ofp
.
write
(
struct
.
pack
(
'h'
,
self
.
crc
))
self
.
crc
=
0
self
.
crc
=
0
...
@@ -257,9 +258,10 @@ class _Hqxdecoderengine:
...
@@ -257,9 +258,10 @@ class _Hqxdecoderengine:
self
.
ifp
=
ifp
self
.
ifp
=
ifp
self
.
eof
=
0
self
.
eof
=
0
def
read
(
self
,
wtd
):
def
read
(
self
,
total
wtd
):
"""Read at least wtd bytes (or until EOF)"""
"""Read at least wtd bytes (or until EOF)"""
decdata
=
''
decdata
=
''
wtd
=
totalwtd
#
#
# The loop here is convoluted, since we don't really now how much
# The loop here is convoluted, since we don't really now how much
# to decode: there may be newlines in the incoming data.
# to decode: there may be newlines in the incoming data.
...
@@ -283,7 +285,7 @@ class _Hqxdecoderengine:
...
@@ -283,7 +285,7 @@ class _Hqxdecoderengine:
raise
Error
,
'Premature EOF on binhex file'
raise
Error
,
'Premature EOF on binhex file'
data
=
data
+
newdata
data
=
data
+
newdata
decdata
=
decdata
+
decdatacur
decdata
=
decdata
+
decdatacur
wtd
=
wtd
-
len
(
decdata
)
wtd
=
total
wtd
-
len
(
decdata
)
if
not
decdata
and
not
self
.
eof
:
if
not
decdata
and
not
self
.
eof
:
raise
Error
,
'Premature EOF on binhex file'
raise
Error
,
'Premature EOF on binhex file'
return
decdata
return
decdata
...
@@ -367,11 +369,12 @@ class HexBin:
...
@@ -367,11 +369,12 @@ class HexBin:
def
_checkcrc
(
self
):
def
_checkcrc
(
self
):
filecrc
=
struct
.
unpack
(
'h'
,
self
.
ifp
.
read
(
2
))[
0
]
&
0xffff
filecrc
=
struct
.
unpack
(
'h'
,
self
.
ifp
.
read
(
2
))[
0
]
&
0xffff
## self.crc = binascii.crc_hqx('\0\0', self.crc) # XXXX Is this needed??
self
.
crc
=
self
.
crc
&
0xffff
self
.
crc
=
self
.
crc
&
0xffff
if
DEBUG
:
if
DEBUG
:
print
'DBG CRC
%
x
%
x'
%
(
self
.
crc
,
filecrc
)
print
'DBG CRC
%
x
%
x'
%
(
self
.
crc
,
filecrc
)
#
if filecrc != self.crc:
if
filecrc
!=
self
.
crc
:
#
raise Error, 'CRC error, computed %x, read %x'%(self.crc, filecrc)
raise
Error
,
'CRC error, computed
%
x, read
%
x'
%
(
self
.
crc
,
filecrc
)
self
.
crc
=
0
self
.
crc
=
0
def
_readheader
(
self
):
def
_readheader
(
self
):
...
...
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