Segment::AppendCluster(): return a bool status
BUG=23430793 Change-Id: I6072234bfe211153ad143ccf7a3c6bbfa8cd166e
This commit is contained in:
parent
e86d046c07
commit
3778408b2a
@ -1219,7 +1219,10 @@ long Segment::DoLoadCluster(long long& pos, long& len) {
|
||||
if (pCluster == NULL)
|
||||
return -1;
|
||||
|
||||
AppendCluster(pCluster);
|
||||
if (!AppendCluster(pCluster)) {
|
||||
delete pCluster;
|
||||
return -1;
|
||||
}
|
||||
assert(m_clusters);
|
||||
assert(idx < m_clusterSize);
|
||||
assert(m_clusters[idx] == pCluster);
|
||||
@ -1270,7 +1273,7 @@ long Segment::DoLoadClusterUnknownSize(long long& pos, long& len) {
|
||||
return 2; // continue parsing
|
||||
}
|
||||
|
||||
void Segment::AppendCluster(Cluster* pCluster) {
|
||||
bool Segment::AppendCluster(Cluster* pCluster) {
|
||||
assert(pCluster);
|
||||
assert(pCluster->m_index >= 0);
|
||||
|
||||
@ -1285,7 +1288,9 @@ void Segment::AppendCluster(Cluster* pCluster) {
|
||||
if (count >= size) {
|
||||
const long n = (size <= 0) ? 2048 : 2 * size;
|
||||
|
||||
Cluster** const qq = new Cluster*[n];
|
||||
Cluster** const qq = new (std::nothrow) Cluster*[n];
|
||||
if (qq == NULL)
|
||||
return false;
|
||||
Cluster** q = qq;
|
||||
|
||||
Cluster** p = m_clusters;
|
||||
@ -1324,6 +1329,7 @@ void Segment::AppendCluster(Cluster* pCluster) {
|
||||
|
||||
m_clusters[idx] = pCluster;
|
||||
++m_clusterCount;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Segment::PreloadCluster(Cluster* pCluster, ptrdiff_t idx) {
|
||||
|
@ -999,7 +999,7 @@ class Segment {
|
||||
long DoLoadClusterUnknownSize(long long&, long&);
|
||||
long DoParseNext(const Cluster*&, long long&, long&);
|
||||
|
||||
void AppendCluster(Cluster*);
|
||||
bool AppendCluster(Cluster*);
|
||||
void PreloadCluster(Cluster*, ptrdiff_t);
|
||||
|
||||
// void ParseSeekHead(long long pos, long long size);
|
||||
|
Loading…
Reference in New Issue
Block a user