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

Simplify some C++ #56

Closed
wants to merge 4 commits into from
Closed

Conversation

mpoullet
Copy link
Contributor

@mpoullet mpoullet commented Nov 7, 2018

  • Enable warnings when compiling.
  • Read and send 16kB when using files. Why is the chunk_size set to 20kB? #48
    • change chunk_size and the delay accordingly
    • use std::make_shared to avoid calling new
    • use std::vector::data to access the underlying array
  • u_char is not a standard type. Build failure on MacOSX #52
  • Simplify smart pointers use.
    • prefer using std::make_shared when possible
    • use std::vector::data to access the underlying array
    • no need to call .get() on a smart pointer when comparing to nullptr
    • avoid using std::move when not required
    • use type aliasing to improve readability
    • avoid calling std::unique_ptr::reset when not needed
    • audio_output_alsa.cc: no need to put std::thread in a std::unique_ptr

@mpoullet mpoullet changed the title Simplify C++ Simplify some C++ Nov 7, 2018
Copy link
Collaborator

@Fleker Fleker left a comment

Choose a reason for hiding this comment

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

As we're investigating the other PR, I figured I'll go ahead with the review for this one.

src/assistant/audio_input_file.cc Show resolved Hide resolved
src/assistant/audio_output_alsa.cc Show resolved Hide resolved
- change chunk_size and the delay accordingly
- use std::make_shared to avoid calling new
- use std::vector::data to access the underlying array
@mpoullet mpoullet force-pushed the cpp_fixes branch 2 times, most recently from e9cf9c0 to 6f8f492 Compare November 28, 2018 15:56
- prefer using std::make_shared when possible
- use std::vector::data to access the underlying array
- no need to call .get() on a smart pointer when comparing to nullptr
- avoid using std::move when not required
- use type aliasing to improve readability
- avoid calling std::unique_ptr::reset when not needed
- audio_output_alsa.cc: no need to put std::thread in a std::unique_ptr
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.

2 participants