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
f4061dac
Kaydet (Commit)
f4061dac
authored
Eki 14, 2010
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
_Py_wgetcwd() decodes the path using _Py_char2wchar() to support surrogates
üst
22a351aa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
9 deletions
+17
-9
getpath.c
Modules/getpath.c
+6
-6
fileutils.c
Python/fileutils.c
+11
-3
No files found.
Modules/getpath.c
Dosyayı görüntüle @
f4061dac
...
@@ -231,12 +231,12 @@ joinpath(wchar_t *buffer, wchar_t *stuff)
...
@@ -231,12 +231,12 @@ joinpath(wchar_t *buffer, wchar_t *stuff)
/* copy_absolute requires that path be allocated at least
/* copy_absolute requires that path be allocated at least
MAXPATHLEN + 1 bytes and that p be no more than MAXPATHLEN bytes. */
MAXPATHLEN + 1 bytes and that p be no more than MAXPATHLEN bytes. */
static
void
static
void
copy_absolute
(
wchar_t
*
path
,
wchar_t
*
p
)
copy_absolute
(
wchar_t
*
path
,
wchar_t
*
p
,
size_t
pathlen
)
{
{
if
(
p
[
0
]
==
SEP
)
if
(
p
[
0
]
==
SEP
)
wcscpy
(
path
,
p
);
wcscpy
(
path
,
p
);
else
{
else
{
if
(
!
_Py_wgetcwd
(
path
,
MAXPATHLEN
))
{
if
(
!
_Py_wgetcwd
(
path
,
pathlen
))
{
/* unable to get the current directory */
/* unable to get the current directory */
wcscpy
(
path
,
p
);
wcscpy
(
path
,
p
);
return
;
return
;
...
@@ -251,11 +251,11 @@ copy_absolute(wchar_t *path, wchar_t *p)
...
@@ -251,11 +251,11 @@ copy_absolute(wchar_t *path, wchar_t *p)
static
void
static
void
absolutize
(
wchar_t
*
path
)
absolutize
(
wchar_t
*
path
)
{
{
wchar_t
buffer
[
MAXPATHLEN
+
1
];
wchar_t
buffer
[
MAXPATHLEN
+
1
];
if
(
path
[
0
]
==
SEP
)
if
(
path
[
0
]
==
SEP
)
return
;
return
;
copy_absolute
(
buffer
,
path
);
copy_absolute
(
buffer
,
path
,
MAXPATHLEN
+
1
);
wcscpy
(
path
,
buffer
);
wcscpy
(
path
,
buffer
);
}
}
...
@@ -295,7 +295,7 @@ search_for_prefix(wchar_t *argv0_path, wchar_t *home)
...
@@ -295,7 +295,7 @@ search_for_prefix(wchar_t *argv0_path, wchar_t *home)
}
}
/* Search from argv0_path, until root is found */
/* Search from argv0_path, until root is found */
copy_absolute
(
prefix
,
argv0_path
);
copy_absolute
(
prefix
,
argv0_path
,
MAXPATHLEN
+
1
);
do
{
do
{
n
=
wcslen
(
prefix
);
n
=
wcslen
(
prefix
);
joinpath
(
prefix
,
lib_python
);
joinpath
(
prefix
,
lib_python
);
...
@@ -372,7 +372,7 @@ search_for_exec_prefix(wchar_t *argv0_path, wchar_t *home)
...
@@ -372,7 +372,7 @@ search_for_exec_prefix(wchar_t *argv0_path, wchar_t *home)
}
}
/* Search from argv0_path, until root is found */
/* Search from argv0_path, until root is found */
copy_absolute
(
exec_prefix
,
argv0_path
);
copy_absolute
(
exec_prefix
,
argv0_path
,
MAXPATHLEN
+
1
);
do
{
do
{
n
=
wcslen
(
exec_prefix
);
n
=
wcslen
(
exec_prefix
);
joinpath
(
exec_prefix
,
lib_python
);
joinpath
(
exec_prefix
,
lib_python
);
...
...
Python/fileutils.c
Dosyayı görüntüle @
f4061dac
...
@@ -364,7 +364,8 @@ _Py_wrealpath(const wchar_t *path,
...
@@ -364,7 +364,8 @@ _Py_wrealpath(const wchar_t *path,
}
}
#endif
#endif
/* Get the current directory. Decode the path from the locale encoding. */
/* Get the current directory. size is the buffer size in wide characters
including the null character. Decode the path from the locale encoding. */
wchar_t
*
wchar_t
*
_Py_wgetcwd
(
wchar_t
*
buf
,
size_t
size
)
_Py_wgetcwd
(
wchar_t
*
buf
,
size_t
size
)
...
@@ -373,12 +374,19 @@ _Py_wgetcwd(wchar_t *buf, size_t size)
...
@@ -373,12 +374,19 @@ _Py_wgetcwd(wchar_t *buf, size_t size)
return
_wgetcwd
(
buf
,
size
);
return
_wgetcwd
(
buf
,
size
);
#else
#else
char
fname
[
PATH_MAX
];
char
fname
[
PATH_MAX
];
wchar_t
*
wname
;
if
(
getcwd
(
fname
,
PATH_MAX
)
==
NULL
)
if
(
getcwd
(
fname
,
PATH_MAX
)
==
NULL
)
return
NULL
;
return
NULL
;
if
(
mbstowcs
(
buf
,
fname
,
size
)
>=
size
)
{
wname
=
_Py_char2wchar
(
fname
);
errno
=
ERANGE
;
if
(
wname
==
NULL
)
return
NULL
;
if
(
size
<=
wcslen
(
wname
))
{
PyMem_Free
(
wname
);
return
NULL
;
return
NULL
;
}
}
wcsncpy
(
buf
,
wname
,
size
);
PyMem_Free
(
wname
);
return
buf
;
return
buf
;
#endif
#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