diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-01-28 21:30:39 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-01-30 23:35:50 +0000 |
commit | 92ffad1a72bc8c422426d52ac408bd71242dd047 (patch) | |
tree | f592f353068dd2043525dd2cc04d6124a4ed4bc4 /toxav/groupav.c | |
parent | 623e9ac331df7323660e21c8a2226523a5ee713b (diff) |
Use nullptr as NULL pointer constant instead of NULL or 0.
This changes only code, no string literals or comments.
Diffstat (limited to 'toxav/groupav.c')
-rw-r--r-- | toxav/groupav.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/toxav/groupav.c b/toxav/groupav.c index 418a42aa..c19c1b3c 100644 --- a/toxav/groupav.c +++ b/toxav/groupav.c | |||
@@ -55,12 +55,12 @@ static Group_JitterBuffer *create_queue(unsigned int capacity) | |||
55 | Group_JitterBuffer *q; | 55 | Group_JitterBuffer *q; |
56 | 56 | ||
57 | if (!(q = (Group_JitterBuffer *)calloc(sizeof(Group_JitterBuffer), 1))) { | 57 | if (!(q = (Group_JitterBuffer *)calloc(sizeof(Group_JitterBuffer), 1))) { |
58 | return NULL; | 58 | return nullptr; |
59 | } | 59 | } |
60 | 60 | ||
61 | if (!(q->queue = (Group_Audio_Packet **)calloc(sizeof(Group_Audio_Packet *), size))) { | 61 | if (!(q->queue = (Group_Audio_Packet **)calloc(sizeof(Group_Audio_Packet *), size))) { |
62 | free(q); | 62 | free(q); |
63 | return NULL; | 63 | return nullptr; |
64 | } | 64 | } |
65 | 65 | ||
66 | q->size = size; | 66 | q->size = size; |
@@ -73,7 +73,7 @@ static void clear_queue(Group_JitterBuffer *q) | |||
73 | for (; q->bottom != q->top; ++q->bottom) { | 73 | for (; q->bottom != q->top; ++q->bottom) { |
74 | if (q->queue[q->bottom % q->size]) { | 74 | if (q->queue[q->bottom % q->size]) { |
75 | free(q->queue[q->bottom % q->size]); | 75 | free(q->queue[q->bottom % q->size]); |
76 | q->queue[q->bottom % q->size] = NULL; | 76 | q->queue[q->bottom % q->size] = nullptr; |
77 | } | 77 | } |
78 | } | 78 | } |
79 | } | 79 | } |
@@ -132,14 +132,14 @@ static Group_Audio_Packet *dequeue(Group_JitterBuffer *q, int *success) | |||
132 | { | 132 | { |
133 | if (q->top == q->bottom) { | 133 | if (q->top == q->bottom) { |
134 | *success = 0; | 134 | *success = 0; |
135 | return NULL; | 135 | return nullptr; |
136 | } | 136 | } |
137 | 137 | ||
138 | unsigned int num = q->bottom % q->size; | 138 | unsigned int num = q->bottom % q->size; |
139 | 139 | ||
140 | if (q->queue[num]) { | 140 | if (q->queue[num]) { |
141 | Group_Audio_Packet *ret = q->queue[num]; | 141 | Group_Audio_Packet *ret = q->queue[num]; |
142 | q->queue[num] = NULL; | 142 | q->queue[num] = nullptr; |
143 | ++q->bottom; | 143 | ++q->bottom; |
144 | *success = 1; | 144 | *success = 1; |
145 | return ret; | 145 | return ret; |
@@ -148,11 +148,11 @@ static Group_Audio_Packet *dequeue(Group_JitterBuffer *q, int *success) | |||
148 | if ((uint32_t)(q->top - q->bottom) > q->capacity) { | 148 | if ((uint32_t)(q->top - q->bottom) > q->capacity) { |
149 | ++q->bottom; | 149 | ++q->bottom; |
150 | *success = 2; | 150 | *success = 2; |
151 | return NULL; | 151 | return nullptr; |
152 | } | 152 | } |
153 | 153 | ||
154 | *success = 0; | 154 | *success = 0; |
155 | return NULL; | 155 | return nullptr; |
156 | } | 156 | } |
157 | 157 | ||
158 | typedef struct { | 158 | typedef struct { |
@@ -190,7 +190,7 @@ static int recreate_encoder(Group_AV *group_av) | |||
190 | { | 190 | { |
191 | if (group_av->audio_encoder) { | 191 | if (group_av->audio_encoder) { |
192 | opus_encoder_destroy(group_av->audio_encoder); | 192 | opus_encoder_destroy(group_av->audio_encoder); |
193 | group_av->audio_encoder = NULL; | 193 | group_av->audio_encoder = nullptr; |
194 | } | 194 | } |
195 | 195 | ||
196 | int rc = OPUS_OK; | 196 | int rc = OPUS_OK; |
@@ -199,7 +199,7 @@ static int recreate_encoder(Group_AV *group_av) | |||
199 | 199 | ||
200 | if (rc != OPUS_OK) { | 200 | if (rc != OPUS_OK) { |
201 | LOGGER_ERROR(group_av->log, "Error while starting audio encoder: %s", opus_strerror(rc)); | 201 | LOGGER_ERROR(group_av->log, "Error while starting audio encoder: %s", opus_strerror(rc)); |
202 | group_av->audio_encoder = NULL; | 202 | group_av->audio_encoder = nullptr; |
203 | return -1; | 203 | return -1; |
204 | } | 204 | } |
205 | 205 | ||
@@ -208,7 +208,7 @@ static int recreate_encoder(Group_AV *group_av) | |||
208 | if (rc != OPUS_OK) { | 208 | if (rc != OPUS_OK) { |
209 | LOGGER_ERROR(group_av->log, "Error while setting encoder ctl: %s", opus_strerror(rc)); | 209 | LOGGER_ERROR(group_av->log, "Error while setting encoder ctl: %s", opus_strerror(rc)); |
210 | opus_encoder_destroy(group_av->audio_encoder); | 210 | opus_encoder_destroy(group_av->audio_encoder); |
211 | group_av->audio_encoder = NULL; | 211 | group_av->audio_encoder = nullptr; |
212 | return -1; | 212 | return -1; |
213 | } | 213 | } |
214 | 214 | ||
@@ -217,7 +217,7 @@ static int recreate_encoder(Group_AV *group_av) | |||
217 | if (rc != OPUS_OK) { | 217 | if (rc != OPUS_OK) { |
218 | LOGGER_ERROR(group_av->log, "Error while setting encoder ctl: %s", opus_strerror(rc)); | 218 | LOGGER_ERROR(group_av->log, "Error while setting encoder ctl: %s", opus_strerror(rc)); |
219 | opus_encoder_destroy(group_av->audio_encoder); | 219 | opus_encoder_destroy(group_av->audio_encoder); |
220 | group_av->audio_encoder = NULL; | 220 | group_av->audio_encoder = nullptr; |
221 | return -1; | 221 | return -1; |
222 | } | 222 | } |
223 | 223 | ||
@@ -229,13 +229,13 @@ static Group_AV *new_group_av(Logger *log, Group_Chats *g_c, void (*audio_callba | |||
229 | unsigned int, uint8_t, unsigned int, void *), void *userdata) | 229 | unsigned int, uint8_t, unsigned int, void *), void *userdata) |
230 | { | 230 | { |
231 | if (!g_c) { | 231 | if (!g_c) { |
232 | return NULL; | 232 | return nullptr; |
233 | } | 233 | } |
234 | 234 | ||
235 | Group_AV *group_av = (Group_AV *)calloc(1, sizeof(Group_AV)); | 235 | Group_AV *group_av = (Group_AV *)calloc(1, sizeof(Group_AV)); |
236 | 236 | ||
237 | if (!group_av) { | 237 | if (!group_av) { |
238 | return NULL; | 238 | return nullptr; |
239 | } | 239 | } |
240 | 240 | ||
241 | group_av->log = log; | 241 | group_av->log = log; |
@@ -296,7 +296,7 @@ static int decode_audio_packet(Group_AV *group_av, Group_Peer_AV *peer_av, int g | |||
296 | return -1; | 296 | return -1; |
297 | } | 297 | } |
298 | 298 | ||
299 | int16_t *out_audio = NULL; | 299 | int16_t *out_audio = nullptr; |
300 | int out_audio_samples = 0; | 300 | int out_audio_samples = 0; |
301 | 301 | ||
302 | unsigned int sample_rate = 48000; | 302 | unsigned int sample_rate = 48000; |
@@ -317,7 +317,7 @@ static int decode_audio_packet(Group_AV *group_av, Group_Peer_AV *peer_av, int g | |||
317 | if (channels != peer_av->decoder_channels) { | 317 | if (channels != peer_av->decoder_channels) { |
318 | if (peer_av->audio_decoder) { | 318 | if (peer_av->audio_decoder) { |
319 | opus_decoder_destroy(peer_av->audio_decoder); | 319 | opus_decoder_destroy(peer_av->audio_decoder); |
320 | peer_av->audio_decoder = NULL; | 320 | peer_av->audio_decoder = nullptr; |
321 | } | 321 | } |
322 | 322 | ||
323 | int rc; | 323 | int rc; |
@@ -366,7 +366,7 @@ static int decode_audio_packet(Group_AV *group_av, Group_Peer_AV *peer_av, int g | |||
366 | return -1; | 366 | return -1; |
367 | } | 367 | } |
368 | 368 | ||
369 | out_audio_samples = opus_decode(peer_av->audio_decoder, NULL, 0, out_audio, peer_av->last_packet_samples, 1); | 369 | out_audio_samples = opus_decode(peer_av->audio_decoder, nullptr, 0, out_audio, peer_av->last_packet_samples, 1); |
370 | 370 | ||
371 | if (out_audio_samples <= 0) { | 371 | if (out_audio_samples <= 0) { |
372 | free(out_audio); | 372 | free(out_audio); |
@@ -436,7 +436,7 @@ static int groupchat_enable_av(Logger *log, Group_Chats *g_c, int groupnumber, v | |||
436 | 436 | ||
437 | Group_AV *group_av = new_group_av(log, g_c, audio_callback, userdata); | 437 | Group_AV *group_av = new_group_av(log, g_c, audio_callback, userdata); |
438 | 438 | ||
439 | if (group_av == NULL) { | 439 | if (group_av == nullptr) { |
440 | return -1; | 440 | return -1; |
441 | } | 441 | } |
442 | 442 | ||