diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-08-12 20:59:35 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-08-25 20:39:24 +0000 |
commit | e99c13120f1b51c25fbb20dc2763889b2b12795a (patch) | |
tree | 313946172c8da8b432888d3678aec14ac87145d9 | |
parent | d380c411317db1baa176ce525fec5919a4cbdff6 (diff) |
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.
-rw-r--r-- | toxav/video.c | 5 | ||||
-rw-r--r-- | 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) | |||
343 | 343 | ||
344 | /* Play decoded images */ | 344 | /* Play decoded images */ |
345 | vpx_codec_iter_t iter = nullptr; | 345 | vpx_codec_iter_t iter = nullptr; |
346 | vpx_image_t *dest = nullptr; | ||
347 | 346 | ||
348 | while ((dest = vpx_codec_get_frame(vc->decoder, &iter)) != nullptr) { | 347 | for (vpx_image_t *dest = vpx_codec_get_frame(vc->decoder, &iter); |
348 | dest != nullptr; | ||
349 | dest = vpx_codec_get_frame(vc->decoder, &iter)) { | ||
349 | if (vc->vcb) { | 350 | if (vc->vcb) { |
350 | vc->vcb(vc->av, vc->friend_number, dest->d_w, dest->d_h, | 351 | vc->vcb(vc->av, vc->friend_number, dest->d_w, dest->d_h, |
351 | (const uint8_t *)dest->planes[0], (const uint8_t *)dest->planes[1], (const uint8_t *)dest->planes[2], | 352 | (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 @@ | |||
58 | 58 | ||
59 | /** Messages. **/ | 59 | /** Messages. **/ |
60 | 60 | ||
61 | #define PACKET_ID_PADDING 0 /* Denotes padding */ | 61 | #define PACKET_ID_PADDING 0 // Denotes padding |
62 | #define PACKET_ID_REQUEST 1 /* Used to request unreceived packets */ | 62 | #define PACKET_ID_REQUEST 1 // Used to request unreceived packets |
63 | #define PACKET_ID_KILL 2 /* Used to kill connection */ | 63 | #define PACKET_ID_KILL 2 // Used to kill connection |
64 | 64 | ||
65 | #define PACKET_ID_ONLINE 24 | 65 | #define PACKET_ID_ONLINE 24 |
66 | #define PACKET_ID_OFFLINE 25 | 66 | #define PACKET_ID_OFFLINE 25 |
@@ -69,8 +69,8 @@ | |||
69 | #define PACKET_ID_USERSTATUS 50 | 69 | #define PACKET_ID_USERSTATUS 50 |
70 | #define PACKET_ID_TYPING 51 | 70 | #define PACKET_ID_TYPING 51 |
71 | #define PACKET_ID_MESSAGE 64 | 71 | #define PACKET_ID_MESSAGE 64 |
72 | #define PACKET_ID_ACTION 65 /* PACKET_ID_MESSAGE + MESSAGE_ACTION */ | 72 | #define PACKET_ID_ACTION 65 // PACKET_ID_MESSAGE + MESSAGE_ACTION |
73 | #define PACKET_ID_MSI 69 /* Used by AV to setup calls and etc */ | 73 | #define PACKET_ID_MSI 69 // Used by AV to setup calls and etc |
74 | #define PACKET_ID_FILE_SENDREQUEST 80 | 74 | #define PACKET_ID_FILE_SENDREQUEST 80 |
75 | #define PACKET_ID_FILE_CONTROL 81 | 75 | #define PACKET_ID_FILE_CONTROL 81 |
76 | #define PACKET_ID_FILE_DATA 82 | 76 | #define PACKET_ID_FILE_DATA 82 |
@@ -91,7 +91,7 @@ typedef enum Crypto_Conn_State { | |||
91 | } Crypto_Conn_State; | 91 | } Crypto_Conn_State; |
92 | 92 | ||
93 | /* Maximum size of receiving and sending packet buffers. */ | 93 | /* Maximum size of receiving and sending packet buffers. */ |
94 | #define CRYPTO_PACKET_BUFFER_SIZE 32768 /* Must be a power of 2 */ | 94 | #define CRYPTO_PACKET_BUFFER_SIZE 32768 // Must be a power of 2 |
95 | 95 | ||
96 | /* Minimum packet rate per second. */ | 96 | /* Minimum packet rate per second. */ |
97 | #define CRYPTO_PACKET_MIN_RATE 4.0 | 97 | #define CRYPTO_PACKET_MIN_RATE 4.0 |
@@ -120,7 +120,8 @@ typedef enum Crypto_Conn_State { | |||
120 | #define MAX_TCP_CONNECTIONS 64 | 120 | #define MAX_TCP_CONNECTIONS 64 |
121 | #define MAX_TCP_RELAYS_PEER 4 | 121 | #define MAX_TCP_RELAYS_PEER 4 |
122 | 122 | ||
123 | #define CRYPTO_MAX_PADDING 8 /* All packets will be padded a number of bytes based on this number. */ | 123 | /* All packets will be padded a number of bytes based on this number. */ |
124 | #define CRYPTO_MAX_PADDING 8 | ||
124 | 125 | ||
125 | /* Base current transfer speed on last CONGESTION_QUEUE_ARRAY_SIZE number of points taken | 126 | /* Base current transfer speed on last CONGESTION_QUEUE_ARRAY_SIZE number of points taken |
126 | at the dT defined in net_crypto.c */ | 127 | at the dT defined in net_crypto.c */ |