Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix groupav.c style and avoid casts in toxav_old.c. #1082

Merged
merged 1 commit into from
Aug 13, 2018

Conversation

iphydf
Copy link
Member

@iphydf iphydf commented Aug 12, 2018

  • No anonymous structs.
  • No assignment expressions.
  • Only one declarator per struct member declaration.
  • Named callback types only, no inline types.
  • No ; empty statements.
  • ++i instead of i++.

Avoiding a cast in toxav_old.c avoids some potential (and real) bugs.


This change is Reviewable

@iphydf iphydf added this to the v0.2.x milestone Aug 12, 2018
@iphydf iphydf force-pushed the groupav-style branch 3 times, most recently from e1fd22b to 5d2fa96 Compare August 12, 2018 23:34
return nullptr;
}

if (!(q->queue = (Group_Audio_Packet **)calloc(sizeof(Group_Audio_Packet *), size))) {
Copy link
Member

@hugbubby hugbubby Aug 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are you some kinda babby who can't handle assigning variables within if statements

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this question is serious, let me know and I'll be happy to talk about it.

@@ -516,7 +515,8 @@ static int send_audio_packet(Group_Chats *g_c, uint32_t groupnumber, uint8_t *pa

uint8_t data[MAX_CRYPTO_DATA_SIZE];
uint8_t *ptr = data;
*ptr++ = GROUP_AUDIO_PACKET_ID;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dear god


uint16_t audio_sequnum;

void (*audio_data)(Messenger *m, uint32_t groupnumber, uint32_t peernumber, const int16_t *pcm, uint32_t samples,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually prefer this for its intuition

Copy link
Member

@hugbubby hugbubby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old stuff was actually so bad it blurs the line between style checks and bugfixing

Copy link
Member

@hugbubby hugbubby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm_strong:

Reviewable status: :shipit: complete! 1 of 1 approvals obtained

Copy link
Member

@hugbubby hugbubby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r1.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained

* No anonymous structs.
* No assignment expressions.
* Only one declarator per struct member declaration.
* Named callback types only, no inline types.
* No `;` empty statements.
* `++i` instead of `i++`.

Avoiding a cast in toxav_old.c avoids some potential (and real) bugs.
@iphydf iphydf merged commit d518374 into TokTok:master Aug 13, 2018
@iphydf iphydf deleted the groupav-style branch August 13, 2018 10:45
@robinlinden robinlinden modified the milestones: v0.2.x, v0.2.6 Aug 14, 2018
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants