summaryrefslogtreecommitdiff
path: root/Modules/_ctypes
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2019-05-06 10:56:51 -0600
committerBrett Cannon <54418+brettcannon@users.noreply.github.com>2019-05-06 12:56:50 -0400
commit1a2252ed39bc1b71cdaa935d7726d82909af93ab (patch)
tree7a816ef20b914628f61cce377a9b245933ff6ec9 /Modules/_ctypes
parentae2c32f32b61f3b141ba4b0b1ad71781d2f9a1a1 (diff)
downloadcpython-git-1a2252ed39bc1b71cdaa935d7726d82909af93ab.tar.gz
bpo-36594: Fix incorrect use of %p in format strings (GH-12769)
In addition, fix some other minor violations of C99.
Diffstat (limited to 'Modules/_ctypes')
-rw-r--r--Modules/_ctypes/_ctypes_test.c8
-rw-r--r--Modules/_ctypes/callproc.c4
2 files changed, 6 insertions, 6 deletions
diff --git a/Modules/_ctypes/_ctypes_test.c b/Modules/_ctypes/_ctypes_test.c
index f8420580ff..bae4976a08 100644
--- a/Modules/_ctypes/_ctypes_test.c
+++ b/Modules/_ctypes/_ctypes_test.c
@@ -87,7 +87,7 @@ EXPORT(void)testfunc_array(int values[4])
EXPORT(long double)testfunc_Ddd(double a, double b)
{
long double result = (long double)(a * b);
- printf("testfunc_Ddd(%p, %p)\n", &a, &b);
+ printf("testfunc_Ddd(%p, %p)\n", (void *)&a, (void *)&b);
printf("testfunc_Ddd(%g, %g)\n", a, b);
return result;
}
@@ -95,7 +95,7 @@ EXPORT(long double)testfunc_Ddd(double a, double b)
EXPORT(long double)testfunc_DDD(long double a, long double b)
{
long double result = a * b;
- printf("testfunc_DDD(%p, %p)\n", &a, &b);
+ printf("testfunc_DDD(%p, %p)\n", (void *)&a, (void *)&b);
printf("testfunc_DDD(%Lg, %Lg)\n", a, b);
return result;
}
@@ -103,7 +103,7 @@ EXPORT(long double)testfunc_DDD(long double a, long double b)
EXPORT(int)testfunc_iii(int a, int b)
{
int result = a * b;
- printf("testfunc_iii(%p, %p)\n", &a, &b);
+ printf("testfunc_iii(%p, %p)\n", (void *)&a, (void *)&b);
return result;
}
@@ -361,7 +361,7 @@ static void _xxx_init(void *(*Xalloc)(int), void (*Xfree)(void *))
{
void *ptr;
- printf("_xxx_init got %p %p\n", Xalloc, Xfree);
+ printf("_xxx_init got %p %p\n", (void *)Xalloc, (void *)Xfree);
printf("calling\n");
ptr = Xalloc(32);
Xfree(ptr);
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index 1ad842eb3d..a8ba84be4a 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -531,11 +531,11 @@ PyCArg_repr(PyCArgObject *self)
default:
if (is_literal_char((unsigned char)self->tag)) {
sprintf(buffer, "<cparam '%c' at %p>",
- (unsigned char)self->tag, self);
+ (unsigned char)self->tag, (void *)self);
}
else {
sprintf(buffer, "<cparam 0x%02x at %p>",
- (unsigned char)self->tag, self);
+ (unsigned char)self->tag, (void *)self);
}
break;
}