Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
0fcab4a3
Commit
0fcab4a3
authored
Jan 04, 2011
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #9566: use Py_ssize_t instead of int
parent
6ab8e829
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
32 additions
and
33 deletions
+32
-33
Modules/_ctypes/_ctypes.c
Modules/_ctypes/_ctypes.c
+3
-3
Modules/_testcapimodule.c
Modules/_testcapimodule.c
+1
-1
Modules/audioop.c
Modules/audioop.c
+1
-1
Modules/md5module.c
Modules/md5module.c
+2
-2
Modules/pyexpat.c
Modules/pyexpat.c
+5
-5
Modules/selectmodule.c
Modules/selectmodule.c
+1
-2
Modules/sha1module.c
Modules/sha1module.c
+2
-2
Modules/sha256module.c
Modules/sha256module.c
+2
-2
Modules/sha512module.c
Modules/sha512module.c
+2
-2
Modules/unicodedata.c
Modules/unicodedata.c
+4
-6
Objects/codeobject.c
Objects/codeobject.c
+3
-2
Objects/listobject.c
Objects/listobject.c
+1
-1
Objects/typeobject.c
Objects/typeobject.c
+3
-3
Python/pythonrun.c
Python/pythonrun.c
+2
-1
No files found.
Modules/_ctypes/_ctypes.c
View file @
0fcab4a3
...
...
@@ -3925,14 +3925,14 @@ PyTypeObject PyCFuncPtr_Type = {
Returns -1 on error, or the index of next argument on success.
*/
static
in
t
static
Py_ssize_
t
_init_pos_args
(
PyObject
*
self
,
PyTypeObject
*
type
,
PyObject
*
args
,
PyObject
*
kwds
,
in
t
index
)
Py_ssize_
t
index
)
{
StgDictObject
*
dict
;
PyObject
*
fields
;
in
t
i
;
Py_ssize_
t
i
;
if
(
PyType_stgdict
((
PyObject
*
)
type
->
tp_base
))
{
index
=
_init_pos_args
(
self
,
type
->
tp_base
,
...
...
Modules/_testcapimodule.c
View file @
0fcab4a3
...
...
@@ -2188,7 +2188,7 @@ argparsing(PyObject *o, PyObject *args)
/* argument converter not called? */
return
NULL
;
/* Should be 1 */
res
=
PyLong_From
Long
(
Py_REFCNT
(
str2
));
res
=
PyLong_From
Ssize_t
(
Py_REFCNT
(
str2
));
Py_DECREF
(
str2
);
PyErr_Clear
();
return
res
;
...
...
Modules/audioop.c
View file @
0fcab4a3
...
...
@@ -309,7 +309,7 @@ audioop_check_size(int size)
}
static
int
audioop_check_parameters
(
in
t
len
,
int
size
)
audioop_check_parameters
(
Py_ssize_
t
len
,
int
size
)
{
if
(
!
audioop_check_size
(
size
))
return
0
;
...
...
Modules/md5module.c
View file @
0fcab4a3
...
...
@@ -228,9 +228,9 @@ void md5_init(struct md5_state *md5)
@param inlen The length of the data (octets)
*/
void
md5_process
(
struct
md5_state
*
md5
,
const
unsigned
char
*
in
,
unsigned
long
inlen
)
const
unsigned
char
*
in
,
Py_ssize_t
inlen
)
{
unsigned
long
n
;
Py_ssize_t
n
;
assert
(
md5
!=
NULL
);
assert
(
in
!=
NULL
);
...
...
Modules/pyexpat.c
View file @
0fcab4a3
...
...
@@ -800,7 +800,7 @@ readinst(char *buf, int buf_size, PyObject *meth)
PyObject
*
arg
=
NULL
;
PyObject
*
bytes
=
NULL
;
PyObject
*
str
=
NULL
;
in
t
len
=
-
1
;
Py_ssize_
t
len
=
-
1
;
char
*
ptr
;
if
((
bytes
=
PyLong_FromLong
(
buf_size
))
==
NULL
)
...
...
@@ -831,7 +831,7 @@ readinst(char *buf, int buf_size, PyObject *meth)
if
(
len
>
buf_size
)
{
PyErr_Format
(
PyExc_ValueError
,
"read() returned too much data: "
"%i bytes requested, %i returned"
,
"%i bytes requested, %
z
i returned"
,
buf_size
,
len
);
goto
finally
;
}
...
...
@@ -839,7 +839,7 @@ readinst(char *buf, int buf_size, PyObject *meth)
finally:
Py_XDECREF
(
arg
);
Py_XDECREF
(
str
);
return
len
;
return
(
int
)
len
;
}
PyDoc_STRVAR
(
xmlparse_ParseFile__doc__
,
...
...
@@ -1807,7 +1807,7 @@ MODULE_INITFUNC(void)
Py_XDECREF
(
rev_codes_dict
);
return
NULL
;
}
#define MYCONST(name) \
if (PyModule_AddStringConstant(errors_module, #name, \
(char *)XML_ErrorString(name)) < 0) \
...
...
@@ -1873,7 +1873,7 @@ MODULE_INITFUNC(void)
return
NULL
;
if
(
PyModule_AddObject
(
errors_module
,
"messages"
,
rev_codes_dict
)
<
0
)
return
NULL
;
#undef MYCONST
#define MYCONST(c) PyModule_AddIntConstant(m, #c, c)
...
...
Modules/selectmodule.c
View file @
0fcab4a3
...
...
@@ -81,10 +81,9 @@ reap_obj(pylist fd2obj[FD_SETSIZE + 1])
static
int
seq2set
(
PyObject
*
seq
,
fd_set
*
set
,
pylist
fd2obj
[
FD_SETSIZE
+
1
])
{
int
i
;
int
max
=
-
1
;
int
index
=
0
;
int
len
=
-
1
;
Py_ssize_t
i
,
len
=
-
1
;
PyObject
*
fast_seq
=
NULL
;
PyObject
*
o
=
NULL
;
...
...
Modules/sha1module.c
View file @
0fcab4a3
...
...
@@ -203,9 +203,9 @@ void sha1_init(struct sha1_state *sha1)
@param inlen The length of the data (octets)
*/
void
sha1_process
(
struct
sha1_state
*
sha1
,
const
unsigned
char
*
in
,
unsigned
long
inlen
)
const
unsigned
char
*
in
,
Py_ssize_t
inlen
)
{
unsigned
long
n
;
Py_ssize_t
n
;
assert
(
sha1
!=
NULL
);
assert
(
in
!=
NULL
);
...
...
Modules/sha256module.c
View file @
0fcab4a3
...
...
@@ -265,9 +265,9 @@ sha224_init(SHAobject *sha_info)
/* update the SHA digest */
static
void
sha_update
(
SHAobject
*
sha_info
,
SHA_BYTE
*
buffer
,
in
t
count
)
sha_update
(
SHAobject
*
sha_info
,
SHA_BYTE
*
buffer
,
Py_ssize_
t
count
)
{
in
t
i
;
Py_ssize_
t
i
;
SHA_INT32
clo
;
clo
=
sha_info
->
count_lo
+
((
SHA_INT32
)
count
<<
3
);
...
...
Modules/sha512module.c
View file @
0fcab4a3
...
...
@@ -291,9 +291,9 @@ sha384_init(SHAobject *sha_info)
/* update the SHA digest */
static
void
sha512_update
(
SHAobject
*
sha_info
,
SHA_BYTE
*
buffer
,
in
t
count
)
sha512_update
(
SHAobject
*
sha_info
,
SHA_BYTE
*
buffer
,
Py_ssize_
t
count
)
{
in
t
i
;
Py_ssize_
t
i
;
SHA_INT32
clo
;
clo
=
sha_info
->
count_lo
+
((
SHA_INT32
)
count
<<
3
);
...
...
Modules/unicodedata.c
View file @
0fcab4a3
...
...
@@ -403,7 +403,8 @@ unicodedata_decomposition(PyObject *self, PyObject *args)
{
PyUnicodeObject
*
v
;
char
decomp
[
256
];
int
code
,
index
,
count
,
i
;
int
code
,
index
,
count
;
size_t
i
;
unsigned
int
prefix_index
;
Py_UCS4
c
;
...
...
@@ -450,15 +451,12 @@ unicodedata_decomposition(PyObject *self, PyObject *args)
while
(
count
--
>
0
)
{
if
(
i
)
decomp
[
i
++
]
=
' '
;
assert
(
(
size_t
)
i
<
sizeof
(
decomp
));
assert
(
i
<
sizeof
(
decomp
));
PyOS_snprintf
(
decomp
+
i
,
sizeof
(
decomp
)
-
i
,
"%04X"
,
decomp_data
[
++
index
]);
i
+=
strlen
(
decomp
+
i
);
}
decomp
[
i
]
=
'\0'
;
return
PyUnicode_FromString
(
decomp
);
return
PyUnicode_FromStringAndSize
(
decomp
,
i
);
}
static
void
...
...
Objects/codeobject.c
View file @
0fcab4a3
...
...
@@ -492,7 +492,7 @@ PyTypeObject PyCode_Type = {
int
PyCode_Addr2Line
(
PyCodeObject
*
co
,
int
addrq
)
{
in
t
size
=
PyBytes_Size
(
co
->
co_lnotab
)
/
2
;
Py_ssize_
t
size
=
PyBytes_Size
(
co
->
co_lnotab
)
/
2
;
unsigned
char
*
p
=
(
unsigned
char
*
)
PyBytes_AsString
(
co
->
co_lnotab
);
int
line
=
co
->
co_firstlineno
;
int
addr
=
0
;
...
...
@@ -510,7 +510,8 @@ PyCode_Addr2Line(PyCodeObject *co, int addrq)
int
_PyCode_CheckLineNumber
(
PyCodeObject
*
co
,
int
lasti
,
PyAddrPair
*
bounds
)
{
int
size
,
addr
,
line
;
Py_ssize_t
size
;
int
addr
,
line
;
unsigned
char
*
p
;
p
=
(
unsigned
char
*
)
PyBytes_AS_STRING
(
co
->
co_lnotab
);
...
...
Objects/listobject.c
View file @
0fcab4a3
...
...
@@ -1381,7 +1381,7 @@ typedef struct s_MergeState {
/* Conceptually a MergeState's constructor. */
static
void
merge_init
(
MergeState
*
ms
,
in
t
list_size
,
int
has_keyfunc
)
merge_init
(
MergeState
*
ms
,
Py_ssize_
t
list_size
,
int
has_keyfunc
)
{
assert
(
ms
!=
NULL
);
if
(
has_keyfunc
)
{
...
...
Objects/typeobject.c
View file @
0fcab4a3
...
...
@@ -2325,7 +2325,7 @@ PyObject* PyType_FromSpec(PyType_Spec *spec)
res
->
ht_type
.
tp_basicsize
=
spec
->
basicsize
;
res
->
ht_type
.
tp_itemsize
=
spec
->
itemsize
;
res
->
ht_type
.
tp_flags
=
spec
->
flags
|
Py_TPFLAGS_HEAPTYPE
;
for
(
slot
=
spec
->
slots
;
slot
->
slot
;
slot
++
)
{
if
(
slot
->
slot
>=
sizeof
(
slotoffsets
)
/
sizeof
(
slotoffsets
[
0
]))
{
PyErr_SetString
(
PyExc_RuntimeError
,
"invalid slot offset"
);
...
...
@@ -2335,7 +2335,7 @@ PyObject* PyType_FromSpec(PyType_Spec *spec)
}
return
(
PyObject
*
)
res
;
fail:
Py_DECREF
(
res
);
return
NULL
;
...
...
@@ -6202,7 +6202,7 @@ super_init(PyObject *self, PyObject *args, PyObject *kwds)
and first local variable on the stack. */
PyFrameObject
*
f
=
PyThreadState_GET
()
->
frame
;
PyCodeObject
*
co
=
f
->
f_code
;
in
t
i
,
n
;
Py_ssize_
t
i
,
n
;
if
(
co
==
NULL
)
{
PyErr_SetString
(
PyExc_SystemError
,
"super(): no code object"
);
...
...
Python/pythonrun.c
View file @
0fcab4a3
...
...
@@ -1202,7 +1202,8 @@ PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit,
{
PyObject
*
m
,
*
d
,
*
v
;
const
char
*
ext
;
int
set_file_name
=
0
,
ret
,
len
;
int
set_file_name
=
0
,
ret
;
size_t
len
;
m
=
PyImport_AddModule
(
"__main__"
);
if
(
m
==
NULL
)
...
...
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