summaryrefslogtreecommitdiff
path: root/toxav
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2020-03-02 15:06:12 +0000
committeriphydf <iphydf@users.noreply.github.com>2020-03-02 15:20:34 +0000
commite618829112a298d6a859369862f760f1b7e3dc11 (patch)
treedcbba36cc500806ea3745e6fdb026b9afc33d9ff /toxav
parent0f7138c01006b35f2b1b477c30ae66ec243c21e1 (diff)
Add "cimple_test" to the bazel build.
Diffstat (limited to 'toxav')
-rw-r--r--toxav/BUILD.bazel20
-rw-r--r--toxav/ring_buffer.c5
2 files changed, 23 insertions, 2 deletions
diff --git a/toxav/BUILD.bazel b/toxav/BUILD.bazel
index a2b57ee9..865c0545 100644
--- a/toxav/BUILD.bazel
+++ b/toxav/BUILD.bazel
@@ -122,3 +122,23 @@ cc_library(
122 ":video", 122 ":video",
123 ], 123 ],
124) 124)
125
126CIMPLE_SRCS = glob(
127 [
128 "*.c",
129 "*.h",
130 ],
131 exclude = [
132 "*.api.h",
133 "toxav.h",
134 ],
135)
136
137sh_test(
138 name = "cimple_test",
139 size = "small",
140 srcs = ["//hs-tokstyle/tools:check-cimple"],
141 args = ["$(location %s)" % f for f in CIMPLE_SRCS],
142 data = CIMPLE_SRCS,
143 tags = ["manual"],
144)
diff --git a/toxav/ring_buffer.c b/toxav/ring_buffer.c
index 2b76f2ba..7cb8996d 100644
--- a/toxav/ring_buffer.c
+++ b/toxav/ring_buffer.c
@@ -85,8 +85,9 @@ RingBuffer *rb_new(int size)
85 } 85 }
86 86
87 buf->size = size + 1; /* include empty elem */ 87 buf->size = size + 1; /* include empty elem */
88 buf->data = (void **)calloc(buf->size, sizeof(void *));
88 89
89 if (!(buf->data = (void **)calloc(buf->size, sizeof(void *)))) { 90 if (!buf->data) {
90 free(buf); 91 free(buf);
91 return nullptr; 92 return nullptr;
92 } 93 }
@@ -118,7 +119,7 @@ uint16_t rb_data(const RingBuffer *b, void **dest)
118{ 119{
119 uint16_t i = 0; 120 uint16_t i = 0;
120 121
121 for (; i < rb_size(b); i++) { 122 for (; i < rb_size(b); ++i) {
122 dest[i] = b->data[(b->start + i) % b->size]; 123 dest[i] = b->data[(b->start + i) % b->size];
123 } 124 }
124 125