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

Tidy and modernize SampleBuffer #11987

Merged
merged 1 commit into from Sep 19, 2023
Merged

Conversation

abique
Copy link
Contributor

@abique abique commented Sep 15, 2023

No description provided.

@JoergAtGithub
Copy link
Member

Welcome at Mixxx!
As a first-time contributor we need you to sign the Mixxx Contributor Agreement and comment here when you have done so. It gives us permission to distribute your contribution under the GPL v2 or later license and the Apple Mac App Store. It is also helpful for us to have contact information for contributors in case we may need it in the future.

@abique
Copy link
Contributor Author

abique commented Sep 15, 2023

Thank you!
I've signed it.
I'll update the PR with the style fix later tonight.

@JoergAtGithub
Copy link
Member

Regarding the code style issues, we recommend to install pre-commit locally: https://github.com/mixxxdj/mixxx/wiki/Using-Git#set-up-automatic-code-checking
Alternatively, you could download the patch file from the GitHub action and apply it manually.

@abique
Copy link
Contributor Author

abique commented Sep 15, 2023

Unfortunately archlinux doesn't have yet the required version of pre-commit, so I'll use the patch for now.
I hope that clang-format does it right, so I'll use that in the mean time.

@daschuer
Copy link
Member

Which pre-commit version do you have?

Did you try to Install pre-commit via pip?
https://github.com/mixxxdj/mixxx/wiki/Using-Git#set-up-automatic-code-checkinng.

If you configure you IDE for clang-fotmat, make sure to reformat only touched lines!

src/util/assert.h Outdated Show resolved Hide resolved
src/util/sample.h Outdated Show resolved Hide resolved
src/util/sample.h Show resolved Hide resolved
src/util/samplebuffer.cpp Outdated Show resolved Hide resolved
src/util/samplebuffer.cpp Outdated Show resolved Hide resolved
src/util/samplebuffer.h Outdated Show resolved Hide resolved
src/util/samplebuffer.h Outdated Show resolved Hide resolved
@abique abique force-pushed the alex/tidy-sample-buffer branch 2 times, most recently from 1a083b6 to 2b65761 Compare September 16, 2023 13:52
src/util/samplebuffer.cpp Outdated Show resolved Hide resolved
src/util/samplebuffer.cpp Outdated Show resolved Hide resolved
src/util/samplebuffer.h Outdated Show resolved Hide resolved
src/util/samplebuffer.h Show resolved Hide resolved
@abique
Copy link
Contributor Author

abique commented Sep 16, 2023

Which pre-commit version do you have?

Did you try to Install pre-commit via pip? https://github.com/mixxxdj/mixxx/wiki/Using-Git#set-up-automatic-code-checkinng.

If you configure you IDE for clang-fotmat, make sure to reformat only touched lines!

Archlinux has the x.20.x instead of the x.21.x and I've tried pip, but it wanted a system wide install, etc... so I didn't want to go that far.

@Swiftb0y
Copy link
Member

have you tried installing pre-commit via pip in a venv?

@abique
Copy link
Contributor Author

abique commented Sep 16, 2023

have you tried installing pre-commit via pip in a venv?

No, I'm short on disk space and I don't want to start hacking my system.
I'll wait for Archlinux to pickup the update.

@Swiftb0y
Copy link
Member

Thats fine too, as long as you're fine with applying the pre-commit patches from CI for now. I'm confused why its not newer though. pre-commit 2.20.0 has been released more than a year ago and arch is a rolling distro, right? so it should've been picked up by now if there is not technical reason why it couldn't.

@abique
Copy link
Contributor Author

abique commented Sep 16, 2023

Thats fine too, as long as you're fine with applying the pre-commit patches from CI for now. I'm confused why its not newer though. pre-commit 2.20.0 has been released more than a year ago and arch is a rolling distro, right? so it should've been picked up by now if there is not technical reason why it couldn't.

It is because the maintainer is probably lacking time to update the package.
I think that arch is working on allowing PR for updating packages, which could help maybe let's see.
In general it is quite up to date, but sometimes arch is behind.

@github-actions github-actions bot added the build label Sep 16, 2023
@abique
Copy link
Contributor Author

abique commented Sep 16, 2023

@daschuer @Swiftb0y thank you very much for the review.
I think we're good now.

@Swiftb0y
Copy link
Member

Thank you. Can you please ensure pre-commit passes now? If you don't want / can't install it, you can find a patch file generated by CI in the pre-commit job. In this case https://github.com/mixxxdj/mixxx/actions/runs/6208187984

@abique
Copy link
Contributor Author

abique commented Sep 16, 2023

Thank you. Can you please ensure pre-commit passes now? If you don't want / can't install it, you can find a patch file generated by CI in the pre-commit job. In this case https://github.com/mixxxdj/mixxx/actions/runs/6208187984

Yes I did apply this patch. However, it feels weird how much it indents the clobber list, feels like it has 1 extra level of indentation.

@Swiftb0y
Copy link
Member

I assume you mean ConstructorInitializerIndentWidth: 8? Yeah that choice is weird but as far as I can tell its based on the style-guide from long before we used clang-format (or even before the majority of currently active devs even worked on mixxx...)

Copy link
Member

@Swiftb0y Swiftb0y left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you. Your contributions are highly appreciated. waiting for LGTM from @daschuer

src/util/samplebuffer.h Show resolved Hide resolved
SampleBuffer()
: m_data(nullptr),
m_size(0) {
constexpr SampleBuffer()
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
constexpr SampleBuffer()
constexpr SampleBuffer() noexcept

: m_data(std::exchange(that.m_data, nullptr)),
m_size(std::exchange(that.m_size, 0)) {
}
~SampleBuffer() {
Copy link
Member

Choose a reason for hiding this comment

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

TIL destructors are noexcept by default since C++11, so even if we don't add it here, the destructor would std::terminate be default if SampleUtil::free would panic.

Copy link
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

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

We have now refined our rules regarding noexcept in https://github.com/mixxxdj/mixxx/wiki/Coding-Guidelines#specifier-nexecept.
So here we have some extra noexecpt now. I will merge this anyway, because this PR has been started before. We can fix the style later.
Thank you @abique for the work!

@daschuer daschuer merged commit c06c016 into mixxxdj:main Sep 19, 2023
13 checks passed
@abique
Copy link
Contributor Author

abique commented Sep 20, 2023

Hi,

Thanks for merging!

Sorry for all the noise with the annotations.

Cheers,
Alex.

@abique abique deleted the alex/tidy-sample-buffer branch September 20, 2023 08:04
@Holzhaus
Copy link
Member

have you tried installing pre-commit via pip in a venv?

No, I'm short on disk space and I don't want to start hacking my system.
I'll wait for Archlinux to pickup the update.

Just wanted to let you know that I reached out to the package maintainer. The package was updated now.

@abique
Copy link
Contributor Author

abique commented Sep 20, 2023

Just wanted to let you know that I reached out to the package maintainer. The package was updated now.

Yes I've seen that, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants