diff --git a/.github/workflows/abibreak.yaml b/.github/workflows/abibreak.yaml new file mode 100644 index 00000000..93697be4 --- /dev/null +++ b/.github/workflows/abibreak.yaml @@ -0,0 +1,70 @@ +name: "ABI Breakage" +on: + push: + branches: [ v1.x ] + pull_request: + +jobs: + test_abidiff: + name: abidiff + runs-on: ubuntu-latest + steps: + - uses: lukka/get-cmake@latest + + - name: Checkout libebml + uses: actions/checkout@v3 + with: + repository: Matroska-Org/libebml + path: libebml + ref: v1.x + + - name: Configure libebml + run: cmake -S libebml -B libebml/_build -DBUILD_SHARED_LIBS=ON + + - name: Build libebml + run: cmake --build libebml/_build --parallel + + - name: Install libebml + run: cmake --install libebml/_build --prefix ${GITHUB_WORKSPACE}/_built + + - name: Get pushed code + uses: actions/checkout@v3 + with: + path: libmatroska-new + + - name: Configure CMake + run: cmake -S libmatroska-new -B _build -DBUILD_SHARED_LIBS=ON -DEBML_DIR="${GITHUB_WORKSPACE}/_built/lib/cmake/EBML" -DCMAKE_BUILD_TYPE=RelWithDebInfo + + - name: Build + run: cmake --build _build --parallel + + - name: Install + run: cmake --install _build --prefix ${GITHUB_WORKSPACE}/dir1 + + - name: Get v1.x code + uses: actions/checkout@v3 + with: + path: libmatroska-1 + ref: v1.x + + - name: Configure v1.x + run: cmake -S libmatroska-1 -B _build_1 -DBUILD_SHARED_LIBS=ON -DEBML_DIR="${GITHUB_WORKSPACE}/_built/lib/cmake/EBML" -DCMAKE_BUILD_TYPE=RelWithDebInfo + + - name: Build v1.x + run: cmake --build _build_1 --parallel + + - name: Install v1.x + run: cmake --install _build_1 --prefix ${GITHUB_WORKSPACE}/dir2 + + - name: Get abidiff + run: | + sudo apt update + sudo apt install abigail-tools + + - name: Check ABI differences + run: | + abidiff --no-added-syms --verbose \ + --headers-dir1 ${GITHUB_WORKSPACE}/dir1/include/matroska \ + --headers-dir2 ${GITHUB_WORKSPACE}/dir2/include/matroska \ + ${GITHUB_WORKSPACE}/dir1/lib/libmatroska.so \ + ${GITHUB_WORKSPACE}/dir2/lib/libmatroska.so diff --git a/matroska/KaxBlock.h b/matroska/KaxBlock.h index 14d7a55a..416d48ef 100644 --- a/matroska/KaxBlock.h +++ b/matroska/KaxBlock.h @@ -57,13 +57,13 @@ class MATROSKA_DLL_API DataBuffer { binary *myBuffer{nullptr}; uint32 mySize; bool bValidValue{true}; - bool (*myFreeBuffer)(const DataBuffer & aBuffer); // method to free the internal buffer + bool (*FreemyBuffer)(const DataBuffer & aBuffer); // method to free the internal buffer bool bInternalBuffer; public: DataBuffer(binary * aBuffer, uint32 aSize, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = nullptr, bool _bInternalBuffer = false) :mySize(aSize) - ,myFreeBuffer(aFreeBuffer) + ,FreemyBuffer(aFreeBuffer) ,bInternalBuffer(_bInternalBuffer) { if (bInternalBuffer) @@ -86,8 +86,8 @@ class MATROSKA_DLL_API DataBuffer { bool FreeBuffer(const DataBuffer & aBuffer) { bool bResult = true; if (myBuffer != nullptr && bValidValue) { - if (myFreeBuffer != nullptr) - bResult = myFreeBuffer(aBuffer); + if (FreemyBuffer != nullptr) + bResult = FreemyBuffer(aBuffer); if (bInternalBuffer) delete [] myBuffer; myBuffer = nullptr; @@ -102,7 +102,7 @@ class MATROSKA_DLL_API DataBuffer { class MATROSKA_DLL_API SimpleDataBuffer : public DataBuffer { public: - SimpleDataBuffer(binary * aBuffer, uint32 aSize, uint32 aOffset, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = myFreeBuffer) + SimpleDataBuffer(binary * aBuffer, uint32 aSize, uint32 aOffset, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = FreemyBuffer, void *unused = nullptr) :DataBuffer(aBuffer + aOffset, aSize, aFreeBuffer) ,Offset(aOffset) ,BaseBuffer(aBuffer) @@ -115,7 +115,7 @@ class MATROSKA_DLL_API SimpleDataBuffer : public DataBuffer { uint32 Offset; binary * BaseBuffer; - static bool myFreeBuffer(const DataBuffer & aBuffer) + static inline bool FreemyBuffer(const DataBuffer & aBuffer) { auto _Buffer = static_cast(&aBuffer)->BaseBuffer; if (_Buffer != nullptr) @@ -196,11 +196,11 @@ DECLARE_MKX_MASTER(KaxBlockGroup) operator KaxInternalBlock &(); - const KaxCluster *GetParentCluster() const { return ParentCluster; } + const KaxCluster *GetParentCluster2() const { return ParentCluster; } protected: - KaxCluster * ParentCluster{nullptr}; - const KaxTrackEntry * ParentTrack{nullptr}; + KaxCluster * ParentCluster; + const KaxTrackEntry * ParentTrack; }; class MATROSKA_DLL_API KaxInternalBlock : public EbmlBinary { @@ -344,12 +344,12 @@ class MATROSKA_DLL_API KaxBlockBlob { bool ReplaceSimpleByGroup(); protected: - KaxCluster *ParentCluster{nullptr}; + KaxCluster *ParentCluster; union { KaxBlockGroup *group; KaxSimpleBlock *simpleblock; } Block; - bool bUseSimpleBlock; + bool bUseSimpleBlock{false}; BlockBlobType SimpleBlockMode; }; @@ -369,8 +369,8 @@ DECLARE_MKX_BINARY_CONS(KaxBlockVirtual) filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) override; protected: - uint64 Timecode; // temporary timecode of the first frame if there are more than one - uint16 TrackNumber; + uint64 Timecode{0}; // temporary timecode of the first frame if there are more than one + uint16 TrackNumber{0}; binary DataBlock[5]; const KaxCluster * ParentCluster{nullptr}; diff --git a/src/KaxBlock.cpp b/src/KaxBlock.cpp index 62b09478..89f26bc2 100644 --- a/src/KaxBlock.cpp +++ b/src/KaxBlock.cpp @@ -58,7 +58,7 @@ DataBuffer * DataBuffer::Clone() } SimpleDataBuffer::SimpleDataBuffer(const SimpleDataBuffer & ToClone) - :DataBuffer(static_cast(malloc(ToClone.mySize * sizeof(binary))), ToClone.mySize, myFreeBuffer) + :DataBuffer(static_cast(malloc(ToClone.mySize * sizeof(binary))), ToClone.mySize, FreemyBuffer) { assert(myBuffer != nullptr); memcpy(myBuffer, ToClone.myBuffer ,mySize ); @@ -101,6 +101,7 @@ KaxInternalBlock::KaxInternalBlock(const KaxInternalBlock & ElementToClone) KaxBlockGroup::KaxBlockGroup(EBML_EXTRA_DEF) :EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxBlockGroup) EBML_DEF_SEP EBML_EXTRA_CALL) + ,ParentCluster(nullptr), ParentTrack(nullptr) {} /*! diff --git a/src/KaxCuesData.cpp b/src/KaxCuesData.cpp index e95c180b..cb47f3e2 100644 --- a/src/KaxCuesData.cpp +++ b/src/KaxCuesData.cpp @@ -72,7 +72,7 @@ void KaxCuePoint::PositionSet(const KaxBlockGroup & BlockReference, uint64 Globa auto CodecState = static_cast(BlockReference.FindFirstElt(EBML_INFO(KaxCodecState))); if (CodecState != nullptr) { auto &CueCodecState = AddNewChild(NewPositions); - *static_cast(&CueCodecState) = BlockReference.GetParentCluster()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition()); + *static_cast(&CueCodecState) = BlockReference.GetParentCluster2()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition()); } SetValueIsSet(); @@ -123,7 +123,7 @@ void KaxCuePoint::PositionSet(const KaxInternalBlock & BlockReference, const Kax const auto CodecState = static_cast(BlockGroup->FindFirstElt(EBML_INFO(KaxCodecState))); if (CodecState != nullptr) { auto &CueCodecState = AddNewChild(NewPositions); - *static_cast(&CueCodecState) = BlockGroup->GetParentCluster()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition()); + *static_cast(&CueCodecState) = BlockGroup->GetParentCluster2()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition()); } }