From e99c13120f1b51c25fbb20dc2763889b2b12795a Mon Sep 17 00:00:00 2001 From: iphydf Date: Sun, 12 Aug 2018 20:59:35 +0000 Subject: Change while-loop to for-loop to express for-each-frame. * Assignments can't be used as expressions, therefore `while` loops should not be used as a `for-each` construct. Use `for`, instead. --- toxav/video.c | 5 +++-- toxcore/net_crypto.h | 15 ++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/toxav/video.c b/toxav/video.c index 4f9d8c84..5a160d37 100644 --- a/toxav/video.c +++ b/toxav/video.c @@ -343,9 +343,10 @@ void vc_iterate(VCSession *vc) /* Play decoded images */ vpx_codec_iter_t iter = nullptr; - vpx_image_t *dest = nullptr; - while ((dest = vpx_codec_get_frame(vc->decoder, &iter)) != nullptr) { + for (vpx_image_t *dest = vpx_codec_get_frame(vc->decoder, &iter); + dest != nullptr; + dest = vpx_codec_get_frame(vc->decoder, &iter)) { if (vc->vcb) { vc->vcb(vc->av, vc->friend_number, dest->d_w, dest->d_h, (const uint8_t *)dest->planes[0], (const uint8_t *)dest->planes[1], (const uint8_t *)dest->planes[2], diff --git a/toxcore/net_crypto.h b/toxcore/net_crypto.h index 4a1d7f2c..61a97e53 100644 --- a/toxcore/net_crypto.h +++ b/toxcore/net_crypto.h @@ -58,9 +58,9 @@ /** Messages. **/ -#define PACKET_ID_PADDING 0 /* Denotes padding */ -#define PACKET_ID_REQUEST 1 /* Used to request unreceived packets */ -#define PACKET_ID_KILL 2 /* Used to kill connection */ +#define PACKET_ID_PADDING 0 // Denotes padding +#define PACKET_ID_REQUEST 1 // Used to request unreceived packets +#define PACKET_ID_KILL 2 // Used to kill connection #define PACKET_ID_ONLINE 24 #define PACKET_ID_OFFLINE 25 @@ -69,8 +69,8 @@ #define PACKET_ID_USERSTATUS 50 #define PACKET_ID_TYPING 51 #define PACKET_ID_MESSAGE 64 -#define PACKET_ID_ACTION 65 /* PACKET_ID_MESSAGE + MESSAGE_ACTION */ -#define PACKET_ID_MSI 69 /* Used by AV to setup calls and etc */ +#define PACKET_ID_ACTION 65 // PACKET_ID_MESSAGE + MESSAGE_ACTION +#define PACKET_ID_MSI 69 // Used by AV to setup calls and etc #define PACKET_ID_FILE_SENDREQUEST 80 #define PACKET_ID_FILE_CONTROL 81 #define PACKET_ID_FILE_DATA 82 @@ -91,7 +91,7 @@ typedef enum Crypto_Conn_State { } Crypto_Conn_State; /* Maximum size of receiving and sending packet buffers. */ -#define CRYPTO_PACKET_BUFFER_SIZE 32768 /* Must be a power of 2 */ +#define CRYPTO_PACKET_BUFFER_SIZE 32768 // Must be a power of 2 /* Minimum packet rate per second. */ #define CRYPTO_PACKET_MIN_RATE 4.0 @@ -120,7 +120,8 @@ typedef enum Crypto_Conn_State { #define MAX_TCP_CONNECTIONS 64 #define MAX_TCP_RELAYS_PEER 4 -#define CRYPTO_MAX_PADDING 8 /* All packets will be padded a number of bytes based on this number. */ +/* All packets will be padded a number of bytes based on this number. */ +#define CRYPTO_MAX_PADDING 8 /* Base current transfer speed on last CONGESTION_QUEUE_ARRAY_SIZE number of points taken at the dT defined in net_crypto.c */ -- cgit v1.2.3