Skip to content

Commit 5c092bd

Browse files
committed
cleanup: Fix invalid function pointer cast.
Casting from `void(*)(T*)` to `void(*)(U*)` is ok, but casting to `void(*)(U*,U*)` is not. The number and size of the parameters and return type must be the same.
1 parent fa307be commit 5c092bd

File tree

7 files changed

+10
-13
lines changed

7 files changed

+10
-13
lines changed

.circleci/config.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
- run: apt-get update
1919
- run: DEBIAN_FRONTEND=noninteractive
2020
apt-get install -y --no-install-recommends
21+
ca-certificates
2122
gcc
2223
g++
2324
cmake
@@ -29,9 +30,9 @@ jobs:
2930
pkg-config
3031
python3-dev
3132
python3-setuptools
32-
- run: git clone --depth=1 git://github.com/TokTok/c-toxcore
33+
- run: git clone --depth=1 https://github.com/TokTok/c-toxcore
3334
- run: cd c-toxcore;
34-
. .travis/flags-gcc.sh;
35+
. .github/scripts/flags-gcc.sh;
3536
add_flag -fsanitize=address;
3637
cmake -H. -B_build -GNinja
3738
-DCMAKE_C_FLAGS="$C_FLAGS"

.cirrus.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
---
22
cirrus-ci_task:
33
container:
4-
image: toxchat/toktok-stack:0.0.31-third_party
4+
image: toxchat/toktok-stack:0.0.31-release
55
cpu: 2
66
memory: 6G
77
configure_script:
88
- /src/workspace/tools/inject-repo py_toxcore_c
99
test_all_script:
1010
- cd /src/workspace && bazel test -k
1111
--remote_http_cache=http://$CIRRUS_HTTP_CACHE_HOST
12-
--config=release
1312
//py_toxcore_c/...

.github/settings.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ branches:
1212
required_status_checks:
1313
contexts:
1414
- "cirrus-ci"
15-
- "Codacy Static Code Analysis"
1615
- "code-review/reviewable"

pytox/av.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,13 +347,12 @@ static int ToxAVCore_init(ToxAVCore *self, PyObject *args, PyObject *kwds) {
347347
return init_helper(self, args);
348348
}
349349

350-
static int ToxAVCore_dealloc(ToxAVCore *self) {
350+
static void ToxAVCore_dealloc(ToxAVCore *self) {
351351
if (self->av) {
352352
Py_DECREF(self->core);
353353
toxav_kill(self->av);
354354
self->av = NULL;
355355
}
356-
return 0;
357356
}
358357

359358
static PyObject *ToxAVCore_call(ToxAVCore *self, PyObject *args) {
@@ -558,12 +557,12 @@ static PyObject *ToxAVCore_get_tox(ToxAVCore *self, PyObject *args) {
558557
return self->core;
559558
}
560559

561-
static PyObject *ToxAVCore_iteration_interval(ToxAVCore *self) {
560+
static PyObject *ToxAVCore_iteration_interval(ToxAVCore *self, PyObject *args) {
562561
uint32_t interval = toxav_iteration_interval(self->av);
563562
return PyLong_FromLong(interval);
564563
}
565564

566-
static PyObject *ToxAVCore_iterate(ToxAVCore *self) {
565+
static PyObject *ToxAVCore_iterate(ToxAVCore *self, PyObject *args) {
567566
toxav_iterate(self->av);
568567
Py_RETURN_NONE;
569568
}

pytox/av.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <vpx/vpx_image.h>
3030

3131
/* ToxAV definition */
32-
typedef struct {
32+
typedef struct ToxAVCore {
3333
PyObject_HEAD PyObject *core;
3434
ToxAV *av;
3535
uint32_t i_w, i_h;

pytox/core.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,11 @@ static int ToxCore_init(ToxCore *self, PyObject *args, PyObject *kwds) {
323323
return init_helper(self, args);
324324
}
325325

326-
static int ToxCore_dealloc(ToxCore *self) {
326+
static void ToxCore_dealloc(ToxCore *self) {
327327
if (self->tox) {
328328
tox_kill(self->tox);
329329
self->tox = NULL;
330330
}
331-
return 0;
332331
}
333332

334333
static PyObject *ToxCore_callback_stub(ToxCore *self, PyObject *args) {

pytox/core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include <tox/tox.h>
2929

3030
/* ToxAV definition */
31-
typedef struct {
31+
typedef struct ToxCore {
3232
PyObject_HEAD Tox *tox;
3333
} ToxCore;
3434

0 commit comments

Comments
 (0)