1. add std::nothrow to new operator because then ptr checked with NULL
2. "currentNewBlock" is assigned values twice successively 3. optimize std::vector<>::iterator's usage "iter++" -> "++iter". See preincrement and postincrement operator++()
This commit is contained in:
parent
82a7b7c6b8
commit
9c07d1e39d
@ -70,7 +70,7 @@ class MATROSKA_DLL_API DataBuffer {
|
|||||||
{
|
{
|
||||||
if (bInternalBuffer)
|
if (bInternalBuffer)
|
||||||
{
|
{
|
||||||
myBuffer = new binary[mySize];
|
myBuffer = new (std::nothrow) binary[mySize];
|
||||||
if (myBuffer == NULL)
|
if (myBuffer == NULL)
|
||||||
bValidValue = false;
|
bValidValue = false;
|
||||||
else
|
else
|
||||||
|
@ -98,7 +98,6 @@ bool KaxCluster::AddFrameInternal(const KaxTrackEntry & track, uint64 timecode,
|
|||||||
if (currentNewBlock == NULL || uint32(track.TrackNumber()) != uint32(currentNewBlock->TrackNumber()) || PastBlock != NULL || ForwBlock != NULL) {
|
if (currentNewBlock == NULL || uint32(track.TrackNumber()) != uint32(currentNewBlock->TrackNumber()) || PastBlock != NULL || ForwBlock != NULL) {
|
||||||
KaxBlockGroup & aNewBlock = GetNewBlock();
|
KaxBlockGroup & aNewBlock = GetNewBlock();
|
||||||
MyNewBlock = currentNewBlock = &aNewBlock;
|
MyNewBlock = currentNewBlock = &aNewBlock;
|
||||||
currentNewBlock = &aNewBlock;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PastBlock != NULL) {
|
if (PastBlock != NULL) {
|
||||||
|
@ -70,7 +70,7 @@ bool KaxCues::AddBlockBlob(const KaxBlockBlob & BlockReference)
|
|||||||
// Do not add the element if it's already present.
|
// Do not add the element if it's already present.
|
||||||
std::vector<const KaxBlockBlob *>::iterator ListIdx;
|
std::vector<const KaxBlockBlob *>::iterator ListIdx;
|
||||||
|
|
||||||
for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++)
|
for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ++ListIdx)
|
||||||
if (*ListIdx == &BlockReference)
|
if (*ListIdx == &BlockReference)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ void KaxCues::PositionSet(const KaxBlockBlob & BlockReference)
|
|||||||
// look for the element in the temporary references
|
// look for the element in the temporary references
|
||||||
std::vector<const KaxBlockBlob *>::iterator ListIdx;
|
std::vector<const KaxBlockBlob *>::iterator ListIdx;
|
||||||
|
|
||||||
for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++) {
|
for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ++ListIdx) {
|
||||||
if (*ListIdx == &BlockReference) {
|
if (*ListIdx == &BlockReference) {
|
||||||
// found, now add the element to the entry list
|
// found, now add the element to the entry list
|
||||||
KaxCuePoint & NewPoint = AddNewChild<KaxCuePoint>(*this);
|
KaxCuePoint & NewPoint = AddNewChild<KaxCuePoint>(*this);
|
||||||
@ -99,7 +99,7 @@ void KaxCues::PositionSet(const KaxBlockGroup & BlockRef)
|
|||||||
// look for the element in the temporary references
|
// look for the element in the temporary references
|
||||||
std::vector<const KaxBlockBlob *>::iterator ListIdx;
|
std::vector<const KaxBlockBlob *>::iterator ListIdx;
|
||||||
|
|
||||||
for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++) {
|
for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ++ListIdx) {
|
||||||
const KaxInternalBlock &refTmp = **ListIdx;
|
const KaxInternalBlock &refTmp = **ListIdx;
|
||||||
if (refTmp.GlobalTimecode() == BlockRef.GlobalTimecode() &&
|
if (refTmp.GlobalTimecode() == BlockRef.GlobalTimecode() &&
|
||||||
refTmp.TrackNum() == BlockRef.TrackNumber()) {
|
refTmp.TrackNum() == BlockRef.TrackNumber()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user