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
be49244b
Kaydet (Commit)
be49244b
authored
Kas 21, 2011
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
winreg module avoids the deprecated Unicode API
üst
0293db69
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
24 deletions
+36
-24
winreg.c
PC/winreg.c
+36
-24
No files found.
PC/winreg.c
Dosyayı görüntüle @
be49244b
...
@@ -760,26 +760,27 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
...
@@ -760,26 +760,27 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
case
REG_SZ
:
case
REG_SZ
:
case
REG_EXPAND_SZ
:
case
REG_EXPAND_SZ
:
{
{
if
(
value
==
Py_None
)
if
(
value
!=
Py_None
)
{
*
retDataSize
=
1
;
Py_ssize_t
len
;
else
{
if
(
!
PyUnicode_Check
(
value
))
if
(
!
PyUnicode_Check
(
value
))
return
FALSE
;
return
FALSE
;
*
retDataBuf
=
(
BYTE
*
)
PyUnicode_AsWideCharString
(
value
,
&
len
);
*
retDataSize
=
Py_SAFE_DOWNCAST
(
if
(
*
retDataBuf
==
NULL
)
2
+
PyUnicode_GET_DATA_SIZE
(
value
),
return
FALSE
;
size_t
,
DWORD
);
*
retDataSize
=
Py_SAFE_DOWNCAST
(
}
(
len
+
1
)
*
sizeof
(
wchar_t
),
*
retDataBuf
=
(
BYTE
*
)
PyMem_NEW
(
DWORD
,
*
retDataSize
);
Py_ssize_t
,
DWORD
);
if
(
*
retDataBuf
==
NULL
){
}
PyErr_NoMemory
();
else
{
return
FALSE
;
*
retDataBuf
=
(
BYTE
*
)
PyMem_NEW
(
wchar_t
,
1
);
}
if
(
*
retDataBuf
==
NULL
)
{
if
(
value
==
Py_None
)
PyErr_NoMemory
();
wcscpy
((
wchar_t
*
)
*
retDataBuf
,
L""
);
return
FALSE
;
else
}
wcscpy
((
wchar_t
*
)
*
retDataBuf
,
((
wchar_t
*
)
*
retDataBuf
)[
0
]
=
L'\0'
;
PyUnicode_AS_UNICODE
(
value
));
*
retDataSize
=
1
*
sizeof
(
wchar_t
);
break
;
}
break
;
}
}
case
REG_MULTI_SZ
:
case
REG_MULTI_SZ
:
{
{
...
@@ -796,10 +797,16 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
...
@@ -796,10 +797,16 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
for
(
j
=
0
;
j
<
i
;
j
++
)
for
(
j
=
0
;
j
<
i
;
j
++
)
{
{
PyObject
*
t
;
PyObject
*
t
;
wchar_t
*
wstr
;
Py_ssize_t
len
;
t
=
PyList_GET_ITEM
(
value
,
j
);
t
=
PyList_GET_ITEM
(
value
,
j
);
if
(
!
PyUnicode_Check
(
t
))
if
(
!
PyUnicode_Check
(
t
))
return
FALSE
;
return
FALSE
;
size
+=
Py_SAFE_DOWNCAST
(
2
+
PyUnicode_GET_DATA_SIZE
(
t
),
wstr
=
PyUnicode_AsUnicodeAndSize
(
t
,
&
len
);
if
(
wstr
==
NULL
)
return
FALSE
;
size
+=
Py_SAFE_DOWNCAST
((
len
+
1
)
*
sizeof
(
wchar_t
),
size_t
,
DWORD
);
size_t
,
DWORD
);
}
}
...
@@ -815,10 +822,15 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
...
@@ -815,10 +822,15 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
for
(
j
=
0
;
j
<
i
;
j
++
)
for
(
j
=
0
;
j
<
i
;
j
++
)
{
{
PyObject
*
t
;
PyObject
*
t
;
wchar_t
*
wstr
;
Py_ssize_t
len
;
t
=
PyList_GET_ITEM
(
value
,
j
);
t
=
PyList_GET_ITEM
(
value
,
j
);
wcscpy
(
P
,
PyUnicode_AS_UNICODE
(
t
));
wstr
=
PyUnicode_AsUnicodeAndSize
(
t
,
&
len
);
P
+=
1
+
wcslen
(
if
(
wstr
==
NULL
)
PyUnicode_AS_UNICODE
(
t
));
return
FALSE
;
wcscpy
(
P
,
wstr
);
P
+=
(
len
+
1
);
}
}
/* And doubly-terminate the list... */
/* And doubly-terminate the list... */
*
P
=
'\0'
;
*
P
=
'\0'
;
...
...
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