lib/ffmpeg/Buffer: add noexcept

This commit is contained in:
Max Kellermann 2020-11-04 19:47:07 +01:00
parent 9332527872
commit f9bdb4b0b8

View File

@ -27,24 +27,24 @@ extern "C" {
#include <cstddef> #include <cstddef>
class FfmpegBuffer { class FfmpegBuffer {
void *data; void *data = nullptr;
unsigned size; unsigned size = 0;
public: public:
FfmpegBuffer():data(nullptr), size(0) {} FfmpegBuffer() noexcept = default;
~FfmpegBuffer() { ~FfmpegBuffer() noexcept {
av_free(data); av_free(data);
} }
gcc_malloc gcc_malloc
void *Get(size_t min_size) { void *Get(size_t min_size) noexcept {
av_fast_malloc(&data, &size, min_size); av_fast_malloc(&data, &size, min_size);
return data; return data;
} }
template<typename T> template<typename T>
T *GetT(size_t n) { T *GetT(size_t n) noexcept {
return (T *)Get(n * sizeof(T)); return (T *)Get(n * sizeof(T));
} }
}; };