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
f0124506
Kaydet (Commit)
f0124506
authored
Kas 21, 2011
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Rewrite PyUnicode_TransformDecimalToASCII() to use the new Unicode API
üst
2d718f39
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
17 deletions
+26
-17
unicodeobject.c
Objects/unicodeobject.c
+26
-17
No files found.
Objects/unicodeobject.c
Dosyayı görüntüle @
f0124506
...
...
@@ -8779,32 +8779,41 @@ PyObject *
PyUnicode_TransformDecimalToASCII(Py_UNICODE *s,
Py_ssize_t length)
{
PyObject *result;
Py_UNICODE *p; /* write pointer into result */
PyObject *decimal;
Py_ssize_t i;
Py_UCS4 maxchar;
enum PyUnicode_Kind kind;
void *data;
maxchar = 0;
for (i = 0; i < length; i++) {
Py_UNICODE ch = s[i];
if (ch > 127) {
int decimal = Py_UNICODE_TODECIMAL(ch);
if (decimal >= 0)
ch = '0' + decimal;
}
maxchar = Py_MAX(maxchar, ch);
}
/* Copy to a new string */
result = (PyObject *)_PyUnicode_New(length
);
Py_UNICODE_COPY(PyUnicode_AS_UNICODE(result), s, length);
if (result == NULL)
return result
;
p = PyUnicode_AS_UNICODE(result
);
decimal = PyUnicode_New(length, maxchar
);
if (decimal == NULL)
return decimal;
kind = PyUnicode_KIND(decimal)
;
data = PyUnicode_DATA(decimal
);
/* Iterate over code points */
for (i = 0; i < length; i++) {
Py_UNICODE ch =s[i];
Py_UNICODE ch =
s[i];
if (ch > 127) {
int decimal = Py_UNICODE_TODECIMAL(ch);
if (decimal >= 0)
p[i]
= '0' + decimal;
ch
= '0' + decimal;
}
PyUnicode_WRITE(kind, data, i, ch);
}
#ifndef DONT_MAKE_RESULT_READY
if (_PyUnicode_READY_REPLACE(&result)) {
Py_DECREF(result);
return NULL;
}
#endif
assert(_PyUnicode_CheckConsistency(result, 1));
return result;
assert(_PyUnicode_CheckConsistency(decimal, 1));
return decimal;
}
/* --- Decimal Encoder ---------------------------------------------------- */
...
...
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