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
518ab1c0
Kaydet (Commit)
518ab1c0
authored
Kas 28, 2001
tarafından
Jeremy Hylton
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use PyOS_snprintf instead of sprintf.
üst
ef58b319
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
45 additions
and
39 deletions
+45
-39
bltinmodule.c
Python/bltinmodule.c
+1
-1
dynload_dl.c
Python/dynload_dl.c
+1
-1
dynload_hpux.c
Python/dynload_hpux.c
+3
-2
dynload_mac.c
Python/dynload_mac.c
+9
-7
dynload_next.c
Python/dynload_next.c
+1
-1
dynload_os2.c
Python/dynload_os2.c
+4
-4
dynload_shlib.c
Python/dynload_shlib.c
+3
-2
dynload_win.c
Python/dynload_win.c
+14
-12
getversion.c
Python/getversion.c
+2
-2
pythonrun.c
Python/pythonrun.c
+1
-1
strerror.c
Python/strerror.c
+2
-1
traceback.c
Python/traceback.c
+1
-1
dynload_riscos.c
RISCOS/Python/dynload_riscos.c
+3
-4
No files found.
Python/bltinmodule.c
Dosyayı görüntüle @
518ab1c0
...
...
@@ -779,7 +779,7 @@ builtin_map(PyObject *self, PyObject *args)
static
char
errmsg
[]
=
"argument %d to map() must support iteration"
;
char
errbuf
[
sizeof
(
errmsg
)
+
25
];
sprintf
(
errbuf
,
errmsg
,
i
+
2
);
PyOS_snprintf
(
errbuf
,
sizeof
(
errbuf
)
,
errmsg
,
i
+
2
);
PyErr_SetString
(
PyExc_TypeError
,
errbuf
);
goto
Fail_2
;
}
...
...
Python/dynload_dl.c
Dosyayı görüntüle @
518ab1c0
...
...
@@ -21,6 +21,6 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
{
char
funcname
[
258
];
sprintf
(
funcname
,
"init%.200s"
,
shortname
);
PyOS_snprintf
(
funcname
,
sizeof
(
funcname
)
,
"init%.200s"
,
shortname
);
return
dl_loadmod
(
Py_GetProgramName
(),
pathname
,
funcname
);
}
Python/dynload_hpux.c
Dosyayı görüntüle @
518ab1c0
...
...
@@ -39,11 +39,12 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
char
buf
[
256
];
if
(
Py_VerboseFlag
)
perror
(
pathname
);
sprintf
(
buf
,
"Failed to load %.200s"
,
pathname
);
PyOS_snprintf
(
buf
,
sizeof
(
buf
),
"Failed to load %.200s"
,
pathname
);
PyErr_SetString
(
PyExc_ImportError
,
buf
);
return
NULL
;
}
sprintf
(
funcname
,
FUNCNAME_PATTERN
,
shortname
);
PyOS_snprintf
(
funcname
,
sizeof
(
funcname
)
,
FUNCNAME_PATTERN
,
shortname
);
if
(
Py_VerboseFlag
)
printf
(
"shl_findsym %s
\n
"
,
funcname
);
shl_findsym
(
&
lib
,
funcname
,
TYPE_UNDEFINED
,
(
void
*
)
&
p
);
...
...
Python/dynload_mac.c
Dosyayı görüntüle @
518ab1c0
...
...
@@ -66,7 +66,8 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
err
=
ResolveAliasFile
(
&
libspec
,
1
,
&
isfolder
,
&
didsomething
);
#endif
if
(
err
)
{
sprintf
(
buf
,
"%.200s: %.200s"
,
pathname
,
PyMac_StrError
(
err
));
PyOS_snprintf
(
buf
,
sizeof
(
buf
),
"%.200s: %.200s"
,
pathname
,
PyMac_StrError
(
err
));
PyErr_SetString
(
PyExc_ImportError
,
buf
);
return
NULL
;
}
...
...
@@ -91,25 +92,26 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
** the dynamic module was meant for a different Python.
*/
if
(
errMessage
[
0
]
==
10
&&
strncmp
((
char
*
)
errMessage
+
1
,
"PythonCore"
,
10
)
==
0
)
{
sprintf
(
buf
,
"Dynamic module was built for %s version of MacPython"
,
(
err
==
cfragImportTooOldErr
?
"a newer"
:
"an older"
));
PyOS_snprintf
(
buf
,
sizeof
(
buf
),
"Dynamic module was built for %s version of MacPython"
,
(
err
==
cfragImportTooOldErr
?
"a newer"
:
"an older"
));
PyErr_SetString
(
PyExc_ImportError
,
buf
);
return
NULL
;
}
}
if
(
err
)
{
sprintf
(
buf
,
"%.*s: %.200s"
,
PyOS_snprintf
(
buf
,
sizeof
(
buf
)
,
"%.*s: %.200s"
,
errMessage
[
0
],
errMessage
+
1
,
PyMac_StrError
(
err
));
PyErr_SetString
(
PyExc_ImportError
,
buf
);
return
NULL
;
}
/* Locate the address of the correct init function */
sprintf
(
funcname
,
"init%.200s"
,
shortname
);
PyOS_snprintf
(
funcname
,
sizeof
(
funcname
)
,
"init%.200s"
,
shortname
);
err
=
FindSymbol
(
connID
,
Pstring
(
funcname
),
&
symAddr
,
&
class
);
if
(
err
)
{
sprintf
(
buf
,
"%s: %.200s"
,
funcname
,
PyMac_StrError
(
err
));
PyOS_snprintf
(
buf
,
sizeof
(
buf
)
,
"%s: %.200s"
,
funcname
,
PyMac_StrError
(
err
));
PyErr_SetString
(
PyExc_ImportError
,
buf
);
return
NULL
;
}
...
...
Python/dynload_next.c
Dosyayı görüntüle @
518ab1c0
...
...
@@ -44,7 +44,7 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
dl_funcptr
p
=
NULL
;
char
funcname
[
258
];
sprintf
(
funcname
,
"_init%.200s"
,
shortname
);
PyOS_snprintf
(
funcname
,
sizeof
(
funcname
)
,
"_init%.200s"
,
shortname
);
#ifdef USE_RLD
{
...
...
Python/dynload_os2.c
Dosyayı görüntüle @
518ab1c0
...
...
@@ -31,14 +31,14 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
if
(
rc
!=
NO_ERROR
)
{
char
errBuf
[
256
];
sprintf
(
errBuf
,
"DLL load failed, rc = %d: %.200s"
,
rc
,
failreason
);
PyOS_snprintf
(
errBuf
,
sizeof
(
errBuf
)
,
"DLL load failed, rc = %d: %.200s"
,
rc
,
failreason
);
PyErr_SetString
(
PyExc_ImportError
,
errBuf
);
return
NULL
;
}
sprintf
(
funcname
,
"init%.200s"
,
shortname
);
PyOS_snprintf
(
funcname
,
sizeof
(
funcname
)
,
"init%.200s"
,
shortname
);
rc
=
DosQueryProcAddr
(
hDLL
,
0L
,
funcname
,
&
p
);
if
(
rc
!=
NO_ERROR
)
p
=
NULL
;
/* Signify Failure to Acquire Entrypoint */
...
...
Python/dynload_shlib.c
Dosyayı görüntüle @
518ab1c0
...
...
@@ -57,11 +57,12 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
if
(
strchr
(
pathname
,
'/'
)
==
NULL
)
{
/* Prefix bare filename with "./" */
sprintf
(
pathbuf
,
"./%-.255s"
,
pathname
);
PyOS_snprintf
(
pathbuf
,
sizeof
(
pathbuf
)
,
"./%-.255s"
,
pathname
);
pathname
=
pathbuf
;
}
sprintf
(
funcname
,
LEAD_UNDERSCORE
"init%.200s"
,
shortname
);
PyOS_snprintf
(
funcname
,
sizeof
(
funcname
),
LEAD_UNDERSCORE
"init%.200s"
,
shortname
);
if
(
fp
!=
NULL
)
{
int
i
;
...
...
Python/dynload_win.c
Dosyayı görüntüle @
518ab1c0
...
...
@@ -159,7 +159,7 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
dl_funcptr
p
;
char
funcname
[
258
],
*
import_python
;
sprintf
(
funcname
,
"init%.200s"
,
shortname
);
PyOS_snprintf
(
funcname
,
sizeof
(
funcname
)
,
"init%.200s"
,
shortname
);
#ifdef MS_WIN32
{
...
...
@@ -201,9 +201,9 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
/* Problem: could not get the error message.
This should not happen if called correctly. */
if
(
theLength
==
0
)
{
sprintf
(
errBuf
,
"DLL load failed with error code %d"
,
errorCode
);
PyOS_snprintf
(
errBuf
,
sizeof
(
errBuf
)
,
"DLL load failed with error code %d"
,
errorCode
);
}
else
{
size_t
len
;
/* For some reason a \r\n
...
...
@@ -225,16 +225,16 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
}
else
{
char
buffer
[
256
];
sprintf
(
buffer
,
"python%d%d.dll"
,
PyOS_snprintf
(
buffer
,
sizeof
(
buffer
),
"python%d%d.dll"
,
PY_MAJOR_VERSION
,
PY_MINOR_VERSION
);
import_python
=
GetPythonImport
(
hDLL
);
if
(
import_python
&&
strcasecmp
(
buffer
,
import_python
))
{
sprintf
(
buffer
,
"Module use of %.150s conflicts "
"with this version of Python."
,
import_python
);
PyOS_snprintf
(
buffer
,
sizeof
(
buffer
)
,
"Module use of %.150s conflicts "
"with this version of Python."
,
import_python
);
PyErr_SetString
(
PyExc_ImportError
,
buffer
);
FreeLibrary
(
hDLL
);
return
NULL
;
...
...
@@ -251,14 +251,16 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
strchr
(
pathname
,
'/'
)
==
NULL
)
{
/* Prefix bare filename with ".\" */
sprintf
(
pathbuf
,
".
\\
%-.13s"
,
pathname
);
PyOS_snprintf
(
pathbuf
,
sizeof
(
pathbuf
),
".
\\
%-.13s"
,
pathname
);
pathname
=
pathbuf
;
}
hDLL
=
LoadLibrary
(
pathname
);
if
(
hDLL
<
HINSTANCE_ERROR
){
char
errBuf
[
256
];
sprintf
(
errBuf
,
"DLL load failed with error code %d"
,
hDLL
);
PyOS_snprintf
(
errBuf
,
sizeof
(
errBuf
),
"DLL load failed with error code %d"
,
hDLL
);
PyErr_SetString
(
PyExc_ImportError
,
errBuf
);
return
NULL
;
}
...
...
Python/getversion.c
Dosyayı görüntüle @
518ab1c0
...
...
@@ -9,7 +9,7 @@ const char *
Py_GetVersion
(
void
)
{
static
char
version
[
250
];
sprintf
(
version
,
"%.80s (%.80s) %.80s"
,
PY_VERSION
,
Py_GetBuildInfo
(),
Py_GetCompiler
());
PyOS_snprintf
(
version
,
sizeof
(
version
),
"%.80s (%.80s) %.80s"
,
PY_VERSION
,
Py_GetBuildInfo
(),
Py_GetCompiler
());
return
version
;
}
Python/pythonrun.c
Dosyayı görüntüle @
518ab1c0
...
...
@@ -933,7 +933,7 @@ void PyErr_Display(PyObject *exception, PyObject *value, PyObject *tb)
else
PyFile_WriteString
(
filename
,
f
);
PyFile_WriteString
(
"
\"
, line "
,
f
);
sprintf
(
buf
,
"%d"
,
lineno
);
PyOS_snprintf
(
buf
,
sizeof
(
buf
)
,
"%d"
,
lineno
);
PyFile_WriteString
(
buf
,
f
);
PyFile_WriteString
(
"
\n
"
,
f
);
if
(
text
!=
NULL
)
...
...
Python/strerror.c
Dosyayı görüntüle @
518ab1c0
...
...
@@ -3,6 +3,7 @@
Author: Guido van Rossum, CWI Amsterdam, Oct. 1990, <guido@cwi.nl>. */
#include <stdio.h>
#include "Python.h"
extern
int
sys_nerr
;
extern
char
*
sys_errlist
[];
...
...
@@ -13,7 +14,7 @@ strerror(int err)
static
char
buf
[
20
];
if
(
err
>=
0
&&
err
<
sys_nerr
)
return
sys_errlist
[
err
];
sprintf
(
buf
,
"Unknown errno %d"
,
err
);
PyOS_snprintf
(
buf
,
sizeof
(
buf
)
,
"Unknown errno %d"
,
err
);
return
buf
;
}
...
...
Python/traceback.c
Dosyayı görüntüle @
518ab1c0
...
...
@@ -195,7 +195,7 @@ tb_displayline(PyObject *f, char *filename, int lineno, char *name)
}
}
}
sprintf
(
linebuf
,
FMT
,
filename
,
lineno
,
name
);
PyOS_snprintf
(
linebuf
,
sizeof
(
linebuf
)
,
FMT
,
filename
,
lineno
,
name
);
err
=
PyFile_WriteString
(
linebuf
,
f
);
if
(
xfp
==
NULL
||
err
!=
0
)
return
err
;
...
...
RISCOS/Python/dynload_riscos.c
Dosyayı görüntüle @
518ab1c0
...
...
@@ -55,10 +55,9 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
void
(
*
init_function
)(
void
);
err
=
dlk_load_no_init
(
pathname
,
&
init_function
);
if
(
err
)
{
sprintf
(
errstr
,
"dlk failure %d"
,
err
);
PyErr_SetString
(
PyExc_ImportError
,
errstr
);
if
(
err
)
{
PyOS_snprintf
(
errstr
,
sizeof
(
errstr
),
"dlk failure %d"
,
err
);
PyErr_SetString
(
PyExc_ImportError
,
errstr
);
}
return
init_function
;
}
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