Skip to content

Commit 6d20ca2

Browse files
committed
Use rules_cc instead of native cc_library rules.
1 parent ecfabb3 commit 6d20ca2

File tree

6 files changed

+11
-4
lines changed

6 files changed

+11
-4
lines changed

BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@rules_cc//cc:defs.bzl", "cc_binary")
12
load("//tools/project:build_defs.bzl", "project")
23

34
project()

examples/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@rules_python//python:defs.bzl", "py_binary")
2+
13
py_binary(
24
name = "echo",
35
srcs = ["echo.py"],

pytox/core.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,14 @@ static void callback_file_recv_chunk(Tox *tox, uint32_t friend_number, uint32_t
176176
static void init_options(ToxCore* self, PyObject* pyopts, struct Tox_Options* tox_opts,
177177
uint8_t **savedata_data, char **proxy_host)
178178
{
179-
char *buf = NULL;
179+
const char *buf = NULL;
180180
Py_ssize_t sz = 0;
181181
PyObject *p = NULL;
182182

183183
p = PyObject_GetAttrString(pyopts, "savedata_data");
184-
PyBytes_AsStringAndSize(p, &buf, &sz);
184+
char *mbuf = NULL;
185+
PyBytes_AsStringAndSize(p, &mbuf, &sz);
186+
buf = mbuf;
185187
if (sz > 0) {
186188
*savedata_data = calloc(1, sz);
187189
memcpy(*savedata_data, buf, sz);

pytox/util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void hex_string_to_bytes(uint8_t* hexstr, int length, uint8_t* bytes)
6565
}
6666
}
6767

68-
void PyStringUnicode_AsStringAndSize(PyObject* object, char** str,
68+
void PyStringUnicode_AsStringAndSize(PyObject* object, const char** str,
6969
Py_ssize_t* len)
7070
{
7171
#if PY_MAJOR_VERSION < 3

pytox/util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void bytes_to_hex_string(const uint8_t* digest, int length, uint8_t* hex_digest)
5252

5353
void hex_string_to_bytes(uint8_t* hexstr, int length, uint8_t* bytes);
5454

55-
void PyStringUnicode_AsStringAndSize(PyObject* object, char** str,
55+
void PyStringUnicode_AsStringAndSize(PyObject* object, const char** str,
5656
Py_ssize_t* len);
5757

5858
#endif /* PYTOX_UTIL_H */

tests/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@rules_python//python:defs.bzl", "py_test")
2+
13
py_test(
24
name = "tests",
35
srcs = ["tests.py"],

0 commit comments

Comments
 (0)