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
d311538a
Kaydet (Commit)
d311538a
authored
Agu 30, 2004
tarafından
Tim Peters
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
win32_urandom(): There's no need to copy the generated byte string, so
don't.
üst
9b279a8d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
17 deletions
+11
-17
posixmodule.c
Modules/posixmodule.c
+11
-17
No files found.
Modules/posixmodule.c
Dosyayı görüntüle @
d311538a
...
...
@@ -7239,9 +7239,8 @@ static HCRYPTPROV hCryptProv = 0;
static
PyObject
*
win32_urandom
(
PyObject
*
self
,
PyObject
*
args
)
{
int
howMany
=
0
;
unsigned
char
*
bytes
=
NULL
;
PyObject
*
returnVal
=
NULL
;
int
howMany
;
PyObject
*
result
;
/* Read arguments */
if
(
!
PyArg_ParseTuple
(
args
,
"i:urandom"
,
&
howMany
))
...
...
@@ -7282,21 +7281,16 @@ win32_urandom(PyObject *self, PyObject *args)
}
/* Allocate bytes */
bytes
=
(
unsigned
char
*
)
PyMem_Malloc
(
howMany
);
if
(
bytes
==
NULL
)
return
PyErr_NoMemory
();
/* Get random data */
if
(
!
pCryptGenRandom
(
hCryptProv
,
howMany
,
bytes
))
{
PyMem_Free
(
bytes
);
return
win32_error
(
"CryptGenRandom"
,
NULL
);
result
=
PyString_FromStringAndSize
(
NULL
,
howMany
);
if
(
result
!=
NULL
)
{
/* Get random data */
if
(
!
pCryptGenRandom
(
hCryptProv
,
howMany
,
(
unsigned
char
*
)
PyString_AS_STRING
(
result
)))
{
Py_DECREF
(
result
);
return
win32_error
(
"CryptGenRandom"
,
NULL
);
}
}
/* Build return value */
returnVal
=
PyString_FromStringAndSize
(
bytes
,
howMany
);
PyMem_Free
(
bytes
);
return
returnVal
;
return
result
;
}
#endif
...
...
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