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

clang-tidy: fix missing special member func #173

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions matroska/KaxBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class MATROSKA_DLL_API SimpleDataBuffer : public DataBuffer {
{}
~SimpleDataBuffer() override = default;

SimpleDataBuffer& operator=(const SimpleDataBuffer &) = delete;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this forbidden ? Should it be mixed with the previous commit ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the error is that the operator is missing. I deleted it only because it does not cause a compile error.


DataBuffer * Clone() override {return new SimpleDataBuffer(*this);}

protected:
Expand Down Expand Up @@ -179,10 +181,9 @@ DECLARE_MKX_MASTER(KaxBlockGroup)

class MATROSKA_DLL_API KaxInternalBlock : public libebml::EbmlBinary {
public:
KaxInternalBlock(const libebml::EbmlCallbacks & classInfo)
:libebml::EbmlBinary(classInfo)
{}
using EbmlBinary::EbmlBinary;
KaxInternalBlock(const KaxInternalBlock & ElementToClone);
KaxInternalBlock& operator=(const KaxInternalBlock &) = delete;
~KaxInternalBlock() override;
bool SizeIsValid(std::uint64_t size) const override
{
Expand Down Expand Up @@ -311,6 +312,9 @@ class MATROSKA_DLL_API KaxBlockBlob {
delete Block.group;
}

KaxBlockBlob(const KaxBlockBlob&) = delete;
KaxBlockBlob& operator=(const KaxBlockBlob&) = delete;

operator KaxBlockGroup &() const;
operator KaxSimpleBlock &() const;
operator KaxInternalBlock &() const;
Expand All @@ -337,8 +341,6 @@ class MATROSKA_DLL_API KaxBlockBlob {

DECLARE_MKX_BINARY_CONS(KaxBlockVirtual)
public:
~KaxBlockVirtual() override;
Copy link
Contributor

Choose a reason for hiding this comment

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

This should make no difference doing that here or in the DECLARE_MKX_BINARY_CONS macro above.

I don't understand the commit description.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

simpler to do it in the macro.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not up to the macro to decide if the child class needs an overriden destructor or not. The macro is only to have a custom CONStructor. The form of the desctructor is up to each class.

It is currently possible to factorize this. But since this will be part of the new API, if ever need to move the destructor out of the macro, we'll be screwed.

Also this commit changes the desctructor and a copy constructor. They should be split. And I wonder why the copy contructor is not allowed.


/*!
\note override this function to generate the Data/Size on the fly, unlike the usual binary elements
*/
Expand Down
1 change: 0 additions & 1 deletion matroska/KaxBlockData.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ namespace libmatroska {
*/
DECLARE_MKX_SINTEGER_CONS(KaxReferenceBlock)
public:
~KaxReferenceBlock() override;
/*!
\brief override this method to compute the timestamp value
*/
Expand Down
3 changes: 3 additions & 0 deletions matroska/KaxCues.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ DECLARE_MKX_MASTER(KaxCues)
public:
~KaxCues() override;

KaxCues(const KaxCues&) = default;
KaxCues& operator=(const KaxCues&) = delete;

//bool AddBlockGroup(const KaxBlockGroup & BlockReference); // deprecated
bool AddBlockBlob(const KaxBlockBlob & BlockReference);

Expand Down
34 changes: 20 additions & 14 deletions matroska/KaxDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,87 +54,93 @@ class MATROSKA_DLL_API MatroskaProfile : public libebml::EbmlDocVersion

#define DECLARE_MKX_MASTER(x) \
DECLARE_xxx_MASTER(x, MATROSKA_DLL_API) \
x(const x & ElementToClone) :EbmlMaster(ElementToClone) {} \
using EbmlMaster::EbmlMaster; \
neheb marked this conversation as resolved.
Show resolved Hide resolved
MATROSKA_CLASS_BODY(x)

#define DECLARE_MKX_MASTER_CONS(x) \
DECLARE_xxx_MASTER(x, MATROSKA_DLL_API) \
~x() override; \
x(const x & ElementToClone); \
x& operator=(const x &) = delete; \
MATROSKA_CLASS_BODY(x)

#define DECLARE_MKX_BINARY(x) \
DECLARE_xxx_BINARY(x, MATROSKA_DLL_API) \
x(const x & ElementToClone) :libebml::EbmlBinary(ElementToClone) {} \
using EbmlBinary::EbmlBinary; \
MATROSKA_CLASS_BODY(x)

#define DECLARE_MKX_BINARY_CONS(x) \
DECLARE_xxx_BINARY(x, MATROSKA_DLL_API) \
~x() override; \
x(const x & ElementToClone); \
x& operator=(const x &) = delete; \
MATROSKA_CLASS_BODY(x)

#define DECLARE_MKX_BINARY_LENGTH(x,len) \
DECLARE_xxx_BINARY_LENGTH(x, len, MATROSKA_DLL_API) \
x(const x & ElementToClone) :libebml::EbmlBinary(ElementToClone) {} \
using EbmlBinary::EbmlBinary; \
MATROSKA_CLASS_BODY(x)

#define DECLARE_MKX_UNISTRING(x) \
DECLARE_xxx_UNISTRING(x, MATROSKA_DLL_API) \
x(const x & ElementToClone) :libebml::EbmlUnicodeString(ElementToClone) {} \
using EbmlUnicodeString::EbmlUnicodeString; \
MATROSKA_CLASS_BODY(x)

#define DECLARE_MKX_STRING(x) \
DECLARE_xxx_STRING(x, MATROSKA_DLL_API) \
x(const x & ElementToClone) :libebml::EbmlString(ElementToClone) {} \
using EbmlString::EbmlString; \
MATROSKA_CLASS_BODY(x)

#define DECLARE_MKX_STRING_DEF(x) \
DECLARE_xxx_STRING_DEF(x, MATROSKA_DLL_API) \
x(const x & ElementToClone) :libebml::EbmlString(ElementToClone) {} \
using EbmlString::EbmlString; \
MATROSKA_CLASS_BODY(x)

#define DECLARE_MKX_UINTEGER(x) \
DECLARE_xxx_UINTEGER(x, MATROSKA_DLL_API) \
x(const x & ElementToClone) :libebml::EbmlUInteger(ElementToClone) {} \
using EbmlUInteger::EbmlUInteger; \
MATROSKA_CLASS_BODY(x)

#define DECLARE_MKX_UINTEGER_DEF(x) \
DECLARE_xxx_UINTEGER_DEF(x, MATROSKA_DLL_API) \
x(const x & ElementToClone) :libebml::EbmlUInteger(ElementToClone) {} \
using EbmlUInteger::EbmlUInteger; \
MATROSKA_CLASS_BODY(x)

#define DECLARE_MKX_SINTEGER_CONS(x) \
DECLARE_xxx_SINTEGER(x, MATROSKA_DLL_API) \
~x() override; \
x(const x & ElementToClone); \
x& operator=(const x &) = delete; \
MATROSKA_CLASS_BODY(x)

#define DECLARE_MKX_SINTEGER(x) \
DECLARE_xxx_SINTEGER(x, MATROSKA_DLL_API) \
x(const x & ElementToClone) :libebml::EbmlSInteger(ElementToClone) {} \
using EbmlSInteger::EbmlSInteger; \
MATROSKA_CLASS_BODY(x)

#define DECLARE_MKX_SINTEGER_DEF(x) \
DECLARE_xxx_SINTEGER_DEF(x, MATROSKA_DLL_API) \
x(const x & ElementToClone) :libebml::EbmlSInteger(ElementToClone) {} \
using EbmlSInteger::EbmlSInteger; \
MATROSKA_CLASS_BODY(x)

#define DECLARE_MKX_DATE(x) \
DECLARE_xxx_DATE(x, MATROSKA_DLL_API) \
x(const x & ElementToClone) :libebml::EbmlDate(ElementToClone) {} \
using EbmlDate::EbmlDate; \
MATROSKA_CLASS_BODY(x)

#define DECLARE_MKX_DATE_DEF(x) \
DECLARE_xxx_DATE_DEF(x, MATROSKA_DLL_API) \
x(const x & ElementToClone) :libebml::EbmlDate(ElementToClone) {} \
using EbmlDate::EbmlDate; \
MATROSKA_CLASS_BODY(x)

#define DECLARE_MKX_FLOAT(x) \
DECLARE_xxx_FLOAT(x, MATROSKA_DLL_API) \
x(const x & ElementToClone) :libebml::EbmlFloat(ElementToClone) {} \
using EbmlFloat::EbmlFloat; \
MATROSKA_CLASS_BODY(x)

#define DECLARE_MKX_FLOAT_DEF(x) \
DECLARE_xxx_FLOAT_DEF(x, MATROSKA_DLL_API) \
x(const x & ElementToClone) :libebml::EbmlFloat(ElementToClone) {} \
using EbmlFloat::EbmlFloat; \
MATROSKA_CLASS_BODY(x)

#endif // LIBMATROSKA_DEFINES_H
2 changes: 2 additions & 0 deletions src/KaxCluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ KaxCluster::KaxCluster(const KaxCluster & ElementToClone)
}
}

KaxCluster::~KaxCluster() = default;

bool KaxCluster::AddBlockBlob(KaxBlockBlob * NewBlob)
{
Blobs.push_back(NewBlob);
Expand Down
1 change: 1 addition & 0 deletions src/KaxSegment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ KaxSegment::KaxSegment(const KaxSegment & ElementToClone)
static_cast<KaxCluster *>(child)->SetParent(*this);
}

KaxSegment::~KaxSegment() = default;

std::uint64_t KaxSegment::GetRelativePosition(std::uint64_t aGlobalPosition) const
{
Expand Down
Loading