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
09707e36
Kaydet (Commit)
09707e36
authored
Agu 14, 2002
tarafından
Barry Warsaw
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Patch by Tim to shut up the compiler's DeprecationWarnings on the
high-bit-set hex constants.
üst
20f0b36a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
18 deletions
+9
-18
gettext.py
Lib/gettext.py
+9
-18
No files found.
Lib/gettext.py
Dosyayı görüntüle @
09707e36
...
...
@@ -139,14 +139,11 @@ class NullTranslations:
class
GNUTranslations
(
NullTranslations
):
# Magic number of .mo files
LE_MAGIC
=
0x950412de
BE_MAGIC
=
0xde120495
LE_MAGIC
=
0x950412de
L
BE_MAGIC
=
0xde120495
L
def
_parse
(
self
,
fp
):
"""Override this method to support alternative .mo formats."""
# We need to & all 32 bit unsigned integers with 0xffffffff for
# portability to 64 bit machines.
MASK
=
0xffffffff
unpack
=
struct
.
unpack
filename
=
getattr
(
fp
,
'name'
,
''
)
# Parse the .mo file header, which consists of 5 little endian 32
...
...
@@ -155,28 +152,22 @@ class GNUTranslations(NullTranslations):
buf
=
fp
.
read
()
buflen
=
len
(
buf
)
# Are we big endian or little endian?
magic
=
unpack
(
'<
i'
,
buf
[:
4
])[
0
]
&
MASK
magic
=
unpack
(
'<
I'
,
buf
[:
4
])[
0
]
if
magic
==
self
.
LE_MAGIC
:
version
,
msgcount
,
masteridx
,
transidx
=
unpack
(
'<4
i
'
,
buf
[
4
:
20
])
ii
=
'<
ii
'
version
,
msgcount
,
masteridx
,
transidx
=
unpack
(
'<4
I
'
,
buf
[
4
:
20
])
ii
=
'<
II
'
elif
magic
==
self
.
BE_MAGIC
:
version
,
msgcount
,
masteridx
,
transidx
=
unpack
(
'>4
i
'
,
buf
[
4
:
20
])
ii
=
'>
ii
'
version
,
msgcount
,
masteridx
,
transidx
=
unpack
(
'>4
I
'
,
buf
[
4
:
20
])
ii
=
'>
II
'
else
:
raise
IOError
(
0
,
'Bad magic number'
,
filename
)
# more unsigned ints
msgcount
&=
MASK
masteridx
&=
MASK
transidx
&=
MASK
# Now put all messages from the .mo file buffer into the catalog
# dictionary.
for
i
in
xrange
(
0
,
msgcount
):
mlen
,
moff
=
unpack
(
ii
,
buf
[
masteridx
:
masteridx
+
8
])
moff
&=
MASK
mend
=
moff
+
(
mlen
&
MASK
)
mend
=
moff
+
mlen
tlen
,
toff
=
unpack
(
ii
,
buf
[
transidx
:
transidx
+
8
])
toff
&=
MASK
tend
=
toff
+
(
tlen
&
MASK
)
tend
=
toff
+
tlen
if
mend
<
buflen
and
tend
<
buflen
:
tmsg
=
buf
[
toff
:
tend
]
catalog
[
buf
[
moff
:
mend
]]
=
tmsg
...
...
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